Skip to content

Help suggests non-existent package std::os::ext::process::CommandExt #39175

Closed
@psimonyi

Description

@psimonyi

Normally rustc will suggest what use line to add, but for CommandExt its suggestion is impossible.

testcase.rs:

use std::process::Command;
// forgot this: use std::os::unix::process::CommandExt;

fn main() {
    Command::new("echo").arg("hello").exec();
}

Compile with rustc testcase.rs. Rust says it can't find exec and explains:

  = help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
  = help: candidate #1: `use std::os::ext::process::CommandExt;`

But the suggested trait doesn't exist; adding the suggested line gives an unresolved import error: "Could not find ext in os"

Rust should instead suggest the correct trait, std::os::unix::process::CommandExt.

Tested with (rustc --version --verbose):

Fedora 25's packaged rust:

rustc 1.10.0 (cfcb716cf 2016-07-03)
binary: rustc
commit-hash: cfcb716cf0961a7e3a4eceac828d94805cf8140b
commit-date: 2016-07-03
host: x86_64-unknown-linux-gnu
release: 1.10.0

And a recent source build:

rustc 1.16.0-dev (74c42ac17 2017-01-19)
binary: rustc
commit-hash: 74c42ac173bee900979870ed986c760596d1fbdb
commit-date: 2017-01-19
host: x86_64-unknown-linux-gnu
release: 1.16.0-dev
LLVM version: 3.9

(The formatting of the error messages differs between versions but the errors are the same.)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions