Skip to content

Commit 85a7bb4

Browse files
authored
Rollup merge of rust-lang#113008 - jyn514:new-contributor-improvements, r=clubby789
Move some docs from the README to the dev-guide and as a drive-by cleanup, improve the error message for `x test tidy` when a feature gate is missing. This also improves the error message you get on Windows if python isn't installed. cc rust-lang/libs-team#242 (comment), rust-lang/rustc-dev-guide#1701
2 parents 2ed4368 + 664ffa4 commit 85a7bb4

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

README.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,13 @@ format:
3333
```
3434

3535
This is how the documentation and examples assume you are running `x.py`.
36-
Some alternative ways are:
37-
38-
```sh
39-
# On a Unix shell if you don't have the necessary `python3` command
40-
./x <subcommand> [flags]
41-
42-
# On the Windows Command Prompt (if .py files are configured to run Python)
43-
x.py <subcommand> [flags]
44-
45-
# You can also run Python yourself, e.g.:
46-
python x.py <subcommand> [flags]
47-
```
36+
See the [rustc dev guide][rustcguidebuild] if this does not work on your platform.
4837

4938
More information about `x.py` can be found by running it with the `--help` flag
5039
or reading the [rustc dev guide][rustcguidebuild].
5140

5241
[gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html
53-
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
42+
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#what-is-xpy
5443

5544
### Dependencies
5645

src/tools/tidy/src/features.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ pub fn check(
160160
for &(name, _) in gate_untested.iter() {
161161
println!("Expected a gate test for the feature '{name}'.");
162162
println!(
163-
"Hint: create a failing test file named 'feature-gate-{}.rs'\
164-
\n in the 'ui' test suite, with its failures due to\
165-
\n missing usage of `#![feature({})]`.",
166-
name, name
163+
"Hint: create a failing test file named 'tests/ui/feature-gates/feature-gate-{}.rs',\
164+
\n with its failures due to missing usage of `#![feature({})]`.",
165+
name.replace("_", "-"),
166+
name
167167
);
168168
println!(
169169
"Hint: If you already have such a test and don't want to rename it,\

x.ps1

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$ErrorActionPreference = "Stop"
66

77
# syntax check
8-
Get-Command -syntax ${PSCommandPath}
8+
Get-Command -syntax ${PSCommandPath} >$null
99

1010
$xpy = Join-Path $PSScriptRoot x.py
1111
# Start-Process for some reason splits arguments on spaces. (Isn't powershell supposed to be simpler than bash?)
@@ -16,7 +16,13 @@ foreach ($arg in $args) {
1616
}
1717

1818
function Get-Application($app) {
19-
return Get-Command $app -ErrorAction SilentlyContinue -CommandType Application
19+
$cmd = Get-Command $app -ErrorAction SilentlyContinue -CommandType Application | Select-Object -First 1
20+
if ($cmd.source -match '.*AppData\\Local\\Microsoft\\WindowsApps\\.*exe') {
21+
# Windows for some reason puts a `python3.exe` executable in PATH that just opens the windows store.
22+
# Ignore it.
23+
return $false
24+
}
25+
return $cmd
2026
}
2127

2228
function Invoke-Application($application, $arguments) {
@@ -51,5 +57,7 @@ if (($null -ne $found) -and ($found.Length -ge 1)) {
5157
Invoke-Application $python $xpy_args
5258
}
5359

54-
Write-Error "${PSCommandPath}: error: did not find python installed"
60+
$msg = "${PSCommandPath}: error: did not find python installed`n"
61+
$msg += "help: consider installing it from https://www.python.org/downloads/"
62+
Write-Error $msg -Category NotInstalled
5563
Exit 1

0 commit comments

Comments
 (0)