diff options
Diffstat (limited to 'tests')
59 files changed, 980 insertions, 776 deletions
diff --git a/tests/mir-opt/casts.redundant.InstCombine.diff b/tests/mir-opt/casts.redundant.InstCombine.diff new file mode 100644 index 00000000000..528a8e5a90f --- /dev/null +++ b/tests/mir-opt/casts.redundant.InstCombine.diff @@ -0,0 +1,25 @@ +- // MIR for `redundant` before InstCombine ++ // MIR for `redundant` after InstCombine + + fn redundant(_1: *const &u8) -> *const &u8 { + debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 + let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64 + let mut _2: *const &u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:55 + let mut _3: *const &u8; // in scope 0 at $DIR/casts.rs:+1:36: +1:37 + scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38 + debug x => _3; // in scope 1 at $DIR/casts.rs:10:23: 10:24 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:55 + StorageLive(_3); // scope 0 at $DIR/casts.rs:+1:36: +1:37 + _3 = _1; // scope 0 at $DIR/casts.rs:+1:36: +1:37 +- _2 = _3 as *const &u8 (PtrToPtr); // scope 1 at $DIR/casts.rs:11:5: 11:18 ++ _2 = _3; // scope 1 at $DIR/casts.rs:11:5: 11:18 + StorageDead(_3); // scope 0 at $DIR/casts.rs:+1:37: +1:38 + _0 = _2; // scope 0 at $DIR/casts.rs:+1:5: +1:55 + StorageDead(_2); // scope 0 at $DIR/casts.rs:+2:1: +2:2 + return; // scope 0 at $DIR/casts.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/casts.redundant.PreCodegen.after.mir b/tests/mir-opt/casts.redundant.PreCodegen.after.mir new file mode 100644 index 00000000000..21a470ea300 --- /dev/null +++ b/tests/mir-opt/casts.redundant.PreCodegen.after.mir @@ -0,0 +1,14 @@ +// MIR for `redundant` after PreCodegen + +fn redundant(_1: *const &u8) -> *const &u8 { + debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 + let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64 + scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38 + debug x => _1; // in scope 1 at $DIR/casts.rs:10:23: 10:24 + } + + bb0: { + _0 = _1; // scope 0 at $DIR/casts.rs:+1:5: +1:55 + return; // scope 0 at $DIR/casts.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir b/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir new file mode 100644 index 00000000000..0c793984ceb --- /dev/null +++ b/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir @@ -0,0 +1,15 @@ +// MIR for `roundtrip` after PreCodegen + +fn roundtrip(_1: *const u8) -> *const u8 { + debug x => _1; // in scope 0 at $DIR/casts.rs:+0:18: +0:19 + let mut _0: *const u8; // return place in scope 0 at $DIR/casts.rs:+0:35: +0:44 + let mut _2: *mut u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:17 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:17 + _2 = _1 as *mut u8 (PtrToPtr); // scope 0 at $DIR/casts.rs:+1:5: +1:17 + _0 = move _2 as *const u8 (Pointer(MutToConstPointer)); // scope 0 at $DIR/casts.rs:+1:5: +1:17 + StorageDead(_2); // scope 0 at $DIR/casts.rs:+1:16: +1:17 + return; // scope 0 at $DIR/casts.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs new file mode 100644 index 00000000000..259c462da3d --- /dev/null +++ b/tests/mir-opt/casts.rs @@ -0,0 +1,17 @@ +#![crate_type = "lib"] + +// EMIT_MIR casts.redundant.InstCombine.diff +// EMIT_MIR casts.redundant.PreCodegen.after.mir +pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { + generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 +} + +#[inline] +fn generic_cast<T, U>(x: *const T) -> *const U { + x as *const U +} + +// EMIT_MIR casts.roundtrip.PreCodegen.after.mir +pub fn roundtrip(x: *const u8) -> *const u8 { + x as *mut u8 as *const u8 +} diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 3aa57d58908..8dac53c2a62 100644 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -27,6 +27,8 @@ use std::any::Any; struct TheBackend; impl CodegenBackend for TheBackend { + fn locale_resource(&self) -> &'static str { "" } + fn codegen_crate<'a, 'tcx>( &self, tcx: TyCtxt<'tcx>, diff --git a/tests/run-make-fulldeps/issue-19371/foo.rs b/tests/run-make-fulldeps/issue-19371/foo.rs index 5bb38fc02af..53ec79e477b 100644 --- a/tests/run-make-fulldeps/issue-19371/foo.rs +++ b/tests/run-make-fulldeps/issue-19371/foo.rs @@ -53,6 +53,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { output_file: Some(output), output_dir: None, file_loader: None, + locale_resources: &[], lint_caps: Default::default(), parse_sess_created: None, register_lints: None, diff --git a/tests/run-make/translation/Makefile b/tests/run-make/translation/Makefile index 20e86c7f9a0..5b0b331ca46 100644 --- a/tests/run-make/translation/Makefile +++ b/tests/run-make/translation/Makefile @@ -6,8 +6,10 @@ include ../../run-make-fulldeps/tools.mk SYSROOT:=$(shell $(RUSTC) --print sysroot) FAKEROOT=$(TMPDIR)/fakeroot +RUSTC_LOG:=rustc_error_messages +export RUSTC_TRANSLATION_NO_DEBUG_ASSERT:=1 -all: normal custom sysroot +all: normal custom missing broken sysroot sysroot-invalid sysroot-missing # Check that the test works normally, using the built-in fallback bundle. normal: test.rs @@ -32,6 +34,7 @@ broken: test.rs broken.ftl # identifier by making a local copy of the sysroot and adding the custom locale # to it. sysroot: test.rs working.ftl + rm -rf $(FAKEROOT) mkdir $(FAKEROOT) ln -s $(SYSROOT)/* $(FAKEROOT) rm -f $(FAKEROOT)/lib @@ -51,12 +54,12 @@ sysroot: test.rs working.ftl # found. This test might start failing if there actually exists a Klingon # translation of rustc's error messages. sysroot-missing: - $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 || grep "missing locale directory" + $(RUSTC) $< -Ztranslate-lang=tlh 2>&1 | grep "missing locale directory" -# Check that the compiler errors out when the sysroot requested cannot be -# found. This test might start failing if there actually exists a Klingon -# translation of rustc's error messages. +# Check that the compiler errors out when the directory for the locale in the +# sysroot is actually a file. sysroot-invalid: test.rs working.ftl + rm -rf $(FAKEROOT) mkdir $(FAKEROOT) ln -s $(SYSROOT)/* $(FAKEROOT) rm -f $(FAKEROOT)/lib @@ -68,5 +71,6 @@ sysroot-invalid: test.rs working.ftl rm -f $(FAKEROOT)/lib/rustlib/src mkdir $(FAKEROOT)/lib/rustlib/src ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src - touch $(FAKEROOT)/share/locale/zh-CN/ - $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 || grep "`\$sysroot/share/locales/\$locale` is not a directory" + mkdir -p $(FAKEROOT)/share/locale + touch $(FAKEROOT)/share/locale/zh-CN + $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | grep "`\$sysroot/share/locales/\$locale` is not a directory" diff --git a/tests/rustdoc/issue-108281.rs b/tests/rustdoc/issue-108281.rs new file mode 100644 index 00000000000..8e1b6ba88a6 --- /dev/null +++ b/tests/rustdoc/issue-108281.rs @@ -0,0 +1,25 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/108281>. +// It ensures that the attributes on the first reexport are not duplicated. + +#![crate_name = "foo"] + +// @has 'foo/index.html' + +#[doc(hidden)] +pub fn bar() {} +mod sub { + pub fn public() {} +} + +// @matches - '//*[@class="desc docblock-short"]' '^Displayed$' +/// Displayed +#[doc(inline)] +pub use crate::bar as Bar; +// @matches - '//*[@class="desc docblock-short"]' '^Hello\sDisplayed$' +#[doc(inline)] +/// Hello +pub use crate::Bar as Bar2; + +// @matches - '//*[@class="desc docblock-short"]' '^Public$' +/// Public +pub use crate::sub::public as Public; diff --git a/tests/ui-fulldeps/fluent-messages/duplicate.ftl b/tests/ui-fulldeps/fluent-messages/duplicate.ftl new file mode 100644 index 00000000000..871550b231a --- /dev/null +++ b/tests/ui-fulldeps/fluent-messages/duplicate.ftl @@ -0,0 +1,3 @@ +no_crate_a_b_key = Value + +no_crate_a_b_key = Another Value diff --git a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl index 016cbeef662..3088b1f8dc8 100644 --- a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl +++ b/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl @@ -1,2 +1,2 @@ -label_with_hyphens_some_slug = hi +no_crate_some_slug = hi .label-has-hyphens = test diff --git a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl b/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl index 9bd035c1bba..0a64e3894bd 100644 --- a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl +++ b/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl @@ -1,2 +1,2 @@ with-hyphens = 1234 -test-crate_foo = abcd +no-crate_foo = abcd diff --git a/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl b/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl index 0cd8229b230..4c6514a9770 100644 --- a/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl +++ b/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl @@ -1 +1 @@ -missing_message_ref = {message} +no_crate_missing_message_ref = {message} diff --git a/tests/ui-fulldeps/fluent-messages/missing-message.ftl b/tests/ui-fulldeps/fluent-messages/missing-message.ftl index 74b2aa1d44d..61f56fd4d57 100644 --- a/tests/ui-fulldeps/fluent-messages/missing-message.ftl +++ b/tests/ui-fulldeps/fluent-messages/missing-message.ftl @@ -1 +1 @@ -missing_message = +no_crate_missing_message = diff --git a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl index 86ba9a268f3..a64c85094f1 100644 --- a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl +++ b/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl @@ -1 +1 @@ -slug_with_hyphens_this-slug-has-hyphens = hi +no_crate_this-slug-has-hyphens = hi diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs index 74303e97dba..66575eb8e30 100644 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ b/tests/ui-fulldeps/fluent-messages/test.rs @@ -21,87 +21,74 @@ pub enum SubdiagnosticMessage { mod missing_absolute { use super::fluent_messages; - fluent_messages! { - missing_absolute => "/definitely_does_not_exist.ftl", -//~^ ERROR could not open Fluent resource - } + fluent_messages! { "/definitely_does_not_exist.ftl" } + //~^ ERROR could not open Fluent resource } mod missing_relative { use super::fluent_messages; - fluent_messages! { - missing_relative => "../definitely_does_not_exist.ftl", -//~^ ERROR could not open Fluent resource - } + fluent_messages! { "../definitely_does_not_exist.ftl" } + //~^ ERROR could not open Fluent resource } mod missing_message { use super::fluent_messages; - fluent_messages! { - missing_message => "./missing-message.ftl", -//~^ ERROR could not parse Fluent resource - } + fluent_messages! { "./missing-message.ftl" } + //~^ ERROR could not parse Fluent resource } mod duplicate { use super::fluent_messages; - fluent_messages! { -//~^ ERROR the name `a_b_key` is defined multiple times - a => "./duplicate-a.ftl", - a_b => "./duplicate-a-b.ftl", -//~^ ERROR overrides existing message: `a_b_key` - } + fluent_messages! { "./duplicate.ftl" } + //~^ ERROR overrides existing message: `no_crate_a_b_key` } mod slug_with_hyphens { use super::fluent_messages; - fluent_messages! { - slug_with_hyphens => "./slug-with-hyphens.ftl", -//~^ ERROR name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character - } + fluent_messages! { "./slug-with-hyphens.ftl" } + //~^ ERROR name `no_crate_this-slug-has-hyphens` contains a '-' character } mod label_with_hyphens { use super::fluent_messages; - fluent_messages! { - label_with_hyphens => "./label-with-hyphens.ftl", -//~^ ERROR attribute `label-has-hyphens` contains a '-' character - } + fluent_messages! { "./label-with-hyphens.ftl" } + //~^ ERROR attribute `label-has-hyphens` contains a '-' character } mod valid { use super::fluent_messages; - fluent_messages! { - valid => "./valid.ftl", - } + fluent_messages! { "./valid.ftl" } - use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid_key}; + mod test_generated { + use super::{fluent_generated::no_crate_key, DEFAULT_LOCALE_RESOURCE}; + } } mod missing_crate_name { use super::fluent_messages; - fluent_messages! { - test_crate => "./missing-crate-name.ftl", -//~^ ERROR name `test-crate_foo` contains a '-' character -//~| ERROR name `with-hyphens` contains a '-' character -//~| ERROR name `with-hyphens` does not start with the crate name - } + fluent_messages! { "./missing-crate-name.ftl" } + //~^ ERROR name `no-crate_foo` contains a '-' character + //~| ERROR name `with-hyphens` contains a '-' character + //~| ERROR name `with-hyphens` does not start with the crate name - use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate_foo, with_hyphens}; + mod test_generated { + use super::{ + fluent_generated::{no_crate_foo, with_hyphens}, + DEFAULT_LOCALE_RESOURCE, + }; + } } mod missing_message_ref { use super::fluent_messages; - fluent_messages! { - missing => "./missing-message-ref.ftl" -//~^ ERROR referenced message `message` does not exist - } + fluent_messages! { "./missing-message-ref.ftl" } + //~^ ERROR referenced message `message` does not exist } diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr index 2631b0a6232..c7961ed22f2 100644 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ b/tests/ui-fulldeps/fluent-messages/test.stderr @@ -1,106 +1,87 @@ error: could not open Fluent resource - --> $DIR/test.rs:25:29 + --> $DIR/test.rs:24:24 | -LL | missing_absolute => "/definitely_does_not_exist.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "/definitely_does_not_exist.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: os-specific message error: could not open Fluent resource - --> $DIR/test.rs:34:29 + --> $DIR/test.rs:31:24 | -LL | missing_relative => "../definitely_does_not_exist.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "../definitely_does_not_exist.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: os-specific message error: could not parse Fluent resource - --> $DIR/test.rs:43:28 + --> $DIR/test.rs:38:24 | -LL | missing_message => "./missing-message.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-message.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: see additional errors emitted -error: expected a message field for "missing_message" +error: expected a message field for "no_crate_missing_message" --> ./missing-message.ftl:1:1 | -1 | missing_message = - | ^^^^^^^^^^^^^^^^^ +1 | no_crate_missing_message = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error: overrides existing message: `a_b_key` - --> $DIR/test.rs:54:16 +error: overrides existing message: `no_crate_a_b_key` + --> $DIR/test.rs:45:24 | -LL | a_b => "./duplicate-a-b.ftl", - | ^^^^^^^^^^^^^^^^^^^^^ - | -help: previously defined in this resource - --> $DIR/test.rs:53:14 - | -LL | a => "./duplicate-a.ftl", - | ^^^^^^^^^^^^^^^^^^^ - -error[E0428]: the name `a_b_key` is defined multiple times - --> $DIR/test.rs:51:5 - | -LL | fluent_messages! { - | ^^^^^^^^^^^^^^^^ - | | - | `a_b_key` redefined here - | previous definition of the value `a_b_key` here - | - = note: os-specific message - = note: os-specific message +LL | fluent_messages! { "./duplicate.ftl" } + | ^^^^^^^^^^^^^^^^^ -error: name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character - --> $DIR/test.rs:63:30 +error: name `no_crate_this-slug-has-hyphens` contains a '-' character + --> $DIR/test.rs:52:24 | -LL | slug_with_hyphens => "./slug-with-hyphens.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./slug-with-hyphens.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: attribute `label-has-hyphens` contains a '-' character - --> $DIR/test.rs:72:31 + --> $DIR/test.rs:59:24 | -LL | label_with_hyphens => "./label-with-hyphens.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./label-with-hyphens.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: name `with-hyphens` contains a '-' character - --> $DIR/test.rs:91:23 + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: name `with-hyphens` does not start with the crate name - --> $DIR/test.rs:91:23 + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: prepend `test_crate_` to the slug name: `test_crate_with_hyphens` + = help: prepend `no_crate_` to the slug name: `no_crate_with_hyphens` -error: name `test-crate_foo` contains a '-' character - --> $DIR/test.rs:91:23 +error: name `no-crate_foo` contains a '-' character + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s -error: referenced message `message` does not exist (in message `missing_message_ref`) - --> $DIR/test.rs:104:20 +error: referenced message `message` does not exist (in message `no_crate_missing_message_ref`) + --> $DIR/test.rs:92:24 | -LL | missing => "./missing-message-ref.ftl" - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-message-ref.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: you may have meant to use a variable reference (`{$message}`) -error: aborting due to 11 previous errors +error: aborting due to 10 previous errors -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui-fulldeps/fluent-messages/valid.ftl b/tests/ui-fulldeps/fluent-messages/valid.ftl index 54927430600..598473adb68 100644 --- a/tests/ui-fulldeps/fluent-messages/valid.ftl +++ b/tests/ui-fulldeps/fluent-messages/valid.ftl @@ -1 +1 @@ -valid_key = Valid! +no_crate_key = Valid! diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.ftl b/tests/ui-fulldeps/internal-lints/diagnostics.ftl new file mode 100644 index 00000000000..cb2d476d815 --- /dev/null +++ b/tests/ui-fulldeps/internal-lints/diagnostics.ftl @@ -0,0 +1,5 @@ +no_crate_example = this is an example message used in testing + .note = with a note + .help = with a help + .suggestion = with a suggestion + .label = with a label diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 643e81d99c6..3aa65d53d4e 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -13,20 +13,22 @@ extern crate rustc_span; use rustc_errors::{ AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder, - ErrorGuaranteed, Handler, fluent, SubdiagnosticMessage, + ErrorGuaranteed, Handler, DiagnosticMessage, SubdiagnosticMessage, }; -use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_macros::{fluent_messages, Diagnostic, Subdiagnostic}; use rustc_span::Span; +fluent_messages! { "./diagnostics.ftl" } + #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct DeriveDiagnostic { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[note(compiletest_example)] +#[note(no_crate_example)] struct Note { #[primary_span] span: Span, @@ -45,7 +47,7 @@ pub struct TranslatableInIntoDiagnostic; impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic { fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> { - handler.struct_err(fluent::compiletest_example) + handler.struct_err(crate::fluent_generated::no_crate_example) } } @@ -68,12 +70,12 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic { where F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, { - diag.note(fluent::note); + diag.note(crate::fluent_generated::no_crate_note); } } pub fn make_diagnostics<'a>(handler: &'a Handler) { - let _diag = handler.struct_err(fluent::compiletest_example); + let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls let _diag = handler.struct_err("untranslatable diagnostic"); diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr index 510d6a17108..6f797ebc2dd 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr +++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr @@ -1,5 +1,5 @@ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:39:17 + --> $DIR/diagnostics.rs:41:17 | LL | handler.struct_err("untranslatable diagnostic") | ^^^^^^^^^^ @@ -11,15 +11,15 @@ LL | #![deny(rustc::untranslatable_diagnostic)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:59:14 + --> $DIR/diagnostics.rs:61:14 | LL | diag.note("untranslatable diagnostic"); | ^^^^ error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls - --> $DIR/diagnostics.rs:76:25 + --> $DIR/diagnostics.rs:78:25 | -LL | let _diag = handler.struct_err(fluent::compiletest_example); +LL | let _diag = handler.struct_err(crate::fluent_generated::no_crate_example); | ^^^^^^^^^^ | note: the lint level is defined here @@ -29,13 +29,13 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls - --> $DIR/diagnostics.rs:79:25 + --> $DIR/diagnostics.rs:81:25 | LL | let _diag = handler.struct_err("untranslatable diagnostic"); | ^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:79:25 + --> $DIR/diagnostics.rs:81:25 | LL | let _diag = handler.struct_err("untranslatable diagnostic"); | ^^^^^^^^^^ diff --git a/tests/ui-fulldeps/mod_dir_path_canonicalized.rs b/tests/ui-fulldeps/mod_dir_path_canonicalized.rs index bdfd9628c48..ddc86c1dc31 100644 --- a/tests/ui-fulldeps/mod_dir_path_canonicalized.rs +++ b/tests/ui-fulldeps/mod_dir_path_canonicalized.rs @@ -31,7 +31,10 @@ pub fn main() { } fn parse() { - let parse_session = ParseSess::new(FilePathMapping::empty()); + let parse_session = ParseSess::new( + vec![rustc_parse::DEFAULT_LOCALE_RESOURCE], + FilePathMapping::empty() + ); let path = Path::new(file!()); let path = path.canonicalize().unwrap(); diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs index a4fad9d3e1e..e417a6a833b 100644 --- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs @@ -220,7 +220,7 @@ fn main() { } fn run() { - let ps = ParseSess::new(FilePathMapping::empty()); + let ps = ParseSess::new(vec![rustc_parse::DEFAULT_LOCALE_RESOURCE], FilePathMapping::empty()); iter_exprs(2, &mut |mut e| { // If the pretty printer is correct, then `parse(print(e))` should be identical to `e`, diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 07f95d13937..01e6434b075 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -17,26 +17,28 @@ use rustc_span::symbol::Ident; use rustc_span::Span; extern crate rustc_macros; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{fluent_messages, Diagnostic, LintDiagnostic, Subdiagnostic}; extern crate rustc_middle; use rustc_middle::ty::Ty; extern crate rustc_errors; -use rustc_errors::{Applicability, MultiSpan}; +use rustc_errors::{Applicability, DiagnosticMessage, MultiSpan, SubdiagnosticMessage}; extern crate rustc_session; +fluent_messages! { "./example.ftl" } + #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct Hello {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct HelloWarn {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] //~^ ERROR unsupported type attribute for diagnostic derive enum enum DiagnosticOnEnum { Foo, @@ -46,13 +48,13 @@ enum DiagnosticOnEnum { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] #[diag = "E0123"] //~^ ERROR `#[diag = ...]` is not a valid attribute struct WrongStructAttrStyle {} #[derive(Diagnostic)] -#[nonsense(compiletest_example, code = "E0123")] +#[nonsense(no_crate_example, code = "E0123")] //~^ ERROR `#[nonsense(...)]` is not a valid attribute //~^^ ERROR diagnostic slug not specified //~^^^ ERROR cannot find attribute `nonsense` in this scope @@ -66,7 +68,7 @@ struct InvalidLitNestedAttr {} #[derive(Diagnostic)] #[diag(nonsense, code = "E0123")] -//~^ ERROR cannot find value `nonsense` in module `rustc_errors::fluent` +//~^ ERROR cannot find value `nonsense` in module `crate::fluent_generated` struct InvalidNestedStructAttr {} #[derive(Diagnostic)] @@ -90,12 +92,12 @@ struct InvalidNestedStructAttr2 {} struct InvalidNestedStructAttr3 {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123", slug = "foo")] +#[diag(no_crate_example, code = "E0123", slug = "foo")] //~^ ERROR `#[diag(slug = ...)]` is not a valid attribute struct InvalidNestedStructAttr4 {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct WrongPlaceField { #[suggestion = "bar"] //~^ ERROR `#[suggestion = ...]` is not a valid attribute @@ -103,20 +105,20 @@ struct WrongPlaceField { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] -#[diag(compiletest_example, code = "E0456")] +#[diag(no_crate_example, code = "E0123")] +#[diag(no_crate_example, code = "E0456")] //~^ ERROR specified multiple times //~^^ ERROR specified multiple times struct DiagSpecifiedTwice {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0456", code = "E0457")] +#[diag(no_crate_example, code = "E0456", code = "E0457")] //~^ ERROR specified multiple times struct CodeSpecifiedTwice {} #[derive(Diagnostic)] -#[diag(compiletest_example, compiletest_example, code = "E0456")] -//~^ ERROR `#[diag(compiletest_example)]` is not a valid attribute +#[diag(no_crate_example, no_crate::example, code = "E0456")] +//~^ ERROR `#[diag(no_crate::example)]` is not a valid attribute struct SlugSpecifiedTwice {} #[derive(Diagnostic)] @@ -128,11 +130,11 @@ struct KindNotProvided {} //~ ERROR diagnostic slug not specified struct SlugNotProvided {} #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct CodeNotProvided {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct MessageWrongType { #[primary_span] //~^ ERROR `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` @@ -140,7 +142,7 @@ struct MessageWrongType { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct InvalidPathFieldAttr { #[nonsense] //~^ ERROR `#[nonsense]` is not a valid attribute @@ -149,34 +151,34 @@ struct InvalidPathFieldAttr { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithField { name: String, - #[label(label)] + #[label(no_crate_label)] span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithMessageAppliedToField { - #[label(label)] + #[label(no_crate_label)] //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` name: String, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithNonexistentField { - #[suggestion(suggestion, code = "{name}")] + #[suggestion(no_crate_suggestion, code = "{name}")] //~^ ERROR `name` doesn't refer to a field on this type suggestion: (Span, Applicability), } #[derive(Diagnostic)] //~^ ERROR invalid format string: expected `'}'` -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorMissingClosingBrace { - #[suggestion(suggestion, code = "{name")] + #[suggestion(no_crate_suggestion, code = "{name")] suggestion: (Span, Applicability), name: String, val: usize, @@ -184,50 +186,50 @@ struct ErrorMissingClosingBrace { #[derive(Diagnostic)] //~^ ERROR invalid format string: unmatched `}` -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorMissingOpeningBrace { - #[suggestion(suggestion, code = "name}")] + #[suggestion(no_crate_suggestion, code = "name}")] suggestion: (Span, Applicability), name: String, val: usize, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct LabelOnSpan { - #[label(label)] + #[label(no_crate_label)] sp: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct LabelOnNonSpan { - #[label(label)] + #[label(no_crate_label)] //~^ ERROR the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` id: u32, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct Suggest { - #[suggestion(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(no_crate_suggestion, code = "This is the suggested code")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "normal")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "short")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "hidden")] + #[suggestion(no_crate_suggestion, code = "This is the suggested code", style = "verbose")] suggestion: (Span, Applicability), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithoutCode { - #[suggestion(suggestion)] + #[suggestion(no_crate_suggestion)] //~^ ERROR suggestion without `code = "..."` suggestion: (Span, Applicability), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithBadKey { #[suggestion(nonsense = "bar")] //~^ ERROR `#[suggestion(nonsense = ...)]` is not a valid attribute @@ -236,7 +238,7 @@ struct SuggestWithBadKey { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithShorthandMsg { #[suggestion(msg = "bar")] //~^ ERROR `#[suggestion(msg = ...)]` is not a valid attribute @@ -245,52 +247,52 @@ struct SuggestWithShorthandMsg { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithoutMsg { #[suggestion(code = "bar")] suggestion: (Span, Applicability), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithTypesSwapped { - #[suggestion(suggestion, code = "This is suggested code")] + #[suggestion(no_crate_suggestion, code = "This is suggested code")] suggestion: (Applicability, Span), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithWrongTypeApplicabilityOnly { - #[suggestion(suggestion, code = "This is suggested code")] + #[suggestion(no_crate_suggestion, code = "This is suggested code")] //~^ ERROR wrong field type for suggestion suggestion: Applicability, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithSpanOnly { - #[suggestion(suggestion, code = "This is suggested code")] + #[suggestion(no_crate_suggestion, code = "This is suggested code")] suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithDuplicateSpanAndApplicability { - #[suggestion(suggestion, code = "This is suggested code")] + #[suggestion(no_crate_suggestion, code = "This is suggested code")] suggestion: (Span, Span, Applicability), //~^ ERROR specified multiple times } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct SuggestWithDuplicateApplicabilityAndSpan { - #[suggestion(suggestion, code = "This is suggested code")] + #[suggestion(no_crate_suggestion, code = "This is suggested code")] suggestion: (Applicability, Applicability, Span), //~^ ERROR specified multiple times } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct WrongKindOfAnnotation { #[label = "bar"] //~^ ERROR `#[label = ...]` is not a valid attribute @@ -298,38 +300,38 @@ struct WrongKindOfAnnotation { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct OptionsInErrors { - #[label(label)] + #[label(no_crate_label)] label: Option<Span>, - #[suggestion(suggestion, code = "...")] + #[suggestion(no_crate_suggestion, code = "...")] opt_sugg: Option<(Span, Applicability)>, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0456")] +#[diag(no_crate_example, code = "E0456")] struct MoveOutOfBorrowError<'tcx> { name: Ident, ty: Ty<'tcx>, #[primary_span] - #[label(label)] + #[label(no_crate_label)] span: Span, - #[label(label)] + #[label(no_crate_label)] other_span: Span, - #[suggestion(suggestion, code = "{name}.clone()")] + #[suggestion(no_crate_suggestion, code = "{name}.clone()")] opt_sugg: Option<(Span, Applicability)>, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithLifetime<'a> { - #[label(label)] + #[label(no_crate_label)] span: Span, name: &'a str, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithDefaultLabelAttr<'a> { #[label] span: Span, @@ -338,7 +340,7 @@ struct ErrorWithDefaultLabelAttr<'a> { #[derive(Diagnostic)] //~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ArgFieldWithoutSkip { #[primary_span] span: Span, @@ -346,7 +348,7 @@ struct ArgFieldWithoutSkip { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ArgFieldWithSkip { #[primary_span] span: Span, @@ -357,132 +359,132 @@ struct ArgFieldWithSkip { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithSpannedNote { #[note] span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithSpannedNoteCustom { - #[note(note)] + #[note(no_crate_note)] span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] #[note] struct ErrorWithNote { val: String, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] -#[note(note)] +#[diag(no_crate_example, code = "E0123")] +#[note(no_crate_note)] struct ErrorWithNoteCustom { val: String, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithSpannedHelp { #[help] span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithSpannedHelpCustom { - #[help(help)] + #[help(no_crate_help)] span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] #[help] struct ErrorWithHelp { val: String, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] -#[help(help)] +#[diag(no_crate_example, code = "E0123")] +#[help(no_crate_help)] struct ErrorWithHelpCustom { val: String, } #[derive(Diagnostic)] #[help] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithHelpWrongOrder { val: String, } #[derive(Diagnostic)] -#[help(help)] -#[diag(compiletest_example, code = "E0123")] +#[help(no_crate_help)] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithHelpCustomWrongOrder { val: String, } #[derive(Diagnostic)] #[note] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithNoteWrongOrder { val: String, } #[derive(Diagnostic)] -#[note(note)] -#[diag(compiletest_example, code = "E0123")] +#[note(no_crate_note)] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithNoteCustomWrongOrder { val: String, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ApplicabilityInBoth { - #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")] + #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] //~^ ERROR specified multiple times suggestion: (Span, Applicability), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct InvalidApplicability { - #[suggestion(suggestion, code = "...", applicability = "batman")] + #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] //~^ ERROR invalid applicability suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ValidApplicability { - #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")] + #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct NoApplicability { - #[suggestion(suggestion, code = "...")] + #[suggestion(no_crate_suggestion, code = "...")] suggestion: Span, } #[derive(Subdiagnostic)] -#[note(parse_add_paren)] +#[note(no_crate_example)] struct Note; #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct Subdiagnostic { #[subdiagnostic] note: Note, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct VecField { #[primary_span] #[label] @@ -490,57 +492,57 @@ struct VecField { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct UnitField { #[primary_span] spans: Span, #[help] foo: (), - #[help(help)] + #[help(no_crate_help)] bar: (), } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct OptUnitField { #[primary_span] spans: Span, #[help] foo: Option<()>, - #[help(help)] + #[help(no_crate_help)] bar: Option<()>, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingPath { - #[label(label, foo)] + #[label(no_crate_label, foo)] //~^ ERROR `#[label(foo)]` is not a valid attribute span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingNameValue { - #[label(label, foo = "...")] + #[label(no_crate_label, foo = "...")] //~^ ERROR `#[label(foo = ...)]` is not a valid attribute span: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct LabelWithTrailingList { - #[label(label, foo("..."))] + #[label(no_crate_label, foo("..."))] //~^ ERROR `#[label(foo(...))]` is not a valid attribute span: Span, } #[derive(LintDiagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct LintsGood {} #[derive(LintDiagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct PrimarySpanOnLint { #[primary_span] //~^ ERROR `#[primary_span]` is not a valid attribute @@ -548,42 +550,42 @@ struct PrimarySpanOnLint { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct ErrorWithMultiSpan { #[primary_span] span: MultiSpan, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] #[warning] struct ErrorWithWarn { val: String, } #[derive(Diagnostic)] -#[error(compiletest_example, code = "E0123")] +#[error(no_crate_example, code = "E0123")] //~^ ERROR `#[error(...)]` is not a valid attribute //~| ERROR diagnostic slug not specified //~| ERROR cannot find attribute `error` in this scope struct ErrorAttribute {} #[derive(Diagnostic)] -#[warn_(compiletest_example, code = "E0123")] +#[warn_(no_crate_example, code = "E0123")] //~^ ERROR `#[warn_(...)]` is not a valid attribute //~| ERROR diagnostic slug not specified //~| ERROR cannot find attribute `warn_` in this scope struct WarnAttribute {} #[derive(Diagnostic)] -#[lint(compiletest_example, code = "E0123")] +#[lint(no_crate_example, code = "E0123")] //~^ ERROR `#[lint(...)]` is not a valid attribute //~| ERROR diagnostic slug not specified //~| ERROR cannot find attribute `lint` in this scope struct LintAttributeOnSessionDiag {} #[derive(LintDiagnostic)] -#[lint(compiletest_example, code = "E0123")] +#[lint(no_crate_example, code = "E0123")] //~^ ERROR `#[lint(...)]` is not a valid attribute //~| ERROR `#[lint(...)]` is not a valid attribute //~| ERROR diagnostic slug not specified @@ -591,55 +593,55 @@ struct LintAttributeOnSessionDiag {} struct LintAttributeOnLintDiag {} #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct DuplicatedSuggestionCode { - #[suggestion(suggestion, code = "...", code = ",,,")] + #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] //~^ ERROR specified multiple times suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct InvalidTypeInSuggestionTuple { - #[suggestion(suggestion, code = "...")] + #[suggestion(no_crate_suggestion, code = "...")] suggestion: (Span, usize), //~^ ERROR wrong types for suggestion } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct MissingApplicabilityInSuggestionTuple { - #[suggestion(suggestion, code = "...")] + #[suggestion(no_crate_suggestion, code = "...")] suggestion: (Span,), //~^ ERROR wrong types for suggestion } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct MissingCodeInSuggestion { - #[suggestion(suggestion)] + #[suggestion(no_crate_suggestion)] //~^ ERROR suggestion without `code = "..."` suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] -#[multipart_suggestion(suggestion)] +#[diag(no_crate_example, code = "E0123")] +#[multipart_suggestion(no_crate_suggestion)] //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute //~| ERROR cannot find attribute `multipart_suggestion` in this scope #[multipart_suggestion()] //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute //~| ERROR cannot find attribute `multipart_suggestion` in this scope struct MultipartSuggestion { - #[multipart_suggestion(suggestion)] + #[multipart_suggestion(no_crate_suggestion)] //~^ ERROR `#[multipart_suggestion(...)]` is not a valid attribute //~| ERROR cannot find attribute `multipart_suggestion` in this scope suggestion: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] -#[suggestion(suggestion, code = "...")] +#[diag(no_crate_example, code = "E0123")] +#[suggestion(no_crate_suggestion, code = "...")] //~^ ERROR `#[suggestion(...)]` is not a valid attribute struct SuggestionOnStruct { #[primary_span] @@ -647,7 +649,7 @@ struct SuggestionOnStruct { } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] #[label] //~^ ERROR `#[label]` is not a valid attribute struct LabelOnStruct { @@ -657,30 +659,30 @@ struct LabelOnStruct { #[derive(Diagnostic)] enum ExampleEnum { - #[diag(compiletest_example)] + #[diag(no_crate_example)] Foo { #[primary_span] sp: Span, #[note] note_sp: Span, }, - #[diag(compiletest_example)] + #[diag(no_crate_example)] Bar { #[primary_span] sp: Span, }, - #[diag(compiletest_example)] + #[diag(no_crate_example)] Baz, } #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct RawIdentDiagnosticArg { pub r#type: String, } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticBad { #[subdiagnostic(bad)] //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute @@ -688,7 +690,7 @@ struct SubdiagnosticBad { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticBadStr { #[subdiagnostic = "bad"] //~^ ERROR `#[subdiagnostic = ...]` is not a valid attribute @@ -696,7 +698,7 @@ struct SubdiagnosticBadStr { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticBadTwice { #[subdiagnostic(bad, bad)] //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute @@ -704,7 +706,7 @@ struct SubdiagnosticBadTwice { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticBadLitStr { #[subdiagnostic("bad")] //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute @@ -712,7 +714,7 @@ struct SubdiagnosticBadLitStr { } #[derive(LintDiagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticEagerLint { #[subdiagnostic(eager)] //~^ ERROR `#[subdiagnostic(...)]` is not a valid attribute @@ -720,7 +722,7 @@ struct SubdiagnosticEagerLint { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticEagerCorrect { #[subdiagnostic(eager)] note: Note, @@ -731,7 +733,7 @@ struct SubdiagnosticEagerCorrect { // after the `span_suggestion` call - which breaks eager translation. #[derive(Subdiagnostic)] -#[suggestion(use_instead, applicability = "machine-applicable", code = "{correct}")] +#[suggestion(no_crate_example, applicability = "machine-applicable", code = "{correct}")] pub(crate) struct SubdiagnosticWithSuggestion { #[primary_span] span: Span, @@ -740,7 +742,7 @@ pub(crate) struct SubdiagnosticWithSuggestion { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SubdiagnosticEagerSuggestion { #[subdiagnostic(eager)] sub: SubdiagnosticWithSuggestion, @@ -748,7 +750,7 @@ struct SubdiagnosticEagerSuggestion { /// with a doc comment on the type.. #[derive(Diagnostic)] -#[diag(compiletest_example, code = "E0123")] +#[diag(no_crate_example, code = "E0123")] struct WithDocComment { /// ..and the field #[primary_span] @@ -756,21 +758,21 @@ struct WithDocComment { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionsGood { #[suggestion(code("foo", "bar"))] sub: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionsSingleItem { #[suggestion(code("foo"))] sub: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionsNoItem { #[suggestion(code())] //~^ ERROR expected at least one string literal for `code(...)` @@ -778,7 +780,7 @@ struct SuggestionsNoItem { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionsInvalidItem { #[suggestion(code(foo))] //~^ ERROR `code(...)` must contain only string literals @@ -786,7 +788,7 @@ struct SuggestionsInvalidItem { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionsInvalidLiteral { #[suggestion(code = 3)] //~^ ERROR `code = "..."`/`code(...)` must contain only string literals @@ -794,16 +796,16 @@ struct SuggestionsInvalidLiteral { } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionStyleGood { #[suggestion(code = "", style = "hidden")] sub: Span, } #[derive(Diagnostic)] -#[diag(compiletest_example)] +#[diag(no_crate_example)] struct SuggestionOnVec { - #[suggestion(suggestion, code = "")] + #[suggestion(no_crate_suggestion, code = "")] //~^ ERROR `#[suggestion(...)]` is not a valid attribute sub: Vec<Span>, } diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 61806c80efc..fc0cd8419e4 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -1,11 +1,11 @@ error: unsupported type attribute for diagnostic derive enum - --> $DIR/diagnostic-derive.rs:39:1 + --> $DIR/diagnostic-derive.rs:41:1 | -LL | #[diag(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diag(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:42:5 + --> $DIR/diagnostic-derive.rs:44:5 | LL | Foo, | ^^^ @@ -13,7 +13,7 @@ LL | Foo, = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:44:5 + --> $DIR/diagnostic-derive.rs:46:5 | LL | Bar, | ^^^ @@ -21,21 +21,21 @@ LL | Bar, = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:50:1 + --> $DIR/diagnostic-derive.rs:52:1 | LL | #[diag = "E0123"] | ^^^^^^^^^^^^^^^^^ error: `#[nonsense(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:55:1 + --> $DIR/diagnostic-derive.rs:57:1 | -LL | #[nonsense(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[nonsense(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:55:1 + --> $DIR/diagnostic-derive.rs:57:1 | -LL | / #[nonsense(compiletest_example, code = "E0123")] +LL | / #[nonsense(no_crate_example, code = "E0123")] LL | | LL | | LL | | @@ -45,7 +45,7 @@ LL | | struct InvalidStructAttr {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag("...")]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:62:8 + --> $DIR/diagnostic-derive.rs:64:8 | LL | #[diag("E0123")] | ^^^^^^^ @@ -53,7 +53,7 @@ LL | #[diag("E0123")] = help: a diagnostic slug is required as the first argument error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:62:1 + --> $DIR/diagnostic-derive.rs:64:1 | LL | / #[diag("E0123")] LL | | @@ -64,7 +64,7 @@ LL | | struct InvalidLitNestedAttr {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag(nonsense(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:73:8 + --> $DIR/diagnostic-derive.rs:75:8 | LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")] | ^^^^^^^^^^^^^^^ @@ -72,7 +72,7 @@ LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")] = help: a diagnostic slug is required as the first argument error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:73:1 + --> $DIR/diagnostic-derive.rs:75:1 | LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")] LL | | @@ -83,7 +83,7 @@ LL | | struct InvalidNestedStructAttr1 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:79:8 + --> $DIR/diagnostic-derive.rs:81:8 | LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] | ^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] = help: only `code` is a valid nested attributes following the slug error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:79:42 + --> $DIR/diagnostic-derive.rs:81:42 | LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] | ^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")] = help: only `code` is a valid nested attributes following the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:79:1 + --> $DIR/diagnostic-derive.rs:81:1 | LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")] LL | | @@ -111,13 +111,13 @@ LL | | struct InvalidNestedStructAttr2 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:86:8 + --> $DIR/diagnostic-derive.rs:88:8 | LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] | ^^^^^^^^^^^^ error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:86:38 + --> $DIR/diagnostic-derive.rs:88:38 | LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] | ^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")] = help: only `code` is a valid nested attributes following the slug error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:86:1 + --> $DIR/diagnostic-derive.rs:88:1 | LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")] LL | | @@ -137,65 +137,65 @@ LL | | struct InvalidNestedStructAttr3 {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[diag(slug = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:93:45 + --> $DIR/diagnostic-derive.rs:95:42 | -LL | #[diag(compiletest_example, code = "E0123", slug = "foo")] - | ^^^^^^^^^^^^ +LL | #[diag(no_crate_example, code = "E0123", slug = "foo")] + | ^^^^^^^^^^^^ | = help: only `code` is a valid nested attributes following the slug error: `#[suggestion = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:100:5 + --> $DIR/diagnostic-derive.rs:102:5 | LL | #[suggestion = "bar"] | ^^^^^^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:107:8 + --> $DIR/diagnostic-derive.rs:109:8 | -LL | #[diag(compiletest_example, code = "E0456")] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[diag(no_crate_example, code = "E0456")] + | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:106:8 + --> $DIR/diagnostic-derive.rs:108:8 | -LL | #[diag(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[diag(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:107:36 + --> $DIR/diagnostic-derive.rs:109:33 | -LL | #[diag(compiletest_example, code = "E0456")] - | ^^^^^^^ +LL | #[diag(no_crate_example, code = "E0456")] + | ^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:106:36 + --> $DIR/diagnostic-derive.rs:108:33 | -LL | #[diag(compiletest_example, code = "E0123")] - | ^^^^^^^ +LL | #[diag(no_crate_example, code = "E0123")] + | ^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:113:52 + --> $DIR/diagnostic-derive.rs:115:49 | -LL | #[diag(compiletest_example, code = "E0456", code = "E0457")] - | ^^^^^^^ +LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] + | ^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:113:36 + --> $DIR/diagnostic-derive.rs:115:33 | -LL | #[diag(compiletest_example, code = "E0456", code = "E0457")] - | ^^^^^^^ +LL | #[diag(no_crate_example, code = "E0456", code = "E0457")] + | ^^^^^^^ -error: `#[diag(compiletest_example)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:118:29 +error: `#[diag(no_crate::example)]` is not a valid attribute + --> $DIR/diagnostic-derive.rs:120:26 | -LL | #[diag(compiletest_example, compiletest_example, code = "E0456")] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[diag(no_crate_example, no_crate::example, code = "E0456")] + | ^^^^^^^^^^^^^^^^^ | = help: diagnostic slug must be the first argument error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:123:1 + --> $DIR/diagnostic-derive.rs:125:1 | LL | struct KindNotProvided {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -203,7 +203,7 @@ LL | struct KindNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:126:1 + --> $DIR/diagnostic-derive.rs:128:1 | LL | / #[diag(code = "E0456")] LL | | @@ -213,31 +213,31 @@ LL | | struct SlugNotProvided {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:137:5 + --> $DIR/diagnostic-derive.rs:139:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: `#[nonsense]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:145:5 + --> $DIR/diagnostic-derive.rs:147:5 | LL | #[nonsense] | ^^^^^^^^^^^ error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/diagnostic-derive.rs:162:5 + --> $DIR/diagnostic-derive.rs:164:5 | -LL | #[label(label)] - | ^^^^^^^^^^^^^^^ +LL | #[label(no_crate_label)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `name` doesn't refer to a field on this type - --> $DIR/diagnostic-derive.rs:170:37 + --> $DIR/diagnostic-derive.rs:172:46 | -LL | #[suggestion(suggestion, code = "{name}")] - | ^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "{name}")] + | ^^^^^^^^ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/diagnostic-derive.rs:175:10 + --> $DIR/diagnostic-derive.rs:177:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ expected `'}'` in format string @@ -246,7 +246,7 @@ LL | #[derive(Diagnostic)] = 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 - --> $DIR/diagnostic-derive.rs:185:10 + --> $DIR/diagnostic-derive.rs:187:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ unmatched `}` in format string @@ -255,19 +255,19 @@ LL | #[derive(Diagnostic)] = 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` - --> $DIR/diagnostic-derive.rs:205:5 + --> $DIR/diagnostic-derive.rs:207:5 | -LL | #[label(label)] - | ^^^^^^^^^^^^^^^ +LL | #[label(no_crate_label)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:224:5 + --> $DIR/diagnostic-derive.rs:226:5 | -LL | #[suggestion(suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion(nonsense = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:232:18 + --> $DIR/diagnostic-derive.rs:234:18 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^ @@ -275,13 +275,13 @@ LL | #[suggestion(nonsense = "bar")] = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:232:5 + --> $DIR/diagnostic-derive.rs:234:5 | LL | #[suggestion(nonsense = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion(msg = ...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:241:18 + --> $DIR/diagnostic-derive.rs:243:18 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^ @@ -289,15 +289,15 @@ LL | #[suggestion(msg = "bar")] = help: only `style`, `code` and `applicability` are valid nested attributes error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:241:5 + --> $DIR/diagnostic-derive.rs:243:5 | LL | #[suggestion(msg = "bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: wrong field type for suggestion - --> $DIR/diagnostic-derive.rs:264:5 + --> $DIR/diagnostic-derive.rs:266:5 | -LL | / #[suggestion(suggestion, code = "This is suggested code")] +LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")] LL | | LL | | suggestion: Applicability, | |_____________________________^ @@ -305,75 +305,75 @@ LL | | suggestion: Applicability, = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` error: specified multiple times - --> $DIR/diagnostic-derive.rs:280:24 + --> $DIR/diagnostic-derive.rs:282:24 | LL | suggestion: (Span, Span, Applicability), | ^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:280:18 + --> $DIR/diagnostic-derive.rs:282:18 | LL | suggestion: (Span, Span, Applicability), | ^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:288:33 + --> $DIR/diagnostic-derive.rs:290:33 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:288:18 + --> $DIR/diagnostic-derive.rs:290:18 | LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:295:5 + --> $DIR/diagnostic-derive.rs:297:5 | LL | #[label = "bar"] | ^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/diagnostic-derive.rs:446:44 + --> $DIR/diagnostic-derive.rs:448:53 | -LL | #[suggestion(suggestion, code = "...", applicability = "maybe-incorrect")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:448:24 + --> $DIR/diagnostic-derive.rs:450:24 | LL | suggestion: (Span, Applicability), | ^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/diagnostic-derive.rs:454:44 + --> $DIR/diagnostic-derive.rs:456:53 | -LL | #[suggestion(suggestion, code = "...", applicability = "batman")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[label(foo)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:517:20 + --> $DIR/diagnostic-derive.rs:519:29 | -LL | #[label(label, foo)] - | ^^^ +LL | #[label(no_crate_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:525:20 + --> $DIR/diagnostic-derive.rs:527:29 | -LL | #[label(label, foo = "...")] - | ^^^^^^^^^^^ +LL | #[label(no_crate_label, foo = "...")] + | ^^^^^^^^^^^ error: `#[label(foo(...))]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:533:20 + --> $DIR/diagnostic-derive.rs:535:29 | -LL | #[label(label, foo("..."))] - | ^^^^^^^^^^ +LL | #[label(no_crate_label, foo("..."))] + | ^^^^^^^^^^ error: `#[primary_span]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:545:5 + --> $DIR/diagnostic-derive.rs:547:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -381,15 +381,15 @@ LL | #[primary_span] = help: the `primary_span` field attribute is not valid for lint diagnostics error: `#[error(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:565:1 + --> $DIR/diagnostic-derive.rs:567:1 | -LL | #[error(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[error(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:565:1 + --> $DIR/diagnostic-derive.rs:567:1 | -LL | / #[error(compiletest_example, code = "E0123")] +LL | / #[error(no_crate_example, code = "E0123")] LL | | LL | | LL | | @@ -399,15 +399,15 @@ LL | | struct ErrorAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[warn_(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:572:1 + --> $DIR/diagnostic-derive.rs:574:1 | -LL | #[warn_(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[warn_(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:572:1 + --> $DIR/diagnostic-derive.rs:574:1 | -LL | / #[warn_(compiletest_example, code = "E0123")] +LL | / #[warn_(no_crate_example, code = "E0123")] LL | | LL | | LL | | @@ -417,15 +417,15 @@ LL | | struct WarnAttribute {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:579:1 + --> $DIR/diagnostic-derive.rs:581:1 | -LL | #[lint(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[lint(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:579:1 + --> $DIR/diagnostic-derive.rs:581:1 | -LL | / #[lint(compiletest_example, code = "E0123")] +LL | / #[lint(no_crate_example, code = "E0123")] LL | | LL | | LL | | @@ -435,21 +435,21 @@ LL | | struct LintAttributeOnSessionDiag {} = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:586:1 + --> $DIR/diagnostic-derive.rs:588:1 | -LL | #[lint(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[lint(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[lint(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:586:1 + --> $DIR/diagnostic-derive.rs:588:1 | -LL | #[lint(compiletest_example, code = "E0123")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[lint(no_crate_example, code = "E0123")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug not specified - --> $DIR/diagnostic-derive.rs:586:1 + --> $DIR/diagnostic-derive.rs:588:1 | -LL | / #[lint(compiletest_example, code = "E0123")] +LL | / #[lint(no_crate_example, code = "E0123")] LL | | LL | | LL | | @@ -460,19 +460,19 @@ LL | | struct LintAttributeOnLintDiag {} = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]` error: specified multiple times - --> $DIR/diagnostic-derive.rs:596:44 + --> $DIR/diagnostic-derive.rs:598:53 | -LL | #[suggestion(suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] + | ^^^^^^^^^^^^ | note: previously specified here - --> $DIR/diagnostic-derive.rs:596:30 + --> $DIR/diagnostic-derive.rs:598:39 | -LL | #[suggestion(suggestion, code = "...", code = ",,,")] - | ^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] + | ^^^^^^^^^^^^ error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:605:24 + --> $DIR/diagnostic-derive.rs:607:24 | LL | suggestion: (Span, usize), | ^^^^^ @@ -480,7 +480,7 @@ LL | suggestion: (Span, usize), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: wrong types for suggestion - --> $DIR/diagnostic-derive.rs:613:17 + --> $DIR/diagnostic-derive.rs:615:17 | LL | suggestion: (Span,), | ^^^^^^^ @@ -488,21 +488,21 @@ LL | suggestion: (Span,), = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` error: suggestion without `code = "..."` - --> $DIR/diagnostic-derive.rs:620:5 + --> $DIR/diagnostic-derive.rs:622:5 | -LL | #[suggestion(suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:627:1 + --> $DIR/diagnostic-derive.rs:629:1 | -LL | #[multipart_suggestion(suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[multipart_suggestion(no_crate_suggestion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider creating a `Subdiagnostic` instead error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:630:1 + --> $DIR/diagnostic-derive.rs:632:1 | LL | #[multipart_suggestion()] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -510,23 +510,23 @@ LL | #[multipart_suggestion()] = help: consider creating a `Subdiagnostic` instead error: `#[multipart_suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:634:5 + --> $DIR/diagnostic-derive.rs:636:5 | -LL | #[multipart_suggestion(suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[multipart_suggestion(no_crate_suggestion)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider creating a `Subdiagnostic` instead error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:642:1 + --> $DIR/diagnostic-derive.rs:644:1 | -LL | #[suggestion(suggestion, code = "...")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "...")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: `#[label]` and `#[suggestion]` can only be applied to fields error: `#[label]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:651:1 + --> $DIR/diagnostic-derive.rs:653:1 | LL | #[label] | ^^^^^^^^ @@ -534,7 +534,7 @@ LL | #[label] = help: `#[label]` and `#[suggestion]` can only be applied to fields error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:685:5 + --> $DIR/diagnostic-derive.rs:687:5 | LL | #[subdiagnostic(bad)] | ^^^^^^^^^^^^^^^^^^^^^ @@ -542,13 +542,13 @@ LL | #[subdiagnostic(bad)] = help: `eager` is the only supported nested attribute for `subdiagnostic` error: `#[subdiagnostic = ...]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:693:5 + --> $DIR/diagnostic-derive.rs:695:5 | LL | #[subdiagnostic = "bad"] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:701:5 + --> $DIR/diagnostic-derive.rs:703:5 | LL | #[subdiagnostic(bad, bad)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -556,7 +556,7 @@ LL | #[subdiagnostic(bad, bad)] = help: `eager` is the only supported nested attribute for `subdiagnostic` error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:709:5 + --> $DIR/diagnostic-derive.rs:711:5 | LL | #[subdiagnostic("bad")] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -564,7 +564,7 @@ LL | #[subdiagnostic("bad")] = help: `eager` is the only supported nested attribute for `subdiagnostic` error: `#[subdiagnostic(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:717:5 + --> $DIR/diagnostic-derive.rs:719:5 | LL | #[subdiagnostic(eager)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -572,95 +572,95 @@ LL | #[subdiagnostic(eager)] = help: eager subdiagnostics are not supported on lints error: expected at least one string literal for `code(...)` - --> $DIR/diagnostic-derive.rs:775:18 + --> $DIR/diagnostic-derive.rs:777:18 | LL | #[suggestion(code())] | ^^^^^^ error: `code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:783:23 + --> $DIR/diagnostic-derive.rs:785:23 | LL | #[suggestion(code(foo))] | ^^^ error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/diagnostic-derive.rs:791:18 + --> $DIR/diagnostic-derive.rs:793:18 | LL | #[suggestion(code = 3)] | ^^^^^^^^ error: `#[suggestion(...)]` is not a valid attribute - --> $DIR/diagnostic-derive.rs:806:5 + --> $DIR/diagnostic-derive.rs:808:5 | -LL | #[suggestion(suggestion, code = "")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_suggestion, code = "")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[suggestion(...)]` applied to `Vec` field is ambiguous = help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]` = help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]` error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:55:3 + --> $DIR/diagnostic-derive.rs:57:3 | -LL | #[nonsense(compiletest_example, code = "E0123")] +LL | #[nonsense(no_crate_example, code = "E0123")] | ^^^^^^^^ error: cannot find attribute `nonsense` in this scope - --> $DIR/diagnostic-derive.rs:145:7 + --> $DIR/diagnostic-derive.rs:147:7 | LL | #[nonsense] | ^^^^^^^^ error: cannot find attribute `error` in this scope - --> $DIR/diagnostic-derive.rs:565:3 + --> $DIR/diagnostic-derive.rs:567:3 | -LL | #[error(compiletest_example, code = "E0123")] +LL | #[error(no_crate_example, code = "E0123")] | ^^^^^ error: cannot find attribute `warn_` in this scope - --> $DIR/diagnostic-derive.rs:572:3 + --> $DIR/diagnostic-derive.rs:574:3 | -LL | #[warn_(compiletest_example, code = "E0123")] +LL | #[warn_(no_crate_example, code = "E0123")] | ^^^^^ help: a built-in attribute with a similar name exists: `warn` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:579:3 + --> $DIR/diagnostic-derive.rs:581:3 | -LL | #[lint(compiletest_example, code = "E0123")] +LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `lint` in this scope - --> $DIR/diagnostic-derive.rs:586:3 + --> $DIR/diagnostic-derive.rs:588:3 | -LL | #[lint(compiletest_example, code = "E0123")] +LL | #[lint(no_crate_example, code = "E0123")] | ^^^^ help: a built-in attribute with a similar name exists: `link` error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:627:3 + --> $DIR/diagnostic-derive.rs:629:3 | -LL | #[multipart_suggestion(suggestion)] +LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:630:3 + --> $DIR/diagnostic-derive.rs:632:3 | LL | #[multipart_suggestion()] | ^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `multipart_suggestion` in this scope - --> $DIR/diagnostic-derive.rs:634:7 + --> $DIR/diagnostic-derive.rs:636:7 | -LL | #[multipart_suggestion(suggestion)] +LL | #[multipart_suggestion(no_crate_suggestion)] | ^^^^^^^^^^^^^^^^^^^^ -error[E0425]: cannot find value `nonsense` in module `rustc_errors::fluent` - --> $DIR/diagnostic-derive.rs:68:8 +error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated` + --> $DIR/diagnostic-derive.rs:70:8 | LL | #[diag(nonsense, code = "E0123")] - | ^^^^^^^^ not found in `rustc_errors::fluent` + | ^^^^^^^^ not found in `crate::fluent_generated` error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:339:10 + --> $DIR/diagnostic-derive.rs:341:10 | LL | #[derive(Diagnostic)] | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` diff --git a/tests/ui-fulldeps/session-diagnostic/example.ftl b/tests/ui-fulldeps/session-diagnostic/example.ftl new file mode 100644 index 00000000000..cb2d476d815 --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/example.ftl @@ -0,0 +1,5 @@ +no_crate_example = this is an example message used in testing + .note = with a note + .help = with a help + .suggestion = with a suggestion + .label = with a label diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs index 09ad6964909..c882f7792d5 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.rs @@ -15,12 +15,14 @@ extern crate rustc_macros; extern crate rustc_session; extern crate rustc_span; -use rustc_errors::Applicability; -use rustc_macros::Subdiagnostic; +use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage}; +use rustc_macros::{fluent_messages, Subdiagnostic}; use rustc_span::Span; +fluent_messages! { "./example.ftl" } + #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct A { #[primary_span] span: Span, @@ -29,13 +31,13 @@ struct A { #[derive(Subdiagnostic)] enum B { - #[label(parse_add_paren)] + #[label(no_crate_example)] A { #[primary_span] span: Span, var: String, }, - #[label(parse_add_paren)] + #[label(no_crate_example)] B { #[primary_span] span: Span, @@ -44,7 +46,7 @@ enum B { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] //~^ ERROR label without `#[primary_span]` field struct C { var: String, @@ -120,8 +122,8 @@ struct K { #[derive(Subdiagnostic)] #[label(slug)] -//~^ ERROR cannot find value `slug` in module `rustc_errors::fluent` -//~^^ NOTE not found in `rustc_errors::fluent` +//~^ ERROR cannot find value `slug` in module `crate::fluent_generated` +//~^^ NOTE not found in `crate::fluent_generated` struct L { #[primary_span] span: Span, @@ -138,7 +140,7 @@ struct M { } #[derive(Subdiagnostic)] -#[label(parse_add_paren, code = "...")] +#[label(no_crate_example, code = "...")] //~^ ERROR `#[label(code = ...)]` is not a valid attribute struct N { #[primary_span] @@ -147,7 +149,7 @@ struct N { } #[derive(Subdiagnostic)] -#[label(parse_add_paren, applicability = "machine-applicable")] +#[label(no_crate_example, applicability = "machine-applicable")] //~^ ERROR `#[label(applicability = ...)]` is not a valid attribute struct O { #[primary_span] @@ -160,7 +162,7 @@ struct O { //~^ ERROR cannot find attribute `foo` in this scope //~^^ ERROR unsupported type attribute for subdiagnostic enum enum P { - #[label(parse_add_paren)] + #[label(no_crate_example)] A { #[primary_span] span: Span, @@ -230,7 +232,7 @@ enum U { #[derive(Subdiagnostic)] enum V { - #[label(parse_add_paren)] + #[label(no_crate_example)] A { #[primary_span] span: Span, @@ -244,7 +246,7 @@ enum V { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] //~^ ERROR label without `#[primary_span]` field struct W { #[primary_span] @@ -253,7 +255,7 @@ struct W { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct X { #[primary_span] span: Span, @@ -263,7 +265,7 @@ struct X { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct Y { #[primary_span] span: Span, @@ -274,7 +276,7 @@ struct Y { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct Z { #[primary_span] span: Span, @@ -285,7 +287,7 @@ struct Z { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct AA { #[primary_span] span: Span, @@ -296,7 +298,7 @@ struct AA { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct AB { #[primary_span] span: Span, @@ -312,23 +314,23 @@ union AC { } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] -#[label(parse_add_paren)] +#[label(no_crate_example)] +#[label(no_crate_example)] struct AD { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[label(parse_add_paren, parse_add_paren)] -//~^ ERROR `#[label(parse_add_paren)]` is not a valid attribute +#[label(no_crate_example, no_crate::example)] +//~^ ERROR `#[label(no_crate::example)]` is not a valid attribute struct AE { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct AF { #[primary_span] //~^ NOTE previously specified here @@ -346,7 +348,7 @@ struct AG { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] struct AH { #[primary_span] span: Span, @@ -357,7 +359,7 @@ struct AH { #[derive(Subdiagnostic)] enum AI { - #[suggestion(parse_add_paren, code = "...")] + #[suggestion(no_crate_example, code = "...")] A { #[primary_span] span: Span, @@ -365,7 +367,7 @@ enum AI { applicability: Applicability, var: String, }, - #[suggestion(parse_add_paren, code = "...")] + #[suggestion(no_crate_example, code = "...")] B { #[primary_span] span: Span, @@ -376,7 +378,7 @@ enum AI { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...", code = "...")] +#[suggestion(no_crate_example, code = "...", code = "...")] //~^ ERROR specified multiple times //~^^ NOTE previously specified here struct AJ { @@ -387,7 +389,7 @@ struct AJ { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] struct AK { #[primary_span] span: Span, @@ -400,7 +402,7 @@ struct AK { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] struct AL { #[primary_span] span: Span, @@ -410,14 +412,14 @@ struct AL { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] struct AM { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren)] +#[suggestion(no_crate_example)] //~^ ERROR suggestion without `code = "..."` struct AN { #[primary_span] @@ -427,7 +429,7 @@ struct AN { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...", applicability = "foo")] +#[suggestion(no_crate_example, code = "...", applicability = "foo")] //~^ ERROR invalid applicability struct AO { #[primary_span] @@ -435,24 +437,24 @@ struct AO { } #[derive(Subdiagnostic)] -#[help(parse_add_paren)] +#[help(no_crate_example)] struct AP { var: String, } #[derive(Subdiagnostic)] -#[note(parse_add_paren)] +#[note(no_crate_example)] struct AQ; #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] //~^ ERROR suggestion without `#[primary_span]` field struct AR { var: String, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] +#[suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] struct AS { #[primary_span] span: Span, @@ -462,7 +464,7 @@ struct AS { #[label] //~^ ERROR unsupported type attribute for subdiagnostic enum enum AT { - #[label(parse_add_paren)] + #[label(no_crate_example)] A { #[primary_span] span: Span, @@ -471,7 +473,7 @@ enum AT { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] +#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] struct AU { #[primary_span] span: Span, @@ -479,7 +481,7 @@ struct AU { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] +#[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] //~^ ERROR `var` doesn't refer to a field on this type struct AV { #[primary_span] @@ -488,7 +490,7 @@ struct AV { #[derive(Subdiagnostic)] enum AW { - #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] + #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] A { #[primary_span] span: Span, @@ -498,7 +500,7 @@ enum AW { #[derive(Subdiagnostic)] enum AX { - #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] + #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] //~^ ERROR `var` doesn't refer to a field on this type A { #[primary_span] @@ -507,18 +509,18 @@ enum AX { } #[derive(Subdiagnostic)] -#[warning(parse_add_paren)] +#[warning(no_crate_example)] struct AY {} #[derive(Subdiagnostic)] -#[warning(parse_add_paren)] +#[warning(no_crate_example)] struct AZ { #[primary_span] span: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "...")] +#[suggestion(no_crate_example, code = "...")] //~^ ERROR suggestion without `#[primary_span]` field struct BA { #[suggestion_part] @@ -533,7 +535,7 @@ struct BA { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, 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 +543,7 @@ struct BBa { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BBb { #[suggestion_part] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -549,7 +551,7 @@ struct BBb { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BBc { #[suggestion_part()] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -557,7 +559,7 @@ struct BBc { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] //~^ ERROR multipart suggestion without any `#[suggestion_part(...)]` fields struct BC { #[primary_span] @@ -566,7 +568,7 @@ struct BC { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BD { #[suggestion_part] //~^ ERROR `#[suggestion_part(...)]` attribute without `code = "..."` @@ -586,7 +588,7 @@ struct BD { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BE { #[suggestion_part(code = "...", code = ",,,")] //~^ ERROR specified multiple times @@ -595,7 +597,7 @@ struct BE { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BF { #[suggestion_part(code = "(")] first: Span, @@ -604,7 +606,7 @@ struct BF { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BG { #[applicability] appl: Applicability, @@ -615,7 +617,7 @@ struct BG { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BH { #[applicability] //~^ ERROR `#[applicability]` has no effect @@ -627,14 +629,14 @@ struct BH { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren, applicability = "machine-applicable")] +#[multipart_suggestion(no_crate_example, applicability = "machine-applicable")] struct BI { #[suggestion_part(code = "")] spans: Vec<Span>, } #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct BJ { #[primary_span] span: Span, @@ -643,7 +645,7 @@ struct BJ { /// with a doc comment on the type.. #[derive(Subdiagnostic)] -#[label(parse_add_paren)] +#[label(no_crate_example)] struct BK { /// ..and the field #[primary_span] @@ -654,7 +656,7 @@ struct BK { #[derive(Subdiagnostic)] enum BL { /// ..and the variant.. - #[label(parse_add_paren)] + #[label(no_crate_example)] Foo { /// ..and the field #[primary_span] @@ -663,7 +665,7 @@ enum BL { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BM { #[suggestion_part(code("foo"))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -672,7 +674,7 @@ struct BM { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BN { #[suggestion_part(code("foo", "bar"))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -681,7 +683,7 @@ struct BN { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BO { #[suggestion_part(code(3))] //~^ ERROR expected exactly one string literal for `code = ...` @@ -690,7 +692,7 @@ struct BO { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BP { #[suggestion_part(code())] //~^ ERROR expected exactly one string literal for `code = ...` @@ -699,7 +701,7 @@ struct BP { } #[derive(Subdiagnostic)] -#[multipart_suggestion(parse_add_paren)] +#[multipart_suggestion(no_crate_example)] struct BQ { #[suggestion_part(code = 3)] //~^ ERROR `code = "..."`/`code(...)` must contain only string literals @@ -708,42 +710,42 @@ struct BQ { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "")] +#[suggestion(no_crate_example, code = "")] struct SuggestionStyleDefault { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "short")] +#[suggestion(no_crate_example, code = "", style = "short")] struct SuggestionStyleShort { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "hidden")] +#[suggestion(no_crate_example, code = "", style = "hidden")] struct SuggestionStyleHidden { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "verbose")] +#[suggestion(no_crate_example, code = "", style = "verbose")] struct SuggestionStyleVerbose { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "tool-only")] +#[suggestion(no_crate_example, code = "", style = "tool-only")] struct SuggestionStyleToolOnly { #[primary_span] sub: Span, } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] +#[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] //~^ ERROR specified multiple times //~| NOTE previously specified here struct SuggestionStyleTwice { @@ -752,7 +754,7 @@ struct SuggestionStyleTwice { } #[derive(Subdiagnostic)] -#[suggestion_hidden(parse_add_paren, code = "")] +#[suggestion_hidden(no_crate_example, code = "")] //~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute struct SuggestionStyleOldSyntax { #[primary_span] @@ -760,7 +762,7 @@ struct SuggestionStyleOldSyntax { } #[derive(Subdiagnostic)] -#[suggestion_hidden(parse_add_paren, code = "", style = "normal")] +#[suggestion_hidden(no_crate_example, code = "", style = "normal")] //~^ ERROR #[suggestion_hidden(...)]` is not a valid attribute struct SuggestionStyleOldAndNewSyntax { #[primary_span] @@ -768,7 +770,7 @@ struct SuggestionStyleOldAndNewSyntax { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = "foo")] +#[suggestion(no_crate_example, code = "", style = "foo")] //~^ ERROR invalid suggestion style struct SuggestionStyleInvalid1 { #[primary_span] @@ -776,7 +778,7 @@ struct SuggestionStyleInvalid1 { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style = 42)] +#[suggestion(no_crate_example, code = "", style = 42)] //~^ ERROR `#[suggestion(style = ...)]` is not a valid attribute struct SuggestionStyleInvalid2 { #[primary_span] @@ -784,7 +786,7 @@ struct SuggestionStyleInvalid2 { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style)] +#[suggestion(no_crate_example, code = "", style)] //~^ ERROR `#[suggestion(style)]` is not a valid attribute struct SuggestionStyleInvalid3 { #[primary_span] @@ -792,7 +794,7 @@ struct SuggestionStyleInvalid3 { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "", style("foo"))] +#[suggestion(no_crate_example, code = "", style("foo"))] //~^ ERROR `#[suggestion(style(...))]` is not a valid attribute struct SuggestionStyleInvalid4 { #[primary_span] @@ -800,7 +802,7 @@ struct SuggestionStyleInvalid4 { } #[derive(Subdiagnostic)] -#[suggestion(parse_add_paren, code = "")] +#[suggestion(no_crate_example, code = "")] //~^ ERROR suggestion without `#[primary_span]` field struct PrimarySpanOnVec { #[primary_span] diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index f9d1a63031d..343134af6bc 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -1,7 +1,7 @@ error: label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:47:1 + --> $DIR/subdiagnostic-derive.rs:49:1 | -LL | / #[label(parse_add_paren)] +LL | / #[label(no_crate_example)] LL | | LL | | struct C { LL | | var: String, @@ -9,141 +9,141 @@ LL | | } | |_^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:54:1 + --> $DIR/subdiagnostic-derive.rs:56:1 | LL | #[label] | ^^^^^^^^ error: `#[foo]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:63:1 + --> $DIR/subdiagnostic-derive.rs:65:1 | LL | #[foo] | ^^^^^^ error: `#[label = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:73:1 + --> $DIR/subdiagnostic-derive.rs:75:1 | LL | #[label = "..."] | ^^^^^^^^^^^^^^^^ error: `#[label(bug = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:82:9 + --> $DIR/subdiagnostic-derive.rs:84:9 | LL | #[label(bug = "...")] | ^^^^^^^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:82:1 + --> $DIR/subdiagnostic-derive.rs:84:1 | LL | #[label(bug = "...")] | ^^^^^^^^^^^^^^^^^^^^^ error: `#[label("...")]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:92:9 + --> $DIR/subdiagnostic-derive.rs:94:9 | LL | #[label("...")] | ^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:92:1 + --> $DIR/subdiagnostic-derive.rs:94:1 | LL | #[label("...")] | ^^^^^^^^^^^^^^^ error: `#[label(slug = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:102:9 + --> $DIR/subdiagnostic-derive.rs:104:9 | LL | #[label(slug = 4)] | ^^^^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:102:1 + --> $DIR/subdiagnostic-derive.rs:104:1 | LL | #[label(slug = 4)] | ^^^^^^^^^^^^^^^^^^ error: `#[label(slug(...))]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:112:9 + --> $DIR/subdiagnostic-derive.rs:114:9 | LL | #[label(slug("..."))] | ^^^^^^^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:112:1 + --> $DIR/subdiagnostic-derive.rs:114:1 | LL | #[label(slug("..."))] | ^^^^^^^^^^^^^^^^^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:132:1 + --> $DIR/subdiagnostic-derive.rs:134:1 | LL | #[label()] | ^^^^^^^^^^ error: `#[label(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:141:26 + --> $DIR/subdiagnostic-derive.rs:143:27 | -LL | #[label(parse_add_paren, code = "...")] - | ^^^^^^^^^^^^ +LL | #[label(no_crate_example, code = "...")] + | ^^^^^^^^^^^^ error: `#[label(applicability = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:150:26 + --> $DIR/subdiagnostic-derive.rs:152:27 | -LL | #[label(parse_add_paren, applicability = "machine-applicable")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[label(no_crate_example, applicability = "machine-applicable")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:159:1 + --> $DIR/subdiagnostic-derive.rs:161:1 | LL | #[foo] | ^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:173:5 + --> $DIR/subdiagnostic-derive.rs:175:5 | LL | #[bar] | ^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:185:5 + --> $DIR/subdiagnostic-derive.rs:187:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:197:5 + --> $DIR/subdiagnostic-derive.rs:199:5 | LL | #[bar = 4] | ^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:209:5 + --> $DIR/subdiagnostic-derive.rs:211:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ error: `#[label(code = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:221:13 + --> $DIR/subdiagnostic-derive.rs:223:13 | LL | #[label(code = "...")] | ^^^^^^^^^^^^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive.rs:221:5 + --> $DIR/subdiagnostic-derive.rs:223:5 | LL | #[label(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:250:5 + --> $DIR/subdiagnostic-derive.rs:252:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:247:1 + --> $DIR/subdiagnostic-derive.rs:249:1 | -LL | / #[label(parse_add_paren)] +LL | / #[label(no_crate_example)] LL | | LL | | struct W { LL | | #[primary_span] @@ -153,13 +153,13 @@ LL | | } | |_^ error: `#[applicability]` is only valid on suggestions - --> $DIR/subdiagnostic-derive.rs:260:5 + --> $DIR/subdiagnostic-derive.rs:262:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:270:5 + --> $DIR/subdiagnostic-derive.rs:272:5 | LL | #[bar] | ^^^^^^ @@ -167,13 +167,13 @@ LL | #[bar] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:281:5 + --> $DIR/subdiagnostic-derive.rs:283:5 | LL | #[bar = "..."] | ^^^^^^^^^^^^^^ error: `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:292:5 + --> $DIR/subdiagnostic-derive.rs:294:5 | LL | #[bar("...")] | ^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | #[bar("...")] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: unexpected unsupported untagged union - --> $DIR/subdiagnostic-derive.rs:308:1 + --> $DIR/subdiagnostic-derive.rs:310:1 | LL | / union AC { LL | | @@ -190,78 +190,78 @@ LL | | b: u64, LL | | } | |_^ -error: `#[label(parse_add_paren)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:323:26 +error: `#[label(no_crate::example)]` is not a valid attribute + --> $DIR/subdiagnostic-derive.rs:325:27 | -LL | #[label(parse_add_paren, parse_add_paren)] - | ^^^^^^^^^^^^^^^ +LL | #[label(no_crate_example, no_crate::example)] + | ^^^^^^^^^^^^^^^^^ | = help: a diagnostic slug must be the first argument to the attribute error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:336:5 + --> $DIR/subdiagnostic-derive.rs:338:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:333:5 + --> $DIR/subdiagnostic-derive.rs:335:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ error: subdiagnostic kind not specified - --> $DIR/subdiagnostic-derive.rs:342:8 + --> $DIR/subdiagnostic-derive.rs:344:8 | LL | struct AG { | ^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:379:45 + --> $DIR/subdiagnostic-derive.rs:381:46 | -LL | #[suggestion(parse_add_paren, code = "...", code = "...")] - | ^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "...", code = "...")] + | ^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:379:31 + --> $DIR/subdiagnostic-derive.rs:381:32 | -LL | #[suggestion(parse_add_paren, code = "...", code = "...")] - | ^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "...", code = "...")] + | ^^^^^^^^^^^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:397:5 + --> $DIR/subdiagnostic-derive.rs:399:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:394:5 + --> $DIR/subdiagnostic-derive.rs:396:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: the `#[applicability]` attribute can only be applied to fields of type `Applicability` - --> $DIR/subdiagnostic-derive.rs:407:5 + --> $DIR/subdiagnostic-derive.rs:409:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: suggestion without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:420:1 + --> $DIR/subdiagnostic-derive.rs:422:1 | -LL | #[suggestion(parse_add_paren)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid applicability - --> $DIR/subdiagnostic-derive.rs:430:45 + --> $DIR/subdiagnostic-derive.rs:432:46 | -LL | #[suggestion(parse_add_paren, code = "...", applicability = "foo")] - | ^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] + | ^^^^^^^^^^^^^^^^^^^^^ error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:448:1 + --> $DIR/subdiagnostic-derive.rs:450:1 | -LL | / #[suggestion(parse_add_paren, code = "...")] +LL | / #[suggestion(no_crate_example, code = "...")] LL | | LL | | struct AR { LL | | var: String, @@ -269,25 +269,25 @@ LL | | } | |_^ error: unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive.rs:462:1 + --> $DIR/subdiagnostic-derive.rs:464:1 | LL | #[label] | ^^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:482:38 + --> $DIR/subdiagnostic-derive.rs:484:39 | -LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] - | ^^^^^^^ +LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] + | ^^^^^^^ error: `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive.rs:501:42 + --> $DIR/subdiagnostic-derive.rs:503:43 | -LL | #[suggestion(parse_add_paren, code = "{var}", applicability = "machine-applicable")] - | ^^^^^^^ +LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] + | ^^^^^^^ error: `#[suggestion_part]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:524:5 + --> $DIR/subdiagnostic-derive.rs:526:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ LL | #[suggestion_part] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead error: `#[suggestion_part(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:527:5 + --> $DIR/subdiagnostic-derive.rs:529:5 | LL | #[suggestion_part(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -303,9 +303,9 @@ LL | #[suggestion_part(code = "...")] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:521:1 + --> $DIR/subdiagnostic-derive.rs:523:1 | -LL | / #[suggestion(parse_add_paren, code = "...")] +LL | / #[suggestion(no_crate_example, 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:41 + --> $DIR/subdiagnostic-derive.rs:538:42 | -LL | #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] - | ^^^^^^^^^^^^ +LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] + | ^^^^^^^^^^^^ | = help: only `style` and `applicability` are valid nested attributes error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:536:1 + --> $DIR/subdiagnostic-derive.rs:538:1 | -LL | / #[multipart_suggestion(parse_add_paren, code = "...", applicability = "machine-applicable")] +LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] LL | | LL | | LL | | struct BBa { @@ -334,19 +334,19 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:546:5 + --> $DIR/subdiagnostic-derive.rs:548:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:554:5 + --> $DIR/subdiagnostic-derive.rs:556:5 | LL | #[suggestion_part()] | ^^^^^^^^^^^^^^^^^^^^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:563:5 + --> $DIR/subdiagnostic-derive.rs:565:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -354,9 +354,9 @@ LL | #[primary_span] = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` error: multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive.rs:560:1 + --> $DIR/subdiagnostic-derive.rs:562:1 | -LL | / #[multipart_suggestion(parse_add_paren)] +LL | / #[multipart_suggestion(no_crate_example)] LL | | LL | | struct BC { LL | | #[primary_span] @@ -366,19 +366,19 @@ LL | | } | |_^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:571:5 + --> $DIR/subdiagnostic-derive.rs:573:5 | LL | #[suggestion_part] | ^^^^^^^^^^^^^^^^^^ error: `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive.rs:574:5 + --> $DIR/subdiagnostic-derive.rs:576:5 | LL | #[suggestion_part()] | ^^^^^^^^^^^^^^^^^^^^ error: `#[suggestion_part(foo = ...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:577:23 + --> $DIR/subdiagnostic-derive.rs:579:23 | LL | #[suggestion_part(foo = "bar")] | ^^^^^^^^^^^ @@ -386,123 +386,123 @@ LL | #[suggestion_part(foo = "bar")] = help: `code` is the only valid nested attribute error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:580:5 + --> $DIR/subdiagnostic-derive.rs:582:5 | LL | #[suggestion_part(code = "...")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive.rs:583:5 + --> $DIR/subdiagnostic-derive.rs:585:5 | LL | #[suggestion_part()] | ^^^^^^^^^^^^^^^^^^^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:591:37 + --> $DIR/subdiagnostic-derive.rs:593:37 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:591:23 + --> $DIR/subdiagnostic-derive.rs:593:23 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^^^^^^^^^ error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` - --> $DIR/subdiagnostic-derive.rs:620:5 + --> $DIR/subdiagnostic-derive.rs:622:5 | LL | #[applicability] | ^^^^^^^^^^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:668:23 + --> $DIR/subdiagnostic-derive.rs:670:23 | LL | #[suggestion_part(code("foo"))] | ^^^^^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:677:23 + --> $DIR/subdiagnostic-derive.rs:679:23 | LL | #[suggestion_part(code("foo", "bar"))] | ^^^^^^^^^^^^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:686:23 + --> $DIR/subdiagnostic-derive.rs:688:23 | LL | #[suggestion_part(code(3))] | ^^^^^^^ error: expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive.rs:695:23 + --> $DIR/subdiagnostic-derive.rs:697:23 | LL | #[suggestion_part(code())] | ^^^^^^ error: `code = "..."`/`code(...)` must contain only string literals - --> $DIR/subdiagnostic-derive.rs:704:23 + --> $DIR/subdiagnostic-derive.rs:706:23 | LL | #[suggestion_part(code = 3)] | ^^^^^^^^ error: specified multiple times - --> $DIR/subdiagnostic-derive.rs:746:60 + --> $DIR/subdiagnostic-derive.rs:748:61 | -LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] + | ^^^^^^^^^^^^^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive.rs:746:42 + --> $DIR/subdiagnostic-derive.rs:748:43 | -LL | #[suggestion(parse_add_paren, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] + | ^^^^^^^^^^^^^^^^ error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:755:1 + --> $DIR/subdiagnostic-derive.rs:757:1 | -LL | #[suggestion_hidden(parse_add_paren, code = "")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion_hidden(no_crate_example, code = "")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Use `#[suggestion(..., style = "hidden")]` instead error: `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:763:1 + --> $DIR/subdiagnostic-derive.rs:765:1 | -LL | #[suggestion_hidden(parse_add_paren, code = "", style = "normal")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: Use `#[suggestion(..., style = "hidden")]` instead error: invalid suggestion style - --> $DIR/subdiagnostic-derive.rs:771:50 + --> $DIR/subdiagnostic-derive.rs:773:51 | -LL | #[suggestion(parse_add_paren, code = "", style = "foo")] - | ^^^^^ +LL | #[suggestion(no_crate_example, 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 + --> $DIR/subdiagnostic-derive.rs:781:43 | -LL | #[suggestion(parse_add_paren, code = "", style = 42)] - | ^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "", style = 42)] + | ^^^^^^^^^^ error: `#[suggestion(style)]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:787:42 + --> $DIR/subdiagnostic-derive.rs:789:43 | -LL | #[suggestion(parse_add_paren, code = "", style)] - | ^^^^^ +LL | #[suggestion(no_crate_example, 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 + --> $DIR/subdiagnostic-derive.rs:797:43 | -LL | #[suggestion(parse_add_paren, code = "", style("foo"))] - | ^^^^^^^^^^^^ +LL | #[suggestion(no_crate_example, code = "", style("foo"))] + | ^^^^^^^^^^^^ error: `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive.rs:806:5 + --> $DIR/subdiagnostic-derive.rs:808:5 | LL | #[primary_span] | ^^^^^^^^^^^^^^^ @@ -511,9 +511,9 @@ LL | #[primary_span] = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead error: suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive.rs:803:1 + --> $DIR/subdiagnostic-derive.rs:805:1 | -LL | / #[suggestion(parse_add_paren, code = "")] +LL | / #[suggestion(no_crate_example, code = "")] LL | | LL | | struct PrimarySpanOnVec { LL | | #[primary_span] @@ -523,64 +523,64 @@ LL | | } | |_^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:63:3 + --> $DIR/subdiagnostic-derive.rs:65:3 | LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive.rs:159:3 + --> $DIR/subdiagnostic-derive.rs:161:3 | LL | #[foo] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:173:7 + --> $DIR/subdiagnostic-derive.rs:175:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:185:7 + --> $DIR/subdiagnostic-derive.rs:187:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:197:7 + --> $DIR/subdiagnostic-derive.rs:199:7 | LL | #[bar = 4] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:209:7 + --> $DIR/subdiagnostic-derive.rs:211:7 | LL | #[bar("...")] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:270:7 + --> $DIR/subdiagnostic-derive.rs:272:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:281:7 + --> $DIR/subdiagnostic-derive.rs:283:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive.rs:292:7 + --> $DIR/subdiagnostic-derive.rs:294:7 | LL | #[bar("...")] | ^^^ -error[E0425]: cannot find value `slug` in module `rustc_errors::fluent` - --> $DIR/subdiagnostic-derive.rs:122:9 +error[E0425]: cannot find value `slug` in module `crate::fluent_generated` + --> $DIR/subdiagnostic-derive.rs:124:9 | LL | #[label(slug)] - | ^^^^ not found in `rustc_errors::fluent` + | ^^^^ not found in `crate::fluent_generated` error: aborting due to 81 previous errors diff --git a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr index d1b9d7a40b4..eb739b149a1 100644 --- a/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr +++ b/tests/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr @@ -7,10 +7,7 @@ LL | fn oom() -> ! { | _-^^^^^^^^^^^^ LL | | loop {} LL | | } - | | - - | | | - | |_unexpected argument of type `core::alloc::Layout` - | help: remove the extra argument + | |_- unexpected argument of type `core::alloc::Layout` | note: function defined here --> $DIR/alloc-error-handler-bad-signature-3.rs:10:4 diff --git a/tests/ui/argument-suggestions/extra_arguments.rs b/tests/ui/argument-suggestions/extra_arguments.rs index 3f83de95e2d..1442062326d 100644 --- a/tests/ui/argument-suggestions/extra_arguments.rs +++ b/tests/ui/argument-suggestions/extra_arguments.rs @@ -3,8 +3,15 @@ fn one_arg(_a: i32) {} fn two_arg_same(_a: i32, _b: i32) {} fn two_arg_diff(_a: i32, _b: &str) {} +macro_rules! foo { + ($x:expr) => { + empty($x, 1); //~ ERROR function takes + } +} + fn main() { empty(""); //~ ERROR function takes + empty(1, 1); //~ ERROR function takes one_arg(1, 1); //~ ERROR function takes one_arg(1, ""); //~ ERROR function takes @@ -32,4 +39,5 @@ fn main() { 1, "" ); + foo!(1); } diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr index 0911685b428..11c71099743 100644 --- a/tests/ui/argument-suggestions/extra_arguments.stderr +++ b/tests/ui/argument-suggestions/extra_arguments.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/extra_arguments.rs:7:3 + --> $DIR/extra_arguments.rs:13:3 | LL | empty(""); | ^^^^^ -- @@ -13,8 +13,27 @@ note: function defined here LL | fn empty() {} | ^^^^^ +error[E0061]: this function takes 0 arguments but 2 arguments were supplied + --> $DIR/extra_arguments.rs:14:3 + | +LL | empty(1, 1); + | ^^^^^ - - unexpected argument of type `{integer}` + | | + | unexpected argument of type `{integer}` + | +note: function defined here + --> $DIR/extra_arguments.rs:1:4 + | +LL | fn empty() {} + | ^^^^^ +help: remove the extra arguments + | +LL - empty(1, 1); +LL + empty(); + | + error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/extra_arguments.rs:9:3 + --> $DIR/extra_arguments.rs:16:3 | LL | one_arg(1, 1); | ^^^^^^^ --- @@ -29,7 +48,7 @@ LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/extra_arguments.rs:10:3 + --> $DIR/extra_arguments.rs:17:3 | LL | one_arg(1, ""); | ^^^^^^^ ---- @@ -44,7 +63,7 @@ LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- error[E0061]: this function takes 1 argument but 3 arguments were supplied - --> $DIR/extra_arguments.rs:11:3 + --> $DIR/extra_arguments.rs:18:3 | LL | one_arg(1, "", 1.0); | ^^^^^^^ -- --- unexpected argument of type `{float}` @@ -63,7 +82,7 @@ LL + one_arg(1); | error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:13:3 + --> $DIR/extra_arguments.rs:20:3 | LL | two_arg_same(1, 1, 1); | ^^^^^^^^^^^^ --- @@ -78,7 +97,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:14:3 + --> $DIR/extra_arguments.rs:21:3 | LL | two_arg_same(1, 1, 1.0); | ^^^^^^^^^^^^ ----- @@ -93,7 +112,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:16:3 + --> $DIR/extra_arguments.rs:23:3 | LL | two_arg_diff(1, 1, ""); | ^^^^^^^^^^^^ --- @@ -108,7 +127,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:17:3 + --> $DIR/extra_arguments.rs:24:3 | LL | two_arg_diff(1, "", ""); | ^^^^^^^^^^^^ ---- @@ -123,7 +142,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- error[E0061]: this function takes 2 arguments but 4 arguments were supplied - --> $DIR/extra_arguments.rs:18:3 + --> $DIR/extra_arguments.rs:25:3 | LL | two_arg_diff(1, 1, "", ""); | ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str` @@ -142,7 +161,7 @@ LL + two_arg_diff(1, ""); | error[E0061]: this function takes 2 arguments but 4 arguments were supplied - --> $DIR/extra_arguments.rs:19:3 + --> $DIR/extra_arguments.rs:26:3 | LL | two_arg_diff(1, "", 1, ""); | ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str` @@ -161,7 +180,7 @@ LL + two_arg_diff(1, ""); | error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:22:3 + --> $DIR/extra_arguments.rs:29:3 | LL | two_arg_same(1, 1, ""); | ^^^^^^^^^^^^ -------- @@ -176,7 +195,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:23:3 + --> $DIR/extra_arguments.rs:30:3 | LL | two_arg_diff(1, 1, ""); | ^^^^^^^^^^^^ --- @@ -191,7 +210,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:24:3 + --> $DIR/extra_arguments.rs:31:3 | LL | two_arg_same( | ^^^^^^^^^^^^ @@ -211,7 +230,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {} | ^^^^^^^^^^^^ ------- ------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/extra_arguments.rs:30:3 + --> $DIR/extra_arguments.rs:37:3 | LL | two_arg_diff( | ^^^^^^^^^^^^ @@ -229,6 +248,26 @@ note: function defined here LL | fn two_arg_diff(_a: i32, _b: &str) {} | ^^^^^^^^^^^^ ------- -------- -error: aborting due to 14 previous errors +error[E0061]: this function takes 0 arguments but 2 arguments were supplied + --> $DIR/extra_arguments.rs:8:9 + | +LL | empty($x, 1); + | ^^^^^ - unexpected argument of type `{integer}` +... +LL | foo!(1); + | ------- + | | | + | | unexpected argument of type `{integer}` + | | help: remove the extra argument + | in this macro invocation + | +note: function defined here + --> $DIR/extra_arguments.rs:1:4 + | +LL | fn empty() {} + | ^^^^^ + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs index 83655341d6a..83655341d6a 100644 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr index baef38f6b80..4246f8c069d 100644 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:28:7 + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:28:7 | LL | struct S; | -------- @@ -12,7 +12,7 @@ LL | a.f(); | ^ method cannot be called on `S` due to unsatisfied trait bounds | note: trait bound `<S as X>::Y<i32> = i32` was not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:12:11 + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:12:11 | LL | impl<T: X<Y<i32> = i32>> M for T {} | ^^^^^^^^^^^^ - - diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs index 1cc09aa6dd4..060ee8821d8 100644 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs @@ -1,3 +1,5 @@ +#![warn(unused_lifetimes)] + pub trait X { type Y<'a: 'static>; //~^ WARNING unnecessary lifetime parameter diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr index fbd79879d0f..a69cd0028c1 100644 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr @@ -1,45 +1,50 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/unsatified-item-lifetime-bound.rs:2:12 + --> $DIR/unsatisfied-item-lifetime-bound.rs:4:12 | LL | type Y<'a: 'static>; | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/unsatisfied-item-lifetime-bound.rs:1:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:11:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8 | LL | f: <T as X>::Y<'a>, | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:10:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:12:10 | LL | struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> { | ^^ = note: but lifetime parameter must outlive the static lifetime error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:16:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:18:8 | LL | f: <T as X>::Y<'a>, | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:15:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:17:10 | LL | struct C<'a, T: X> { | ^^ = note: but lifetime parameter must outlive the static lifetime error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:21:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:23:8 | LL | f: <() as X>::Y<'a>, | ^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:20:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:22:10 | LL | struct D<'a> { | ^^ diff --git a/tests/ui/impl-trait/equal-hidden-lifetimes.rs b/tests/ui/impl-trait/equal-hidden-lifetimes.rs index 79db88828b9..a6dbf3f08f2 100644 --- a/tests/ui/impl-trait/equal-hidden-lifetimes.rs +++ b/tests/ui/impl-trait/equal-hidden-lifetimes.rs @@ -5,7 +5,6 @@ // `'a == 'static` so `&'a i32` is fine as the return type fn equal_regions_static<'a: 'static>(x: &'a i32) -> impl Sized { - //~^ WARNING unnecessary lifetime parameter `'a` x } diff --git a/tests/ui/impl-trait/equal-hidden-lifetimes.stderr b/tests/ui/impl-trait/equal-hidden-lifetimes.stderr deleted file mode 100644 index 3e48aef553b..00000000000 --- a/tests/ui/impl-trait/equal-hidden-lifetimes.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/equal-hidden-lifetimes.rs:7:25 - | -LL | fn equal_regions_static<'a: 'static>(x: &'a i32) -> impl Sized { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: 1 warning emitted - diff --git a/tests/ui/infinite/auxiliary/alias.rs b/tests/ui/infinite/auxiliary/alias.rs new file mode 100644 index 00000000000..59add7eb18b --- /dev/null +++ b/tests/ui/infinite/auxiliary/alias.rs @@ -0,0 +1,2 @@ +pub struct W<T>(T); +pub type Wrapper<T> = W<T>; diff --git a/tests/ui/infinite/infinite-alias.rs b/tests/ui/infinite/infinite-alias.rs new file mode 100644 index 00000000000..45356f359ce --- /dev/null +++ b/tests/ui/infinite/infinite-alias.rs @@ -0,0 +1,9 @@ +// aux-build: alias.rs +// regression test for 108160 + +extern crate alias; + +use alias::Wrapper; +struct Rec(Wrapper<Rec>); //~ ERROR recursive type `Rec` has infinite + +fn main() {} diff --git a/tests/ui/infinite/infinite-alias.stderr b/tests/ui/infinite/infinite-alias.stderr new file mode 100644 index 00000000000..9d9265f8c36 --- /dev/null +++ b/tests/ui/infinite/infinite-alias.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Rec` has infinite size + --> $DIR/infinite-alias.rs:7:1 + | +LL | struct Rec(Wrapper<Rec>); + | ^^^^^^^^^^ ------------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Rec(Box<Wrapper<Rec>>); + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-26094.rs b/tests/ui/issues/issue-26094.rs index abf3543ddb9..2742529edd3 100644 --- a/tests/ui/issues/issue-26094.rs +++ b/tests/ui/issues/issue-26094.rs @@ -1,7 +1,7 @@ macro_rules! some_macro { - ($other: expr) => ({ + ($other: expr) => {{ $other(None) //~ NOTE unexpected argument of type `Option<_>` - }) + }}; } fn some_function() {} //~ NOTE defined here @@ -9,5 +9,4 @@ fn some_function() {} //~ NOTE defined here fn main() { some_macro!(some_function); //~^ ERROR function takes 0 arguments but 1 argument was supplied - //~| NOTE in this expansion of some_macro! } diff --git a/tests/ui/issues/issue-26094.stderr b/tests/ui/issues/issue-26094.stderr index 608d2c7aff9..ecdf48470f7 100644 --- a/tests/ui/issues/issue-26094.stderr +++ b/tests/ui/issues/issue-26094.stderr @@ -2,10 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/issue-26094.rs:10:17 | LL | $other(None) - | ---- - | | - | unexpected argument of type `Option<_>` - | help: remove the extra argument + | ---- unexpected argument of type `Option<_>` ... LL | some_macro!(some_function); | ^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-30438-c.rs b/tests/ui/issues/issue-30438-c.rs index 4cf634245be..813c1d3e2cc 100644 --- a/tests/ui/issues/issue-30438-c.rs +++ b/tests/ui/issues/issue-30438-c.rs @@ -5,7 +5,6 @@ trait Trait { type Out; } struct Test<'a> { s: &'a str } fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { - //~^ WARN unnecessary lifetime parameter `'z` let x = Test { s: "this cannot last" }; &x //~^ ERROR: cannot return reference to local variable `x` diff --git a/tests/ui/issues/issue-30438-c.stderr b/tests/ui/issues/issue-30438-c.stderr index a7a5c0500fd..7c001088097 100644 --- a/tests/ui/issues/issue-30438-c.stderr +++ b/tests/ui/issues/issue-30438-c.stderr @@ -1,17 +1,9 @@ -warning: unnecessary lifetime parameter `'z` - --> $DIR/issue-30438-c.rs:7:74 - | -LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'z` - error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-30438-c.rs:10:5 + --> $DIR/issue-30438-c.rs:9:5 | LL | &x | ^^ returns a reference to data owned by the current function -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/lint/dead-code/in-closure.rs b/tests/ui/lint/dead-code/in-closure.rs new file mode 100644 index 00000000000..c55634405ed --- /dev/null +++ b/tests/ui/lint/dead-code/in-closure.rs @@ -0,0 +1,16 @@ +// edition: 2021 + +#![deny(dead_code)] + +pub fn foo() { + let closure = || { + fn a() {} //~ ERROR function `a` is never used + }; + closure() +} + +pub async fn async_foo() { + const A: usize = 1; //~ ERROR constant `A` is never used +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/in-closure.stderr b/tests/ui/lint/dead-code/in-closure.stderr new file mode 100644 index 00000000000..deb276be702 --- /dev/null +++ b/tests/ui/lint/dead-code/in-closure.stderr @@ -0,0 +1,20 @@ +error: function `a` is never used + --> $DIR/in-closure.rs:7:12 + | +LL | fn a() {} + | ^ + | +note: the lint level is defined here + --> $DIR/in-closure.rs:3:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: constant `A` is never used + --> $DIR/in-closure.rs:13:11 + | +LL | const A: usize = 1; + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs index 7c2e1aeeea6..46462c432a8 100644 --- a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs +++ b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.rs @@ -8,6 +8,8 @@ // // 'a : 'b +#![warn(unused_lifetimes)] + fn test<'a,'b>(x: &'a i32) -> &'b i32 where 'a: 'static //~ WARN unnecessary lifetime parameter `'a` { diff --git a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr index 70ed418d5cb..9f03a6553ba 100644 --- a/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr +++ b/tests/ui/regions/regions-free-region-outlives-static-outlives-free-region.stderr @@ -1,10 +1,15 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:12:11 + --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:14:11 | LL | where 'a: 'static | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/regions-free-region-outlives-static-outlives-free-region.rs:11:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/tests/ui/regions/regions-static-bound-rpass.rs b/tests/ui/regions/regions-static-bound-rpass.rs index 25232b455b6..e2ebb394d0a 100644 --- a/tests/ui/regions/regions-static-bound-rpass.rs +++ b/tests/ui/regions/regions-static-bound-rpass.rs @@ -1,5 +1,7 @@ // run-pass +#![warn(unused_lifetimes)] + fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a () where 'a: 'static { t } //~^ WARN unnecessary lifetime parameter `'a` diff --git a/tests/ui/regions/regions-static-bound-rpass.stderr b/tests/ui/regions/regions-static-bound-rpass.stderr index 9355a409d50..f0f3a4c5261 100644 --- a/tests/ui/regions/regions-static-bound-rpass.stderr +++ b/tests/ui/regions/regions-static-bound-rpass.stderr @@ -1,13 +1,18 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound-rpass.rs:4:11 + --> $DIR/regions-static-bound-rpass.rs:6:11 | LL | where 'a: 'static { t } | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/regions-static-bound-rpass.rs:3:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound-rpass.rs:8:11 + --> $DIR/regions-static-bound-rpass.rs:10:11 | LL | where 'a: 'static { t } | ^^ @@ -15,7 +20,7 @@ LL | where 'a: 'static { t } = help: you can use the `'static` lifetime directly, in place of `'a` warning: unnecessary lifetime parameter `'b` - --> $DIR/regions-static-bound-rpass.rs:12:19 + --> $DIR/regions-static-bound-rpass.rs:14:19 | LL | where 'a: 'b, 'b: 'static { t } | ^^ diff --git a/tests/ui/regions/regions-static-bound.rs b/tests/ui/regions/regions-static-bound.rs index 4d2455470e2..e7aa8795f01 100644 --- a/tests/ui/regions/regions-static-bound.rs +++ b/tests/ui/regions/regions-static-bound.rs @@ -1,6 +1,8 @@ -fn static_id<'a,'b>(t: &'a ()) -> &'static () - where 'a: 'static { t } -//~^ WARN unnecessary lifetime parameter `'a` +#![warn(unused_lifetimes)] + +fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } +//~^ WARN lifetime parameter `'b` never used +//~| WARN unnecessary lifetime parameter `'a` fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } diff --git a/tests/ui/regions/regions-static-bound.stderr b/tests/ui/regions/regions-static-bound.stderr index 2886ec3ead5..b314e9fe85d 100644 --- a/tests/ui/regions/regions-static-bound.stderr +++ b/tests/ui/regions/regions-static-bound.stderr @@ -1,13 +1,27 @@ +warning: lifetime parameter `'b` never used + --> $DIR/regions-static-bound.rs:3:17 + | +LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } + | -^^ + | | + | help: elide the unused lifetime + | +note: the lint level is defined here + --> $DIR/regions-static-bound.rs:1:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ + warning: unnecessary lifetime parameter `'a` - --> $DIR/regions-static-bound.rs:2:11 + --> $DIR/regions-static-bound.rs:3:53 | -LL | where 'a: 'static { t } - | ^^ +LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } + | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` warning: unnecessary lifetime parameter `'b` - --> $DIR/regions-static-bound.rs:6:19 + --> $DIR/regions-static-bound.rs:8:19 | LL | where 'a: 'b, 'b: 'static { t } | ^^ @@ -15,7 +29,7 @@ LL | where 'a: 'b, 'b: 'static { t } = help: you can use the `'static` lifetime directly, in place of `'b` error: lifetime may not live long enough - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:12:5 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here @@ -23,7 +37,7 @@ LL | t | ^ returning this value requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:15:5 + --> $DIR/regions-static-bound.rs:17:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'1` @@ -36,7 +50,7 @@ LL | static_id(&u); | argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:17:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'2` @@ -49,6 +63,6 @@ LL | static_id_indirect(&v); | `v` escapes the function body here | argument requires that `'2` must outlive `'static` -error: aborting due to 3 previous errors; 2 warnings emitted +error: aborting due to 3 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/regions/resolve-re-error-ice.rs b/tests/ui/regions/resolve-re-error-ice.rs new file mode 100644 index 00000000000..f37b27a82b3 --- /dev/null +++ b/tests/ui/regions/resolve-re-error-ice.rs @@ -0,0 +1,22 @@ +// check-pass + +// Allow this for now, can remove this UI test when this becomes a hard error. +#![allow(implied_bounds_entailment)] + +use std::collections::hash_map::{Keys, HashMap}; +use std::marker::PhantomData; + +trait MapAssertion<'a, K, V, R> { + fn key_set(&self) -> Subject<Keys<K, V>, (), R>; +} + +struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); + +impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R> +{ + fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { + todo!() + } +} + +fn main() {} diff --git a/tests/ui/regions/resolve-re-error-ice.stderr b/tests/ui/regions/resolve-re-error-ice.stderr new file mode 100644 index 00000000000..e7003e1c32f --- /dev/null +++ b/tests/ui/regions/resolve-re-error-ice.stderr @@ -0,0 +1,15 @@ +Future incompatibility report: Future breakage diagnostic: +warning: impl method assumes more implied bounds than the corresponding trait method + --> $DIR/resolve-re-error-ice.rs:17:16 + | +LL | fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { + | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `Subject<'_, std::collections::hash_map::Keys<'_, K, V>, (), R>` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572> +note: the lint level is defined here + --> $DIR/resolve-re-error-ice.rs:4:10 + | +LL | #![allow(implied_bounds_entailment)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/static/static-lifetime-bound.rs b/tests/ui/static/static-lifetime-bound.rs index b5da91ec3b6..847fe87b2ea 100644 --- a/tests/ui/static/static-lifetime-bound.rs +++ b/tests/ui/static/static-lifetime-bound.rs @@ -1,4 +1,4 @@ -fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +fn f<'a: 'static>(_: &'a i32) {} fn main() { let x = 0; diff --git a/tests/ui/static/static-lifetime-bound.stderr b/tests/ui/static/static-lifetime-bound.stderr index e22411b13b7..19e55a6582e 100644 --- a/tests/ui/static/static-lifetime-bound.stderr +++ b/tests/ui/static/static-lifetime-bound.stderr @@ -1,11 +1,3 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:1:6 - | -LL | fn f<'a: 'static>(_: &'a i32) {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | @@ -19,6 +11,6 @@ LL | f(&x); LL | } | - `x` dropped here while still borrowed -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs index eeb5dca07f0..7c3a3a84406 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.rs +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.rs @@ -6,7 +6,6 @@ type X<'a> = impl Into<&'static str> + From<&'a str>; fn f<'a: 'static>(t: &'a str) -> X<'a> { - //~^ WARNING unnecessary lifetime parameter t //~^ ERROR expected generic lifetime parameter, found `'static` } diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr index 94882597a62..962dedde09a 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr @@ -1,13 +1,5 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/bounds-are-checked.rs:8:6 - | -LL | fn f<'a: 'static>(t: &'a str) -> X<'a> { - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/bounds-are-checked.rs:10:5 + --> $DIR/bounds-are-checked.rs:9:5 | LL | type X<'a> = impl Into<&'static str> + From<&'a str>; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -15,6 +7,6 @@ LL | type X<'a> = impl Into<&'static str> + From<&'a str>; LL | t | ^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs index 07f825aea50..6f9434255a8 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs @@ -4,7 +4,6 @@ mod test_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } @@ -13,14 +12,12 @@ mod test_higher_kinded_lifetime_param { type Ty<'a> = impl Sized + 'a; fn defining(a: &str) -> Ty<'_> { a } fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } mod test_higher_kinded_lifetime_param2 { fn assert_static<'a: 'static>() {} - //~^ WARN: unnecessary lifetime parameter `'a` fn test<'a>() { assert_static::<'a>() } //~^ ERROR: lifetime may not live long enough } diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr index 887620a4d50..399775641f8 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr @@ -1,41 +1,17 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:6:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:15:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -warning: unnecessary lifetime parameter `'a` - --> $DIR/implied_lifetime_wf_check3.rs:22:22 - | -LL | fn assert_static<'a: 'static>() {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:8:43 + --> $DIR/implied_lifetime_wf_check3.rs:7:43 | LL | fn test<'a>() where Ty<'a>: 'static { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:17:46 + --> $DIR/implied_lifetime_wf_check3.rs:15:46 | LL | fn test<'a>() where for<'b> Ty<'b>: 'a { assert_static::<'a>() } | -- lifetime `'a` defined here ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:24:21 + --> $DIR/implied_lifetime_wf_check3.rs:21:21 | LL | fn test<'a>() { assert_static::<'a>() } | -- ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` @@ -43,7 +19,7 @@ LL | fn test<'a>() { assert_static::<'a>() } | lifetime `'a` defined here error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:32:41 + --> $DIR/implied_lifetime_wf_check3.rs:29:41 | LL | fn test<A>() where Ty<A>: 'static { assert_static::<A>() } | ^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds @@ -53,6 +29,6 @@ help: consider adding an explicit lifetime bound... LL | fn test<A: 'static>() where Ty<A>: 'static { assert_static::<A>() } | +++++++++ -error: aborting due to 4 previous errors; 3 warnings emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0310`. |
