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

Unify wording of "failed to resolve" errors with "cannot find" resolution errors #128086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

estebank
Copy link
Contributor

  • Use the same wording for all macro resolution errors
  • specify the scope in which the resolution failure happened

Before

error[E0433]: failed to resolve: `crate` in paths can only be used in start position
  --> $DIR/crate-path-non-absolute.rs:5:22
   |
LL |         let s = ::m::crate::S;
   |                      ^^^^^ `crate` in paths can only be used in start position

after

error[E0433]: cannot find module `crate` in module `m`
  --> $DIR/crate-path-non-absolute.rs:5:22
   |
LL |         let s = ::m::crate::S;
   |                      ^^^^^ `crate` in paths can only be used in start position

r? @petrochenkov

…tion errors

* Use the same wording for all macro resolution errors
* specify the scope in which the resolution failure happened

Before

```
error[E0433]: failed to resolve: `crate` in paths can only be used in start position
  --> $DIR/crate-path-non-absolute.rs:5:22
   |
LL |         let s = ::m::crate::S;
   |                      ^^^^^ `crate` in paths can only be used in start position
```
after
```
error[E0433]: cannot find module `crate` in module `m`
  --> $DIR/crate-path-non-absolute.rs:5:22
   |
LL |         let s = ::m::crate::S;
   |                      ^^^^^ `crate` in paths can only be used in start position
```
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 23, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 23, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@estebank
Copy link
Contributor Author

Split off from #126810.

"Hide whitespace" will aid in seeing mostly "true" changes. The amount of files being touched is a consequence of the blast radius the diagnostic has.

Happy to hear about other potential alternatives for what the output should be instead.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
------
 > importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:3aacb9c90579defe09351ac5e8ee504359f8054da6326ff19038f1b7c90e3cb2aafe33685c6d9b76ee8d2ccbd187ca80c46ab5380485abdd8c0ce7d69cd8d8fd:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---

---- [ui] tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs stdout ----
diff of stderr:

451 LL | #[suggestion(no_crate_example, code = "")]
453 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
455   --> $DIR/subdiagnostic-derive.rs:96:9
455   --> $DIR/subdiagnostic-derive.rs:96:9
456    |
457 LL | #[label("...")]
458    |         ^^^^^ maybe a missing crate `core`?
459 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
---
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
467   --> $DIR/subdiagnostic-derive.rs:582:27
468    |
469 LL |     #[suggestion_part(foo = "bar")]
470    |                           ^ maybe a missing crate `core`?
471 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
473   --> $DIR/subdiagnostic-derive.rs:675:28
474    |
475 LL |     #[suggestion_part(code("foo"))]
476    |                            ^^^^^ maybe a missing crate `core`?
477 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
479   --> $DIR/subdiagnostic-derive.rs:686:28
480    |
481 LL |     #[suggestion_part(code("foo", "bar"))]
482    |                            ^^^^^ maybe a missing crate `core`?
483 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
485   --> $DIR/subdiagnostic-derive.rs:697:28
486    |
487 LL |     #[suggestion_part(code(3))]
488    |                            ^ maybe a missing crate `core`?
489 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
491   --> $DIR/subdiagnostic-derive.rs:720:30
492    |
493 LL |     #[suggestion_part(code = 3)]
494    |                              ^ maybe a missing crate `core`?
495 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
497   --> $DIR/subdiagnostic-derive.rs:812:48
498    |
499 LL | #[suggestion(no_crate_example, code = "", style("foo"))]

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive/subdiagnostic-derive.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args session-diagnostic/subdiagnostic-derive.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error: label without `#[primary_span]` field
   |
   |
LL | #[label(no_crate_example)]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
LL | #[label]
   | ^


error: `#[foo]` is not a valid attribute
   |
LL | #[foo]
   | ^


error: `#[label = ...]` is not a valid attribute
   |
   |
LL | #[label = "..."]


error: only `no_span` is a valid nested attribute
   |
   |
LL | #[label(bug = "...")]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
   |
LL | #[label(bug = "...")]


