about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-06-25 02:04:21 +0200
committerGitHub <noreply@github.com>2023-06-25 02:04:21 +0200
commit85a7bb47e4dd5bb7a84548ba59964722c4fdcbe3 (patch)
tree550f4071abba90b19db37d2eef697fcb1048b071
parent2ed4368d2fa05d27cf86509b16d06a5402f7e111 (diff)
parent664ffa419eb4793d2c6e161d6f098b0104550ca2 (diff)
downloadrust-85a7bb47e4dd5bb7a84548ba59964722c4fdcbe3.tar.gz
rust-85a7bb47e4dd5bb7a84548ba59964722c4fdcbe3.zip
Rollup merge of #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 https://github.com/rust-lang/libs-team/issues/242#issuecomment-1597558557, https://github.com/rust-lang/rustc-dev-guide/pull/1701
-rw-r--r--README.md15
-rw-r--r--src/tools/tidy/src/features.rs8
-rwxr-xr-xx.ps114
3 files changed, 17 insertions, 20 deletions
diff --git a/README.md b/README.md
index 41b135972af..901213d2ca9 100644
--- a/README.md
+++ b/README.md
@@ -33,24 +33,13 @@ format:
 ```
 
 This is how the documentation and examples assume you are running `x.py`.
-Some alternative ways are:
-
-```sh
-# On a Unix shell if you don't have the necessary `python3` command
-./x <subcommand> [flags]
-
-# On the Windows Command Prompt (if .py files are configured to run Python)
-x.py <subcommand> [flags]
-
-# You can also run Python yourself, e.g.:
-python x.py <subcommand> [flags]
-```
+See the [rustc dev guide][rustcguidebuild] if this does not work on your platform.
 
 More information about `x.py` can be found by running it with the `--help` flag
 or reading the [rustc dev guide][rustcguidebuild].
 
 [gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html
-[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
+[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#what-is-xpy
 
 ### Dependencies
 
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index 2fd4c797b43..7ad8f5c5c05 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -160,10 +160,10 @@ pub fn check(
     for &(name, _) in gate_untested.iter() {
         println!("Expected a gate test for the feature '{name}'.");
         println!(
-            "Hint: create a failing test file named 'feature-gate-{}.rs'\
-                \n      in the 'ui' test suite, with its failures due to\
-                \n      missing usage of `#![feature({})]`.",
-            name, name
+            "Hint: create a failing test file named 'tests/ui/feature-gates/feature-gate-{}.rs',\
+                \n      with its failures due to missing usage of `#![feature({})]`.",
+            name.replace("_", "-"),
+            name
         );
         println!(
             "Hint: If you already have such a test and don't want to rename it,\
diff --git a/x.ps1 b/x.ps1
index a156017628d..55f99901645 100755
--- a/x.ps1
+++ b/x.ps1
@@ -5,7 +5,7 @@
 $ErrorActionPreference = "Stop"
 
 # syntax check
-Get-Command -syntax ${PSCommandPath}
+Get-Command -syntax ${PSCommandPath} >$null
 
 $xpy = Join-Path $PSScriptRoot x.py
 # 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) {
 }
 
 function Get-Application($app) {
-    return Get-Command $app -ErrorAction SilentlyContinue -CommandType Application
+    $cmd = Get-Command $app -ErrorAction SilentlyContinue -CommandType Application | Select-Object -First 1
+    if ($cmd.source -match '.*AppData\\Local\\Microsoft\\WindowsApps\\.*exe') {
+        # Windows for some reason puts a `python3.exe` executable in PATH that just opens the windows store.
+        # Ignore it.
+        return $false
+    }
+    return $cmd
 }
 
 function Invoke-Application($application, $arguments) {
@@ -51,5 +57,7 @@ if (($null -ne $found) -and ($found.Length -ge 1)) {
     Invoke-Application $python $xpy_args
 }
 
-Write-Error "${PSCommandPath}: error: did not find python installed"
+$msg = "${PSCommandPath}: error: did not find python installed`n"
+$msg += "help: consider installing it from https://www.python.org/downloads/"
+Write-Error $msg -Category NotInstalled
 Exit 1