diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl index 718129c5b6e2d..2e150f7bb279b 100644 --- a/compiler/rustc_expand/messages.ftl +++ b/compiler/rustc_expand/messages.ftl @@ -157,7 +157,7 @@ expand_unsupported_key_value = key-value macro attributes are not supported expand_var_still_repeating = - variable '{$ident}' is still repeating at this depth + variable `{$ident}` is still repeating at this depth expand_wrong_fragment_kind = non-{$kind} macro in {$kind} position: {$name} diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 0c236a4ed11f3..733c73bc3d078 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -445,7 +445,8 @@ lint_macro_is_private = macro `{$ident}` is private lint_macro_rule_never_used = rule #{$n} of macro `{$name}` is never used lint_macro_use_deprecated = - deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead + applying the `#[macro_use]` attribute to an `extern crate` item is deprecated + .help = remove it and import macros at use sites with a `use` item instead lint_malformed_attribute = malformed lint attribute input @@ -456,7 +457,7 @@ lint_map_unit_fn = `Iterator::map` call that discard the iterator's values .map_label = after this call to map, the resulting iterator is `impl Iterator`, which means the only information carried by the iterator is the number of items .suggestion = you might have meant to use `Iterator::for_each` -lint_metavariable_still_repeating = variable '{$name}' is still repeating at this depth +lint_metavariable_still_repeating = variable `{$name}` is still repeating at this depth lint_metavariable_wrong_operator = meta-variable repeats with different Kleene operator @@ -635,8 +636,8 @@ lint_pattern_in_bodiless = patterns aren't allowed in functions without bodies lint_pattern_in_foreign = patterns aren't allowed in foreign function declarations .label = pattern not allowed in foreign function -lint_private_extern_crate_reexport = - extern crate `{$ident}` is private, and cannot be re-exported, consider declaring with `pub` +lint_private_extern_crate_reexport = extern crate `{$ident}` is private and cannot be re-exported + .suggestion = consider making the `extern crate` item publicly accessible lint_proc_macro_derive_resolution_fallback = cannot find {$ns} `{$ident}` in this scope .label = names from parent modules are not accessible without an explicit import @@ -847,7 +848,8 @@ lint_unused_coroutine = }{$post} that must be used .note = coroutines are lazy and do nothing unless resumed -lint_unused_crate_dependency = external crate `{$extern_crate}` unused in `{$local_crate}`: remove the dependency or add `use {$extern_crate} as _;` +lint_unused_crate_dependency = extern crate `{$extern_crate}` is unused in crate `{$local_crate}` + .help = remove the dependency or add `use {$extern_crate} as _;` to the crate root lint_unused_def = unused {$pre}`{$def}`{$post} that must be used .suggestion = use `let _ = ...` to ignore the resulting value diff --git a/compiler/rustc_lint/src/context/diagnostics.rs b/compiler/rustc_lint/src/context/diagnostics.rs index 1dfbe1e938282..83640d7210fa7 100644 --- a/compiler/rustc_lint/src/context/diagnostics.rs +++ b/compiler/rustc_lint/src/context/diagnostics.rs @@ -340,8 +340,9 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: & lints::MacroUseDeprecated.decorate_lint(diag); } BuiltinLintDiag::UnusedMacroUse => lints::UnusedMacroUse.decorate_lint(diag), - BuiltinLintDiag::PrivateExternCrateReexport(ident) => { - lints::PrivateExternCrateReexport { ident }.decorate_lint(diag); + BuiltinLintDiag::PrivateExternCrateReexport { source: ident, extern_crate_span } => { + lints::PrivateExternCrateReexport { ident, sugg: extern_crate_span.shrink_to_lo() } + .decorate_lint(diag); } BuiltinLintDiag::UnusedLabel => lints::UnusedLabel.decorate_lint(diag), BuiltinLintDiag::MacroIsPrivate(ident) => { diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c493a989d913a..b377da31a581b 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -2313,6 +2313,7 @@ pub mod unexpected_cfg_value { #[derive(LintDiagnostic)] #[diag(lint_macro_use_deprecated)] +#[help] pub struct MacroUseDeprecated; #[derive(LintDiagnostic)] @@ -2323,6 +2324,8 @@ pub struct UnusedMacroUse; #[diag(lint_private_extern_crate_reexport, code = E0365)] pub struct PrivateExternCrateReexport { pub ident: Ident, + #[suggestion(code = "pub ", style = "verbose", applicability = "maybe-incorrect")] + pub sugg: Span, } #[derive(LintDiagnostic)] @@ -2416,6 +2419,7 @@ pub struct UnknownMacroVariable { #[derive(LintDiagnostic)] #[diag(lint_unused_crate_dependency)] +#[help] pub struct UnusedCrateDependency { pub extern_crate: Symbol, pub local_crate: Symbol, diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index d0d570db04f8d..726bd0de1299f 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -511,8 +511,9 @@ declare_lint! { /// This will produce: /// /// ```text - /// error: external crate `regex` unused in `lint_example`: remove the dependency or add `use regex as _;` + /// error: extern crate `regex` is unused in crate `lint_example` /// | + /// = help: remove the dependency or add `use regex as _;` to the crate root /// note: the lint level is defined here /// --> src/lib.rs:1:9 /// | @@ -2160,8 +2161,7 @@ declare_lint! { } declare_lint! { - /// The `macro_use_extern_crate` lint detects the use of the - /// [`macro_use` attribute]. + /// The `macro_use_extern_crate` lint detects the use of the [`macro_use` attribute]. /// /// ### Example /// @@ -2179,12 +2179,13 @@ declare_lint! { /// This will produce: /// /// ```text - /// error: deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead + /// error: applying the `#[macro_use]` attribute to an `extern crate` item is deprecated /// --> src/main.rs:3:1 /// | /// 3 | #[macro_use] /// | ^^^^^^^^^^^^ /// | + /// = help: remove it and import macros at use sites with a `use` item instead /// note: the lint level is defined here /// --> src/main.rs:1:9 /// | diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index a2970884af40b..8bf25024afe7f 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -706,7 +706,10 @@ pub enum BuiltinLintDiag { }, MacroUseDeprecated, UnusedMacroUse, - PrivateExternCrateReexport(Ident), + PrivateExternCrateReexport { + source: Ident, + extern_crate_span: Span, + }, UnusedLabel, MacroIsPrivate(Ident), UnusedMacroDefinition(Symbol), diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 74b89546e6f94..6dd8eaf7e6734 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -207,18 +207,21 @@ impl<'tcx> ReachableContext<'tcx> { } hir::ItemKind::Const(_, _, init) => { - // Only things actually ending up in the final constant need to be reachable. - // Everything else is either already available as `mir_for_ctfe`, or can't be used - // by codegen anyway. + // Only things actually ending up in the final constant value are reachable + // for codegen. Everything else is only needed during const-eval, so even if + // const-eval happens in a downstream crate, all they need is + // `mir_for_ctfe`. match self.tcx.const_eval_poly_to_alloc(item.owner_id.def_id.into()) { Ok(alloc) => { let alloc = self.tcx.global_alloc(alloc.alloc_id).unwrap_memory(); self.propagate_from_alloc(alloc); } - // Reachable generic constants will be inlined into other crates - // unconditionally, so we need to make sure that their - // contents are also reachable. + // We can't figure out which value the constant will evaluate to. In + // lieu of that, we have to consider everything mentioned in the const + // initializer reachable, since it *may* end up in the final value. Err(ErrorHandled::TooGeneric(_)) => self.visit_nested_body(init), + // If there was an error evaluating the const, nothing can be reachable + // via it, and anyway compilation will fail. Err(ErrorHandled::Reported(..)) => {} } } diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 27ea7760f5893..6c7afb305ba31 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -259,13 +259,18 @@ struct UnresolvedImportError { // Reexports of the form `pub use foo as bar;` where `foo` is `extern crate foo;` // are permitted for backward-compatibility under a deprecation lint. -fn pub_use_of_private_extern_crate_hack(import: Import<'_>, binding: NameBinding<'_>) -> bool { +fn pub_use_of_private_extern_crate_hack( + import: Import<'_>, + binding: NameBinding<'_>, +) -> Option { match (&import.kind, &binding.kind) { - (ImportKind::Single { .. }, NameBindingKind::Import { import: binding_import, .. }) => { - matches!(binding_import.kind, ImportKind::ExternCrate { .. }) - && import.expect_vis().is_public() + (ImportKind::Single { .. }, NameBindingKind::Import { import: binding_import, .. }) + if let ImportKind::ExternCrate { id, .. } = binding_import.kind + && import.expect_vis().is_public() => + { + Some(id) } - _ => false, + _ => None, } } @@ -275,7 +280,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn import(&self, binding: NameBinding<'a>, import: Import<'a>) -> NameBinding<'a> { let import_vis = import.expect_vis().to_def_id(); let vis = if binding.vis.is_at_least(import_vis, self.tcx) - || pub_use_of_private_extern_crate_hack(import, binding) + || pub_use_of_private_extern_crate_hack(import, binding).is_some() { import_vis } else { @@ -1253,12 +1258,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // All namespaces must be re-exported with extra visibility for an error to occur. if !any_successful_reexport { let (ns, binding) = reexport_error.unwrap(); - if pub_use_of_private_extern_crate_hack(import, binding) { + if let Some(extern_crate_id) = pub_use_of_private_extern_crate_hack(import, binding) { self.lint_buffer.buffer_lint( PUB_USE_OF_PRIVATE_EXTERN_CRATE, import_id, import.span, - BuiltinLintDiag::PrivateExternCrateReexport(ident), + BuiltinLintDiag::PrivateExternCrateReexport { + source: ident, + extern_crate_span: self.tcx.source_span(self.local_def_id(extern_crate_id)), + }, ); } else { if ns == TypeNS { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index ec24eac4a9d09..9eeb0da7ed2fd 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2041,8 +2041,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn { called }, ast::AssocItemKind::Type(..) => AssocSuggestion::AssocType, ast::AssocItemKind::Delegation(..) - if self.r.delegation_fn_sigs[&self.r.local_def_id(assoc_item.id)] - .has_self => + if self + .r + .delegation_fn_sigs + .get(&self.r.local_def_id(assoc_item.id)) + .map_or(false, |sig| sig.has_self) => { AssocSuggestion::MethodWithSelf { called } } diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile index 64a1fb093b49b..fa31801269afe 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile @@ -47,7 +47,7 @@ ENV RUST_CONFIGURE_ARGS \ # This job appears to be checking two separate things: # - That we can build the compiler with `--enable-debug` # (without necessarily testing the result). -# - That the tests with `//@ needs-matching-clang` pass, since they +# - That the tests with `//@ needs-force-clang-based-tests` pass, since they # don't run by default unless RUSTBUILD_FORCE_CLANG_BASED_TESTS is set. # - FIXME(https://github.com/rust-lang/rust/pull/126155#issuecomment-2156314273): # Currently we only run the subset of tests with "clang" in their name. diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index fd4ab72bbf463..a5475a158deb0 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -854,9 +854,9 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "needs-asm-support", "needs-dlltool", "needs-dynamic-linking", + "needs-force-clang-based-tests", "needs-git-hash", "needs-llvm-components", - "needs-matching-clang", "needs-profiler-support", "needs-relocation-model-pic", "needs-run-enabled", diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs index 7bc7e4b868038..b96832db67bed 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/header/needs.rs @@ -100,9 +100,9 @@ pub(super) fn handle_needs( ignore_reason: "ignored when profiler support is disabled", }, Need { - name: "needs-matching-clang", + name: "needs-force-clang-based-tests", condition: config.run_clang_based_tests_with.is_some(), - ignore_reason: "ignored when the used clang does not match the built LLVM", + ignore_reason: "ignored when RUSTBUILD_FORCE_CLANG_BASED_TESTS is not set", }, Need { name: "needs-xray", diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs index b9e56ab632add..cc395e491ee12 100644 --- a/src/tools/run-make-support/src/command.rs +++ b/src/tools/run-make-support/src/command.rs @@ -107,38 +107,38 @@ impl CompletedProcess { /// Checks that trimmed `stdout` matches trimmed `content`. #[track_caller] - pub fn assert_stdout_equals>(self, content: S) -> Self { + pub fn assert_stdout_equals>(&self, content: S) -> &Self { assert_eq!(self.stdout_utf8().trim(), content.as_ref().trim()); self } #[track_caller] - pub fn assert_stdout_not_contains>(self, needle: S) -> Self { + pub fn assert_stdout_not_contains>(&self, needle: S) -> &Self { assert_not_contains(&self.stdout_utf8(), needle.as_ref()); self } /// Checks that trimmed `stderr` matches trimmed `content`. #[track_caller] - pub fn assert_stderr_equals>(self, content: S) -> Self { + pub fn assert_stderr_equals>(&self, content: S) -> &Self { assert_eq!(self.stderr_utf8().trim(), content.as_ref().trim()); self } #[track_caller] - pub fn assert_stderr_contains>(self, needle: S) -> Self { + pub fn assert_stderr_contains>(&self, needle: S) -> &Self { assert!(self.stderr_utf8().contains(needle.as_ref())); self } #[track_caller] - pub fn assert_stderr_not_contains>(self, needle: S) -> Self { + pub fn assert_stderr_not_contains>(&self, needle: S) -> &Self { assert_not_contains(&self.stdout_utf8(), needle.as_ref()); self } #[track_caller] - pub fn assert_exit_code(self, code: i32) -> Self { + pub fn assert_exit_code(&self, code: i32) -> &Self { assert!(self.output.status.code() == Some(code)); self } diff --git a/tests/crashes/124342.rs b/tests/crashes/124342.rs deleted file mode 100644 index ae51b3db96f5d..0000000000000 --- a/tests/crashes/124342.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ known-bug: #124342 -trait Trait2 : Trait { - reuse <() as Trait>::async { - (async || {}).await; - }; -} diff --git a/tests/run-make/cross-lang-lto-clang/Makefile b/tests/run-make/cross-lang-lto-clang/Makefile index acaebf439d65b..acf49c8f5c85d 100644 --- a/tests/run-make/cross-lang-lto-clang/Makefile +++ b/tests/run-make/cross-lang-lto-clang/Makefile @@ -1,4 +1,4 @@ -# needs-matching-clang +# needs-force-clang-based-tests # This test makes sure that cross-language inlining actually works by checking # the generated machine code. diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile index 70085d9bde1d9..738e23f9c6614 100644 --- a/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile @@ -1,4 +1,7 @@ -# needs-matching-clang +# needs-force-clang-based-tests + +# FIXME(#126180): This test doesn't actually run anywhere, because the only +# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. # This test makes sure that cross-language inlining can be used in conjunction # with profile-guided optimization. The test only tests that the whole workflow diff --git a/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs b/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs index 04afc92bf7e9a..f40da6621287f 100644 --- a/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs +++ b/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs @@ -1,8 +1,11 @@ //! Make sure that cross-language LTO works on riscv targets, //! which requires extra `target-abi` metadata to be emitted. -//@ needs-matching-clang +//@ needs-force-clang-based-tests //@ needs-llvm-components riscv +// FIXME(#126180): This test doesn't actually run anywhere, because the only +// CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. + use run_make_support::{bin_name, clang, llvm_readobj, rustc}; use std::{ env, diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile index 95c8d08a18bc7..aabe90754a654 100644 --- a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile +++ b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile @@ -1,4 +1,7 @@ -# needs-matching-clang +# needs-force-clang-based-tests + +# FIXME(#126180): This test doesn't actually run anywhere, because the only +# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. # This test makes sure the embed bitcode in elf created with # lto-embed-bitcode=optimized is valid llvm BC module. diff --git a/tests/run-make/wasm-override-linker/Makefile b/tests/run-make/wasm-override-linker/Makefile index 52339f9261c43..1a01a574dee28 100644 --- a/tests/run-make/wasm-override-linker/Makefile +++ b/tests/run-make/wasm-override-linker/Makefile @@ -1,4 +1,7 @@ -# needs-matching-clang +# needs-force-clang-based-tests + +# FIXME(#126180): This test doesn't actually run anywhere, because the only +# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. include ../tools.mk diff --git a/tests/ui/delegation/ice-issue-124342.rs b/tests/ui/delegation/ice-issue-124342.rs new file mode 100644 index 0000000000000..ad62f6bd54af9 --- /dev/null +++ b/tests/ui/delegation/ice-issue-124342.rs @@ -0,0 +1,12 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +mod to_reuse {} + +trait Trait { + reuse to_reuse::foo { foo } + //~^ ERROR cannot find function `foo` in module `to_reuse` + //~| ERROR cannot find value `foo` in this scope +} + +fn main() {} diff --git a/tests/ui/delegation/ice-issue-124342.stderr b/tests/ui/delegation/ice-issue-124342.stderr new file mode 100644 index 0000000000000..f9a3684d64932 --- /dev/null +++ b/tests/ui/delegation/ice-issue-124342.stderr @@ -0,0 +1,20 @@ +error[E0425]: cannot find function `foo` in module `to_reuse` + --> $DIR/ice-issue-124342.rs:7:21 + | +LL | reuse to_reuse::foo { foo } + | ^^^ not found in `to_reuse` + +error[E0425]: cannot find value `foo` in this scope + --> $DIR/ice-issue-124342.rs:7:27 + | +LL | reuse to_reuse::foo { foo } + | ^^^ + | +help: you might have meant to refer to the associated function + | +LL | reuse to_reuse::foo { Self::foo } + | ++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/extern-flag/no-nounused.rs b/tests/ui/extern-flag/no-nounused.rs index bed8006542ca3..30b6633987636 100644 --- a/tests/ui/extern-flag/no-nounused.rs +++ b/tests/ui/extern-flag/no-nounused.rs @@ -2,5 +2,5 @@ //@ compile-flags: -Zunstable-options -Dunused-crate-dependencies //@ edition:2018 -fn main() { //~ ERROR external crate `somedep` unused in `no_nounused` +fn main() { //~ ERROR extern crate `somedep` is unused in crate `no_nounused` } diff --git a/tests/ui/extern-flag/no-nounused.stderr b/tests/ui/extern-flag/no-nounused.stderr index 171079287f0b3..2b42e851561a9 100644 --- a/tests/ui/extern-flag/no-nounused.stderr +++ b/tests/ui/extern-flag/no-nounused.stderr @@ -1,9 +1,10 @@ -error: external crate `somedep` unused in `no_nounused`: remove the dependency or add `use somedep as _;` +error: extern crate `somedep` is unused in crate `no_nounused` --> $DIR/no-nounused.rs:5:1 | LL | fn main() { | ^ | + = help: remove the dependency or add `use somedep as _;` to the crate root = note: requested on the command line with `-D unused-crate-dependencies` error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-61053-missing-repetition.rs b/tests/ui/macros/issue-61053-missing-repetition.rs index 6b36c730b8254..77c94f24171ae 100644 --- a/tests/ui/macros/issue-61053-missing-repetition.rs +++ b/tests/ui/macros/issue-61053-missing-repetition.rs @@ -3,7 +3,7 @@ macro_rules! foo { () => {}; ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; - //~^ ERROR variable 'j' is still repeating + //~^ ERROR variable `j` is still repeating } macro_rules! bar { @@ -12,12 +12,12 @@ macro_rules! bar { macro_rules! nested { () => {}; ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; - //~^ ERROR variable 'j' is still repeating + //~^ ERROR variable `j` is still repeating } }; ( $( $i:ident = $($j:ident),+ );* ) => { $(macro_rules! $i { - () => { $j }; //~ ERROR variable 'j' is still repeating + () => { $j }; //~ ERROR variable `j` is still repeating })* }; } diff --git a/tests/ui/macros/issue-61053-missing-repetition.stderr b/tests/ui/macros/issue-61053-missing-repetition.stderr index 738f711f04e13..ba254401f17da 100644 --- a/tests/ui/macros/issue-61053-missing-repetition.stderr +++ b/tests/ui/macros/issue-61053-missing-repetition.stderr @@ -1,4 +1,4 @@ -error: variable 'j' is still repeating at this depth +error: variable `j` is still repeating at this depth --> $DIR/issue-61053-missing-repetition.rs:5:52 | LL | ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; @@ -12,7 +12,7 @@ note: the lint level is defined here LL | #![deny(meta_variable_misuse)] | ^^^^^^^^^^^^^^^^^^^^ -error: variable 'j' is still repeating at this depth +error: variable `j` is still repeating at this depth --> $DIR/issue-61053-missing-repetition.rs:14:60 | LL | ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; @@ -20,7 +20,7 @@ LL | ($( $i:ident = $($j:ident),+ );*) => { $( $i = $j; )* }; | | | expected repetition -error: variable 'j' is still repeating at this depth +error: variable `j` is still repeating at this depth --> $DIR/issue-61053-missing-repetition.rs:20:21 | LL | ( $( $i:ident = $($j:ident),+ );* ) => { diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs index 9fec546ecd65e..1eda5f5bb6bc3 100644 --- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs +++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs @@ -35,7 +35,7 @@ macro_rules! no_curly__no_rhs_dollar__no_round { #[rustfmt::skip] // autoformatters can break a few of the error traces macro_rules! no_curly__rhs_dollar__round { ( $( $i:ident ),* ) => { count($i) }; - //~^ ERROR variable 'i' is still repeating at this depth + //~^ ERROR variable `i` is still repeating at this depth } #[rustfmt::skip] // autoformatters can break a few of the error traces diff --git a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr index e9cef5ec6cc96..3fa3839bae2e5 100644 --- a/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr +++ b/tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr @@ -208,7 +208,7 @@ error: `count` can not be placed inside the inner-most repetition LL | ( $i:ident ) => { ${ count($i) } }; | ^^^^^^^^^^^^^ -error: variable 'i' is still repeating at this depth +error: variable `i` is still repeating at this depth --> $DIR/syntax-errors.rs:37:36 | LL | ( $( $i:ident ),* ) => { count($i) }; diff --git a/tests/ui/parser/macro/macro-repeat.stderr b/tests/ui/parser/macro/macro-repeat.stderr index ade2bbf9b0b05..ba722ab6cf987 100644 --- a/tests/ui/parser/macro/macro-repeat.stderr +++ b/tests/ui/parser/macro/macro-repeat.stderr @@ -1,10 +1,10 @@ -error: variable 'v' is still repeating at this depth +error: variable `v` is still repeating at this depth --> $DIR/macro-repeat.rs:3:9 | LL | $v | ^^ -error: variable 'v' is still repeating at this depth +error: variable `v` is still repeating at this depth --> $DIR/macro-repeat.rs:3:9 | LL | $v diff --git a/tests/ui/pub/pub-reexport-priv-extern-crate.rs b/tests/ui/pub/pub-reexport-priv-extern-crate.rs index dd5cd420fa546..fb495be400151 100644 --- a/tests/ui/pub/pub-reexport-priv-extern-crate.rs +++ b/tests/ui/pub/pub-reexport-priv-extern-crate.rs @@ -1,5 +1,5 @@ extern crate core; -pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported +pub use core as reexported_core; //~ ERROR `core` is private and cannot be re-exported //~^ WARN this was previously accepted mod foo1 { diff --git a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr index 3fa5b0f9aef3e..915d07fd08a6c 100644 --- a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr +++ b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr @@ -22,7 +22,7 @@ note: the crate import `core` is defined here LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ -error[E0365]: extern crate `core` is private, and cannot be re-exported, consider declaring with `pub` +error[E0365]: extern crate `core` is private and cannot be re-exported --> $DIR/pub-reexport-priv-extern-crate.rs:2:9 | LL | pub use core as reexported_core; @@ -31,6 +31,10 @@ LL | pub use core as reexported_core; = 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 #34537 = note: `#[deny(pub_use_of_private_extern_crate)]` on by default +help: consider making the `extern crate` item publicly accessible + | +LL | pub extern crate core; + | +++ error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2018/macro-use-warned-against.rs b/tests/ui/rust-2018/macro-use-warned-against.rs index 1e78acf201da7..d6bb5150178a3 100644 --- a/tests/ui/rust-2018/macro-use-warned-against.rs +++ b/tests/ui/rust-2018/macro-use-warned-against.rs @@ -4,7 +4,7 @@ #![warn(macro_use_extern_crate, unused)] -#[macro_use] //~ WARN should be replaced at use sites with a `use` item +#[macro_use] //~ WARN applying the `#[macro_use]` attribute to an `extern crate` item is deprecated extern crate macro_use_warned_against; #[macro_use] //~ WARN unused `#[macro_use]` extern crate macro_use_warned_against2; diff --git a/tests/ui/rust-2018/macro-use-warned-against.stderr b/tests/ui/rust-2018/macro-use-warned-against.stderr index 6b46f002e32ee..3ac1f12705170 100644 --- a/tests/ui/rust-2018/macro-use-warned-against.stderr +++ b/tests/ui/rust-2018/macro-use-warned-against.stderr @@ -1,9 +1,10 @@ -warning: deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead +warning: applying the `#[macro_use]` attribute to an `extern crate` item is deprecated --> $DIR/macro-use-warned-against.rs:7:1 | LL | #[macro_use] | ^^^^^^^^^^^^ | + = help: remove it and import macros at use sites with a `use` item instead note: the lint level is defined here --> $DIR/macro-use-warned-against.rs:5:9 | diff --git a/tests/ui/unused-crate-deps/deny-attr.rs b/tests/ui/unused-crate-deps/deny-attr.rs index 3b2e8b5677e28..71f478b6b7d72 100644 --- a/tests/ui/unused-crate-deps/deny-attr.rs +++ b/tests/ui/unused-crate-deps/deny-attr.rs @@ -4,6 +4,6 @@ //@ aux-crate:bar=bar.rs #![deny(unused_crate_dependencies)] -//~^ ERROR external crate `bar` unused in +//~^ ERROR extern crate `bar` is unused in fn main() {} diff --git a/tests/ui/unused-crate-deps/deny-attr.stderr b/tests/ui/unused-crate-deps/deny-attr.stderr index 89e87c9d5ac28..7540d9cdc1629 100644 --- a/tests/ui/unused-crate-deps/deny-attr.stderr +++ b/tests/ui/unused-crate-deps/deny-attr.stderr @@ -1,9 +1,10 @@ -error: external crate `bar` unused in `deny_attr`: remove the dependency or add `use bar as _;` +error: extern crate `bar` is unused in crate `deny_attr` --> $DIR/deny-attr.rs:6:1 | LL | #![deny(unused_crate_dependencies)] | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root note: the lint level is defined here --> $DIR/deny-attr.rs:6:9 | diff --git a/tests/ui/unused-crate-deps/deny-cmdline.rs b/tests/ui/unused-crate-deps/deny-cmdline.rs index d32e8e205af3e..890c01e00162c 100644 --- a/tests/ui/unused-crate-deps/deny-cmdline.rs +++ b/tests/ui/unused-crate-deps/deny-cmdline.rs @@ -5,4 +5,4 @@ //@ aux-crate:bar=bar.rs fn main() {} -//~^ ERROR external crate `bar` unused in +//~^ ERROR extern crate `bar` is unused in diff --git a/tests/ui/unused-crate-deps/deny-cmdline.stderr b/tests/ui/unused-crate-deps/deny-cmdline.stderr index fc526878ef052..b48d1ec1ba9f0 100644 --- a/tests/ui/unused-crate-deps/deny-cmdline.stderr +++ b/tests/ui/unused-crate-deps/deny-cmdline.stderr @@ -1,9 +1,10 @@ -error: external crate `bar` unused in `deny_cmdline`: remove the dependency or add `use bar as _;` +error: extern crate `bar` is unused in crate `deny_cmdline` --> $DIR/deny-cmdline.rs:7:1 | LL | fn main() {} | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root = note: requested on the command line with `-D unused-crate-dependencies` error: aborting due to 1 previous error diff --git a/tests/ui/unused-crate-deps/libfib.rs b/tests/ui/unused-crate-deps/libfib.rs index 8a5ec758e5609..d7729c9ebe7ea 100644 --- a/tests/ui/unused-crate-deps/libfib.rs +++ b/tests/ui/unused-crate-deps/libfib.rs @@ -5,7 +5,7 @@ //@ compile-flags:--crate-type lib -Wunused-crate-dependencies pub fn fib(n: u32) -> Vec { -//~^ WARNING external crate `bar` unused in +//~^ WARNING extern crate `bar` is unused in let mut prev = 0; let mut cur = 1; let mut v = vec![]; diff --git a/tests/ui/unused-crate-deps/libfib.stderr b/tests/ui/unused-crate-deps/libfib.stderr index 15833126bd620..da6893f50345c 100644 --- a/tests/ui/unused-crate-deps/libfib.stderr +++ b/tests/ui/unused-crate-deps/libfib.stderr @@ -1,9 +1,10 @@ -warning: external crate `bar` unused in `libfib`: remove the dependency or add `use bar as _;` +warning: extern crate `bar` is unused in crate `libfib` --> $DIR/libfib.rs:7:1 | LL | pub fn fib(n: u32) -> Vec { | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root = note: requested on the command line with `-W unused-crate-dependencies` warning: 1 warning emitted diff --git a/tests/ui/unused-crate-deps/unused-aliases.rs b/tests/ui/unused-crate-deps/unused-aliases.rs index f86f6bbf35646..2db50cec971d5 100644 --- a/tests/ui/unused-crate-deps/unused-aliases.rs +++ b/tests/ui/unused-crate-deps/unused-aliases.rs @@ -6,7 +6,7 @@ //@ aux-crate:barbar=bar.rs #![warn(unused_crate_dependencies)] -//~^ WARNING external crate `barbar` unused in +//~^ WARNING extern crate `barbar` is unused in use bar as _; diff --git a/tests/ui/unused-crate-deps/unused-aliases.stderr b/tests/ui/unused-crate-deps/unused-aliases.stderr index c8c6c4507b0c5..d4093b102d507 100644 --- a/tests/ui/unused-crate-deps/unused-aliases.stderr +++ b/tests/ui/unused-crate-deps/unused-aliases.stderr @@ -1,9 +1,10 @@ -warning: external crate `barbar` unused in `unused_aliases`: remove the dependency or add `use barbar as _;` +warning: extern crate `barbar` is unused in crate `unused_aliases` --> $DIR/unused-aliases.rs:8:1 | LL | #![warn(unused_crate_dependencies)] | ^ | + = help: remove the dependency or add `use barbar as _;` to the crate root note: the lint level is defined here --> $DIR/unused-aliases.rs:8:9 | diff --git a/tests/ui/unused-crate-deps/warn-attr.rs b/tests/ui/unused-crate-deps/warn-attr.rs index b558c0678d6ba..c40ed00173296 100644 --- a/tests/ui/unused-crate-deps/warn-attr.rs +++ b/tests/ui/unused-crate-deps/warn-attr.rs @@ -5,6 +5,6 @@ //@ aux-crate:bar=bar.rs #![warn(unused_crate_dependencies)] -//~^ WARNING external crate `bar` unused in +//~^ WARNING extern crate `bar` is unused in fn main() {} diff --git a/tests/ui/unused-crate-deps/warn-attr.stderr b/tests/ui/unused-crate-deps/warn-attr.stderr index 0d38315704b11..2c72961093c2c 100644 --- a/tests/ui/unused-crate-deps/warn-attr.stderr +++ b/tests/ui/unused-crate-deps/warn-attr.stderr @@ -1,9 +1,10 @@ -warning: external crate `bar` unused in `warn_attr`: remove the dependency or add `use bar as _;` +warning: extern crate `bar` is unused in crate `warn_attr` --> $DIR/warn-attr.rs:7:1 | LL | #![warn(unused_crate_dependencies)] | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root note: the lint level is defined here --> $DIR/warn-attr.rs:7:9 | diff --git a/tests/ui/unused-crate-deps/warn-cmdline-static.rs b/tests/ui/unused-crate-deps/warn-cmdline-static.rs index ccb404e3033b2..eb51543ad1ab6 100644 --- a/tests/ui/unused-crate-deps/warn-cmdline-static.rs +++ b/tests/ui/unused-crate-deps/warn-cmdline-static.rs @@ -7,4 +7,4 @@ //@ no-prefer-dynamic fn main() {} -//~^ WARNING external crate `bar` unused in +//~^ WARNING extern crate `bar` is unused in diff --git a/tests/ui/unused-crate-deps/warn-cmdline-static.stderr b/tests/ui/unused-crate-deps/warn-cmdline-static.stderr index 65956461d6439..79a3ade871903 100644 --- a/tests/ui/unused-crate-deps/warn-cmdline-static.stderr +++ b/tests/ui/unused-crate-deps/warn-cmdline-static.stderr @@ -1,9 +1,10 @@ -warning: external crate `bar` unused in `warn_cmdline_static`: remove the dependency or add `use bar as _;` +warning: extern crate `bar` is unused in crate `warn_cmdline_static` --> $DIR/warn-cmdline-static.rs:9:1 | LL | fn main() {} | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root = note: requested on the command line with `-W unused-crate-dependencies` warning: 1 warning emitted diff --git a/tests/ui/unused-crate-deps/warn-cmdline.rs b/tests/ui/unused-crate-deps/warn-cmdline.rs index 8d390e02ca591..cdeff5e5f6029 100644 --- a/tests/ui/unused-crate-deps/warn-cmdline.rs +++ b/tests/ui/unused-crate-deps/warn-cmdline.rs @@ -6,4 +6,4 @@ //@ aux-crate:bar=bar.rs fn main() {} -//~^ WARNING external crate `bar` unused in +//~^ WARNING extern crate `bar` is unused in diff --git a/tests/ui/unused-crate-deps/warn-cmdline.stderr b/tests/ui/unused-crate-deps/warn-cmdline.stderr index ea675ba9a1eb1..f5df83ca88411 100644 --- a/tests/ui/unused-crate-deps/warn-cmdline.stderr +++ b/tests/ui/unused-crate-deps/warn-cmdline.stderr @@ -1,9 +1,10 @@ -warning: external crate `bar` unused in `warn_cmdline`: remove the dependency or add `use bar as _;` +warning: extern crate `bar` is unused in crate `warn_cmdline` --> $DIR/warn-cmdline.rs:8:1 | LL | fn main() {} | ^ | + = help: remove the dependency or add `use bar as _;` to the crate root = note: requested on the command line with `-W unused-crate-dependencies` warning: 1 warning emitted