rust icon indicating copy to clipboard operation
rust copied to clipboard

Move and rename `SessionDiagnostic` & `SessionSubdiagnostic` traits and macros

Open JhonnyBillM opened this issue 3 years ago • 24 comments

After PR #101434, we want to:

  • [x] Move SessionDiagnostic to rustc_errors.
  • [x] Add emit_ methods that accept impl SessionDiagnostic to Handler.
  • [x] (optional) Rename trait SessionDiagnostic to DiagnosticHandler.
  • [x] (optional) Rename macro SessionDiagnostic to DiagnosticHandler.
  • [x] Update Rustc Dev Guide and Docs to reflect these changes. https://github.com/rust-lang/rustc-dev-guide/pull/1460

Now I am having build issues getting the compiler to build when trying to rename the macro.

See diagnostics errors and context when building.
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
  --> compiler/rustc_attr/src/session_diagnostics.rs:13:10
   |
13 |   #[derive(DiagnosticHandler)]
   |            ^^^^^^^^^^^^^^^^^ in this derive macro expansion
   |
  ::: /Users/jhonny/.cargo/registry/src/github.com-1ecc6299db9ec823/synstructure-0.12.6/src/macros.rs:94:9
   |
94 | /         pub fn $derives(
95 | |             i: $crate::macros::TokenStream
96 | |         ) -> $crate::macros::TokenStream {
   | |________________________________________- in this expansion of `#[derive(DiagnosticHandler)]`
   |
note: the lint level is defined here
  --> compiler/rustc_attr/src/lib.rs:10:9
   |
10 | #![deny(rustc::diagnostic_outside_of_impl)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And also this one:

error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
   --> compiler/rustc_attr/src/session_diagnostics.rs:213:32
    |
213 |         let mut diag = handler.struct_span_err_with_code(
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^

Note Can't find where this message is coming from, because you can see in this experimental branch that I updated all errors and diags to say: error: diagnostics should only be created in DiagnosticHandler/AddSubdiagnostic impls and not: error: diagnostics should only be created in SessionDiagnostic/AddSubdiagnostic impls

I tried building the compiler in different ways (playing with the stages etc), but nothing worked.

Question

Do we need to build or do something different when renaming a macro and identifiers?

For context, see experimental commit https://github.com/JhonnyBillM/rust/commit/f2193a98b44db3f2af77a878824b152cdf0d34a5 where the macro and symbols are renamed, but it doesn't compile.

JhonnyBillM avatar Sep 08 '22 04:09 JhonnyBillM

r? @fee1-dead

(rust-highfive has picked a reviewer for you, use r? to override)

rust-highfive avatar Sep 08 '22 04:09 rust-highfive

r? @davidtwco

fee1-dead avatar Sep 08 '22 08:09 fee1-dead

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

Click to see the possible cause of the failure (guessed by this bot)
diff of stderr:

449   --> $DIR/diagnostic-derive.rs:331:10
450    |
451 LL | #[derive(Diagnostic)]
-    |          ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
+    |          ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
454    = help: normalized in stderr
454    = help: normalized in stderr
455 note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`

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: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=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" "-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"
stdout: none
--- stderr -------------------------------
error: `#[derive(Diagnostic)]` can only be used on structs
   |
   |
LL | / #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[derive(Diagnostic)]` can only be used on structs
LL | | enum DiagnosticOnEnum {
LL | |     Foo,
LL | |     Bar,
LL | | }


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


error: `#[nonsense(...)]` is not a valid attribute
   |
   |
LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |
   |
   = help: only `diag`, `help`, `note` and `warning` are valid attributes

error: diagnostic slug not specified
   |
   |
LL | / #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[nonsense(...)]` is not a valid attribute
LL | | //~^^ ERROR diagnostic slug not specified
LL | | //~^^^ ERROR cannot find attribute `nonsense` in this scope
LL | | struct InvalidStructAttr {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[diag("...")]` is not a valid attribute
   |
   |
LL | #[diag("E0123")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
   |
   |
LL | / #[diag("E0123")]
LL | | //~^ ERROR `#[diag("...")]` is not a valid attribute
LL | | //~^^ ERROR diagnostic slug not specified
LL | | struct InvalidLitNestedAttr {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[diag(nonsense(...))]` is not a valid attribute
   |
   |
LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
   |
   |
LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
LL | | //~^ ERROR `#[diag(nonsense(...))]` is not a valid attribute
LL | | //~^^ ERROR diagnostic slug not specified
LL | | struct InvalidNestedStructAttr1 {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[diag(nonsense = ...)]` is not a valid attribute
   |
   |
LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
   |
   |
LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")]
LL | | //~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
LL | | //~^^ ERROR diagnostic slug not specified
LL | | struct InvalidNestedStructAttr2 {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[diag(nonsense = ...)]` is not a valid attribute
   |
   |
LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
   |
   |
LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")]
LL | | //~^ ERROR `#[diag(nonsense = ...)]` is not a valid attribute
LL | | //~^^ ERROR diagnostic slug not specified
LL | | struct InvalidNestedStructAttr3 {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[diag(slug = ...)]` is not a valid attribute
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")]
   |
   |
   = help: only `code` is a valid nested attributes following the slug

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

error: specified multiple times
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:103:1
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")]
   |
note: previously specified here
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:102:1
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]

error: specified multiple times
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:103:49
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")]
   |
note: previously specified here
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:102:49
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]

error: specified multiple times
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:109:65
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
   |
note: previously specified here
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:109:49
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]


error: `#[diag(typeck::ambiguous_lifetime_bound)]` is not a valid attribute
   |
   |
LL | #[diag(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")]


error: diagnostic slug not specified
   |
   |
LL | struct KindNotProvided {} //~ ERROR diagnostic slug not specified
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: diagnostic slug not specified
   |
   |
LL | / #[diag(code = "E0456")]
LL | | //~^ ERROR diagnostic slug not specified
LL | | struct SlugNotProvided {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::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]
   |
   |
   = help: only `skip_arg`, `primary_span`, `label`, `note`, `help` and `subdiagnostic` are valid field attributes

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

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


error: invalid format string: expected `'}'` but string was terminated
   |
LL | #[derive(Diagnostic)]
LL | #[derive(Diagnostic)]
   |           -    ^ expected `'}'` in format string
   |           because of this opening brace
   |
   |
   = 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(typeck::label)]


error: `#[suggestion(nonsense = ...)]` is not a valid attribute
   |
   |
LL |     #[suggestion(nonsense = "bar")]
   |
   |
   = help: only `message`, `code` and `applicability` are valid field attributes

error: `#[suggestion(msg = ...)]` is not a valid attribute
   |
   |
LL |     #[suggestion(msg = "bar")]
   |
   |
   = help: only `message`, `code` and `applicability` are valid field attributes
error: wrong field type for suggestion
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:256:5
   |
   |
LL | /     #[suggestion(typeck::suggestion, code = "This is suggested code")]
LL | |     //~^ ERROR wrong field type for suggestion
LL | |     suggestion: Applicability,
   |
   |
   = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`

error: type of field annotated with `#[suggestion(...)]` contains more than one `Span`
   |
   |
LL | /     #[suggestion(typeck::suggestion, code = "This is suggested code")]
LL | |     //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one `Span`
LL | |     suggestion: (Span, Span, Applicability),


error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
   |
   |
LL | /     #[suggestion(typeck::suggestion, code = "This is suggested code")]
LL | |     //~^ ERROR type of field annotated with `#[suggestion(...)]` contains more than one
LL | |     suggestion: (Applicability, Applicability, Span),


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


error: applicability cannot be set in both the field and attribute
   |
   |
LL |     #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")]

error: invalid applicability
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:446:52
   |
   |
LL |     #[suggestion(typeck::suggestion, code = "...", applicability = "batman")]


error: `#[label(...)]` is not a valid attribute
   |
   |
LL |     #[label(typeck::label, foo)]


error: `#[label(...)]` is not a valid attribute
   |
   |
LL |     #[label(typeck::label, foo = "...")]


error: `#[label(...)]` is not a valid attribute
   |
   |
LL |     #[label(typeck::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(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |
   |
   = help: `error` and `lint` have been replaced by `diag`

error: diagnostic slug not specified
   |
   |
LL | / #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[error(...)]` is not a valid attribute
LL | | //~| ERROR diagnostic slug not specified
LL | | //~| ERROR cannot find attribute `error` in this scope
LL | | struct ErrorAttribute {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[warn_(...)]` is not a valid attribute
   |
   |
LL | #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |
   |
   = help: `warn_` have been replaced by `warning`

error: diagnostic slug not specified
   |
   |
LL | / #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[warn_(...)]` is not a valid attribute
LL | | //~| ERROR diagnostic slug not specified
LL | | //~| ERROR cannot find attribute `warn_` in this scope
LL | | struct WarnAttribute {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[lint(...)]` is not a valid attribute
   |
   |
LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |
   |
   = help: `error` and `lint` have been replaced by `diag`

error: diagnostic slug not specified
   |
   |
LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[lint(...)]` is not a valid attribute
LL | | //~| ERROR diagnostic slug not specified
LL | | //~| ERROR cannot find attribute `lint` in this scope
LL | | struct LintAttributeOnSessionDiag {}
   |
   |
   = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`

error: `#[lint(...)]` is not a valid attribute
   |
   |
LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |
   |
   = help: `error` and `lint` have been replaced by `diag`

error: diagnostic slug not specified
   |
   |
LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
LL | | //~^ ERROR `#[lint(...)]` is not a valid attribute
LL | | //~| ERROR diagnostic slug not specified
LL | | //~| ERROR cannot find attribute `lint` in this scope
LL | | struct LintAttributeOnLintDiag {}
   |
   |
   = help: specify the slug as the first argument to the attribute, such as `#[diag(typeck::example_error)]`
error: cannot find attribute `nonsense` in this scope
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:53:3
   |
   |
LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]

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

error: cannot find attribute `error` in this scope
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:558:3
   |
   |
LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]


error: cannot find attribute `warn_` in this scope
   |
   |
LL | #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |   ^^^^^ help: a built-in attribute with a similar name exists: `warn`
error: cannot find attribute `lint` in this scope
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:572:3
   |
   |
LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |   ^^^^ help: a built-in attribute with a similar name exists: `link`
error: cannot find attribute `lint` in this scope
  --> /checkout/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs:579:3
   |
   |
LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
   |   ^^^^ help: a built-in attribute with a similar name exists: `link`

error[E0425]: cannot find value `nonsense` in module `rustc_errors::fluent`
   |
   |
LL | #[diag(nonsense, code = "E0123")]
   |        ^^^^^^^^ not found in `rustc_errors::fluent`

error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
   |
LL | #[derive(Diagnostic)]
LL | #[derive(Diagnostic)]
   |          ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
   |
   = help: the following other types implement trait `IntoDiagnosticArg`:
             &'a std::path::Path
             &'a str
             &rustc_target::spec::TargetTriple
             Binder<'_, TraitRef<'_>>
             CguReuse
             DiagnosticArgFromDisplay<'_>
             Ident
           and 29 others
           and 29 others
note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`
   |
   |
LL |         arg: impl IntoDiagnosticArg,
   |                   ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg`
   = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 55 previous errors

Some errors have detailed explanations: E0277, E0425.
For more information about an error, try `rustc --explain E0277`.

rust-log-analyzer avatar Sep 09 '22 06:09 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #101224) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 09 '22 06:09 bors

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

Some changes occurred in need_type_info.rs

cc @lcnr

rustbot avatar Sep 09 '22 16:09 rustbot

@davidtwco Updated commit history. Now it has 1 commit per rename, plus one with updates and fixes.

Thanks for the approval, I would like to confirm:

  1. Are we ok with TargetDataLayoutErrorsWrapper in: 1.1 rustc_session/src/errors.rs:48 1.2 rustc_middle/src/ty/context.rs:1249 1.3 rustc_session/src/config.rs:902

  2. Updated lint_diagnostic_derive in rustc_macros/src/diagnostics/mod.rs:106 to https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html#reference. Is this ok?

JhonnyBillM avatar Sep 12 '22 13:09 JhonnyBillM

@davidtwco Updated commit history. Now it has 1 commit per rename, plus one with updates and fixes.

Perfect!

  1. Are we ok with TargetDataLayoutErrorsWrapper in: 1.1 rustc_session/src/errors.rs:48 1.2 rustc_middle/src/ty/context.rs:1249 1.3 rustc_session/src/config.rs:902

I'm not sure why this is necessary. I'd prefer we avoid the wrapper if we could.

  1. Updated lint_diagnostic_derive in rustc_macros/src/diagnostics/mod.rs:106 to https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html#reference. Is this ok?

This is fine.

davidtwco avatar Sep 12 '22 14:09 davidtwco

I'm not sure why this is necessary. I'd prefer we avoid the wrapper if we could.

We need it because of Coherence/Orphan rule. It wasn't needed before because the SessionDiagnostic protocol was defined in rustc_session, now that it isn't, neither the type nor the trait are defined in the crate.

But I am not sure if the compiler codebase handles this differently. Open to suggestions

JhonnyBillM avatar Sep 12 '22 14:09 JhonnyBillM

I'm not sure why this is necessary. I'd prefer we avoid the wrapper if we could.

We need it because of Coherence/Orphan rule. It wasn't needed before because the SessionDiagnostic protocol was defined in rustc_session, now that it isn't, neither the type nor the trait are defined in the crate.

But I am not sure if the compiler codebase handles this differently. Open to suggestions

I think rustc_errors depends on rustc_target for some IntoDiagnosticArg impls, so you might be able to move this impl there?

davidtwco avatar Sep 12 '22 14:09 davidtwco

@davidtwco Great point. Is it possible to move this error in a follow up PR?

Because:

  1. right now rustc_errors doesn't have a fluent file.
  2. we would have to move the fluent strings.
  3. I think we should have a separate file for these "general IntoDiagnostic impls" in rustc_errors instead of having them all in rustc_errors/src/diagnostics.rs

this would introduce many changes unrelated to the move+rename of the traits, and another PR could be more appropriate (for example, when porting rustc_errors, or just in a general clean up task).

JhonnyBillM avatar Sep 12 '22 15:09 JhonnyBillM

Sure, we can leave that to a follow-up.

@bors r+ rollup=never (likely to conflict with other translation pull requests)

davidtwco avatar Sep 12 '22 15:09 davidtwco

:pushpin: Commit da3b0802d9b7d46be34ed9b649596408eeeb8ced has been approved by davidtwco

It is now in the queue for this repository.

bors avatar Sep 12 '22 15:09 bors

:umbrella: The latest upstream changes (presumably #100101) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 13 '22 07:09 bors

@rustbot label -S-waiting-on-author +S-waiting-on-review

JhonnyBillM avatar Sep 13 '22 12:09 JhonnyBillM

:umbrella: The latest upstream changes (presumably #101777) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 14 '22 00:09 bors

@bors r+

davidtwco avatar Sep 14 '22 13:09 davidtwco

:pushpin: Commit 7b43059a45f6c288aa45ea2e2e12ebbac660ffe8 has been approved by davidtwco

It is now in the queue for this repository.

bors avatar Sep 14 '22 13:09 bors

:hourglass: Testing commit 7b43059a45f6c288aa45ea2e2e12ebbac660ffe8 with merge 09276acc0a60a2e9d75568eaafacec641df621fa...

bors avatar Sep 14 '22 23:09 bors

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

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_lint_defs test:false 0.350
    Checking rustc_errors v0.0.0 (/checkout/compiler/rustc_errors)
 Documenting rustc_errors v0.0.0 (/checkout/compiler/rustc_errors)
[RUSTC-TIMING] rustc_hir_pretty test:false 0.408
error: `Diagnostic` is both a struct and a derive macro
    |
    |
440 |     /// Expected [`Diagnostic`]s store a [`LintExpectationId`] as part of
    |                    ^^^^^^^^^^ ambiguous link
    |
    = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
help: to link to the struct, prefix with `struct@`
    |
440 |     /// Expected [`struct@Diagnostic`]s store a [`LintExpectationId`] as part of
    |                    +++++++
help: to link to the derive macro, prefix with `derive@`
    |
440 |     /// Expected [`derive@Diagnostic`]s store a [`LintExpectationId`] as part of


error: `Diagnostic` is both a struct and a derive macro
    |
    |
444 |     /// replaced by a stable [`LintExpectationId`]. The [`Diagnostic`]s are the
    |                                                           ^^^^^^^^^^ ambiguous link
    |
help: to link to the struct, prefix with `struct@`
    |
444 |     /// replaced by a stable [`LintExpectationId`]. The [`struct@Diagnostic`]s are the
    |                                                           +++++++
help: to link to the derive macro, prefix with `derive@`
    |
444 |     /// replaced by a stable [`LintExpectationId`]. The [`derive@Diagnostic`]s are the

error: could not document `rustc_errors`

Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2021 --crate-type lib --crate-name rustc_errors compiler/rustc_errors/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/doc -Zunstable-options --check-cfg 'values(feature)' --check-cfg 'names()' --check-cfg 'values()' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=6929ef0939dc9a60 -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps --extern annotate_snippets=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libannotate_snippets-f5a2b06e341babbe.rmeta --extern atty=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libatty-3f60af9ffd31d27b.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-3fef9cc98f55f4c7.rmeta --extern rustc_error_messages=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_error_messages-3334f0a245401058.rmeta --extern rustc_hir=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-92c26aab30527b5c.rmeta --extern rustc_lint_defs=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_lint_defs-126d2e485c9c4ff8.rmeta --extern rustc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/release/deps/librustc_macros-312220db1c4e5ee9.so --extern rustc_serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_serialize-341cb7aea971ef26.rmeta --extern rustc_span=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-3643dec4afe5173c.rmeta --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-84ef2235447599ec.rmeta --extern serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libserde-8a4772ee0e83914b.rmeta --extern serde_json=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libserde_json-0b3276397c0f8403.rmeta --extern termcolor=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libtermcolor-cde2cbe97738009c.rmeta --extern termize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libtermize-25c196428b9517cb.rmeta --extern tracing=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-4669a793b23f1f25.rmeta --extern unicode_width=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-rustc/x86_64-unknown-linux-gnu/release/deps/libunicode_width-7245566a99a8843b.rmeta --extern-html-root-url 'annotate_snippets=https://docs.rs/annotate-snippets/0.9.1/' --extern-html-root-url 'atty=https://docs.rs/atty/0.2.14/' --extern-html-root-url 'serde=https://docs.rs/serde/1.0.143/' --extern-html-root-url 'serde_json=https://docs.rs/serde_json/1.0.83/' --extern-html-root-url 'termcolor=https://docs.rs/termcolor/1.1.2/' --extern-html-root-url 'termize=https://docs.rs/termize/0.1.1/' --extern-html-root-url 'tracing=https://docs.rs/tracing/0.1.35/' --extern-html-root-url 'unicode_width=https://docs.rs/unicode-width/0.1.8/' -Zunstable-options -Csymbol-mangling-version=v0 -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(parallel_compiler)' '--check-cfg=values(no_btreemap_remove_entry)' '--check-cfg=values(crossbeam_loom)' '--check-cfg=values(span_locations)' -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.65.0
  (09276acc0
  2022-09-14)' --document-private-items '-Arustdoc::private-intra-doc-links' --enable-index-page -Zunstable-options -Znormalize-docs --show-type-layout --generate-link-to-definition --extern-html-root-url 'ena=https://docs.rs/ena/latest/'` (exit status: 1)
[RUSTC-TIMING] rustc_errors test:false 1.376
Build completed unsuccessfully in 0:20:54

rust-log-analyzer avatar Sep 15 '22 00:09 rust-log-analyzer

:broken_heart: Test failed - checks-actions

bors avatar Sep 15 '22 00:09 bors

:umbrella: The latest upstream changes (presumably #101620) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 15 '22 03:09 bors

:umbrella: The latest upstream changes (presumably #101928) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 17 '22 09:09 bors

:umbrella: The latest upstream changes (presumably #101946) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 17 '22 22:09 bors

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
---
skip untracked path cpu-usage.csv during rustfmt invocations
skip untracked path src/doc/book/ during rustfmt invocations
skip untracked path src/doc/rust-by-example/ during rustfmt invocations
skip untracked path src/llvm-project/ during rustfmt invocations
Diff in /checkout/compiler/rustc_query_system/src/error.rs at line 1:
 use rustc_errors::AddToDiagnostic;
+use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_session::Limit;
 use rustc_span::{Span, Symbol};
-use rustc_macros::{Diagnostic, Subdiagnostic};
 pub struct CycleStack {
     pub span: Span,
     pub span: Span,
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/checkout/compiler/rustc_query_system/src/cache.rs" "/checkout/compiler/rustc_query_system/src/error.rs" "/checkout/compiler/rustc_infer/src/traits/engine.rs" "/checkout/compiler/rustc_infer/src/traits/util.rs" "/checkout/compiler/rustc_save_analysis/src/sig.rs" "/checkout/compiler/rustc_metadata/src/fs.rs" "/checkout/compiler/rustc_save_analysis/src/lib.rs" "/checkout/compiler/rustc_query_system/src/dep_graph/graph.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.

rust-log-analyzer avatar Sep 18 '22 17:09 rust-log-analyzer

@bors r+ p=1 (this will conflict with a lot of other pull requests)

davidtwco avatar Sep 21 '22 15:09 davidtwco

:pushpin: Commit e79662475821e6a0ee281567b156e4e63010a17b has been approved by davidtwco

It is now in the queue for this repository.

bors avatar Sep 21 '22 15:09 bors

:hourglass: Testing commit e79662475821e6a0ee281567b156e4e63010a17b with merge 88f5d8878bf5b32192323bcdce02fa3b5417a84e...

bors avatar Sep 21 '22 15:09 bors

:broken_heart: Test failed - checks-actions

bors avatar Sep 21 '22 15:09 bors

@bors r+

davidtwco avatar Sep 21 '22 16:09 davidtwco

:pushpin: Commit e52e2344dc574922ce4f8ddfd508f8bfdec3f404 has been approved by davidtwco

It is now in the queue for this repository.

bors avatar Sep 21 '22 16:09 bors