error: only `no_span` is a valid nested attribute
   |
   |
LL | #[label(slug = 4)]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
   |
LL | #[label(slug = 4)]


error: only `no_span` is a valid nested attribute
   |
   |
LL | #[label(slug("..."))]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
   |
LL | #[label(slug("..."))]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
   |
LL | #[label()]


error: only `no_span` is a valid nested attribute
   |
   |
LL | #[label(no_crate_example, code = "...")]


error: only `no_span` is a valid nested attribute
   |
   |
LL | #[label(no_crate_example, applicability = "machine-applicable")]

error: unsupported type attribute for subdiagnostic enum
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:163:1
   |
   |
LL | #[foo]
   | ^

error: `#[bar]` is not a valid attribute
   |
LL |     #[bar]
   |     ^


error: `#[bar = ...]` is not a valid attribute
   |
   |
LL |     #[bar = "..."]


error: `#[bar = ...]` is not a valid attribute
   |
   |
LL |     #[bar = 4]


error: `#[bar(...)]` is not a valid attribute
   |
   |
LL |     #[bar("...")]


error: only `no_span` is a valid nested attribute
   |
   |
LL |     #[label(code = "...")]


error: diagnostic slug must be first argument of a `#[label(...)]` attribute
   |
   |
LL |     #[label(code = "...")]


error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[primary_span]


error: label without `#[primary_span]` field
   |
   |
LL | #[label(no_crate_example)]


error: `#[applicability]` is only valid on suggestions
   |
LL |     #[applicability]
   |     ^


error: `#[bar]` is not a valid attribute
   |
LL |     #[bar]
   |     ^
   |
   |
   = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes

error: `#[bar = ...]` is not a valid attribute
   |
   |
LL |     #[bar = "..."]


error: `#[bar(...)]` is not a valid attribute
   |
   |
LL |     #[bar("...")]
   |
   |
   = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: a diagnostic slug must be the first argument to the attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:328:44
   |
   |
LL | #[label(no_crate_example, no_crate::example)]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:341:5
   |
   |
LL |     #[primary_span]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:338:5
   |
   |
LL |     #[primary_span]

error: subdiagnostic kind not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:347:8
   |
   |
LL | struct AG {
   |        ^^

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:384:46
   |
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:384:32
   |
   |
LL | #[suggestion(no_crate_example, code = "...", code = "...")]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:402:5
   |
---
   |
LL |     #[applicability]
   |     ^

error: the `#[applicability]` attribute can only be applied to fields of type `Applicability`
   |
LL |     #[applicability]
   |     ^


error: suggestion without `code = "..."`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:425:1
   |
LL | #[suggestion(no_crate_example)]

error: invalid applicability
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:435:62
   |
   |
LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")]


error: suggestion without `#[primary_span]` field
   |
LL | #[suggestion(no_crate_example, code = "...")]
   | ^

---

error: `var` doesn't refer to a field on this type
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:487:39
   |
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]

error: `var` doesn't refer to a field on this type
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:506:43
   |
   |
LL |     #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]


error: `#[suggestion_part]` is not a valid attribute
   |
LL |     #[suggestion_part]
   |     ^
   |
   |
   = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead

error: `#[suggestion_part(...)]` is not a valid attribute
   |
   |
LL |     #[suggestion_part(code = "...")]
   |
   |
   = help: `#[suggestion_part(...)]` is only valid in multipart suggestions

error: suggestion without `#[primary_span]` field
   |
LL | #[suggestion(no_crate_example, code = "...")]
   | ^


error: invalid nested attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:541:42
   |
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
   |
   |
   = help: only `no_span`, `style` and `applicability` are valid nested attributes

error: multipart suggestion without any `#[suggestion_part(...)]` fields
   |
   |
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]


error: `#[suggestion_part(...)]` attribute without `code = "..."`
   |
LL |     #[suggestion_part]
   |     ^


error: `#[suggestion_part(...)]` attribute without `code = "..."`
   |
   |
LL |     #[suggestion_part()]


error: `#[primary_span]` is not a valid attribute
   |
   |
LL |     #[primary_span]
   |
   |
   = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`

error: multipart suggestion without any `#[suggestion_part(...)]` fields
   |
LL | #[multipart_suggestion(no_crate_example)]
   | ^


error: `#[suggestion_part(...)]` attribute without `code = "..."`
   |
LL |     #[suggestion_part]
   |     ^


error: `#[suggestion_part(...)]` attribute without `code = "..."`
   |
   |
LL |     #[suggestion_part()]

error: `code` is the only valid nested attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:582:23
   |
   |
LL |     #[suggestion_part(foo = "bar")]


error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[suggestion_part(code = "...")]


error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[suggestion_part()]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:598:37
   |
   |
LL |     #[suggestion_part(code = "...", code = ",,,")]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:598:23
   |
   |
LL |     #[suggestion_part(code = "...", code = ",,,")]


error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
   |
LL |     #[applicability]
   |     ^


error: expected exactly one string literal for `code = ...`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:675:34
   |
LL |     #[suggestion_part(code("foo"))]

error: expected exactly one string literal for `code = ...`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:686:41
   |
   |
LL |     #[suggestion_part(code("foo", "bar"))]

error: expected exactly one string literal for `code = ...`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:697:30
   |
   |
LL |     #[suggestion_part(code(3))]

error: expected exactly one string literal for `code = ...`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:708:29
   |
   |
LL |     #[suggestion_part(code())]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:763:1
   |
   |
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:763:1
   |
   |
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]


error: `#[suggestion_hidden(...)]` is not a valid attribute
   |
   |
LL | #[suggestion_hidden(no_crate_example, code = "")]
   |
   |
   = help: Use `#[suggestion(..., style = "hidden")]` instead

error: `#[suggestion_hidden(...)]` is not a valid attribute
   |
   |
LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
   |
   |
   = help: Use `#[suggestion(..., style = "hidden")]` instead
error: invalid suggestion style
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:788:51
   |
   |
LL | #[suggestion(no_crate_example, code = "", style = "foo")]
   |
   |
   = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`

error: expected `= "xxx"`
   |
   |
LL | #[suggestion(no_crate_example, code = "", style = 42)]

error: a diagnostic slug must be the first argument to the attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:804:48
   |
   |
LL | #[suggestion(no_crate_example, code = "", style)]


error: expected `= "xxx"`
   |
   |
LL | #[suggestion(no_crate_example, code = "", style("foo"))]


error: `#[primary_span]` is not a valid attribute
   |
   |
LL |     #[primary_span]
   |
   = note: there must be exactly one primary span
   = note: there must be exactly one primary span
   = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead

error: suggestion without `#[primary_span]` field
   |
   |
LL | #[suggestion(no_crate_example, code = "")]

error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:96:9
   |
   |
LL | #[label("...")]
   |         ^^^^^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:312:1
   |
LL | union AC {
LL | union AC {
   | ^^^^^ maybe a missing crate `core`?

error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:582:27
   |
LL |     #[suggestion_part(foo = "bar")]
   |                           ^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:675:28
   |
   |
LL |     #[suggestion_part(code("foo"))]
   |                            ^^^^^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:686:28
   |
   |
LL |     #[suggestion_part(code("foo", "bar"))]
   |                            ^^^^^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:697:28
   |
   |
LL |     #[suggestion_part(code(3))]
   |                            ^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:720:30
   |
   |
LL |     #[suggestion_part(code = 3)]
   |                              ^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:812:48
   |
   |
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
   |                                                ^ maybe a missing crate `core`?
error: cannot find attribute `foo` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:67:3
   |
LL | #[foo]
---

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:189:7
   |
LL |     #[bar = "..."]

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:201:7
   |
   |
LL |     #[bar = 4]

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:213:7
   |
   |
LL |     #[bar("...")]

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:274:7
   |
   |
LL |     #[bar]
   |       ^^^

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:285:7
   |
LL |     #[bar = "..."]

error: cannot find attribute `bar` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:296:7
   |
   |
LL |     #[bar("...")]

error[E0425]: cannot find value `slug` in module `crate::fluent_generated`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs:126:9
   |
   |
LL | #[label(slug)]
   |         ^^^^ not found in `crate::fluent_generated`

error[E0425]: cannot find value `__code_29` in this scope
   |
LL | #[derive(Subdiagnostic)]
   |          ^^^^^^^^^^^^^ not found in this scope
   |
---

---- [ui] tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs stdout ----
diff of stderr:

524    = help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]`
525    = 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]: cannot find item `core` in the crate root
528   --> $DIR/diagnostic-derive.rs:58:8
529    |
---
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
534   --> $DIR/diagnostic-derive.rs:802:23
535    |
536 LL |     #[suggestion(code(foo))]
537    |                       ^^^ maybe a missing crate `core`?
538 
- error[E0433]: failed to resolve: maybe a missing crate `core`?
+ error[E0433]: cannot find item `core` in the crate root
+ error[E0433]: cannot find item `core` in the crate root
540   --> $DIR/diagnostic-derive.rs:811:25
541    |
542 LL |     #[suggestion(code = 3)]

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/diagnostic-derive/diagnostic-derive.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args session-diagnostic/diagnostic-derive.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/diagnostic-derive" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/session-diagnostic/diagnostic-derive/auxiliary"
--- stderr -------------------------------
error: unsupported type attribute for diagnostic derive enum
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:47:1
   |
---
   |
LL |     Foo,
   |     ^^^
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:52:5
   |
LL |     Bar,
LL |     Bar,
   |     ^^^
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`

error: `#[nonsense(...)]` is not a valid attribute
   |
   |
LL | #[nonsense(no_crate_example, code = E0123)]

error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:63:1
   |
   |
LL | #[nonsense(no_crate_example, code = E0123)]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:70:1
   |
LL | #[diag(code = E0123)]
LL | #[diag(code = E0123)]
   | ^
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug must be the first argument
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:80:16
   |
   |
LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")]

error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:80:1
   |
   |
LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:86:8
   |
   |
LL | #[diag(nonsense = "...", code = E0123, slug = "foo")]
   |
   = note: only the `code` parameter is valid after the slug

error: diagnostic slug not specified
error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:86:1
   |
LL | #[diag(nonsense = "...", code = E0123, slug = "foo")]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:92:8
   |
   |
LL | #[diag(nonsense = 4, code = E0123, slug = "foo")]
   |
   = note: only the `code` parameter is valid after the slug

error: diagnostic slug not specified
error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:92:1
   |
LL | #[diag(nonsense = 4, code = E0123, slug = "foo")]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:98:40
   |
   |
LL | #[diag(no_crate_example, code = E0123, slug = "foo")]
   |
   = note: only the `code` parameter is valid after the slug


error: `#[suggestion = ...]` is not a valid attribute
   |
   |
LL |     #[suggestion = "bar"]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:112:8
   |
---

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:118:40
   |
LL | #[diag(no_crate_example, code = E0123, code = E0456)]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:118:26
   |
   |
LL | #[diag(no_crate_example, code = E0123, code = E0456)]

error: diagnostic slug must be the first argument
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:123:43
   |
   |
LL | #[diag(no_crate_example, no_crate::example, code = E0123)]
   |                                           ^

error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:128:1
   |
LL | struct KindNotProvided {} //~ ERROR diagnostic slug not specified
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:131:1
   |
LL | #[diag(code = E0123)]
LL | #[diag(code = E0123)]
   | ^
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`

error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[primary_span]


error: `#[nonsense]` is not a valid attribute
   |
   |
LL |     #[nonsense]


error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[label(no_crate_label)]

error: `name` doesn't refer to a field on this type
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:175:46
   |
   |
LL |     #[suggestion(no_crate_suggestion, code = "{name}")]


error: invalid format string: expected `'}'` but string was terminated
   |
LL | #[derive(Diagnostic)]
LL | #[derive(Diagnostic)]
   |          ^^^^^^^^^^ expected `'}'` in format string
   |
   = note: if you intended to print `{`, you can escape it using `{{`
   = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)

