Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust recommends to use a non-existing module #55868

Closed
RalfJung opened this issue Nov 11, 2018 · 1 comment
Closed

Rust recommends to use a non-existing module #55868

RalfJung opened this issue Nov 11, 2018 · 1 comment

Comments

@RalfJung
Copy link
Member

The following program:

use std::process::Command;

fn main() {
    Command::new("true")
        .before_exec(|| {})
        .status().unwrap();
}

shows an error saying

error[E0599]: no method named `before_exec` found for type `std::process::Command` in the current scope
 --> src/main.rs:5:10
  |
5 |         .before_exec(|| {})
  |          ^^^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
1 | use std::os::ext::process::CommandExt;
  |

However, following that suggestions leads to a program that errors saying

error[E0433]: failed to resolve. Could not find `ext` in `os`
 --> src/main.rs:2:14
  |
2 | use std::os::ext::process::CommandExt;
  |              ^^^ Could not find `ext` in `os`

warning: unused import: `std::os::ext::process::CommandExt`
 --> src/main.rs:2:5
  |
2 | use std::os::ext::process::CommandExt;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

error[E0599]: no method named `before_exec` found for type `std::process::Command` in the current scope
 --> src/main.rs:6:10
  |
6 |         .before_exec(|| {})
  |          ^^^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
1 | use std::os::ext::process::CommandExt;
  |
@RalfJung
Copy link
Member Author

Oh, this is a duplicate of #21934. Never mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant