Skip to content

Commit

Permalink
Unrolled build for rust-lang#128111
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#128111 - estebank:no-question, r=fmease

Do not use question as label

We don't want to have questions in the diagnostic output. Instead, we use wording that communicates uncertainty, like "might":

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ you might be missing crate `spam`
   |
   = help: consider adding `extern crate spam` to use the `spam` crate
```
  • Loading branch information
rust-timer authored Jul 25, 2024
2 parents e7d66ea + 850faea commit cf2bcb7
Show file tree
Hide file tree
Showing 44 changed files with 159 additions and 151 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
)
} else if ident.name == sym::core {
(
format!("maybe a missing crate `{ident}`?"),
format!("you might be missing crate `{ident}`"),
Some((
vec![(ident.span, "std".to_string())],
"try using `std` instead of `core`".to_string(),
Expand All @@ -2021,7 +2021,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
)
} else if self.tcx.sess.is_rust_2015() {
(
format!("maybe a missing crate `{ident}`?"),
format!("you might be missing crate `{ident}`"),
Some((
vec![],
format!(
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/ice-unresolved-import-100241.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `inner`
--> $DIR/ice-unresolved-import-100241.rs:9:13
|
LL | pub use inner::S;
| ^^^^^ maybe a missing crate `inner`?
| ^^^^^ you might be missing crate `inner`
|
= help: consider adding `extern crate inner` to use the `inner` crate

Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: maybe a missing crate `unresolved_crate`?
error[E0433]: failed to resolve: you might be missing crate `unresolved_crate`
--> $DIR/unresolved-import-recovery.rs:3:5
|
LL | use unresolved_crate::module::Name;
| ^^^^^^^^^^^^^^^^ maybe a missing crate `unresolved_crate`?
| ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate`
|
= help: consider adding `extern crate unresolved_crate` to use the `unresolved_crate` crate

Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/issue-61732.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This previously triggered an ICE.

pub(in crate::r#mod) fn main() {}
//~^ ERROR failed to resolve: maybe a missing crate `r#mod`
//~^ ERROR failed to resolve: you might be missing crate `r#mod`
4 changes: 2 additions & 2 deletions tests/rustdoc-ui/issues/issue-61732.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: maybe a missing crate `r#mod`?
error[E0433]: failed to resolve: you might be missing crate `r#mod`
--> $DIR/issue-61732.rs:3:15
|
LL | pub(in crate::r#mod) fn main() {}
| ^^^^^ maybe a missing crate `r#mod`?
| ^^^^^ you might be missing crate `r#mod`
|
= help: consider adding `extern crate r#mod` to use the `r#mod` crate

Expand Down
6 changes: 3 additions & 3 deletions tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum DiagnosticOnEnum {
#[derive(Diagnostic)]
#[diag(no_crate_example, code = E0123)]
#[diag = "E0123"]
//~^ ERROR failed to resolve: maybe a missing crate `core`
//~^ ERROR failed to resolve: you might be missing crate `core`
struct WrongStructAttrStyle {}

#[derive(Diagnostic)]
Expand Down Expand Up @@ -801,15 +801,15 @@ struct SuggestionsNoItem {
struct SuggestionsInvalidItem {
#[suggestion(code(foo))]
//~^ ERROR `code(...)` must contain only string literals
//~| ERROR failed to resolve: maybe a missing crate `core`
//~| ERROR failed to resolve: you might be missing crate `core`
sub: Span,
}

#[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope
#[diag(no_crate_example)]
struct SuggestionsInvalidLiteral {
#[suggestion(code = 3)]
//~^ ERROR failed to resolve: maybe a missing crate `core`
//~^ ERROR failed to resolve: you might be missing crate `core`
sub: Span,
}

Expand Down
12 changes: 6 additions & 6 deletions tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -524,23 +524,23 @@ LL | #[suggestion(no_crate_suggestion, code = "")]
= help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]`
= help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/diagnostic-derive.rs:58:8
|
LL | #[diag = "E0123"]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/diagnostic-derive.rs:802:23
|
LL | #[suggestion(code(foo))]
| ^^^ maybe a missing crate `core`?
| ^^^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/diagnostic-derive.rs:811:25
|
LL | #[suggestion(code = 3)]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error: cannot find attribute `nonsense` in this scope
--> $DIR/diagnostic-derive.rs:63:3
Expand Down
32 changes: 16 additions & 16 deletions tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ struct G {

#[derive(Subdiagnostic)]
#[label("...")]
//~^ ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~^ ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
struct H {
#[primary_span]
span: Span,
Expand Down Expand Up @@ -310,8 +310,8 @@ struct AB {

#[derive(Subdiagnostic)]
union AC {
//~^ ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~^ ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span: u32,
b: u64,
}
Expand Down Expand Up @@ -581,8 +581,8 @@ struct BD {
span2: Span,
#[suggestion_part(foo = "bar")]
//~^ ERROR `code` is the only valid nested attribute
//~| ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~| ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span4: Span,
#[suggestion_part(code = "...")]
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
Expand Down Expand Up @@ -674,8 +674,8 @@ enum BL {
struct BM {
#[suggestion_part(code("foo"))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~| ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span: Span,
r#type: String,
}
Expand All @@ -685,8 +685,8 @@ struct BM {
struct BN {
#[suggestion_part(code("foo", "bar"))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~| ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span: Span,
r#type: String,
}
Expand All @@ -696,8 +696,8 @@ struct BN {
struct BO {
#[suggestion_part(code(3))]
//~^ ERROR expected exactly one string literal for `code = ...`
//~| ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~| ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span: Span,
r#type: String,
}
Expand All @@ -718,8 +718,8 @@ struct BP {
#[multipart_suggestion(no_crate_example)]
struct BQ {
#[suggestion_part(code = 3)]
//~^ ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~^ ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
span: Span,
r#type: String,
}
Expand Down Expand Up @@ -811,8 +811,8 @@ struct SuggestionStyleInvalid3 {
#[derive(Subdiagnostic)]
#[suggestion(no_crate_example, code = "", style("foo"))]
//~^ ERROR expected `= "xxx"`
//~| ERROR failed to resolve: maybe a missing crate `core`?
//~| NOTE maybe a missing crate `core`?
//~| ERROR failed to resolve: you might be missing crate `core`
//~| NOTE you might be missing crate `core`
struct SuggestionStyleInvalid4 {
#[primary_span]
sub: Span,
Expand Down
32 changes: 16 additions & 16 deletions tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -451,53 +451,53 @@ error: suggestion without `#[primary_span]` field
LL | #[suggestion(no_crate_example, code = "")]
| ^

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:96:9
|
LL | #[label("...")]
| ^^^^^ maybe a missing crate `core`?
| ^^^^^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:312:1
|
LL | union AC {
| ^^^^^ maybe a missing crate `core`?
| ^^^^^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:582:27
|
LL | #[suggestion_part(foo = "bar")]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:675:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^ maybe a missing crate `core`?
| ^^^^^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:686:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^ maybe a missing crate `core`?
| ^^^^^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:697:28
|
LL | #[suggestion_part(code(3))]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:720:30
|
LL | #[suggestion_part(code = 3)]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/subdiagnostic-derive.rs:812:48
|
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
| ^ maybe a missing crate `core`?
| ^ you might be missing crate `core`

error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:67:3
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/attributes/field-attributes-vis-unresolved.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0433]: failed to resolve: maybe a missing crate `nonexistent`?
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
--> $DIR/field-attributes-vis-unresolved.rs:17:12
|
LL | pub(in nonexistent) field: u8
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`?
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
|
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate

error[E0433]: failed to resolve: maybe a missing crate `nonexistent`?
error[E0433]: failed to resolve: you might be missing crate `nonexistent`
--> $DIR/field-attributes-vis-unresolved.rs:22:12
|
LL | pub(in nonexistent) u8
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`?
| ^^^^^^^^^^^ you might be missing crate `nonexistent`
|
= help: consider adding `extern crate nonexistent` to use the `nonexistent` crate

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0432.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `something`
--> $DIR/E0432.rs:1:5
|
LL | use something::Foo;
| ^^^^^^^^^ maybe a missing crate `something`?
| ^^^^^^^^^ you might be missing crate `something`
|
= help: consider adding `extern crate something` to use the `something` crate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ error[E0432]: unresolved import `core`
LL | use core::default;
| ^^^^
| |
| maybe a missing crate `core`?
| you might be missing crate `core`
| help: try using `std` instead of `core`: `std`

error[E0433]: failed to resolve: maybe a missing crate `core`?
error[E0433]: failed to resolve: you might be missing crate `core`
--> $DIR/feature-gate-extern_absolute_paths.rs:4:19
|
LL | let _: u8 = ::core::default::Default();
| ^^^^ maybe a missing crate `core`?
| ^^^^ you might be missing crate `core`
|
help: try using `std` instead of `core`
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/import-from-missing-star-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-2.rs:2:9
|
LL | use spam::*;
| ^^^^ maybe a missing crate `spam`?
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/imports/import-from-missing-star-3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-3.rs:2:9
|
LL | use spam::*;
| ^^^^ maybe a missing crate `spam`?
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate

error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-3.rs:27:13
|
LL | use spam::*;
| ^^^^ maybe a missing crate `spam`?
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/import-from-missing-star.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star.rs:1:5
|
LL | use spam::*;
| ^^^^ maybe a missing crate `spam`?
| ^^^^ you might be missing crate `spam`
|
= help: consider adding `extern crate spam` to use the `spam` crate

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/import3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `main`
--> $DIR/import3.rs:2:5
|
LL | use main::bar;
| ^^^^ maybe a missing crate `main`?
| ^^^^ you might be missing crate `main`
|
= help: consider adding `extern crate main` to use the `main` crate

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/issue-109343.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved`
--> $DIR/issue-109343.rs:4:9
|
LL | pub use unresolved::f;
| ^^^^^^^^^^ maybe a missing crate `unresolved`?
| ^^^^^^^^^^ you might be missing crate `unresolved`
|
= help: consider adding `extern crate unresolved` to use the `unresolved` crate

Expand Down
6 changes: 4 additions & 2 deletions tests/ui/imports/issue-1697.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Testing that we don't fail abnormally after hitting the errors

use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432]
//~^ maybe a missing crate `unresolved`?
use unresolved::*;
//~^ ERROR unresolved import `unresolved` [E0432]
//~| NOTE you might be missing crate `unresolved`
//~| HELP consider adding `extern crate unresolved` to use the `unresolved` crate

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/imports/issue-1697.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved`
--> $DIR/issue-1697.rs:3:5
|
LL | use unresolved::*;
| ^^^^^^^^^^ maybe a missing crate `unresolved`?
| ^^^^^^^^^^ you might be missing crate `unresolved`
|
= help: consider adding `extern crate unresolved` to use the `unresolved` crate

Expand Down
Loading

0 comments on commit cf2bcb7

Please sign in to comment.