Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/cargo/ops/cargo_compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,17 @@ pub fn create_bcx<'a, 'gctx>(
match build_config.intent {
UserIntent::Test | UserIntent::Build | UserIntent::Check { .. } | UserIntent::Bench => {
if ws.gctx().get_env("RUST_FLAGS").is_ok() {
gctx.shell().warn(
"Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?",
)?;
gctx.shell()
.warn("ignoring environment variable `RUST_FLAGS`")?;
gctx.shell().note("rust flags are passed via `RUSTFLAGS`")?;
}
}
UserIntent::Doc { .. } | UserIntent::Doctest => {
if ws.gctx().get_env("RUSTDOC_FLAGS").is_ok() {
gctx.shell().warn(
"Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?"
)?;
gctx.shell()
.warn("ignoring environment variable `RUSTDOC_FLAGS`")?;
gctx.shell()
.note("rustdoc flags are passed via `RUSTDOCFLAGS`")?;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,8 @@ impl<'gctx> Source for RegistrySource<'gctx> {
// Attempt to handle misspellings by searching for a chain of related
// names to the original name. The resolver will later
// reject any candidates that have the wrong name, and with this it'll
// along the way produce helpful "did you mean?" suggestions.
// For now we only try the canonical lysing `-` to `_` and vice versa.
// have enough information to offer "a similar crate exists" suggestions.
// For now we only try canonicalizing `-` to `_` and vice versa.
// More advanced fuzzy searching become in the future.
for name_permutation in [
dep.package_name().replace('-', "_"),
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1747,8 +1747,8 @@ pub fn to_real_manifest(

if summary.features().contains_key("default-features") {
warnings.push(
"`default-features = [\"..\"]` was found in [features]. \
Did you mean to use `default = [\"..\"]`?"
"`[features]` defines a feature named `default-features`
note: only a feature named `default` will be enabled by default"
.to_string(),
)
}
Expand Down
9 changes: 6 additions & 3 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,13 +1851,16 @@ fn warn_if_default_features() {
.file("bar/src/lib.rs", "pub fn bar() {}")
.build();

p.cargo("check").with_stderr_data(str![[r#"
[WARNING] `default-features = [".."]` was found in [features]. Did you mean to use `default = [".."]`?
p.cargo("check")
.with_stderr_data(str![[r#"
[WARNING] `[features]` defines a feature named `default-features`
[NOTE] only a feature named `default` will be enabled by default
[LOCKING] 1 package to latest compatible version
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

"#]]).run();
"#]])
.run();
}

#[cargo_test]
Expand Down
3 changes: 2 additions & 1 deletion tests/testsuite/rustdocflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ fn rustdocflags_misspelled() {
p.cargo("doc")
.env("RUSTDOC_FLAGS", "foo")
.with_stderr_data(str![[r#"
[WARNING] Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?
[WARNING] ignoring environment variable `RUSTDOC_FLAGS`
[NOTE] rustdoc flags are passed via `RUSTDOCFLAGS`
...
"#]])
.run();
Expand Down
6 changes: 4 additions & 2 deletions tests/testsuite/rustflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,8 @@ fn env_rustflags_misspelled() {
.env("RUST_FLAGS", "foo")
.with_stderr_data(
"\
[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?
[WARNING] ignoring environment variable `RUST_FLAGS`
[NOTE] rust flags are passed via `RUSTFLAGS`
...
",
)
Expand Down Expand Up @@ -1471,7 +1472,8 @@ fn env_rustflags_misspelled_build_script() {
p.cargo("check")
.env("RUST_FLAGS", "foo")
.with_stderr_data(str![[r#"
[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?
[WARNING] ignoring environment variable `RUST_FLAGS`
[NOTE] rust flags are passed via `RUSTFLAGS`
[COMPILING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

Expand Down
Loading