error: invalid format string: unmatched `}` found
   |
LL | #[derive(Diagnostic)]
LL | #[derive(Diagnostic)]
   |          ^^^^^^^^^^ unmatched `}` in format string
   |
   = note: if you intended to print `}`, you can escape it using `}}`
   = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)

error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
   |
   |
LL |     #[label(no_crate_label)]

error: suggestion without `code = "..."`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:229:5
   |
   |
LL |     #[suggestion(no_crate_suggestion)]

error: invalid nested attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:237:18
   |
   |
LL |     #[suggestion(nonsense = "bar")]
   |
   |
   = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:237:5
   |
   |
LL |     #[suggestion(nonsense = "bar")]

error: invalid nested attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:246:18
   |
   |
LL |     #[suggestion(msg = "bar")]
   |
   |
   = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:246:5
   |
   |
LL |     #[suggestion(msg = "bar")]

error: wrong field type for suggestion
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:269:5
   |
   |
LL |     #[suggestion(no_crate_suggestion, code = "This is suggested code")]
   |
   |
   = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:285:24
   |
LL |     suggestion: (Span, Span, Applicability),
---
   |
LL |     suggestion: (Applicability, Applicability, Span),
   |                  ^^^^^^^^^^^^^

error: `#[label = ...]` is not a valid attribute
   |
   |
LL |     #[label = "bar"]

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:451:5
   |
   |
LL |     #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:453:24
   |
   |
LL |     suggestion: (Span, Applicability),
   |                        ^^^^^^^^^^^^^

error: invalid applicability
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:459:69
   |
LL |     #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")]


error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()`
   |
   |
LL |     #[help(no_crate_help)]

error: a diagnostic slug must be the first argument to the attribute
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:535:32
   |
   |
LL |     #[label(no_crate_label, foo)]


error: only `no_span` is a valid nested attribute
   |
   |
LL |     #[label(no_crate_label, foo = "...")]


error: only `no_span` is a valid nested attribute
   |
   |
LL |     #[label(no_crate_label, foo("..."))]


error: `#[primary_span]` is not a valid attribute
   |
   |
LL |     #[primary_span]
   |
   = help: the `primary_span` field attribute is not valid for lint diagnostics


error: `#[error(...)]` is not a valid attribute
   |
   |
LL | #[error(no_crate_example, code = E0123)]

error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:583:1
   |
   |
LL | #[error(no_crate_example, code = E0123)]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`

error: `#[warn_(...)]` is not a valid attribute
   |
   |
LL | #[warn_(no_crate_example, code = E0123)]

error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:590:1
   |
   |
LL | #[warn_(no_crate_example, code = E0123)]
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`

error: `#[lint(...)]` is not a valid attribute
   |
LL | #[lint(no_crate_example, code = E0123)]
   | ^


error: diagnostic slug not specified
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:597:1
   |
LL | #[lint(no_crate_example, code = E0123)]
   | ^
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`

error: `#[lint(...)]` is not a valid attribute
   |
LL | #[lint(no_crate_example, code = E0123)]
   | ^

---

error: specified multiple times
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:613:53
   |
LL |     #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]
   |
note: previously specified here
  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:613:39
   |
   |
LL |     #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]

error: wrong types for suggestion
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:622:24
   |
   |
LL |     suggestion: (Span, usize),
   |                        ^^^^^
   |
   = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: wrong types for suggestion
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:630:17
   |
   |
LL |     suggestion: (Span,),
   |
   |
   = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: suggestion without `code = "..."`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:637:5
   |
   |
LL |     #[suggestion(no_crate_suggestion)]


error: `#[multipart_suggestion(...)]` is not a valid attribute
   |
LL | #[multipart_suggestion(no_crate_suggestion)]
   | ^
   |
   |
   = help: consider creating a `Subdiagnostic` instead

error: `#[multipart_suggestion(...)]` is not a valid attribute
   |
LL | #[multipart_suggestion()]
   | ^
   |
   |
   = help: consider creating a `Subdiagnostic` instead

