2022-04-26 05:59:45 -05:00
|
|
|
// check-fail
|
2022-09-18 10:47:31 -05:00
|
|
|
// Tests error conditions for specifying subdiagnostics using #[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
|
|
|
|
// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
|
2022-09-18 10:47:31 -05:00
|
|
|
// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
|
2022-04-26 05:59:45 -05:00
|
|
|
// the test is just ignored on stable and beta:
|
Support `x test --stage 1 ui-fulldeps`
Nils had an excellent idea the other day: the same way that rustdoc is
able to load `rustc_driver` from the sysroot, ui-fulldeps tests should
also be able to load it from the sysroot. That allows us to run fulldeps
tests with stage1, without having to fully rebuild the compiler twice.
It does unfortunately have the downside that we're running the tests on
the *bootstrap* compiler, not the in-tree sources, but since most of the
fulldeps tests are for the *API* of the compiler, that seems ok.
I think it's possible to extend this to `run-make-fulldeps`, but I've
run out of energy for tonight.
- Move `plugin` tests into a subdirectory.
Plugins are loaded at runtime with `dlopen` and so require the ABI of
the running compile to match the ABI of the compiler linked with
`rustc_driver`. As a result they can't be supported in stage 1 and have
to use `// ignore-stage1`.
- Remove `ignore-stage1` from most non-plugin tests
- Ignore diagnostic tests in stage 1. Even though this requires a stage
2 build to load rustc_driver, it's primarily testing the error message
that the *running* compiler emits when the diagnostic struct is malformed.
- Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That
allows running `hash-stable-is-unstable` in stage1, since it now
suggests adding `rustc_private` to enable loading the crates.
- Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests
that act as custom drivers to load it at runtime.
- Pass `--sysroot stage0-sysroot` in compiletest so that we use the
correct version of std.
2023-04-17 20:00:36 -05:00
|
|
|
// ignore-stage1
|
2022-04-26 05:59:45 -05:00
|
|
|
// ignore-beta
|
|
|
|
// ignore-stable
|
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
extern crate rustc_errors;
|
2023-04-16 07:33:00 -05:00
|
|
|
extern crate rustc_fluent_macro;
|
2022-10-20 14:09:54 -05:00
|
|
|
extern crate rustc_macros;
|
2022-04-26 05:59:45 -05:00
|
|
|
extern crate rustc_session;
|
|
|
|
extern crate rustc_span;
|
|
|
|
|
2022-10-13 04:13:02 -05:00
|
|
|
use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage};
|
2023-04-16 07:33:00 -05:00
|
|
|
use rustc_fluent_macro::fluent_messages;
|
|
|
|
use rustc_macros::Subdiagnostic;
|
2022-10-20 14:09:54 -05:00
|
|
|
use rustc_span::Span;
|
2022-04-26 05:59:45 -05:00
|
|
|
|
2022-10-13 04:13:02 -05:00
|
|
|
fluent_messages! { "./example.ftl" }
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
struct A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
enum B {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
},
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
B {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR label without `#[primary_span]` field
|
|
|
|
struct C {
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label]
|
2022-09-12 13:44:28 -05:00
|
|
|
//~^ ERROR diagnostic slug must be first argument
|
2022-04-26 05:59:45 -05:00
|
|
|
struct D {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[foo]
|
2022-04-26 22:06:13 -05:00
|
|
|
//~^ ERROR `#[foo]` is not a valid attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^^ ERROR cannot find attribute `foo` in this scope
|
|
|
|
struct E {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label = "..."]
|
2022-04-26 22:06:13 -05:00
|
|
|
//~^ ERROR `#[label = ...]` is not a valid attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
struct F {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label(bug = "...")]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR invalid nested attribute
|
2022-09-12 13:44:28 -05:00
|
|
|
//~| ERROR diagnostic slug must be first argument
|
2022-04-26 05:59:45 -05:00
|
|
|
struct G {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label("...")]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR unexpected literal in nested attribute, expected ident
|
2022-04-26 05:59:45 -05:00
|
|
|
struct H {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label(slug = 4)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR invalid nested attribute
|
2022-09-12 13:44:28 -05:00
|
|
|
//~| ERROR diagnostic slug must be first argument
|
2022-04-26 05:59:45 -05:00
|
|
|
struct J {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label(slug("..."))]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR invalid nested attribute
|
2022-09-12 13:44:28 -05:00
|
|
|
//~| ERROR diagnostic slug must be first argument
|
2022-04-26 05:59:45 -05:00
|
|
|
struct K {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label(slug)]
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR cannot find value `slug` in module `crate::fluent_generated`
|
|
|
|
//~^^ NOTE not found in `crate::fluent_generated`
|
2022-04-26 05:59:45 -05:00
|
|
|
struct L {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label()]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
|
2022-04-26 05:59:45 -05:00
|
|
|
struct M {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example, code = "...")]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR invalid nested attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
struct N {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example, applicability = "machine-applicable")]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR invalid nested attribute
|
2022-06-23 10:12:52 -05:00
|
|
|
struct O {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[foo]
|
|
|
|
//~^ ERROR cannot find attribute `foo` in this scope
|
|
|
|
//~^^ ERROR unsupported type attribute for subdiagnostic enum
|
2022-06-23 10:12:52 -05:00
|
|
|
enum P {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum Q {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[bar]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR `#[bar]` is not a valid attribute
|
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum R {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[bar = "..."]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR `#[bar = ...]` is not a valid attribute
|
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum S {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[bar = 4]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR `#[bar = ...]` is not a valid attribute
|
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum T {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[bar("...")]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR `#[bar(...)]` is not a valid attribute
|
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum U {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label(code = "...")]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR diagnostic slug must be first argument of a `#[label(...)]` attribute
|
2023-04-03 10:11:30 -05:00
|
|
|
//~| ERROR invalid nested attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum V {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
},
|
|
|
|
B {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR label without `#[primary_span]` field
|
2022-06-23 10:12:52 -05:00
|
|
|
struct W {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
2022-07-11 11:15:31 -05:00
|
|
|
//~^ ERROR the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
|
2022-04-26 05:59:45 -05:00
|
|
|
span: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct X {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
//~^ ERROR `#[applicability]` is only valid on suggestions
|
|
|
|
applicability: Applicability,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct Y {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[bar]
|
2022-04-26 22:06:13 -05:00
|
|
|
//~^ ERROR `#[bar]` is not a valid attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
|
|
|
bar: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct Z {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[bar = "..."]
|
2022-04-26 22:06:13 -05:00
|
|
|
//~^ ERROR `#[bar = ...]` is not a valid attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
|
|
|
bar: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AA {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[bar("...")]
|
2022-04-26 22:06:13 -05:00
|
|
|
//~^ ERROR `#[bar(...)]` is not a valid attribute
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^^ ERROR cannot find attribute `bar` in this scope
|
|
|
|
bar: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AB {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[skip_arg]
|
2022-10-20 14:09:54 -05:00
|
|
|
z: Z,
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
union AC {
|
2022-10-20 14:09:54 -05:00
|
|
|
//~^ ERROR unexpected unsupported untagged union
|
2022-04-26 05:59:45 -05:00
|
|
|
span: u32,
|
2022-10-20 14:09:54 -05:00
|
|
|
b: u64,
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
|
|
|
#[label(no_crate_example)]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct AD {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example, no_crate::example)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR a diagnostic slug must be the first argument to the attribute
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AE {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AF {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ NOTE previously specified here
|
2022-04-26 05:59:45 -05:00
|
|
|
span_a: Span,
|
|
|
|
#[primary_span]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR specified multiple times
|
2022-04-26 05:59:45 -05:00
|
|
|
span_b: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AG {
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR subdiagnostic kind not specified
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AH {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum AI {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
var: String,
|
|
|
|
},
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-04-26 05:59:45 -05:00
|
|
|
B {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...", code = "...")]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR specified multiple times
|
|
|
|
//~^^ NOTE previously specified here
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AJ {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AK {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ NOTE previously specified here
|
2022-04-26 05:59:45 -05:00
|
|
|
applicability_a: Applicability,
|
|
|
|
#[applicability]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR specified multiple times
|
2022-04-26 05:59:45 -05:00
|
|
|
applicability_b: Applicability,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AL {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR the `#[applicability]` attribute can only be applied to fields of type `Applicability`
|
2022-04-26 05:59:45 -05:00
|
|
|
applicability: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AM {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR suggestion without `code = "..."`
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AN {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...", applicability = "foo")]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR invalid applicability
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AO {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[help(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AP {
|
2022-10-20 14:09:54 -05:00
|
|
|
var: String,
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[note(no_crate_example)]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AQ;
|
2022-04-26 05:59:45 -05:00
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR suggestion without `#[primary_span]` field
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AR {
|
2022-04-26 05:59:45 -05:00
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AS {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 05:59:45 -05:00
|
|
|
#[label]
|
|
|
|
//~^ ERROR unsupported type attribute for subdiagnostic enum
|
2022-06-23 10:12:52 -05:00
|
|
|
enum AT {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AU {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
|
2022-04-26 05:59:45 -05:00
|
|
|
//~^ ERROR `var` doesn't refer to a field on this type
|
2022-06-23 10:12:52 -05:00
|
|
|
struct AV {
|
2022-04-26 05:59:45 -05:00
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum AW {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
var: String,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-06-23 10:12:52 -05:00
|
|
|
enum AX {
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
|
2022-10-20 14:09:54 -05:00
|
|
|
//~^ ERROR `var` doesn't refer to a field on this type
|
2022-04-26 05:59:45 -05:00
|
|
|
A {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-04-26 05:59:45 -05:00
|
|
|
}
|
2022-07-11 12:46:24 -05:00
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[warning(no_crate_example)]
|
2022-08-24 10:57:10 -05:00
|
|
|
struct AY {}
|
2022-07-11 12:46:24 -05:00
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[warning(no_crate_example)]
|
2022-07-11 12:46:24 -05:00
|
|
|
struct AZ {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
2022-09-01 12:42:49 -05:00
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "...")]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR suggestion without `#[primary_span]` field
|
|
|
|
struct BA {
|
|
|
|
#[suggestion_part]
|
|
|
|
//~^ ERROR `#[suggestion_part]` is not a valid attribute
|
|
|
|
span: Span,
|
|
|
|
#[suggestion_part(code = "...")]
|
|
|
|
//~^ ERROR `#[suggestion_part(...)]` is not a valid attribute
|
|
|
|
span2: Span,
|
|
|
|
#[applicability]
|
|
|
|
applicability: Applicability,
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
|
2023-04-03 10:11:30 -05:00
|
|
|
//~| ERROR invalid nested attribute
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BBa {
|
|
|
|
var: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BBb {
|
|
|
|
#[suggestion_part]
|
|
|
|
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
|
|
|
|
span1: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BBc {
|
|
|
|
#[suggestion_part()]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
|
2022-09-01 12:42:49 -05:00
|
|
|
span1: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-09-01 12:42:49 -05:00
|
|
|
//~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields
|
|
|
|
struct BC {
|
|
|
|
#[primary_span]
|
|
|
|
//~^ ERROR `#[primary_span]` is not a valid attribute
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BD {
|
|
|
|
#[suggestion_part]
|
|
|
|
//~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."`
|
|
|
|
span1: Span,
|
|
|
|
#[suggestion_part()]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR unexpected end of input, unexpected token in nested attribute, expected ident
|
2022-09-01 12:42:49 -05:00
|
|
|
span2: Span,
|
|
|
|
#[suggestion_part(foo = "bar")]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR `code` is the only valid nested attribute
|
|
|
|
//~| ERROR expected `,`
|
2022-09-01 12:42:49 -05:00
|
|
|
span4: Span,
|
|
|
|
#[suggestion_part(code = "...")]
|
|
|
|
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
|
|
|
|
s1: String,
|
|
|
|
#[suggestion_part()]
|
|
|
|
//~^ ERROR the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
|
|
|
|
s2: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BE {
|
|
|
|
#[suggestion_part(code = "...", code = ",,,")]
|
|
|
|
//~^ ERROR specified multiple times
|
|
|
|
//~| NOTE previously specified here
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BF {
|
|
|
|
#[suggestion_part(code = "(")]
|
|
|
|
first: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
second: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BG {
|
|
|
|
#[applicability]
|
|
|
|
appl: Applicability,
|
|
|
|
#[suggestion_part(code = "(")]
|
|
|
|
first: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
second: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BH {
|
|
|
|
#[applicability]
|
2022-09-12 13:44:28 -05:00
|
|
|
//~^ ERROR `#[applicability]` has no effect
|
2022-09-01 12:42:49 -05:00
|
|
|
appl: Applicability,
|
|
|
|
#[suggestion_part(code = "(")]
|
|
|
|
first: Span,
|
|
|
|
#[suggestion_part(code = ")")]
|
|
|
|
second: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 10:47:31 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")]
|
2022-09-01 12:42:49 -05:00
|
|
|
struct BI {
|
|
|
|
#[suggestion_part(code = "")]
|
|
|
|
spans: Vec<Span>,
|
|
|
|
}
|
2022-09-14 13:12:22 -05:00
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-09-14 13:12:22 -05:00
|
|
|
struct BJ {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
2022-10-14 05:00:46 -05:00
|
|
|
|
|
|
|
/// with a doc comment on the type..
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-10-14 05:00:46 -05:00
|
|
|
struct BK {
|
|
|
|
/// ..and the field
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// with a doc comment on the type..
|
|
|
|
#[derive(Subdiagnostic)]
|
|
|
|
enum BL {
|
|
|
|
/// ..and the variant..
|
2022-10-13 04:13:02 -05:00
|
|
|
#[label(no_crate_example)]
|
2022-10-14 05:00:46 -05:00
|
|
|
Foo {
|
|
|
|
/// ..and the field
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
2022-10-20 14:09:54 -05:00
|
|
|
},
|
2022-10-14 05:00:46 -05:00
|
|
|
}
|
2022-10-17 12:41:49 -05:00
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-10-17 12:41:49 -05:00
|
|
|
struct BM {
|
|
|
|
#[suggestion_part(code("foo"))]
|
|
|
|
//~^ ERROR expected exactly one string literal for `code = ...`
|
2023-04-03 10:11:30 -05:00
|
|
|
//~| ERROR unexpected token
|
2022-10-17 12:41:49 -05:00
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-10-17 12:41:49 -05:00
|
|
|
struct BN {
|
|
|
|
#[suggestion_part(code("foo", "bar"))]
|
|
|
|
//~^ ERROR expected exactly one string literal for `code = ...`
|
2023-04-03 10:11:30 -05:00
|
|
|
//~| ERROR unexpected token
|
2022-10-17 12:41:49 -05:00
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-10-17 12:41:49 -05:00
|
|
|
struct BO {
|
|
|
|
#[suggestion_part(code(3))]
|
|
|
|
//~^ ERROR expected exactly one string literal for `code = ...`
|
2023-04-03 10:11:30 -05:00
|
|
|
//~| ERROR unexpected token
|
2022-10-17 12:41:49 -05:00
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-10-17 12:41:49 -05:00
|
|
|
struct BP {
|
|
|
|
#[suggestion_part(code())]
|
|
|
|
//~^ ERROR expected exactly one string literal for `code = ...`
|
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR cannot find value `__code_29` in this scope
|
|
|
|
//~| NOTE in this expansion
|
|
|
|
//~| NOTE not found in this scope
|
2022-10-13 04:13:02 -05:00
|
|
|
#[multipart_suggestion(no_crate_example)]
|
2022-10-17 12:41:49 -05:00
|
|
|
struct BQ {
|
|
|
|
#[suggestion_part(code = 3)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR expected string literal
|
2022-10-17 12:41:49 -05:00
|
|
|
span: Span,
|
|
|
|
r#type: String,
|
|
|
|
}
|
2022-10-20 13:28:24 -05:00
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "")]
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleDefault {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "short")]
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleShort {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "hidden")]
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleHidden {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "verbose")]
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleVerbose {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
2022-10-20 14:17:14 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "tool-only")]
|
2022-10-20 14:17:14 -05:00
|
|
|
struct SuggestionStyleToolOnly {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
2022-10-20 13:28:24 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
|
2022-10-20 13:28:24 -05:00
|
|
|
//~^ ERROR specified multiple times
|
|
|
|
//~| NOTE previously specified here
|
|
|
|
struct SuggestionStyleTwice {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
2022-10-22 10:21:11 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion_hidden(no_crate_example, code = "")]
|
2022-10-22 10:21:11 -05:00
|
|
|
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
|
|
|
struct SuggestionStyleOldSyntax {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
2022-10-20 13:28:24 -05:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion_hidden(no_crate_example, code = "", style = "normal")]
|
2022-10-22 10:21:11 -05:00
|
|
|
//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute
|
|
|
|
struct SuggestionStyleOldAndNewSyntax {
|
2022-10-20 13:28:24 -05:00
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = "foo")]
|
2022-10-20 13:28:24 -05:00
|
|
|
//~^ ERROR invalid suggestion style
|
|
|
|
struct SuggestionStyleInvalid1 {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style = 42)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR expected `= "xxx"`
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleInvalid2 {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style)]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR a diagnostic slug must be the first argument to the attribute
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleInvalid3 {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "", style("foo"))]
|
2023-04-03 10:11:30 -05:00
|
|
|
//~^ ERROR expected `= "xxx"`
|
|
|
|
//~| ERROr expected `,`
|
2022-10-20 13:28:24 -05:00
|
|
|
struct SuggestionStyleInvalid4 {
|
|
|
|
#[primary_span]
|
|
|
|
sub: Span,
|
|
|
|
}
|
2022-10-16 09:15:39 -05:00
|
|
|
|
|
|
|
#[derive(Subdiagnostic)]
|
2022-10-13 04:13:02 -05:00
|
|
|
#[suggestion(no_crate_example, code = "")]
|
2022-10-16 09:15:39 -05:00
|
|
|
//~^ ERROR suggestion without `#[primary_span]` field
|
|
|
|
struct PrimarySpanOnVec {
|
|
|
|
#[primary_span]
|
|
|
|
//~^ ERROR `#[primary_span]` is not a valid attribute
|
|
|
|
//~| NOTE there must be exactly one primary span
|
|
|
|
sub: Vec<Span>,
|
|
|
|
}
|