From 5363f350887b1e5b5dd21a86f88c8af9d7fea6da Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:25 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- .../ui-fulldeps/lint-plugin-cmdline-load.stderr | 16 +- src/test/ui-fulldeps/lint-plugin-deny-attr.stderr | 16 +- .../ui-fulldeps/lint-plugin-deny-cmdline.stderr | 16 +- src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs | 1 - .../ui-fulldeps/lint-plugin-forbid-attrs.stderr | 27 +-- src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs | 2 +- .../ui-fulldeps/lint-plugin-forbid-cmdline.stderr | 26 +-- src/test/ui-fulldeps/lint-plugin.stderr | 16 +- .../ui-fulldeps/lint-tool-cmdline-allow.stderr | 22 +- src/test/ui-fulldeps/lint-tool-test.rs | 3 - src/test/ui-fulldeps/lint-tool-test.stderr | 70 +++--- src/test/ui-fulldeps/pprust-expr-roundtrip.rs | 35 +-- .../session-diagnostic/diagnostic-derive.rs | 39 ++-- .../session-diagnostic/diagnostic-derive.stderr | 46 ++-- .../session-diagnostic/enforce_slug_naming.rs | 24 ++ .../session-diagnostic/enforce_slug_naming.stderr | 11 + .../session-diagnostic/subdiagnostic-derive.rs | 248 ++++++++++++++------- .../session-diagnostic/subdiagnostic-derive.stderr | 122 +++++++--- src/test/ui-fulldeps/uninit_mask.rs | 28 --- 19 files changed, 445 insertions(+), 323 deletions(-) create mode 100644 src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs create mode 100644 src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr delete mode 100644 src/test/ui-fulldeps/uninit_mask.rs (limited to 'src/test/ui-fulldeps') diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr index 981631494..82679c9e1 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> :1:1 - | -LL | plugin(lint_plugin_test) - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - warning: item is named 'lintme' --> $DIR/lint-plugin-cmdline-load.rs:8:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: `#[warn(test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> :1:1 + | +LL | plugin(lint_plugin_test) + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: 2 warnings emitted diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index b9774c044..5e8891bf1 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-attr.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-deny-attr.rs:9:1 | @@ -18,5 +10,13 @@ note: the lint level is defined here LL | #![deny(test_lint)] | ^^^^^^^^^ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-attr.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr index cbabb09f6..d5d6b5352 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-deny-cmdline.rs:9:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: requested on the command line with `-D test-lint` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 4833f6971..cf31b3ec1 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -11,7 +11,6 @@ fn lintme() {} //~ ERROR item is named 'lintme' #[allow(test_lint)] //~^ ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible -//~| ERROR allow(test_lint) incompatible pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index e11a4f844..ae34b25cc 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -7,23 +7,6 @@ LL | #![forbid(test_lint)] LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-attrs.rs:11:9 - | -LL | #![forbid(test_lint)] - | --------- `forbid` level set here -... -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-attrs.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-forbid-attrs.rs:9:1 | @@ -45,6 +28,14 @@ LL | #![forbid(test_lint)] LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid -error: aborting due to 4 previous errors; 1 warning emitted +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-attrs.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs index ce034ee38..b9d1aa85a 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -9,7 +9,7 @@ fn lintme() { } //~ ERROR item is named 'lintme' #[allow(test_lint)] //~ ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible - //~| ERROR allow(test_lint) + pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr index 09c19af61..491c4d206 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -6,22 +6,6 @@ LL | #[allow(test_lint)] | = note: `forbid` lint level was set on command line -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 - | -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - | - = note: `forbid` lint level was set on command line - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 | @@ -38,6 +22,14 @@ LL | #[allow(test_lint)] | = note: `forbid` lint level was set on command line -error: aborting due to 4 previous errors; 1 warning emitted +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index 765832071..dd5d3d72e 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - warning: item is named 'lintme' --> $DIR/lint-plugin.rs:8:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: `#[warn(test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: 2 warnings emitted diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr index b4fb9e22d..b060e3a3e 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -6,18 +6,6 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore | = note: requested on the command line with `-A test_lint` -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-cmdline-allow.rs:7:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - warning: item is named 'lintme' --> $DIR/lint-tool-cmdline-allow.rs:9:1 | @@ -26,9 +14,17 @@ LL | fn lintme() {} | = note: `#[warn(clippy::test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint | = note: requested on the command line with `-A test_lint` -warning: 6 warnings emitted +warning: 5 warnings emitted diff --git a/src/test/ui-fulldeps/lint-tool-test.rs b/src/test/ui-fulldeps/lint-tool-test.rs index 0d04eb6fc..f92bcd213 100644 --- a/src/test/ui-fulldeps/lint-tool-test.rs +++ b/src/test/ui-fulldeps/lint-tool-test.rs @@ -10,12 +10,10 @@ //~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future #![deny(clippy_group)] //~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future fn lintme() { } //~ ERROR item is named 'lintme' @@ -32,7 +30,6 @@ pub fn main() { //~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` fn hello() { fn lintmetoo() { } diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index af9b8dedc..027cf8f80 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -7,13 +7,13 @@ LL | #![cfg_attr(foo, warn(test_lint))] = note: `#[warn(renamed_and_removed_lints)]` on by default warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` @@ -25,60 +25,26 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint-tool-test.rs:36:8 - | -LL | #[deny(this_lint_does_not_exist)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unknown_lints)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-test.rs:6:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:9:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` error: item is named 'lintme' - --> $DIR/lint-tool-test.rs:20:1 + --> $DIR/lint-tool-test.rs:18:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` error: item is named 'lintmetoo' - --> $DIR/lint-tool-test.rs:28:5 + --> $DIR/lint-tool-test.rs:26:5 | LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ @@ -86,11 +52,27 @@ LL | fn lintmetoo() { } = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:33:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-test.rs:6:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: lint name `test_lint` is deprecated and may not have an effect in the future. --> $DIR/lint-tool-test.rs:9:23 | @@ -98,16 +80,16 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` -error: aborting due to 2 previous errors; 14 warnings emitted +error: aborting due to 2 previous errors; 11 warnings emitted diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index 117b79871..a93ba8747 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -25,6 +25,7 @@ extern crate rustc_data_structures; extern crate rustc_parse; extern crate rustc_session; extern crate rustc_span; +extern crate thin_vec; use rustc_ast::mut_visit::{self, visit_clobber, MutVisitor}; use rustc_ast::ptr::P; @@ -35,6 +36,7 @@ use rustc_session::parse::ParseSess; use rustc_span::source_map::FilePathMapping; use rustc_span::source_map::{FileName, Spanned, DUMMY_SP}; use rustc_span::symbol::Ident; +use thin_vec::thin_vec; fn parse_expr(ps: &ParseSess, src: &str) -> Option> { let src_as_string = src.to_string(); @@ -51,7 +53,7 @@ fn expr(kind: ExprKind) -> P { fn make_x() -> P { let seg = PathSegment::from_ident(Ident::from_str("x")); - let path = Path { segments: vec![seg], span: DUMMY_SP, tokens: None }; + let path = Path { segments: thin_vec![seg], span: DUMMY_SP, tokens: None }; expr(ExprKind::Path(None, path)) } @@ -73,11 +75,15 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P)) { 2 => { let seg = PathSegment::from_ident(Ident::from_str("x")); iter_exprs(depth - 1, &mut |e| { - g(ExprKind::MethodCall(seg.clone(), e, vec![make_x()], DUMMY_SP)) - }); + g(ExprKind::MethodCall(Box::new(MethodCall { + seg: seg.clone(), receiver: e, args: vec![make_x()], span: DUMMY_SP + })) + )}); iter_exprs(depth - 1, &mut |e| { - g(ExprKind::MethodCall(seg.clone(), make_x(), vec![e], DUMMY_SP)) - }); + g(ExprKind::MethodCall(Box::new(MethodCall { + seg: seg.clone(), receiver: make_x(), args: vec![e], span: DUMMY_SP + })) + )}); } 3..=8 => { let op = Spanned { @@ -112,15 +118,16 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P)) { 11 => { let decl = P(FnDecl { inputs: vec![], output: FnRetTy::Default(DUMMY_SP) }); iter_exprs(depth - 1, &mut |e| { - g(ExprKind::Closure( - ClosureBinder::NotPresent, - CaptureBy::Value, - Async::No, - Movability::Movable, - decl.clone(), - e, - DUMMY_SP, - )) + g(ExprKind::Closure(Box::new(Closure { + binder: ClosureBinder::NotPresent, + capture_clause: CaptureBy::Value, + asyncness: Async::No, + movability: Movability::Movable, + fn_decl: decl.clone(), + body: e, + fn_decl_span: DUMMY_SP, + fn_arg_span: DUMMY_SP, + }))) }); } 12 => { diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index ca77e483d..cb4cd4665 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -40,9 +40,9 @@ struct HelloWarn {} //~^ ERROR unsupported type attribute for diagnostic derive enum enum DiagnosticOnEnum { Foo, -//~^ ERROR diagnostic slug not specified + //~^ ERROR diagnostic slug not specified Bar, -//~^ ERROR diagnostic slug not specified + //~^ ERROR diagnostic slug not specified } #[derive(Diagnostic)] @@ -211,9 +211,10 @@ struct LabelOnNonSpan { #[diag(compiletest_example, code = "E0123")] struct Suggest { #[suggestion(suggestion, code = "This is the suggested code")] - #[suggestion_short(suggestion, code = "This is the suggested code")] - #[suggestion_hidden(suggestion, code = "This is the suggested code")] - #[suggestion_verbose(suggestion, code = "This is the suggested code")] + #[suggestion(suggestion, code = "This is the suggested code", style = "normal")] + #[suggestion(suggestion, code = "This is the suggested code", style = "short")] + #[suggestion(suggestion, code = "This is the suggested code", style = "hidden")] + #[suggestion(suggestion, code = "This is the suggested code", style = "verbose")] suggestion: (Span, Applicability), } @@ -470,7 +471,7 @@ struct NoApplicability { } #[derive(Subdiagnostic)] -#[note(parser_add_paren)] +#[note(parse_add_paren)] struct Note; #[derive(Diagnostic)] @@ -536,8 +537,7 @@ struct LabelWithTrailingList { #[derive(LintDiagnostic)] #[diag(compiletest_example)] -struct LintsGood { -} +struct LintsGood {} #[derive(LintDiagnostic)] #[diag(compiletest_example)] @@ -683,7 +683,7 @@ struct RawIdentDiagnosticArg { #[diag(compiletest_example)] struct SubdiagnosticBad { #[subdiagnostic(bad)] -//~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute + //~^ ERROR `#[subdiagnostic(bad)]` is not a valid attribute note: Note, } @@ -691,7 +691,7 @@ struct SubdiagnosticBad { #[diag(compiletest_example)] struct SubdiagnosticBadStr { #[subdiagnostic = "bad"] -//~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute + //~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute note: Note, } @@ -699,7 +699,7 @@ struct SubdiagnosticBadStr { #[diag(compiletest_example)] struct SubdiagnosticBadTwice { #[subdiagnostic(bad, bad)] -//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute + //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute note: Note, } @@ -707,7 +707,7 @@ struct SubdiagnosticBadTwice { #[diag(compiletest_example)] struct SubdiagnosticBadLitStr { #[subdiagnostic("bad")] -//~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute + //~^ ERROR `#[subdiagnostic("...")]` is not a valid attribute note: Note, } @@ -715,7 +715,7 @@ struct SubdiagnosticBadLitStr { #[diag(compiletest_example)] struct SubdiagnosticEagerLint { #[subdiagnostic(eager)] -//~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute + //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute note: Note, } @@ -731,11 +731,7 @@ struct SubdiagnosticEagerCorrect { // after the `span_suggestion` call - which breaks eager translation. #[derive(Subdiagnostic)] -#[suggestion_short( - use_instead, - applicability = "machine-applicable", - code = "{correct}" -)] +#[suggestion(use_instead, applicability = "machine-applicable", code = "{correct}")] pub(crate) struct SubdiagnosticWithSuggestion { #[primary_span] span: Span, @@ -796,3 +792,10 @@ struct SuggestionsInvalidLiteral { //~^ ERROR `code = "..."`/`code(...)` must contain only string literals sub: Span, } + +#[derive(Diagnostic)] +#[diag(compiletest_example)] +struct SuggestionStyleGood { + #[suggestion(code = "", style = "hidden")] + sub: Span, +} diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 859c272b6..b4c211db4 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -261,41 +261,41 @@ LL | #[label(label)] | ^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:223:5 + --> $DIR/diagnostic-derive.rs:224:5 | LL | #[suggestion(suggestion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:231:18 + --> $DIR/diagnostic-derive.rs:232:18 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^ | - = help: only `code` and `applicability` are valid nested attributes + = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:231:5 + --> $DIR/diagnostic-derive.rs:232:5 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion(msg = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:240:18 + --> $DIR/diagnostic-derive.rs:241:18 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^ | - = help: only `code` and `applicability` are valid nested attributes + = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:240:5 + --> $DIR/diagnostic-derive.rs:241:5 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:263:5 + --> $DIR/diagnostic-derive.rs:264:5 | LL | / #[suggestion(suggestion, code = "This is suggested code")] LL | | @@ -305,55 +305,55 @@ LL | | suggestion: Applicability, = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` error: specified multiple times - --> $DIR/diagnostic-derive.rs:279:24 + --> $DIR/diagnostic-derive.rs:280:24 | LL | suggestion: (Span, Span, Applicability), | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:279:18 + --> $DIR/diagnostic-derive.rs:280:18 | LL | suggestion: (Span, Span, Applicability), | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:287:33 + --> $DIR/diagnostic-derive.rs:288:33 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:287:18 + --> $DIR/diagnostic-derive.rs:288:18 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:294:5 + --> $DIR/diagnostic-derive.rs:295:5 | LL | #[label = "bar"] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:445:44 + --> $DIR/diagnostic-derive.rs:446:44 | LL | #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:447:24 + --> $DIR/diagnostic-derive.rs:448:24 | LL | suggestion: (Span, Applicability), | ^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/diagnostic-derive.rs:453:44 + --> $DIR/diagnostic-derive.rs:454:44 | LL | #[suggestion(suggestion, code = "...", applicability = "batman")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[label(foo)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:516:20 + --> $DIR/diagnostic-derive.rs:517:20 | LL | #[label(label, foo)] | ^^^ @@ -361,13 +361,13 @@ LL | #[label(label, foo)] = help: a diagnostic slug must be the first argument to the attribute error: `#[label(foo = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:524:20 + --> $DIR/diagnostic-derive.rs:525:20 | LL | #[label(label, foo = "...")] | ^^^^^^^^^^^ error: `#[label(foo(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:532:20 + --> $DIR/diagnostic-derive.rs:533:20 | LL | #[label(label, foo("..."))] | ^^^^^^^^^^ @@ -574,19 +574,19 @@ LL | #[subdiagnostic(eager)] = help: eager subdiagnostics are not supported on lints error: expected at least one string literal for `code(...)` - --> $DIR/diagnostic-derive.rs:779:18 + --> $DIR/diagnostic-derive.rs:775:18 | LL | #[suggestion(code())] | ^^^^^^ error: `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:787:23 + --> $DIR/diagnostic-derive.rs:783:23 | LL | #[suggestion(code(foo))] | ^^^ error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:795:18 + --> $DIR/diagnostic-derive.rs:791:18 | LL | #[suggestion(code = 3)] | ^^^^^^^^ @@ -652,7 +652,7 @@ LL | #[diag(nonsense, code = "E0123")] | ^^^^^^^^ not found in `rustc_errors::fluent` error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:338:10 + --> $DIR/diagnostic-derive.rs:339:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` diff --git a/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs new file mode 100644 index 000000000..a0a8114e0 --- /dev/null +++ b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs @@ -0,0 +1,24 @@ +// rustc-env:CARGO_CRATE_NAME=rustc_dummy + +#![feature(rustc_private)] +#![crate_type = "lib"] + +extern crate rustc_span; +use rustc_span::symbol::Ident; +use rustc_span::Span; + +extern crate rustc_macros; +use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; + +extern crate rustc_middle; +use rustc_middle::ty::Ty; + +extern crate rustc_errors; +use rustc_errors::{Applicability, MultiSpan}; + +extern crate rustc_session; + +#[derive(Diagnostic)] +#[diag(compiletest_example, code = "E0123")] +//~^ ERROR diagnostic slug and crate name do not match +struct Hello {} diff --git a/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr new file mode 100644 index 000000000..dcf4af5df --- /dev/null +++ b/src/test/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr @@ -0,0 +1,11 @@ +error: diagnostic slug and crate name do not match + --> $DIR/enforce_slug_naming.rs:22:8 + | +LL | #[diag(compiletest_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: slug is `compiletest_example` but the crate name is `rustc_dummy` + = help: expected a slug starting with `dummy_...` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index efec85eb5..61ac456a6 100644 --- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -11,16 +11,16 @@ #![crate_type = "lib"] extern crate rustc_errors; +extern crate rustc_macros; extern crate rustc_session; extern crate rustc_span; -extern crate rustc_macros; use rustc_errors::Applicability; -use rustc_span::Span; use rustc_macros::Subdiagnostic; +use rustc_span::Span; #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct A { #[primary_span] span: Span, @@ -29,22 +29,22 @@ struct A { #[derive(Subdiagnostic)] enum B { - #[label(parser_add_paren)] + #[label(parse_add_paren)] A { #[primary_span] span: Span, var: String, }, - #[label(parser_add_paren)] + #[label(parse_add_paren)] B { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] //~^ ERROR label without `#[primary_span]` field struct C { var: String, @@ -138,7 +138,7 @@ struct M { } #[derive(Subdiagnostic)] -#[label(parser_add_paren, code = "...")] +#[label(parse_add_paren, code = "...")] //~^ ERROR `#[label(code = ...)]` is not a valid attribute struct N { #[primary_span] @@ -147,7 +147,7 @@ struct N { } #[derive(Subdiagnostic)] -#[label(parser_add_paren, applicability = "machine-applicable")] +#[label(parse_add_paren, applicability = "machine-applicable")] //~^ ERROR `#[label(applicability = ...)]` is not a valid attribute struct O { #[primary_span] @@ -160,12 +160,12 @@ struct O { //~^ ERROR cannot find attribute `foo` in this scope //~^^ ERROR unsupported type attribute for subdiagnostic enum enum P { - #[label(parser_add_paren)] + #[label(parse_add_paren)] A { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] @@ -177,7 +177,7 @@ enum Q { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] @@ -189,7 +189,7 @@ enum R { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] @@ -201,7 +201,7 @@ enum S { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] @@ -213,7 +213,7 @@ enum T { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] @@ -225,12 +225,12 @@ enum U { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] enum V { - #[label(parser_add_paren)] + #[label(parse_add_paren)] A { #[primary_span] span: Span, @@ -240,11 +240,11 @@ enum V { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] //~^ ERROR label without `#[primary_span]` field struct W { #[primary_span] @@ -253,7 +253,7 @@ struct W { } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct X { #[primary_span] span: Span, @@ -263,7 +263,7 @@ struct X { } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct Y { #[primary_span] span: Span, @@ -274,7 +274,7 @@ struct Y { } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct Z { #[primary_span] span: Span, @@ -285,7 +285,7 @@ struct Z { } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct AA { #[primary_span] span: Span, @@ -296,39 +296,39 @@ struct AA { } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct AB { #[primary_span] span: Span, #[skip_arg] - z: Z + z: Z, } #[derive(Subdiagnostic)] union AC { -//~^ ERROR unexpected unsupported untagged union + //~^ ERROR unexpected unsupported untagged union span: u32, - b: u64 + b: u64, } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] +#[label(parse_add_paren)] struct AD { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[label(parser_add_paren, parser_add_paren)] -//~^ ERROR `#[label(parser_add_paren)]` is not a valid attribute +#[label(parse_add_paren, parse_add_paren)] +//~^ ERROR `#[label(parse_add_paren)]` is not a valid attribute struct AE { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct AF { #[primary_span] //~^ NOTE previously specified here @@ -346,7 +346,7 @@ struct AG { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] struct AH { #[primary_span] span: Span, @@ -357,7 +357,7 @@ struct AH { #[derive(Subdiagnostic)] enum AI { - #[suggestion(parser_add_paren, code = "...")] + #[suggestion(parse_add_paren, code = "...")] A { #[primary_span] span: Span, @@ -365,18 +365,18 @@ enum AI { applicability: Applicability, var: String, }, - #[suggestion(parser_add_paren, code = "...")] + #[suggestion(parse_add_paren, code = "...")] B { #[primary_span] span: Span, #[applicability] applicability: Applicability, var: String, - } + }, } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...", code = "...")] +#[suggestion(parse_add_paren, code = "...", code = "...")] //~^ ERROR specified multiple times //~^^ NOTE previously specified here struct AJ { @@ -387,7 +387,7 @@ struct AJ { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] struct AK { #[primary_span] span: Span, @@ -400,7 +400,7 @@ struct AK { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] struct AL { #[primary_span] span: Span, @@ -410,14 +410,14 @@ struct AL { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] struct AM { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren)] +#[suggestion(parse_add_paren)] //~^ ERROR suggestion without `code = "..."` struct AN { #[primary_span] @@ -427,7 +427,7 @@ struct AN { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code ="...", applicability = "foo")] +#[suggestion(parse_add_paren, code = "...", applicability = "foo")] //~^ ERROR invalid applicability struct AO { #[primary_span] @@ -435,24 +435,24 @@ struct AO { } #[derive(Subdiagnostic)] -#[help(parser_add_paren)] +#[help(parse_add_paren)] struct AP { - var: String + var: String, } #[derive(Subdiagnostic)] -#[note(parser_add_paren)] +#[note(parse_add_paren)] struct AQ; #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] //~^ ERROR suggestion without `#[primary_span]` field struct AR { var: String, } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code ="...", applicability = "machine-applicable")] +#[suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] struct AS { #[primary_span] span: Span, @@ -462,16 +462,16 @@ struct AS { #[label] //~^ ERROR unsupported type attribute for subdiagnostic enum enum AT { - #[label(parser_add_paren)] + #[label(parse_add_paren)] A { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] +#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] struct AU { #[primary_span] span: Span, @@ -479,7 +479,7 @@ struct AU { } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] +#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] //~^ ERROR `var` doesn't refer to a field on this type struct AV { #[primary_span] @@ -488,37 +488,37 @@ struct AV { #[derive(Subdiagnostic)] enum AW { - #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] + #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] A { #[primary_span] span: Span, var: String, - } + }, } #[derive(Subdiagnostic)] enum AX { - #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] -//~^ ERROR `var` doesn't refer to a field on this type + #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] + //~^ ERROR `var` doesn't refer to a field on this type A { #[primary_span] span: Span, - } + }, } #[derive(Subdiagnostic)] -#[warning(parser_add_paren)] +#[warning(parse_add_paren)] struct AY {} #[derive(Subdiagnostic)] -#[warning(parser_add_paren)] +#[warning(parse_add_paren)] struct AZ { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[suggestion(parser_add_paren, code = "...")] +#[suggestion(parse_add_paren, code = "...")] //~^ ERROR suggestion without `#[primary_span]` field struct BA { #[suggestion_part] @@ -533,7 +533,7 @@ struct BA { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] //~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields //~| ERROR `#[multipart_suggestion(code = ...)]` is not a valid attribute struct BBa { @@ -541,7 +541,7 @@ struct BBa { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BBb { #[suggestion_part] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -549,7 +549,7 @@ struct BBb { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BBc { #[suggestion_part()] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -557,7 +557,7 @@ struct BBc { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] //~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields struct BC { #[primary_span] @@ -566,7 +566,7 @@ struct BC { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BD { #[suggestion_part] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -586,7 +586,7 @@ struct BD { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BE { #[suggestion_part(code = "...", code = ",,,")] //~^ ERROR specified multiple times @@ -595,7 +595,7 @@ struct BE { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BF { #[suggestion_part(code = "(")] first: Span, @@ -604,7 +604,7 @@ struct BF { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BG { #[applicability] appl: Applicability, @@ -615,7 +615,7 @@ struct BG { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BH { #[applicability] //~^ ERROR `#[applicability]` has no effect @@ -627,14 +627,14 @@ struct BH { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] struct BI { #[suggestion_part(code = "")] spans: Vec, } #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct BJ { #[primary_span] span: Span, @@ -643,7 +643,7 @@ struct BJ { /// with a doc comment on the type.. #[derive(Subdiagnostic)] -#[label(parser_add_paren)] +#[label(parse_add_paren)] struct BK { /// ..and the field #[primary_span] @@ -654,16 +654,16 @@ struct BK { #[derive(Subdiagnostic)] enum BL { /// ..and the variant.. - #[label(parser_add_paren)] + #[label(parse_add_paren)] Foo { /// ..and the field #[primary_span] span: Span, - } + }, } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BM { #[suggestion_part(code("foo"))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -672,7 +672,7 @@ struct BM { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BN { #[suggestion_part(code("foo", "bar"))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -681,7 +681,7 @@ struct BN { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BO { #[suggestion_part(code(3))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -690,7 +690,7 @@ struct BO { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BP { #[suggestion_part(code())] //~^ ERROR expected exactly one string literal for `code = ...` @@ -699,10 +699,102 @@ struct BP { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parser_add_paren)] +#[multipart_suggestion(parse_add_paren)] struct BQ { #[suggestion_part(code = 3)] //~^ ERROR `code = "..."`/`code(...)` must contain only string literals span: Span, r#type: String, } + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "")] +struct SuggestionStyleDefault { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "short")] +struct SuggestionStyleShort { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "hidden")] +struct SuggestionStyleHidden { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "verbose")] +struct SuggestionStyleVerbose { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "tool-only")] +struct SuggestionStyleToolOnly { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] +//~^ ERROR specified multiple times +//~| NOTE previously specified here +struct SuggestionStyleTwice { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion_hidden(parse_add_paren, code = "")] +//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute +struct SuggestionStyleOldSyntax { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion_hidden(parse_add_paren, code = "", style = "normal")] +//~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute +struct SuggestionStyleOldAndNewSyntax { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = "foo")] +//~^ ERROR invalid suggestion style +struct SuggestionStyleInvalid1 { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style = 42)] +//~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute +struct SuggestionStyleInvalid2 { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style)] +//~^ ERROR `#[suggestion(style)]` is not a valid attribute +struct SuggestionStyleInvalid3 { + #[primary_span] + sub: Span, +} + +#[derive(Subdiagnostic)] +#[suggestion(parse_add_paren, code = "", style("foo"))] +//~^ ERROR `#[suggestion(style(...))]` is not a valid attribute +struct SuggestionStyleInvalid4 { + #[primary_span] + sub: Span, +} diff --git a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index a85a8711e..b594fa6cd 100644 --- a/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/src/test/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -1,7 +1,7 @@ error: label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:47:1 | -LL | / #[label(parser_add_paren)] +LL | / #[label(parse_add_paren)] LL | | LL | | struct C { LL | | var: String, @@ -81,16 +81,16 @@ LL | #[label()] | ^^^^^^^^^^ error: `#[label(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:141:27 + --> $DIR/subdiagnostic-derive.rs:141:26 | -LL | #[label(parser_add_paren, code = "...")] - | ^^^^^^^^^^^^ +LL | #[label(parse_add_paren, code = "...")] + | ^^^^^^^^^^^^ error: `#[label(applicability = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:150:27 + --> $DIR/subdiagnostic-derive.rs:150:26 | -LL | #[label(parser_add_paren, applicability = "machine-applicable")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[label(parse_add_paren, applicability = "machine-applicable")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: unsupported type attribute for subdiagnostic enum --> $DIR/subdiagnostic-derive.rs:159:1 @@ -143,7 +143,7 @@ LL | #[primary_span] error: label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:247:1 | -LL | / #[label(parser_add_paren)] +LL | / #[label(parse_add_paren)] LL | | LL | | struct W { LL | | #[primary_span] @@ -186,15 +186,15 @@ error: unexpected unsupported untagged union LL | / union AC { LL | | LL | | span: u32, -LL | | b: u64 +LL | | b: u64, LL | | } | |_^ -error: `#[label(parser_add_paren)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:323:27 +error: `#[label(parse_add_paren)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:323:26 | -LL | #[label(parser_add_paren, parser_add_paren)] - | ^^^^^^^^^^^^^^^^ +LL | #[label(parse_add_paren, parse_add_paren)] + | ^^^^^^^^^^^^^^^ | = help: a diagnostic slug must be the first argument to the attribute @@ -217,16 +217,16 @@ LL | struct AG { | ^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:379:46 + --> $DIR/subdiagnostic-derive.rs:379:45 | -LL | #[suggestion(parser_add_paren, code = "...", code = "...")] - | ^^^^^^^^^^^^ +LL | #[suggestion(parse_add_paren, code = "...", code = "...")] + | ^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:379:32 + --> $DIR/subdiagnostic-derive.rs:379:31 | -LL | #[suggestion(parser_add_paren, code = "...", code = "...")] - | ^^^^^^^^^^^^ +LL | #[suggestion(parse_add_paren, code = "...", code = "...")] + | ^^^^^^^^^^^^ error: specified multiple times --> $DIR/subdiagnostic-derive.rs:397:5 @@ -249,19 +249,19 @@ LL | #[applicability] error: suggestion without `code = "..."` --> $DIR/subdiagnostic-derive.rs:420:1 | -LL | #[suggestion(parser_add_paren)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(parse_add_paren)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid applicability --> $DIR/subdiagnostic-derive.rs:430:45 | -LL | #[suggestion(parser_add_paren, code ="...", applicability = "foo")] +LL | #[suggestion(parse_add_paren, code = "...", applicability = "foo")] | ^^^^^^^^^^^^^^^^^^^^^ error: suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:448:1 | -LL | / #[suggestion(parser_add_paren, code = "...")] +LL | / #[suggestion(parse_add_paren, code = "...")] LL | | LL | | struct AR { LL | | var: String, @@ -277,13 +277,13 @@ LL | #[label] error: `var` doesn't refer to a field on this type --> $DIR/subdiagnostic-derive.rs:482:38 | -LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] +LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `var` doesn't refer to a field on this type --> $DIR/subdiagnostic-derive.rs:501:42 | -LL | #[suggestion(parser_add_paren, code ="{var}", applicability = "machine-applicable")] +LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: `#[suggestion_part]` is not a valid attribute @@ -305,7 +305,7 @@ LL | #[suggestion_part(code = "...")] error: suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:521:1 | -LL | / #[suggestion(parser_add_paren, code = "...")] +LL | / #[suggestion(parse_add_paren, code = "...")] LL | | LL | | struct BA { LL | | #[suggestion_part] @@ -315,17 +315,17 @@ LL | | } | |_^ error: `#[multipart_suggestion(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:536:42 + --> $DIR/subdiagnostic-derive.rs:536:41 | -LL | #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")] - | ^^^^^^^^^^^^ +LL | #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] + | ^^^^^^^^^^^^ | - = help: only `applicability` is a valid nested attributes + = help: only `style` and `applicability` are valid nested attributes error: multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:536:1 | -LL | / #[multipart_suggestion(parser_add_paren, code = "...", applicability = "machine-applicable")] +LL | / #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] LL | | LL | | LL | | struct BBa { @@ -356,7 +356,7 @@ LL | #[primary_span] error: multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:560:1 | -LL | / #[multipart_suggestion(parser_add_paren)] +LL | / #[multipart_suggestion(parse_add_paren)] LL | | LL | | struct BC { LL | | #[primary_span] @@ -445,6 +445,62 @@ error: `code = "..."`/`code(...)` must contain only string literals LL | #[suggestion_part(code = 3)] | ^^^^^^^^ +error: specified multiple times + --> $DIR/subdiagnostic-derive.rs:746:60 + | +LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] + | ^^^^^^^^^^^^^^^^ + | +note: previously specified here + --> $DIR/subdiagnostic-derive.rs:746:42 + | +LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] + | ^^^^^^^^^^^^^^^^ + +error: `#[suggestion_hidden(...)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:755:1 + | +LL | #[suggestion_hidden(parse_add_paren, code = "")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: Use `#[suggestion(..., style = "hidden")]` instead + +error: `#[suggestion_hidden(...)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:763:1 + | +LL | #[suggestion_hidden(parse_add_paren, code = "", style = "normal")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: Use `#[suggestion(..., style = "hidden")]` instead + +error: invalid suggestion style + --> $DIR/subdiagnostic-derive.rs:771:50 + | +LL | #[suggestion(parse_add_paren, code = "", style = "foo")] + | ^^^^^ + | + = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` + +error: `#[suggestion(style = ...)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:779:42 + | +LL | #[suggestion(parse_add_paren, code = "", style = 42)] + | ^^^^^^^^^^ + +error: `#[suggestion(style)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:787:42 + | +LL | #[suggestion(parse_add_paren, code = "", style)] + | ^^^^^ + | + = help: a diagnostic slug must be the first argument to the attribute + +error: `#[suggestion(style(...))]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:795:42 + | +LL | #[suggestion(parse_add_paren, code = "", style("foo"))] + | ^^^^^^^^^^^^ + error: cannot find attribute `foo` in this scope --> $DIR/subdiagnostic-derive.rs:63:3 | @@ -505,6 +561,6 @@ error[E0425]: cannot find value `slug` in module `rustc_errors::fluent` LL | #[label(slug)] | ^^^^ not found in `rustc_errors::fluent` -error: aborting due to 72 previous errors +error: aborting due to 79 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui-fulldeps/uninit_mask.rs b/src/test/ui-fulldeps/uninit_mask.rs deleted file mode 100644 index 84ce29101..000000000 --- a/src/test/ui-fulldeps/uninit_mask.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass -// ignore-cross-compile -// ignore-stage1 - -#![feature(rustc_private)] - -extern crate rustc_middle; -extern crate rustc_target; - -use rustc_middle::mir::interpret::InitMask; -use rustc_target::abi::Size; - -fn main() { - let mut mask = InitMask::new(Size::from_bytes(500), false); - assert!(!mask.get(Size::from_bytes(499))); - mask.set(Size::from_bytes(499), true); - assert!(mask.get(Size::from_bytes(499))); - mask.set_range_inbounds(Size::from_bytes(100), Size::from_bytes(256), true); - for i in 0..100 { - assert!(!mask.get(Size::from_bytes(i))); - } - for i in 100..256 { - assert!(mask.get(Size::from_bytes(i))); - } - for i in 256..499 { - assert!(!mask.get(Size::from_bytes(i))); - } -} -- cgit v1.2.3