error: `#[multipart_suggestion(...)]` is not a valid attribute
   |
LL |     #[multipart_suggestion(no_crate_suggestion)]
   |     ^
   |
   |
   = help: consider creating a `Subdiagnostic` instead

error: `#[suggestion(...)]` is not a valid attribute
   |
LL | #[suggestion(no_crate_suggestion, code = "...")]
   | ^
   |
   |
   = help: `#[label]` and `#[suggestion]` can only be applied to fields

error: `#[label]` is not a valid attribute
   |
LL | #[label]
   | ^
   |
   |
   = help: `#[label]` and `#[suggestion]` can only be applied to fields

error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic(bad)]


error: `#[subdiagnostic = ...]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic = "bad"]


error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic(bad, bad)]


error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic("bad")]


error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic(eager)]


error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic(eager)]


error: `#[subdiagnostic(...)]` is not a valid attribute
   |
   |
LL |     #[subdiagnostic(eager)]

error: expected at least one string literal for `code(...)`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:794:23
   |
   |
LL |     #[suggestion(code())]


error: `code(...)` must contain only string literals
   |
   |
LL |     #[suggestion(code(foo))]


error: `#[suggestion(...)]` is not a valid attribute
   |
   |
LL |     #[suggestion(no_crate_suggestion, code = "")]
   |
   |
   = note: `#[suggestion(...)]` applied to `Vec` field is ambiguous
   = 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]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:58:8
   |
LL | #[diag = "E0123"]
LL | #[diag = "E0123"]
   |        ^ maybe a missing crate `core`?

error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:802:23
   |
LL |     #[suggestion(code(foo))]
   |                       ^^^ maybe a missing crate `core`?
error[E0433]: cannot find item `core` in the crate root
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:811:25
   |
   |
LL |     #[suggestion(code = 3)]
   |                         ^ maybe a missing crate `core`?
error: cannot find attribute `nonsense` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:63:3
   |
   |
LL | #[nonsense(no_crate_example, code = E0123)]

error: cannot find attribute `nonsense` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:150:7
   |
   |
LL |     #[nonsense]

error: cannot find attribute `error` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:583:3
   |
   |
LL | #[error(no_crate_example, code = E0123)]

error: cannot find attribute `warn_` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:590:3
   |
   |
LL | #[warn_(no_crate_example, code = E0123)]
   |   ^^^^^ help: a built-in attribute with a similar name exists: `warn`
error: cannot find attribute `lint` in this scope
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:597:3
   |
LL | #[lint(no_crate_example, code = E0123)]
---

error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated`
##[error]  --> /checkout/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:75:8
   |
LL | #[diag(nonsense, code = E0123)]
   |        ^^^^^^^^ not found in `crate::fluent_generated`

error[E0425]: cannot find value `__code_34` in this scope
   |
   |
LL | #[derive(Diagnostic)] //~ ERROR cannot find value `__code_34` in this scope
   |
   = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `Hello: IntoDiagArg` is not satisfied
   |
LL | #[derive(Diagnostic)]
   |          ---------- required by a bound introduced by this call
...
...
LL |     other: Hello,
   |            ^^^^^ the trait `IntoDiagArg` is not implemented for `Hello`
   = help: the following other types implement trait `IntoDiagArg`:
             &'a T
             &'a std::path::Path
             &'a str
             &'a str
             &rustc_target::spec::TargetTriple
             AllocId
             AllocRange
             Backtrace
             Binder<I, T>
           and 71 others
note: required by a bound in `Diag::<'a, G>::arg`
   = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 85 previous errors

@petrochenkov
Copy link
Contributor

Blocking on the wording discussion in #128080 (comment).
@rustbot blocked

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 23, 2024
@bors
Copy link
Contributor

bors commented Jul 25, 2024

☔ The latest upstream changes (presumably #128169) made this pull request unmergeable. Please resolve the merge conflicts.

@lolbinarycat lolbinarycat added the A-diagnostics Area: Messages for errors, warnings, and lints label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants