Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit eee72ba

Browse files
committed
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.
1 parent 669f4bc commit eee72ba

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

tests/ui/issues/issue-39175.fixed

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test ignores some platforms as the particular extension trait used
2+
// to demonstrate the issue is only available on unix. This is fine as
3+
// the fix to suggested paths is not platform-dependent and will apply on
4+
// these platforms also.
5+
6+
//@ run-rustfix
7+
//@ only-unix (the diagnostics is influenced by `use std::os::unix::process::CommandExt;`)
8+
9+
use std::os::unix::process::CommandExt;
10+
use std::process::Command;
11+
// use std::os::unix::process::CommandExt;
12+
13+
fn main() {
14+
let _ = Command::new("echo").arg("hello").exec();
15+
//~^ ERROR no method named `exec`
16+
}

tests/ui/issues/issue-39175.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
// the fix to suggested paths is not platform-dependent and will apply on
44
// these platforms also.
55

6-
//@ ignore-windows
7-
//@ ignore-wasm32 no processes
8-
//@ ignore-sgx no processes
6+
//@ run-rustfix
7+
//@ only-unix (the diagnostics is influenced by `use std::os::unix::process::CommandExt;`)
98

109
use std::process::Command;
1110
// use std::os::unix::process::CommandExt;
1211

1312
fn main() {
14-
Command::new("echo").arg("hello").exec();
13+
let _ = Command::new("echo").arg("hello").exec();
1514
//~^ ERROR no method named `exec`
1615
}

tests/ui/issues/issue-39175.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0599]: no method named `exec` found for mutable reference `&mut Command` in the current scope
2-
--> $DIR/issue-39175.rs:14:39
2+
--> $DIR/issue-39175.rs:13:47
33
|
4-
LL | Command::new("echo").arg("hello").exec();
5-
| ^^^^
4+
LL | let _ = Command::new("echo").arg("hello").exec();
5+
| ^^^^
66
|
77
= help: items from traits can only be used if the trait is in scope
88
help: there is a method `pre_exec` with a similar name, but with different arguments

0 commit comments

Comments
 (0)