diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-01-23 15:25:18 +0800 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-01-23 20:51:28 +0800 |
| commit | eee72ba2f1a87f88be7a9da127705c1ad0aea6f8 (patch) | |
| tree | 48634cd17a010ceefbf16ab5eb848287eec863eb /tests | |
| parent | 669f4bce4d747aafb55ebffa11216b6e8996f894 (diff) | |
| download | rust-eee72ba2f1a87f88be7a9da127705c1ad0aea6f8.tar.gz rust-eee72ba2f1a87f88be7a9da127705c1ad0aea6f8.zip | |
tests: adjust `tests/ui/issues/issue-39175.rs`
- Change test to check only. - Don't ignore `wasm` or `sgx`. - Gate test to be Unix only because Unix `CommandExt` influences the suggestion. - Run rustfix on the suggestion.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/issues/issue-39175.fixed | 16 | ||||
| -rw-r--r-- | tests/ui/issues/issue-39175.rs | 7 | ||||
| -rw-r--r-- | tests/ui/issues/issue-39175.stderr | 6 |
3 files changed, 22 insertions, 7 deletions
diff --git a/tests/ui/issues/issue-39175.fixed b/tests/ui/issues/issue-39175.fixed new file mode 100644 index 00000000000..1f2b5b8b0ce --- /dev/null +++ b/tests/ui/issues/issue-39175.fixed @@ -0,0 +1,16 @@ +// This test ignores some platforms as the particular extension trait used +// to demonstrate the issue is only available on unix. This is fine as +// the fix to suggested paths is not platform-dependent and will apply on +// these platforms also. + +//@ run-rustfix +//@ only-unix (the diagnostics is influenced by `use std::os::unix::process::CommandExt;`) + +use std::os::unix::process::CommandExt; +use std::process::Command; +// use std::os::unix::process::CommandExt; + +fn main() { + let _ = Command::new("echo").arg("hello").exec(); +//~^ ERROR no method named `exec` +} diff --git a/tests/ui/issues/issue-39175.rs b/tests/ui/issues/issue-39175.rs index 7b801317b71..a7e6134b2d9 100644 --- a/tests/ui/issues/issue-39175.rs +++ b/tests/ui/issues/issue-39175.rs @@ -3,14 +3,13 @@ // the fix to suggested paths is not platform-dependent and will apply on // these platforms also. -//@ ignore-windows -//@ ignore-wasm32 no processes -//@ ignore-sgx no processes +//@ run-rustfix +//@ only-unix (the diagnostics is influenced by `use std::os::unix::process::CommandExt;`) use std::process::Command; // use std::os::unix::process::CommandExt; fn main() { - Command::new("echo").arg("hello").exec(); + let _ = Command::new("echo").arg("hello").exec(); //~^ ERROR no method named `exec` } diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr index bbe8badb652..163b4989aae 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -1,8 +1,8 @@ error[E0599]: no method named `exec` found for mutable reference `&mut Command` in the current scope - --> $DIR/issue-39175.rs:14:39 + --> $DIR/issue-39175.rs:13:47 | -LL | Command::new("echo").arg("hello").exec(); - | ^^^^ +LL | let _ = Command::new("echo").arg("hello").exec(); + | ^^^^ | = help: items from traits can only be used if the trait is in scope help: there is a method `pre_exec` with a similar name, but with different arguments |
