diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index 2a1d6b472cb07..edc175b990885 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -4,7 +4,7 @@ use rustc_abi::ExternAbi; use rustc_ast::ParamKindOrd; use rustc_errors::codes::*; use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic}; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Ident, Span, Symbol}; #[derive(Diagnostic)] @@ -671,7 +671,7 @@ pub(crate) struct MissingUnsafeOnExtern { pub span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("extern blocks should be unsafe")] pub(crate) struct MissingUnsafeOnExternLint { #[suggestion( @@ -1027,7 +1027,7 @@ pub(crate) struct MissingAbi { pub span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("`extern` declarations without an explicit ABI are deprecated")] pub(crate) struct MissingAbiSugg { #[suggestion( diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 7c12737776949..641121597848c 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -28,7 +28,7 @@ use rustc_middle::ty::{ use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex}; use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::hygiene::DesugaringKind; -use rustc_span::{BytePos, Ident, Span, Symbol, kw, sym}; +use rustc_span::{BytePos, ExpnKind, Ident, MacroKind, Span, Symbol, kw, sym}; use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::traits::FindExprBySpan; use rustc_trait_selection::error_reporting::traits::call_kind::CallKind; @@ -1438,6 +1438,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { expr: &hir::Expr<'_>, ) -> bool { let tcx = self.infcx.tcx; + + // Don't suggest `.clone()` in a derive macro expansion. + if let ExpnKind::Macro(MacroKind::Derive, _) = self.body.span.ctxt().outer_expn_data().kind + { + return false; + } if let Some(_) = self.clone_on_reference(expr) { // Avoid redundant clone suggestion already suggested in `explain_captures`. // See `tests/ui/moves/needs-clone-through-deref.rs` diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index 29ab8ee505d69..f8b466373e0b3 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -3,26 +3,26 @@ use rustc_errors::{ Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan, SingleLabelManySpans, Subdiagnostic, msg, }; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Ident, Span, Symbol}; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("avoid using `.intel_syntax`, Intel syntax is the default")] pub(crate) struct AvoidIntelSyntax; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("avoid using `.att_syntax`, prefer using `options(att_syntax)` instead")] pub(crate) struct AvoidAttSyntax; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("include macro expected single expression in source")] pub(crate) struct IncompleteInclude; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("cannot test inner items")] pub(crate) struct UnnameableTestItems; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("duplicated attribute")] pub(crate) struct DuplicateMacroAttribute; diff --git a/compiler/rustc_errors/src/decorate_diag.rs b/compiler/rustc_errors/src/decorate_diag.rs index 5aef26ccf973d..7e53b8195d5bc 100644 --- a/compiler/rustc_errors/src/decorate_diag.rs +++ b/compiler/rustc_errors/src/decorate_diag.rs @@ -1,15 +1,16 @@ /// This module provides types and traits for buffering lints until later in compilation. use rustc_ast::node_id::NodeId; use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::sync::DynSend; use rustc_error_messages::MultiSpan; use rustc_lint_defs::{BuiltinLintDiag, Lint, LintId}; -use crate::{DynSend, LintDiagnostic, LintDiagnosticBox}; +use crate::{Diag, DiagCtxtHandle, Diagnostic, Level}; /// We can't implement `LintDiagnostic` for `BuiltinLintDiag`, because decorating some of its /// variants requires types we don't have yet. So, handle that case separately. pub enum DecorateDiagCompat { - Dynamic(Box LintDiagnosticBox<'a, ()> + DynSend + 'static>), + Dynamic(Box FnOnce(DiagCtxtHandle<'a>, Level) -> Diag<'a, ()> + DynSend + 'static>), Builtin(BuiltinLintDiag), } @@ -19,12 +20,10 @@ impl std::fmt::Debug for DecorateDiagCompat { } } -impl !LintDiagnostic<'_, ()> for BuiltinLintDiag {} - -impl LintDiagnostic<'a, ()> + DynSend + 'static> From for DecorateDiagCompat { +impl Diagnostic<'a, ()> + DynSend + 'static> From for DecorateDiagCompat { #[inline] fn from(d: D) -> Self { - Self::Dynamic(Box::new(d)) + Self::Dynamic(Box::new(|dcx, level| d.into_diag(dcx, level))) } } diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 27a70534c5bc8..888009bf9d4c5 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -7,6 +7,7 @@ use std::panic; use std::path::PathBuf; use std::thread::panicking; +use rustc_data_structures::sync::DynSend; use rustc_error_messages::{DiagArgMap, DiagArgName, DiagArgValue, IntoDiagArg}; use rustc_lint_defs::{Applicability, LintExpectationId}; use rustc_macros::{Decodable, Encodable}; @@ -118,6 +119,14 @@ where } } +impl<'a> Diagnostic<'a, ()> + for Box FnOnce(DiagCtxtHandle<'b>, Level) -> Diag<'b, ()> + DynSend + 'static> +{ + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + self(dcx, level) + } +} + /// Trait implemented by error types. This should not be implemented manually. Instead, use /// `#[derive(Subdiagnostic)]` -- see [rustc_macros::Subdiagnostic]. #[rustc_diagnostic_item = "Subdiagnostic"] @@ -137,16 +146,6 @@ pub trait LintDiagnostic<'a, G: EmissionGuarantee> { fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, G>); } -pub trait LintDiagnosticBox<'a, G: EmissionGuarantee> { - fn decorate_lint_box<'b>(self: Box, diag: &'b mut Diag<'a, G>); -} - -impl<'a, G: EmissionGuarantee, D: LintDiagnostic<'a, G>> LintDiagnosticBox<'a, G> for D { - fn decorate_lint_box<'b>(self: Box, diag: &'b mut Diag<'a, G>) { - self.decorate_lint(diag); - } -} - #[derive(Clone, Debug, Encodable, Decodable)] pub(crate) struct DiagLocation { file: Cow<'static, str>, diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index eab919f08ab50..4ef4d58074639 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -40,7 +40,7 @@ pub use codes::*; pub use decorate_diag::{BufferedEarlyLint, DecorateDiagCompat, LintBuffer}; pub use diagnostic::{ BugAbort, Diag, DiagInner, DiagStyledString, Diagnostic, EmissionGuarantee, FatalAbort, - LintDiagnostic, LintDiagnosticBox, StringPart, Subdiag, Subdiagnostic, + LintDiagnostic, StringPart, Subdiag, Subdiagnostic, }; pub use diagnostic_impls::{ DiagSymbolList, ElidedLifetimeInPathSubdiag, ExpectedLifetimeParameter, diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index 8285733c68aa7..6c5732f497f8a 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -3,10 +3,10 @@ use std::borrow::Cow; use rustc_ast::ast; use rustc_errors::codes::*; use rustc_hir::limit::Limit; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol}; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("`#[cfg_attr]` does not expand to any attributes")] pub(crate) struct CfgAttrNoAttributes; @@ -94,7 +94,7 @@ pub(crate) struct MacroVarStillRepeating { pub ident: MacroRulesNormalizedIdent, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("variable `{$ident}` is still repeating at this depth")] pub(crate) struct MetaVarStillRepeatingLint { #[label("expected repetition")] @@ -102,7 +102,7 @@ pub(crate) struct MetaVarStillRepeatingLint { pub ident: MacroRulesNormalizedIdent, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("meta-variable repeats with different Kleene operator")] pub(crate) struct MetaVariableWrongOperator { #[label("expected repetition")] @@ -119,7 +119,7 @@ pub(crate) struct MetaVarsDifSeqMatchers { pub msg: String, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unknown macro variable `{$name}`")] pub(crate) struct UnknownMacroVariable { pub name: MacroRulesNormalizedIdent, @@ -391,7 +391,7 @@ pub(crate) struct DuplicateMatcherBinding { pub prev: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("duplicate matcher binding")] pub(crate) struct DuplicateMatcherBindingLint { #[label("duplicate binding")] @@ -569,7 +569,7 @@ pub(crate) struct MacroArgsBadDelimSugg { pub close: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused doc comment")] #[help( "to document an item produced by a macro, the macro must produce the documentation as part of its expansion" @@ -579,7 +579,7 @@ pub(crate) struct MacroCallUnusedDocComment { pub span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag( "the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro" )] @@ -593,7 +593,7 @@ pub(crate) struct OrPatternsBackCompat { pub suggestion: String, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("trailing semicolon in macro used in expression position")] pub(crate) struct TrailingMacro { #[note("macro invocations at the end of a block are treated as expressions")] @@ -604,7 +604,7 @@ pub(crate) struct TrailingMacro { pub name: Ident, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused attribute `{$attr_name}`")] pub(crate) struct UnusedBuiltinAttribute { #[note( diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index a2ee7936685b3..92232c7d230bc 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -50,8 +50,7 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> { ); } DecorateDiagCompat::Dynamic(d) => { - self.context - .opt_span_lint(lint_id.lint, span, |diag| d.decorate_lint_box(diag)); + self.context.opt_span_diag_lint(lint_id.lint, span, d); } } } diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index ccd0fdfcd1e7a..c362badd033ca 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -932,13 +932,14 @@ pub(crate) struct IrrefutableLetPatternsIfLetGuard { )] #[note( "{$count -> - [one] this pattern - *[other] these patterns -} will always match, so the `else` clause is useless" + [one] this pattern always matches, so the else clause is unreachable + *[other] these patterns always match, so the else clause is unreachable +}" )] -#[help("consider removing the `else` clause")] pub(crate) struct IrrefutableLetPatternsLetElse { pub(crate) count: usize, + #[help("remove this `else` block")] + pub(crate) else_span: Option, } #[derive(Diagnostic)] diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index f4645604e6efd..e844f1114d61e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -160,7 +160,7 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> { self.check_match(scrutinee, arms, MatchSource::Normal, span); } ExprKind::Let { box ref pat, expr } => { - self.check_let(pat, Some(expr), ex.span); + self.check_let(pat, Some(expr), ex.span, None); } ExprKind::LogicalOp { op: LogicalOp::And, .. } if !matches!(self.let_source, LetSource::None) => @@ -169,7 +169,7 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> { let Ok(()) = self.visit_land(ex, &mut chain_refutabilities) else { return }; // Lint only single irrefutable let binding. if let [Some((_, Irrefutable))] = chain_refutabilities[..] { - self.lint_single_let(ex.span); + self.lint_single_let(ex.span, None); } return; } @@ -184,8 +184,9 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> { self.with_hir_source(hir_id, |this| { let let_source = if else_block.is_some() { LetSource::LetElse } else { LetSource::PlainLet }; + let else_span = else_block.map(|bid| this.thir.blocks[bid].span); this.with_let_source(let_source, |this| { - this.check_let(pattern, initializer, span) + this.check_let(pattern, initializer, span, else_span) }); visit::walk_stmt(this, stmt); }); @@ -426,13 +427,19 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { } #[instrument(level = "trace", skip(self))] - fn check_let(&mut self, pat: &'p Pat<'tcx>, scrutinee: Option, span: Span) { + fn check_let( + &mut self, + pat: &'p Pat<'tcx>, + scrutinee: Option, + span: Span, + else_span: Option, + ) { assert!(self.let_source != LetSource::None); let scrut = scrutinee.map(|id| &self.thir[id]); if let LetSource::PlainLet = self.let_source { self.check_binding_is_irrefutable(pat, "local binding", scrut, Some(span)); } else if let Ok(Irrefutable) = self.is_let_irrefutable(pat, scrut) { - self.lint_single_let(span); + self.lint_single_let(span, else_span); } } @@ -540,8 +547,15 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { } #[instrument(level = "trace", skip(self))] - fn lint_single_let(&mut self, let_span: Span) { - report_irrefutable_let_patterns(self.tcx, self.hir_source, self.let_source, 1, let_span); + fn lint_single_let(&mut self, let_span: Span, else_span: Option) { + report_irrefutable_let_patterns( + self.tcx, + self.hir_source, + self.let_source, + 1, + let_span, + else_span, + ); } fn analyze_binding( @@ -836,6 +850,7 @@ fn report_irrefutable_let_patterns( source: LetSource, count: usize, span: Span, + else_span: Option, ) { macro_rules! emit_diag { ($lint:tt) => {{ @@ -847,7 +862,14 @@ fn report_irrefutable_let_patterns( LetSource::None | LetSource::PlainLet | LetSource::Else => bug!(), LetSource::IfLet | LetSource::ElseIfLet => emit_diag!(IrrefutableLetPatternsIfLet), LetSource::IfLetGuard => emit_diag!(IrrefutableLetPatternsIfLetGuard), - LetSource::LetElse => emit_diag!(IrrefutableLetPatternsLetElse), + LetSource::LetElse => { + tcx.emit_node_span_lint( + IRREFUTABLE_LET_PATTERNS, + id, + span, + IrrefutableLetPatternsLetElse { count, else_span }, + ); + } LetSource::WhileLet => emit_diag!(IrrefutableLetPatternsWhileLet), } } diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index e156ad79e1900..c1ccb6a298315 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -11,7 +11,7 @@ use rustc_errors::{ Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level, Subdiagnostic, SuggestionStyle, msg, }; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::edition::{Edition, LATEST_STABLE_EDITION}; use rustc_span::{Ident, Span, Symbol}; @@ -4305,7 +4305,7 @@ pub(crate) struct ExpectedRegisterClassOrExplicitRegister { pub(crate) span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unicode codepoint changing visible direction of text present in {$label}")] #[note( "these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen" @@ -4388,7 +4388,7 @@ impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub { } } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("missing pattern for `...` argument")] pub(crate) struct VarargsWithoutPattern { #[suggestion( diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index c776020c21274..6c7cc311da2a0 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -136,7 +136,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } for ambiguity_error in &self.ambiguity_errors { - let diag = self.ambiguity_diagnostic(ambiguity_error); + let mut diag = self.ambiguity_diagnostic(ambiguity_error); if let Some(ambiguity_warning) = ambiguity_error.warning { let node_id = match ambiguity_error.b1.0.kind { @@ -152,6 +152,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { self.lint_buffer.buffer_lint(lint, node_id, diag.ident.span, diag); } else { + diag.is_error = true; self.dcx().emit_err(diag); } } @@ -2093,6 +2094,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { b1_help_msgs, b2_note, b2_help_msgs, + is_error: false, } } diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index ee07f5b8f43d4..2a0021ebc3bdc 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -1,9 +1,9 @@ use rustc_errors::codes::*; use rustc_errors::{ Applicability, Diag, DiagCtxtHandle, DiagMessage, Diagnostic, ElidedLifetimeInPathSubdiag, - EmissionGuarantee, IntoDiagArg, Level, LintDiagnostic, MultiSpan, Subdiagnostic, msg, + EmissionGuarantee, IntoDiagArg, Level, MultiSpan, Subdiagnostic, msg, }; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::source_map::Spanned; use rustc_span::{Ident, Span, Symbol}; @@ -614,7 +614,7 @@ pub(crate) struct ProcMacroSameCrate { pub(crate) is_test: bool, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("cannot find {$ns_descr} `{$ident}` in this scope")] pub(crate) struct ProcMacroDeriveResolutionFallback { #[label("names from parent modules are not accessible without an explicit import")] @@ -623,7 +623,7 @@ pub(crate) struct ProcMacroDeriveResolutionFallback { pub ident: Symbol, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag( "macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths" )] @@ -823,7 +823,7 @@ pub(crate) struct CannotBeReexportedCratePublicNS { pub(crate) ident: Ident, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("extern crate `{$ident}` is private and cannot be re-exported", code = E0365)] pub(crate) struct PrivateExternCrateReexport { pub ident: Ident, @@ -1393,14 +1393,14 @@ pub(crate) struct TraitImplMismatch { pub(crate) trait_item_span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("derive helper attribute is used before it is introduced")] pub(crate) struct LegacyDeriveHelpers { #[label("the attribute is introduced here")] pub span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused extern crate")] pub(crate) struct UnusedExternCrate { #[label("unused")] @@ -1414,7 +1414,7 @@ pub(crate) struct UnusedExternCrate { pub removal_span: Span, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("{$kind} `{$name}` from private dependency '{$krate}' is re-exported")] pub(crate) struct ReexportPrivateDependency { pub name: Symbol, @@ -1422,32 +1422,32 @@ pub(crate) struct ReexportPrivateDependency { pub krate: Symbol, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused label")] pub(crate) struct UnusedLabel; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused `#[macro_use]` import")] pub(crate) struct UnusedMacroUse; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("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")] pub(crate) struct MacroUseDeprecated; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("macro `{$ident}` is private")] pub(crate) struct MacroIsPrivate { pub ident: Ident, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unused macro definition: `{$name}`")] pub(crate) struct UnusedMacroDefinition { pub name: Symbol, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("rule #{$n} of macro `{$name}` is never used")] pub(crate) struct MacroRuleNeverUsed { pub n: usize, @@ -1458,13 +1458,14 @@ pub(crate) struct UnstableFeature { pub msg: DiagMessage, } -impl<'a> LintDiagnostic<'a, ()> for UnstableFeature { - fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) { - diag.primary_message(self.msg); +impl<'a> Diagnostic<'a, ()> for UnstableFeature { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { + let Self { msg } = self; + Diag::new(dcx, level, msg) } } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("`extern crate` is not idiomatic in the new edition")] pub(crate) struct ExternCrateNotIdiomatic { #[suggestion( @@ -1477,7 +1478,7 @@ pub(crate) struct ExternCrateNotIdiomatic { pub code: &'static str, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("cannot find macro `{$path}` in the current scope when looking from {$location}")] #[help("import `macro_rules` with `use` to make it callable above its definition")] pub(crate) struct OutOfScopeMacroCalls { @@ -1487,7 +1488,7 @@ pub(crate) struct OutOfScopeMacroCalls { pub location: String, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag( "glob import doesn't reexport anything with visibility `{$import_vis}` because no imported item is public enough" )] @@ -1500,7 +1501,7 @@ pub(crate) struct RedundantImportVisibility { pub max_vis: String, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unknown diagnostic attribute")] pub(crate) struct UnknownDiagnosticAttribute { #[subdiagnostic] @@ -1530,43 +1531,48 @@ pub(crate) struct Ambiguity { pub b1_help_msgs: Vec, pub b2_note: Spanned, pub b2_help_msgs: Vec, + /// If false, then it's a lint, if true, then it's an error with the `E0659` error code. + pub is_error: bool, } -impl Ambiguity { - fn decorate<'a>(self, diag: &mut Diag<'a, impl EmissionGuarantee>) { - if let Some(ambig_vis) = self.ambig_vis { +impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for Ambiguity { + fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { + let Self { + ident, + ambig_vis, + kind, + help, + b1_note, + b1_help_msgs, + b2_note, + b2_help_msgs, + is_error, + } = self; + + let mut diag = Diag::new(dcx, level, "").with_span(ident.span); + if is_error { + diag.code(E0659); + } + if let Some(ambig_vis) = ambig_vis { diag.primary_message(format!("ambiguous import visibility: {ambig_vis}")); } else { - diag.primary_message(format!("`{}` is ambiguous", self.ident)); - diag.span_label(self.ident.span, "ambiguous name"); + diag.primary_message(format!("`{}` is ambiguous", ident)); + diag.span_label(ident.span, "ambiguous name"); } - diag.note(format!("ambiguous because of {}", self.kind)); - diag.span_note(self.b1_note.span, self.b1_note.node); - if let Some(help) = self.help { + diag.note(format!("ambiguous because of {}", kind)); + diag.span_note(b1_note.span, b1_note.node); + if let Some(help) = help { for help in help { diag.help(*help); } } - for help_msg in self.b1_help_msgs { + for help_msg in b1_help_msgs { diag.help(help_msg); } - diag.span_note(self.b2_note.span, self.b2_note.node); - for help_msg in self.b2_help_msgs { + diag.span_note(b2_note.span, b2_note.node); + for help_msg in b2_help_msgs { diag.help(help_msg); } - } -} - -impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for Ambiguity { - fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { - let mut diag = Diag::new(dcx, level, "").with_span(self.ident.span).with_code(E0659); - self.decorate(&mut diag); diag } } - -impl<'a> LintDiagnostic<'a, ()> for Ambiguity { - fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) { - self.decorate(diag); - } -} diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 04a32c20a7915..219ec5c51279e 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -7,7 +7,7 @@ use rustc_errors::{ Diag, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, ErrorGuaranteed, Level, MultiSpan, }; -use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTuple}; @@ -528,7 +528,7 @@ pub(crate) struct SoftFloatIgnored; #[note("see issue #129893 for more information")] pub(crate) struct SoftFloatDeprecated; -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag("unexpected `--cfg {$cfg}` flag")] #[note("config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}`")] #[note("manually setting a built-in cfg can and does create incoherent behaviors")] diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index 0012e85e8a593..27dd0b764f3b2 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -67,7 +67,7 @@ macro_rules! def_reg_class { macro_rules! def_regs { ($arch:ident $arch_reg:ident $arch_regclass:ident { $( - $reg:ident: $class:ident $(, $extra_class:ident)* = [$reg_name:literal $(, $alias:literal)*] $(% $filter:ident)?, + $reg:ident: $class:ident $(, $extra_class:ident)* = [$reg_name:literal $(, $alias:literal)*] $(% $filter:ident)*, )* $( #error = [$($bad_reg:literal),+] => $error:literal, @@ -121,7 +121,7 @@ macro_rules! def_regs { _target_features, _target, _is_clobber - )?;)? + )?;)* Ok(()) } )* @@ -142,7 +142,7 @@ macro_rules! def_regs { #[allow(unused_imports)] use super::{InlineAsmReg, InlineAsmRegClass}; $( - if $($filter(_arch, _reloc_model, _target_features, _target, false).is_ok() &&)? true { + if $($filter(_arch, _reloc_model, _target_features, _target, false).is_ok() &&)* true { if let Some(set) = _map.get_mut(&InlineAsmRegClass::$arch($arch_regclass::$class)) { set.insert(InlineAsmReg::$arch($arch_reg::$reg)); } diff --git a/compiler/rustc_target/src/asm/x86.rs b/compiler/rustc_target/src/asm/x86.rs index 03e7fd5969608..6f0faffa32984 100644 --- a/compiler/rustc_target/src/asm/x86.rs +++ b/compiler/rustc_target/src/asm/x86.rs @@ -250,8 +250,8 @@ def_regs! { r15: reg = ["r15", "r15w", "r15d"] % x86_64_only, al: reg_byte = ["al"], ah: reg_byte = ["ah"] % high_byte, - bl: reg_byte = ["bl"], - bh: reg_byte = ["bh"] % high_byte, + bl: reg_byte = ["bl"] % rbx_reserved, + bh: reg_byte = ["bh"] % rbx_reserved % high_byte, cl: reg_byte = ["cl"], ch: reg_byte = ["ch"] % high_byte, dl: reg_byte = ["dl"], diff --git a/library/coretests/tests/time.rs b/library/coretests/tests/time.rs index ff80ff680943f..5877f662b7ddc 100644 --- a/library/coretests/tests/time.rs +++ b/library/coretests/tests/time.rs @@ -598,3 +598,100 @@ fn from_neg_zero() { assert_eq!(Duration::from_secs_f32(-0.0), Duration::ZERO); assert_eq!(Duration::from_secs_f64(-0.0), Duration::ZERO); } + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_mul_nan() { + let _ = Duration::NANOSECOND.mul_f64(f64::NAN); +} + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_mul_posinfinity() { + let _ = Duration::NANOSECOND.mul_f64(f64::INFINITY); +} + +#[test] +#[should_panic(expected = "value is negative")] +fn duration_fp_mul_neginfinity() { + let _ = Duration::NANOSECOND.mul_f64(f64::NEG_INFINITY); +} + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_div_nan() { + let _ = Duration::NANOSECOND.div_f64(f64::NAN); +} + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_div_poszero() { + let _ = Duration::NANOSECOND.div_f64(0.0); +} + +#[test] +#[should_panic(expected = "value is negative")] +fn duration_fp_div_negzero() { + let _ = Duration::NANOSECOND.div_f64(-0.0); +} + +#[test] +#[should_panic(expected = "value is negative")] +fn duration_fp_div_negative() { + let _ = Duration::NANOSECOND.div_f64(f64::MIN); +} + +const TOO_LARGE_FACTOR: f64 = Duration::MAX.as_nanos() as f64; +const TOO_LARGE_DIVISOR: f64 = (Duration::MAX.as_secs_f64() * 2e9).next_up(); +const SMALLEST_DIVISOR: f64 = (TOO_LARGE_DIVISOR.recip() * 2.0).next_up().next_up(); +const SMALLEST_FACTOR: f64 = TOO_LARGE_FACTOR.recip() / 2.0; +const SMALLEST_NEGFACTOR: f64 = (0.0f64.next_down() * 0.5e9).next_up(); + +#[test] +fn duration_fp_boundaries() { + const DURATION_BITS: u32 = Duration::MAX.as_nanos().ilog2() + 1; + const PRECISION: u32 = DURATION_BITS - f64::MANTISSA_DIGITS + 1; + + assert_eq!(Duration::MAX.mul_f64(0.0), Duration::ZERO); + assert_eq!(Duration::MAX.mul_f64(-0.0), Duration::ZERO); + + assert_eq!(Duration::MAX.mul_f64(SMALLEST_FACTOR), Duration::NANOSECOND); + assert_eq!(Duration::MAX.mul_f64(SMALLEST_FACTOR.next_down()), Duration::ZERO); + + assert_eq!(Duration::MAX.div_f64(TOO_LARGE_DIVISOR), Duration::ZERO); + assert_eq!(Duration::MAX.div_f64(TOO_LARGE_DIVISOR.next_down()), Duration::NANOSECOND); + + assert_eq!(Duration::MAX.div_f64(f64::INFINITY), Duration::ZERO); + assert_eq!(Duration::MAX.div_f64(f64::NEG_INFINITY), Duration::ZERO); + + // the following assertions pair with the subsequent (`should_panic`) tests + + assert_eq!(Duration::NANOSECOND.mul_f64(SMALLEST_NEGFACTOR), Duration::ZERO); + + assert!( + Duration::MAX - Duration::NANOSECOND.mul_f64(TOO_LARGE_FACTOR.next_down()) + < Duration::from_nanos(1 << PRECISION) + ); + assert!( + Duration::MAX - Duration::NANOSECOND.div_f64(SMALLEST_DIVISOR) + < Duration::from_nanos(1 << PRECISION) + ); +} + +#[test] +#[should_panic(expected = "value is negative")] +fn duration_fp_mul_negative() { + let _ = Duration::NANOSECOND.mul_f64(SMALLEST_NEGFACTOR.next_down()); +} + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_mul_overflow() { + let _ = Duration::NANOSECOND.mul_f64(TOO_LARGE_FACTOR); +} + +#[test] +#[should_panic(expected = "value is either too big or NaN")] +fn duration_fp_div_overflow() { + let _ = Duration::NANOSECOND.div_f64(SMALLEST_DIVISOR.next_down()); +} diff --git a/library/std/src/path.rs b/library/std/src/path.rs index bf27df7b04281..9026606987e16 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3308,6 +3308,34 @@ impl Path { fs::canonicalize(self) } + /// Makes the path absolute without accessing the filesystem. + /// + /// This is an alias to [`path::absolute`](absolute). + /// + /// # Errors + /// + /// This function may return an error in the following situations: + /// + /// * If the path is syntactically invalid; in particular, if it is empty. + /// * If getting the [current directory][crate::env::current_dir] fails. + /// + /// # Examples + /// + /// ```no_run + /// #![feature(path_absolute_method)] + /// use std::path::Path; + /// + /// let path = Path::new("foo/./bar"); + /// let absolute = path.absolute()?; + /// assert!(absolute.is_absolute()); + /// # Ok::<(), std::io::Error>(()) + /// ``` + #[unstable(feature = "path_absolute_method", issue = "153328")] + #[inline] + pub fn absolute(&self) -> io::Result { + absolute(self) + } + /// Normalize a path, including `..` without traversing the filesystem. /// /// Returns an error if normalization would leave leading `..` components. diff --git a/library/std/src/thread/functions.rs b/library/std/src/thread/functions.rs index 95d7aaf518408..70642108e1e01 100644 --- a/library/std/src/thread/functions.rs +++ b/library/std/src/thread/functions.rs @@ -168,7 +168,11 @@ pub fn yield_now() { imp::yield_now() } -/// Determines whether the current thread is unwinding because of panic. +/// Determines whether the current thread is panicking. +/// +/// This returns `true` both when the thread is unwinding due to a panic, +/// or executing a panic hook. Note that the latter case will still happen +/// when `panic=abort` is set. /// /// A common use of this feature is to poison shared resources when writing /// unsafe code, by checking `panicking` when the `drop` is called. @@ -309,14 +313,14 @@ pub fn sleep(dur: Duration) { /// /// | Platform | System call | /// |-----------|----------------------------------------------------------------------| -/// | Linux | [clock_nanosleep] (Monotonic clock) | -/// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock)] | -/// | Android | [clock_nanosleep] (Monotonic Clock)] | -/// | Solaris | [clock_nanosleep] (Monotonic Clock)] | -/// | Illumos | [clock_nanosleep] (Monotonic Clock)] | -/// | Dragonfly | [clock_nanosleep] (Monotonic Clock)] | -/// | Hurd | [clock_nanosleep] (Monotonic Clock)] | -/// | Vxworks | [clock_nanosleep] (Monotonic Clock)] | +/// | Linux | [clock_nanosleep] (Monotonic Clock) | +/// | BSD except OpenBSD | [clock_nanosleep] (Monotonic Clock) | +/// | Android | [clock_nanosleep] (Monotonic Clock) | +/// | Solaris | [clock_nanosleep] (Monotonic Clock) | +/// | Illumos | [clock_nanosleep] (Monotonic Clock) | +/// | Dragonfly | [clock_nanosleep] (Monotonic Clock) | +/// | Hurd | [clock_nanosleep] (Monotonic Clock) | +/// | Vxworks | [clock_nanosleep] (Monotonic Clock) | /// | Apple | `mach_wait_until` | /// | Other | `sleep_until` uses [`sleep`] and does not issue a syscall itself | /// diff --git a/tests/rustdoc-html/primitive/auxiliary/reexport-fake_variadic.rs b/tests/rustdoc-html/primitive/auxiliary/reexport-fake_variadic.rs new file mode 100644 index 0000000000000..ca7f3a915a48b --- /dev/null +++ b/tests/rustdoc-html/primitive/auxiliary/reexport-fake_variadic.rs @@ -0,0 +1,6 @@ +#![feature(rustdoc_internals)] + +pub trait Foo {} + +#[doc(fake_variadic)] +impl Foo for (T,) {} diff --git a/tests/rustdoc-html/primitive/reexport-fake_variadic.rs b/tests/rustdoc-html/primitive/reexport-fake_variadic.rs new file mode 100644 index 0000000000000..255a28209bc2a --- /dev/null +++ b/tests/rustdoc-html/primitive/reexport-fake_variadic.rs @@ -0,0 +1,12 @@ +// This test ensures that the `doc(fake_variadic)` attribute is correctly handled +// through reexports. + +//@ aux-build:reexport-fake_variadic.rs + +#![crate_name = "foo"] + +extern crate reexport_fake_variadic as dep; + +//@ has foo/trait.Foo.html +//@ has - '//section[@id="impl-Foo-for-(T,)"]/h3' 'impl Foo for (T₁, T₂, …, Tₙ)' +pub use dep::Foo; diff --git a/tests/ui/asm/x86_64/bad-reg.experimental_reg.stderr b/tests/ui/asm/x86_64/bad-reg.experimental_reg.stderr index 7c9b211337694..133921b894dd0 100644 --- a/tests/ui/asm/x86_64/bad-reg.experimental_reg.stderr +++ b/tests/ui/asm/x86_64/bad-reg.experimental_reg.stderr @@ -67,49 +67,49 @@ LL | asm!("", in("ip") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:39:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", in("st(2)") foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", in("mm0") foo); | ^^^^^^^^^^^^^ error: register class `kreg0` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:49:18 | LL | asm!("", in("k0") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:50:20 + --> $DIR/bad-reg.rs:54:20 | LL | asm!("{}", in(x87_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:53:20 + --> $DIR/bad-reg.rs:57:20 | LL | asm!("{}", in(mmx_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:56:20 + --> $DIR/bad-reg.rs:60:20 | LL | asm!("{}", out(x87_reg) _); | ^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:58:20 + --> $DIR/bad-reg.rs:62:20 | LL | asm!("{}", out(mmx_reg) _); | ^^^^^^^^^^^^^^ error: register `al` conflicts with register `eax` - --> $DIR/bad-reg.rs:64:33 + --> $DIR/bad-reg.rs:68:33 | LL | asm!("", in("eax") foo, in("al") bar); | ------------- ^^^^^^^^^^^^ register `al` @@ -117,7 +117,7 @@ LL | asm!("", in("eax") foo, in("al") bar); | register `eax` error: register `rax` conflicts with register `rax` - --> $DIR/bad-reg.rs:67:33 + --> $DIR/bad-reg.rs:71:33 | LL | asm!("", in("rax") foo, out("rax") bar); | ------------- ^^^^^^^^^^^^^^ register `rax` @@ -125,13 +125,13 @@ LL | asm!("", in("rax") foo, out("rax") bar); | register `rax` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:67:18 + --> $DIR/bad-reg.rs:71:18 | LL | asm!("", in("rax") foo, out("rax") bar); | ^^^^^^^^^^^^^ error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:72:34 + --> $DIR/bad-reg.rs:76:34 | LL | asm!("", in("xmm0") foo, in("ymm0") bar); | -------------- ^^^^^^^^^^^^^^ register `ymm0` @@ -139,7 +139,7 @@ LL | asm!("", in("xmm0") foo, in("ymm0") bar); | register `xmm0` error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:74:34 + --> $DIR/bad-reg.rs:78:34 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | -------------- ^^^^^^^^^^^^^^^ register `ymm0` @@ -147,13 +147,25 @@ LL | asm!("", in("xmm0") foo, out("ymm0") bar); | register `xmm0` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:74:18 + --> $DIR/bad-reg.rs:78:18 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | ^^^^^^^^^^^^^^ +error: cannot use register `bl`: rbx is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", in("bl") foo); + | ^^^^^^^^^^^^ + +error: cannot use register `bh`: rbx is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", in("bh") foo); + | ^^^^^^^^^^^^ + error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:39:30 + --> $DIR/bad-reg.rs:43:30 | LL | asm!("", in("st(2)") foo); | ^^^ @@ -161,7 +173,7 @@ LL | asm!("", in("st(2)") foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:42:28 + --> $DIR/bad-reg.rs:46:28 | LL | asm!("", in("mm0") foo); | ^^^ @@ -169,7 +181,7 @@ LL | asm!("", in("mm0") foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:45:27 + --> $DIR/bad-reg.rs:49:27 | LL | asm!("", in("k0") foo); | ^^^ @@ -177,7 +189,7 @@ LL | asm!("", in("k0") foo); = note: register class `kreg0` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:50:32 + --> $DIR/bad-reg.rs:54:32 | LL | asm!("{}", in(x87_reg) foo); | ^^^ @@ -185,7 +197,7 @@ LL | asm!("{}", in(x87_reg) foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:53:32 + --> $DIR/bad-reg.rs:57:32 | LL | asm!("{}", in(mmx_reg) foo); | ^^^ @@ -193,7 +205,7 @@ LL | asm!("{}", in(mmx_reg) foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:64:42 + --> $DIR/bad-reg.rs:68:42 | LL | asm!("", in("eax") foo, in("al") bar); | ^^^ @@ -201,7 +213,7 @@ LL | asm!("", in("eax") foo, in("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:69:27 + --> $DIR/bad-reg.rs:73:27 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ @@ -209,12 +221,12 @@ LL | asm!("", in("al") foo, lateout("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:69:46 + --> $DIR/bad-reg.rs:73:46 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ | = note: register class `reg_byte` supports these types: i8 -error: aborting due to 28 previous errors +error: aborting due to 30 previous errors diff --git a/tests/ui/asm/x86_64/bad-reg.rs b/tests/ui/asm/x86_64/bad-reg.rs index 994dcfd77ccde..4b3005d5675b3 100644 --- a/tests/ui/asm/x86_64/bad-reg.rs +++ b/tests/ui/asm/x86_64/bad-reg.rs @@ -35,6 +35,10 @@ fn main() { //~^ ERROR invalid register `rsp`: the stack pointer cannot be used as an operand asm!("", in("ip") foo); //~^ ERROR invalid register `ip`: the instruction pointer cannot be used as an operand + asm!("", in("bl") foo); + //~^ ERROR cannot use register `bl`: rbx is used internally by LLVM and cannot be used as an operand for inline asm + asm!("", in("bh") foo); + //~^ ERROR cannot use register `bh`: rbx is used internally by LLVM and cannot be used as an operand for inline asm asm!("", in("st(2)") foo); //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output diff --git a/tests/ui/asm/x86_64/bad-reg.stable.stderr b/tests/ui/asm/x86_64/bad-reg.stable.stderr index 2b5c453d70c63..a1c2792a5b1fc 100644 --- a/tests/ui/asm/x86_64/bad-reg.stable.stderr +++ b/tests/ui/asm/x86_64/bad-reg.stable.stderr @@ -67,49 +67,49 @@ LL | asm!("", in("ip") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:39:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", in("st(2)") foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", in("mm0") foo); | ^^^^^^^^^^^^^ error: register class `kreg0` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:49:18 | LL | asm!("", in("k0") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:50:20 + --> $DIR/bad-reg.rs:54:20 | LL | asm!("{}", in(x87_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:53:20 + --> $DIR/bad-reg.rs:57:20 | LL | asm!("{}", in(mmx_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:56:20 + --> $DIR/bad-reg.rs:60:20 | LL | asm!("{}", out(x87_reg) _); | ^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:58:20 + --> $DIR/bad-reg.rs:62:20 | LL | asm!("{}", out(mmx_reg) _); | ^^^^^^^^^^^^^^ error: register `al` conflicts with register `eax` - --> $DIR/bad-reg.rs:64:33 + --> $DIR/bad-reg.rs:68:33 | LL | asm!("", in("eax") foo, in("al") bar); | ------------- ^^^^^^^^^^^^ register `al` @@ -117,7 +117,7 @@ LL | asm!("", in("eax") foo, in("al") bar); | register `eax` error: register `rax` conflicts with register `rax` - --> $DIR/bad-reg.rs:67:33 + --> $DIR/bad-reg.rs:71:33 | LL | asm!("", in("rax") foo, out("rax") bar); | ------------- ^^^^^^^^^^^^^^ register `rax` @@ -125,13 +125,13 @@ LL | asm!("", in("rax") foo, out("rax") bar); | register `rax` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:67:18 + --> $DIR/bad-reg.rs:71:18 | LL | asm!("", in("rax") foo, out("rax") bar); | ^^^^^^^^^^^^^ error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:72:34 + --> $DIR/bad-reg.rs:76:34 | LL | asm!("", in("xmm0") foo, in("ymm0") bar); | -------------- ^^^^^^^^^^^^^^ register `ymm0` @@ -139,7 +139,7 @@ LL | asm!("", in("xmm0") foo, in("ymm0") bar); | register `xmm0` error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:74:34 + --> $DIR/bad-reg.rs:78:34 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | -------------- ^^^^^^^^^^^^^^^ register `ymm0` @@ -147,13 +147,25 @@ LL | asm!("", in("xmm0") foo, out("ymm0") bar); | register `xmm0` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:74:18 + --> $DIR/bad-reg.rs:78:18 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | ^^^^^^^^^^^^^^ +error: cannot use register `bl`: rbx is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", in("bl") foo); + | ^^^^^^^^^^^^ + +error: cannot use register `bh`: rbx is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", in("bh") foo); + | ^^^^^^^^^^^^ + error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:39:30 + --> $DIR/bad-reg.rs:43:30 | LL | asm!("", in("st(2)") foo); | ^^^ @@ -161,7 +173,7 @@ LL | asm!("", in("st(2)") foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:42:28 + --> $DIR/bad-reg.rs:46:28 | LL | asm!("", in("mm0") foo); | ^^^ @@ -169,7 +181,7 @@ LL | asm!("", in("mm0") foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:45:27 + --> $DIR/bad-reg.rs:49:27 | LL | asm!("", in("k0") foo); | ^^^ @@ -177,7 +189,7 @@ LL | asm!("", in("k0") foo); = note: register class `kreg0` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:50:32 + --> $DIR/bad-reg.rs:54:32 | LL | asm!("{}", in(x87_reg) foo); | ^^^ @@ -185,7 +197,7 @@ LL | asm!("{}", in(x87_reg) foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:53:32 + --> $DIR/bad-reg.rs:57:32 | LL | asm!("{}", in(mmx_reg) foo); | ^^^ @@ -193,7 +205,7 @@ LL | asm!("{}", in(mmx_reg) foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:64:42 + --> $DIR/bad-reg.rs:68:42 | LL | asm!("", in("eax") foo, in("al") bar); | ^^^ @@ -201,7 +213,7 @@ LL | asm!("", in("eax") foo, in("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:69:27 + --> $DIR/bad-reg.rs:73:27 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ @@ -209,7 +221,7 @@ LL | asm!("", in("al") foo, lateout("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:69:46 + --> $DIR/bad-reg.rs:73:46 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ @@ -217,7 +229,7 @@ LL | asm!("", in("al") foo, lateout("al") bar); = note: register class `reg_byte` supports these types: i8 error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:81:40 + --> $DIR/bad-reg.rs:85:40 | LL | asm!("/* {:x} */", in(xmm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -227,7 +239,7 @@ LL | asm!("/* {:x} */", in(xmm_reg) xmmword); // requires asm_experiment = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:83:41 + --> $DIR/bad-reg.rs:87:41 | LL | asm!("/* {:x} */", out(xmm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -237,7 +249,7 @@ LL | asm!("/* {:x} */", out(xmm_reg) xmmword); // requires asm_experimen = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:86:40 + --> $DIR/bad-reg.rs:90:40 | LL | asm!("/* {:y} */", in(ymm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -247,7 +259,7 @@ LL | asm!("/* {:y} */", in(ymm_reg) xmmword); // requires asm_experiment = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:88:41 + --> $DIR/bad-reg.rs:92:41 | LL | asm!("/* {:y} */", out(ymm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -257,7 +269,7 @@ LL | asm!("/* {:y} */", out(ymm_reg) xmmword); // requires asm_experimen = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:91:40 + --> $DIR/bad-reg.rs:95:40 | LL | asm!("/* {:z} */", in(zmm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -267,7 +279,7 @@ LL | asm!("/* {:z} */", in(zmm_reg) xmmword); // requires asm_experiment = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `u128` cannot be used with this register class in stable - --> $DIR/bad-reg.rs:93:41 + --> $DIR/bad-reg.rs:97:41 | LL | asm!("/* {:z} */", out(zmm_reg) xmmword); // requires asm_experimental_reg | ^^^^^^^ @@ -276,6 +288,6 @@ LL | asm!("/* {:z} */", out(zmm_reg) xmmword); // requires asm_experimen = help: add `#![feature(asm_experimental_reg)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 34 previous errors +error: aborting due to 36 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/attributes/key-value-expansion-scope.stderr b/tests/ui/attributes/key-value-expansion-scope.stderr index 1ebed6b8b6fce..70e831729cd45 100644 --- a/tests/ui/attributes/key-value-expansion-scope.stderr +++ b/tests/ui/attributes/key-value-expansion-scope.stderr @@ -132,9 +132,9 @@ error: cannot find macro `in_root` in the current scope when looking from the cr LL | #![doc = in_root!()] | ^^^^^^^ not found from the crate root | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default error: cannot find macro `in_mod_escape` in the current scope when looking from the crate root @@ -143,9 +143,9 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #![doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from the crate root | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay` --> $DIR/key-value-expansion-scope.rs:31:9 @@ -153,9 +153,9 @@ error: cannot find macro `in_mod` in the current scope when looking from module LL | #[doc = in_mod!()] | ^^^^^^ not found from module `macros_stay` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition error: cannot find macro `in_mod` in the current scope when looking from module `macros_stay` --> $DIR/key-value-expansion-scope.rs:34:14 @@ -163,9 +163,9 @@ error: cannot find macro `in_mod` in the current scope when looking from module LL | #![doc = in_mod!()] | ^^^^^^ not found from module `macros_stay` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape` --> $DIR/key-value-expansion-scope.rs:46:9 @@ -173,9 +173,9 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #[doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from module `macros_escape` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition error: cannot find macro `in_mod_escape` in the current scope when looking from module `macros_escape` --> $DIR/key-value-expansion-scope.rs:49:14 @@ -183,9 +183,9 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #![doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from module `macros_escape` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition error: attribute value must be a literal --> $DIR/key-value-expansion-scope.rs:3:10 @@ -292,9 +292,9 @@ error: cannot find macro `in_root` in the current scope when looking from the cr LL | #![doc = in_root!()] | ^^^^^^^ not found from the crate root | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -304,9 +304,9 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #![doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from the crate root | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -316,9 +316,9 @@ error: cannot find macro `in_mod` in the current scope when looking from module LL | #[doc = in_mod!()] | ^^^^^^ not found from module `macros_stay` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -328,9 +328,9 @@ error: cannot find macro `in_mod` in the current scope when looking from module LL | #![doc = in_mod!()] | ^^^^^^ not found from module `macros_stay` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -340,9 +340,9 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #[doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from module `macros_escape` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -352,8 +352,8 @@ error: cannot find macro `in_mod_escape` in the current scope when looking from LL | #![doc = in_mod_escape!()] | ^^^^^^^^^^^^^ not found from module `macros_escape` | + = help: import `macro_rules` with `use` to make it callable above its definition = 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 #124535 - = help: import `macro_rules` with `use` to make it callable above its definition = note: `#[deny(out_of_scope_macro_calls)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr index 4b085425033d9..e857b308d531f 100644 --- a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr +++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr @@ -7,10 +7,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -21,10 +17,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -36,10 +28,6 @@ LL | struct StructA(String); | = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -50,10 +38,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -65,10 +49,6 @@ LL | struct StructA(String); | = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -79,10 +59,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -94,10 +70,6 @@ LL | struct StructA(String); | = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -108,10 +80,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(Hash)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16 @@ -122,10 +90,6 @@ LL | struct StructA(String); | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait | = note: `#[derive(Clone)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour -help: consider cloning the value if the performance cost is acceptable - | -LL | struct StructA(String.clone()); - | ++++++++ error[E0507]: cannot move out of `self` which is behind a shared reference --> $DIR/deriving-with-repr-packed-move-errors.rs:28:9 diff --git a/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.rs b/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.rs new file mode 100644 index 0000000000000..2fc9e47939501 --- /dev/null +++ b/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.rs @@ -0,0 +1,9 @@ +// Test for https://github.com/rust-lang/rust/issues/153126 + +#[repr(packed, C)] +#[derive(PartialEq)] +struct Thing(u8, String); +//~^ ERROR cannot move out of a shared reference +//~| ERROR cannot move out of a shared reference + +fn main() {} diff --git a/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.stderr b/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.stderr new file mode 100644 index 0000000000000..777661bcc252e --- /dev/null +++ b/tests/ui/derives/deriving-with-repr-packed-no-clone-suggestion.stderr @@ -0,0 +1,24 @@ +error[E0507]: cannot move out of a shared reference + --> $DIR/deriving-with-repr-packed-no-clone-suggestion.rs:5:18 + | +LL | #[derive(PartialEq)] + | --------- in this derive macro expansion +LL | struct Thing(u8, String); + | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait + | + = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour + +error[E0507]: cannot move out of a shared reference + --> $DIR/deriving-with-repr-packed-no-clone-suggestion.rs:5:18 + | +LL | #[derive(PartialEq)] + | --------- in this derive macro expansion +LL | struct Thing(u8, String); + | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait + | + = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/imports/ambiguous-1.stderr b/tests/ui/imports/ambiguous-1.stderr index 04ff3a36c7467..603a8938194b1 100644 --- a/tests/ui/imports/ambiguous-1.stderr +++ b/tests/ui/imports/ambiguous-1.stderr @@ -15,8 +15,6 @@ warning: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-1.rs:13:13 @@ -30,6 +28,8 @@ note: `id` could also refer to the function imported here LL | pub use self::handwritten::*; | ^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 note: the lint level is defined here --> $DIR/ambiguous-1.rs:4:9 | @@ -45,8 +45,6 @@ warning: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-1.rs:13:13 @@ -60,6 +58,8 @@ note: `id` could also refer to the function imported here LL | pub use self::handwritten::*; | ^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 note: the lint level is defined here --> $DIR/ambiguous-1.rs:4:9 | diff --git a/tests/ui/imports/ambiguous-10.stderr b/tests/ui/imports/ambiguous-10.stderr index f175d27c99e98..edd787785d9d8 100644 --- a/tests/ui/imports/ambiguous-10.stderr +++ b/tests/ui/imports/ambiguous-10.stderr @@ -4,8 +4,6 @@ error: `Token` is ambiguous LL | fn c(_: Token) {} | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Token` could refer to the enum imported here --> $DIR/ambiguous-10.rs:13:5 @@ -19,6 +17,8 @@ note: `Token` could also refer to the enum imported here LL | use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `Token` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `Token` is ambiguous LL | fn c(_: Token) {} | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Token` could refer to the enum imported here --> $DIR/ambiguous-10.rs:13:5 @@ -45,5 +43,7 @@ note: `Token` could also refer to the enum imported here LL | use crate::b::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `Token` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-12.stderr b/tests/ui/imports/ambiguous-12.stderr index 5f92eae0dbcb1..e20eec249965a 100644 --- a/tests/ui/imports/ambiguous-12.stderr +++ b/tests/ui/imports/ambiguous-12.stderr @@ -4,8 +4,6 @@ error: `b` is ambiguous LL | b(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `b` could refer to the function imported here --> $DIR/ambiguous-12.rs:17:5 @@ -19,6 +17,8 @@ note: `b` could also refer to the function imported here LL | use crate::public::*; | ^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `b` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `b` is ambiguous LL | b(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `b` could refer to the function imported here --> $DIR/ambiguous-12.rs:17:5 @@ -45,5 +43,7 @@ note: `b` could also refer to the function imported here LL | use crate::public::*; | ^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `b` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-13.stderr b/tests/ui/imports/ambiguous-13.stderr index 279b4e8f1420a..c1dfac5eb4332 100644 --- a/tests/ui/imports/ambiguous-13.stderr +++ b/tests/ui/imports/ambiguous-13.stderr @@ -4,8 +4,6 @@ error: `Rect` is ambiguous LL | fn a(_: Rect) {} | ^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Rect` could refer to the struct imported here --> $DIR/ambiguous-13.rs:15:5 @@ -19,6 +17,8 @@ note: `Rect` could also refer to the struct imported here LL | use crate::content::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Rect` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `Rect` is ambiguous LL | fn a(_: Rect) {} | ^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Rect` could refer to the struct imported here --> $DIR/ambiguous-13.rs:15:5 @@ -45,5 +43,7 @@ note: `Rect` could also refer to the struct imported here LL | use crate::content::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Rect` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-14.stderr b/tests/ui/imports/ambiguous-14.stderr index 2a3557c31f120..2ca10d2d6a848 100644 --- a/tests/ui/imports/ambiguous-14.stderr +++ b/tests/ui/imports/ambiguous-14.stderr @@ -4,8 +4,6 @@ error: `foo` is ambiguous LL | g::foo(); | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `foo` could refer to the function imported here --> $DIR/ambiguous-14.rs:18:13 @@ -19,6 +17,8 @@ note: `foo` could also refer to the function imported here LL | pub use f::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `foo` is ambiguous LL | g::foo(); | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `foo` could refer to the function imported here --> $DIR/ambiguous-14.rs:18:13 @@ -45,5 +43,7 @@ note: `foo` could also refer to the function imported here LL | pub use f::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-15.stderr b/tests/ui/imports/ambiguous-15.stderr index 15f83546532ec..cb9f6ebde1fb1 100644 --- a/tests/ui/imports/ambiguous-15.stderr +++ b/tests/ui/imports/ambiguous-15.stderr @@ -4,8 +4,6 @@ error: `Error` is ambiguous LL | fn a(_: E) {} | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Error` could refer to the trait imported here --> $DIR/ambiguous-15.rs:21:5 @@ -19,6 +17,8 @@ note: `Error` could also refer to the enum imported here LL | pub use t2::*; | ^^^^^ = help: consider adding an explicit import of `Error` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `Error` is ambiguous LL | fn a(_: E) {} | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Error` could refer to the trait imported here --> $DIR/ambiguous-15.rs:21:5 @@ -45,5 +43,7 @@ note: `Error` could also refer to the enum imported here LL | pub use t2::*; | ^^^^^ = help: consider adding an explicit import of `Error` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-16.stderr b/tests/ui/imports/ambiguous-16.stderr index 7c80dee17f040..cad19b8f7a16b 100644 --- a/tests/ui/imports/ambiguous-16.stderr +++ b/tests/ui/imports/ambiguous-16.stderr @@ -4,8 +4,6 @@ error: `ConfirmedTranscriptHashInput` is ambiguous LL | use crate::framing::ConfirmedTranscriptHashInput; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `ConfirmedTranscriptHashInput` could refer to the struct imported here --> $DIR/ambiguous-16.rs:18:13 @@ -19,6 +17,8 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her LL | pub use self::public_message_in::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `ConfirmedTranscriptHashInput` is ambiguous LL | use crate::framing::ConfirmedTranscriptHashInput; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `ConfirmedTranscriptHashInput` could refer to the struct imported here --> $DIR/ambiguous-16.rs:18:13 @@ -45,5 +43,7 @@ note: `ConfirmedTranscriptHashInput` could also refer to the struct imported her LL | pub use self::public_message_in::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-17.stderr b/tests/ui/imports/ambiguous-17.stderr index 1849b83d76a35..80d152fe53440 100644 --- a/tests/ui/imports/ambiguous-17.stderr +++ b/tests/ui/imports/ambiguous-17.stderr @@ -14,8 +14,6 @@ error: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-17.rs:4:9 @@ -29,6 +27,8 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error; 1 warning emitted @@ -40,8 +40,6 @@ error: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-17.rs:4:9 @@ -55,5 +53,7 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-2.stderr b/tests/ui/imports/ambiguous-2.stderr index d989d3b133798..a07f09c41475b 100644 --- a/tests/ui/imports/ambiguous-2.stderr +++ b/tests/ui/imports/ambiguous-2.stderr @@ -4,8 +4,6 @@ error: `id` is ambiguous LL | ambiguous_1::id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function defined here --> $DIR/auxiliary/../ambiguous-1.rs:13:13 @@ -19,6 +17,8 @@ note: `id` could also refer to the function defined here | LL | pub use self::handwritten::*; | ^^^^^^^^^^^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `id` is ambiguous LL | ambiguous_1::id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function defined here --> $DIR/auxiliary/../ambiguous-1.rs:13:13 @@ -45,5 +43,7 @@ note: `id` could also refer to the function defined here | LL | pub use self::handwritten::*; | ^^^^^^^^^^^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-3.stderr b/tests/ui/imports/ambiguous-3.stderr index 27fa05a195b94..1e4aad83d985b 100644 --- a/tests/ui/imports/ambiguous-3.stderr +++ b/tests/ui/imports/ambiguous-3.stderr @@ -4,8 +4,6 @@ error: `x` is ambiguous LL | x(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `x` could refer to the function imported here --> $DIR/ambiguous-3.rs:18:13 @@ -19,6 +17,8 @@ note: `x` could also refer to the function imported here LL | pub use self::c::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `x` is ambiguous LL | x(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `x` could refer to the function imported here --> $DIR/ambiguous-3.rs:18:13 @@ -45,5 +43,7 @@ note: `x` could also refer to the function imported here LL | pub use self::c::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `x` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-4-extern.stderr b/tests/ui/imports/ambiguous-4-extern.stderr index 87492dee67fb4..4658071363e91 100644 --- a/tests/ui/imports/ambiguous-4-extern.stderr +++ b/tests/ui/imports/ambiguous-4-extern.stderr @@ -14,8 +14,6 @@ warning: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-4-extern.rs:13:9 @@ -29,6 +27,8 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 note: the lint level is defined here --> $DIR/ambiguous-4-extern.rs:5:9 | @@ -44,8 +44,6 @@ warning: `id` is ambiguous LL | id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function imported here --> $DIR/ambiguous-4-extern.rs:13:9 @@ -59,6 +57,8 @@ note: `id` could also refer to the function imported here LL | pub use handwritten::*; | ^^^^^^^^^^^^^^ = help: consider adding an explicit import of `id` to disambiguate + = 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 #114095 note: the lint level is defined here --> $DIR/ambiguous-4-extern.rs:5:9 | diff --git a/tests/ui/imports/ambiguous-4.stderr b/tests/ui/imports/ambiguous-4.stderr index 7e4afdb7f62e7..0d207665ca776 100644 --- a/tests/ui/imports/ambiguous-4.stderr +++ b/tests/ui/imports/ambiguous-4.stderr @@ -4,8 +4,6 @@ error: `id` is ambiguous LL | ambiguous_4_extern::id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function defined here --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 @@ -19,6 +17,8 @@ note: `id` could also refer to the function defined here | LL | pub use handwritten::*; | ^^^^^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `id` is ambiguous LL | ambiguous_4_extern::id(); | ^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `id` could refer to the function defined here --> $DIR/auxiliary/../ambiguous-4-extern.rs:13:9 @@ -45,5 +43,7 @@ note: `id` could also refer to the function defined here | LL | pub use handwritten::*; | ^^^^^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-5.stderr b/tests/ui/imports/ambiguous-5.stderr index 1fc5f4543f358..8cc37c65c4c4d 100644 --- a/tests/ui/imports/ambiguous-5.stderr +++ b/tests/ui/imports/ambiguous-5.stderr @@ -4,8 +4,6 @@ error: `Class` is ambiguous LL | struct MarkRecord(Class); | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Class` could refer to the struct imported here --> $DIR/ambiguous-5.rs:11:9 @@ -19,6 +17,8 @@ note: `Class` could also refer to the struct imported here LL | use super::gsubgpos::*; | ^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Class` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `Class` is ambiguous LL | struct MarkRecord(Class); | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Class` could refer to the struct imported here --> $DIR/ambiguous-5.rs:11:9 @@ -45,5 +43,7 @@ note: `Class` could also refer to the struct imported here LL | use super::gsubgpos::*; | ^^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `Class` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-6.stderr b/tests/ui/imports/ambiguous-6.stderr index 681bc40931f52..ea5b2d2f19b80 100644 --- a/tests/ui/imports/ambiguous-6.stderr +++ b/tests/ui/imports/ambiguous-6.stderr @@ -4,8 +4,6 @@ error: `C` is ambiguous LL | C | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the constant imported here --> $DIR/ambiguous-6.rs:15:13 @@ -19,6 +17,8 @@ note: `C` could also refer to the constant imported here LL | pub use mod2::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `C` is ambiguous LL | C | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the constant imported here --> $DIR/ambiguous-6.rs:15:13 @@ -45,5 +43,7 @@ note: `C` could also refer to the constant imported here LL | pub use mod2::*; | ^^^^^^^ = help: consider adding an explicit import of `C` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr index 800a2e10c9d78..bbbce638a44dc 100644 --- a/tests/ui/imports/ambiguous-9.stderr +++ b/tests/ui/imports/ambiguous-9.stderr @@ -14,8 +14,6 @@ error: `date_range` is ambiguous LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:7:13 @@ -29,6 +27,8 @@ note: `date_range` could also refer to the function imported here LL | use super::prelude::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default warning: ambiguous glob re-exports @@ -45,8 +45,6 @@ error: `date_range` is ambiguous LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:19:5 @@ -60,6 +58,8 @@ note: `date_range` could also refer to the function imported here LL | use prelude::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate + = 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 #114095 error: aborting due to 2 previous errors; 2 warnings emitted @@ -70,8 +70,6 @@ error: `date_range` is ambiguous LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:7:13 @@ -85,6 +83,8 @@ note: `date_range` could also refer to the function imported here LL | use super::prelude::*; | ^^^^^^^^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -94,8 +94,6 @@ error: `date_range` is ambiguous LL | date_range(); | ^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `date_range` could refer to the function imported here --> $DIR/ambiguous-9.rs:19:5 @@ -109,5 +107,7 @@ note: `date_range` could also refer to the function imported here LL | use prelude::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `date_range` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-import-visibility-macro.stderr b/tests/ui/imports/ambiguous-import-visibility-macro.stderr index ed6eb6f893af2..6f5f1c4dd3ec6 100644 --- a/tests/ui/imports/ambiguous-import-visibility-macro.stderr +++ b/tests/ui/imports/ambiguous-import-visibility-macro.stderr @@ -4,8 +4,6 @@ warning: ambiguous import visibility: pub(crate) or pub LL | pub use RustEmbed as Embed; | ^^^^^^^^^ | - = 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 #149145 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `RustEmbed` could refer to the derive macro imported here --> $DIR/ambiguous-import-visibility-macro.rs:7:17 @@ -22,6 +20,8 @@ note: `RustEmbed` could also refer to the derive macro imported here | LL | #[macro_use] // this imports the `RustEmbed` macro with `pub(crate)` visibility | ^^^^^^^^^^^^ + = 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 #149145 = note: `#[warn(ambiguous_import_visibilities)]` (part of `#[warn(future_incompatible)]`) on by default = note: this warning originates in the macro `globbing` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/imports/ambiguous-import-visibility-module.stderr b/tests/ui/imports/ambiguous-import-visibility-module.stderr index a97070c20a62d..1532bcfe7f4e6 100644 --- a/tests/ui/imports/ambiguous-import-visibility-module.stderr +++ b/tests/ui/imports/ambiguous-import-visibility-module.stderr @@ -4,8 +4,6 @@ warning: ambiguous import visibility: pub or pub(in crate::reexport) LL | pub use S as Z; | ^ | - = 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 #149145 = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution note: `S` could refer to the struct imported here --> $DIR/ambiguous-import-visibility-module.rs:11:17 @@ -22,6 +20,8 @@ note: `S` could also refer to the struct imported here LL | pub use m::*; | ^^^^ = help: use `self::S` to refer to this struct unambiguously + = 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 #149145 = note: `#[warn(ambiguous_import_visibilities)]` (part of `#[warn(future_incompatible)]`) on by default = note: this warning originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/imports/ambiguous-import-visibility.stderr b/tests/ui/imports/ambiguous-import-visibility.stderr index 30cddca4697d5..c846a5dadd1eb 100644 --- a/tests/ui/imports/ambiguous-import-visibility.stderr +++ b/tests/ui/imports/ambiguous-import-visibility.stderr @@ -4,8 +4,6 @@ warning: ambiguous import visibility: pub(crate) or pub LL | pub use RustEmbed as Embed; | ^^^^^^^^^ | - = 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 #149145 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `RustEmbed` could refer to the derive macro imported here --> $DIR/ambiguous-import-visibility.rs:8:9 @@ -19,6 +17,8 @@ note: `RustEmbed` could also refer to the derive macro imported here | LL | #[macro_use] // this imports the `RustEmbed` macro with `pub(crate)` visibility | ^^^^^^^^^^^^ + = 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 #149145 = note: `#[warn(ambiguous_import_visibilities)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/imports/ambiguous-panic-globvsglob.stderr b/tests/ui/imports/ambiguous-panic-globvsglob.stderr index 455c58bb6c025..981c9b05b9eb4 100644 --- a/tests/ui/imports/ambiguous-panic-globvsglob.stderr +++ b/tests/ui/imports/ambiguous-panic-globvsglob.stderr @@ -4,8 +4,6 @@ error: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-globvsglob.rs:12:9 @@ -19,6 +17,8 @@ note: `panic` could also refer to the macro imported here LL | use m2::*; | ^^^^^ = help: consider adding an explicit import of `panic` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default warning: `panic` is ambiguous @@ -27,8 +27,6 @@ warning: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-globvsglob.rs:12:9 @@ -38,6 +36,8 @@ LL | use m1::*; = help: consider adding an explicit import of `panic` to disambiguate note: `panic` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default error: aborting due to 1 previous error; 1 warning emitted @@ -49,8 +49,6 @@ error: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-globvsglob.rs:12:9 @@ -64,5 +62,7 @@ note: `panic` could also refer to the macro imported here LL | use m2::*; | ^^^^^ = help: consider adding an explicit import of `panic` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/ambiguous-panic-non-prelude-core-glob.stderr b/tests/ui/imports/ambiguous-panic-non-prelude-core-glob.stderr index 5317d8d6d312f..db654659d0157 100644 --- a/tests/ui/imports/ambiguous-panic-non-prelude-core-glob.stderr +++ b/tests/ui/imports/ambiguous-panic-non-prelude-core-glob.stderr @@ -4,8 +4,6 @@ warning: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-non-prelude-core-glob.rs:5:5 @@ -16,6 +14,8 @@ LL | use ::core::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/imports/ambiguous-panic-non-prelude-std-glob.stderr b/tests/ui/imports/ambiguous-panic-non-prelude-std-glob.stderr index b7434e3737b8f..0f9b85095f034 100644 --- a/tests/ui/imports/ambiguous-panic-non-prelude-std-glob.stderr +++ b/tests/ui/imports/ambiguous-panic-non-prelude-std-glob.stderr @@ -4,8 +4,6 @@ warning: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-non-prelude-std-glob.rs:6:5 @@ -16,6 +14,8 @@ LL | use ::std::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/core/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default warning: 1 warning emitted diff --git a/tests/ui/imports/ambiguous-panic-pick-core.stderr b/tests/ui/imports/ambiguous-panic-pick-core.stderr index 5729311fabd04..0a43c83934acc 100644 --- a/tests/ui/imports/ambiguous-panic-pick-core.stderr +++ b/tests/ui/imports/ambiguous-panic-pick-core.stderr @@ -4,8 +4,6 @@ warning: `panic` is ambiguous LL | panic!(&std::string::String::new()); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-pick-core.rs:4:5 @@ -16,6 +14,8 @@ LL | use ::core::prelude::v1::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default warning: panic message is not a string literal diff --git a/tests/ui/imports/ambiguous-panic-pick-std.stderr b/tests/ui/imports/ambiguous-panic-pick-std.stderr index 1b5b508a79655..53e51afe051c2 100644 --- a/tests/ui/imports/ambiguous-panic-pick-std.stderr +++ b/tests/ui/imports/ambiguous-panic-pick-std.stderr @@ -4,8 +4,6 @@ warning: `panic` is ambiguous LL | panic!(std::string::String::new()); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-pick-std.rs:7:5 @@ -16,6 +14,8 @@ LL | use ::std::prelude::v1::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/core/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default warning: panic message is not a string literal diff --git a/tests/ui/imports/ambiguous-panic-re-emit.stderr b/tests/ui/imports/ambiguous-panic-re-emit.stderr index ca30c54b84fe6..662bec1b73603 100644 --- a/tests/ui/imports/ambiguous-panic-re-emit.stderr +++ b/tests/ui/imports/ambiguous-panic-re-emit.stderr @@ -10,8 +10,6 @@ warning: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic-re-emit.rs:11:9 @@ -22,6 +20,8 @@ LL | use std::prelude::v1::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/core/src/prelude/mod.rs:LL:COL + = 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 #147319 = note: `#[warn(ambiguous_panic_imports)]` (part of `#[warn(future_incompatible)]`) on by default error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/imports/ambiguous-panic.stderr b/tests/ui/imports/ambiguous-panic.stderr index 781424eede48c..2b87a2f80230b 100644 --- a/tests/ui/imports/ambiguous-panic.stderr +++ b/tests/ui/imports/ambiguous-panic.stderr @@ -4,8 +4,6 @@ error: `panic` is ambiguous LL | panic!(); | ^^^^^ ambiguous name | - = 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 #147319 = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution note: `panic` could refer to the macro imported here --> $DIR/ambiguous-panic.rs:6:5 @@ -16,6 +14,8 @@ LL | use std::prelude::v1::*; = help: or use `crate::panic` to refer to this macro unambiguously note: `panic` could also refer to a macro from prelude --> $SRC_DIR/core/src/prelude/mod.rs:LL:COL + = 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 #147319 note: the lint level is defined here --> $DIR/ambiguous-panic.rs:1:9 | diff --git a/tests/ui/imports/ambiguous-reachable.stderr b/tests/ui/imports/ambiguous-reachable.stderr index 78a0d76d68b5b..309ba04fd0f0c 100644 --- a/tests/ui/imports/ambiguous-reachable.stderr +++ b/tests/ui/imports/ambiguous-reachable.stderr @@ -5,8 +5,6 @@ warning: `generic` is ambiguous LL | ambiguous_reachable_extern::generic::(); | ^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `generic` could refer to the function defined here --> $DIR/auxiliary/ambiguous-reachable-extern.rs:13:9 @@ -20,4 +18,6 @@ note: `generic` could also refer to the function defined here | LL | pub use m2::*; | ^^ + = 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 #114095 diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr index 74829fc21e22f..f02d35b1d28ce 100644 --- a/tests/ui/imports/duplicate.stderr +++ b/tests/ui/imports/duplicate.stderr @@ -74,8 +74,6 @@ error: `foo` is ambiguous LL | g::foo(); | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `foo` could refer to the function imported here --> $DIR/duplicate.rs:29:13 @@ -89,6 +87,8 @@ note: `foo` could also refer to the function imported here LL | pub use crate::f::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 5 previous errors @@ -102,8 +102,6 @@ error: `foo` is ambiguous LL | g::foo(); | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `foo` could refer to the function imported here --> $DIR/duplicate.rs:29:13 @@ -117,5 +115,7 @@ note: `foo` could also refer to the function imported here LL | pub use crate::f::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/glob-conflict-cross-crate-1.stderr b/tests/ui/imports/glob-conflict-cross-crate-1.stderr index 496e7bdf66bc7..d118c2d583ecf 100644 --- a/tests/ui/imports/glob-conflict-cross-crate-1.stderr +++ b/tests/ui/imports/glob-conflict-cross-crate-1.stderr @@ -4,8 +4,6 @@ error: `f` is ambiguous LL | glob_conflict::f(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `f` could refer to the function defined here --> $DIR/auxiliary/glob-conflict.rs:12:9 @@ -19,6 +17,8 @@ note: `f` could also refer to the function defined here | LL | pub use m2::*; | ^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: `f` is ambiguous @@ -27,8 +27,6 @@ error: `f` is ambiguous LL | glob_conflict::glob::f(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `f` could refer to the function defined here --> $DIR/auxiliary/glob-conflict.rs:12:9 @@ -42,6 +40,8 @@ note: `f` could also refer to the function defined here | LL | pub use m2::*; | ^^ + = 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 #114095 error: aborting due to 2 previous errors @@ -52,8 +52,6 @@ error: `f` is ambiguous LL | glob_conflict::f(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `f` could refer to the function defined here --> $DIR/auxiliary/glob-conflict.rs:12:9 @@ -67,6 +65,8 @@ note: `f` could also refer to the function defined here | LL | pub use m2::*; | ^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -76,8 +76,6 @@ error: `f` is ambiguous LL | glob_conflict::glob::f(); | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `f` could refer to the function defined here --> $DIR/auxiliary/glob-conflict.rs:12:9 @@ -91,5 +89,7 @@ note: `f` could also refer to the function defined here | LL | pub use m2::*; | ^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/glob-conflict-cross-crate-2.stderr b/tests/ui/imports/glob-conflict-cross-crate-2.stderr index 500f0f6fff6a1..b4b17e783ac19 100644 --- a/tests/ui/imports/glob-conflict-cross-crate-2.stderr +++ b/tests/ui/imports/glob-conflict-cross-crate-2.stderr @@ -4,8 +4,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias defined here --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 @@ -19,6 +17,8 @@ note: `C` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias defined here --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 @@ -45,5 +43,7 @@ note: `C` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/glob-conflict-cross-crate-3.stderr b/tests/ui/imports/glob-conflict-cross-crate-3.stderr index 5a862ca072a1f..8a9ece94deeb1 100644 --- a/tests/ui/imports/glob-conflict-cross-crate-3.stderr +++ b/tests/ui/imports/glob-conflict-cross-crate-3.stderr @@ -4,8 +4,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias defined here --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 @@ -19,6 +17,8 @@ note: `C` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: `C` is ambiguous @@ -27,8 +27,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias imported here --> $DIR/glob-conflict-cross-crate-3.rs:9:5 @@ -42,6 +40,8 @@ note: `C` could also refer to the type alias imported here LL | use a::*; | ^^^^ = help: consider adding an explicit import of `C` to disambiguate + = 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 #114095 error: aborting due to 2 previous errors @@ -52,8 +52,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias defined here --> $DIR/auxiliary/glob-conflict-cross-crate-2-extern.rs:9:9 @@ -67,6 +65,8 @@ note: `C` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -76,8 +76,6 @@ error: `C` is ambiguous LL | let _a: C = 1; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `C` could refer to the type alias imported here --> $DIR/glob-conflict-cross-crate-3.rs:9:5 @@ -91,5 +89,7 @@ note: `C` could also refer to the type alias imported here LL | use a::*; | ^^^^ = help: consider adding an explicit import of `C` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/issue-114682-2.stderr b/tests/ui/imports/issue-114682-2.stderr index 5aba57e82b55c..0a658a819a7d3 100644 --- a/tests/ui/imports/issue-114682-2.stderr +++ b/tests/ui/imports/issue-114682-2.stderr @@ -4,8 +4,6 @@ error: `max` is ambiguous LL | use issue_114682_2_extern::max; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `max` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-2-extern.rs:17:9 @@ -19,6 +17,8 @@ note: `max` could also refer to the module defined here | LL | pub use self::d::*; | ^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: `max` is ambiguous @@ -27,8 +27,6 @@ error: `max` is ambiguous LL | type A = issue_114682_2_extern::max; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `max` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-2-extern.rs:17:9 @@ -42,6 +40,8 @@ note: `max` could also refer to the module defined here | LL | pub use self::d::*; | ^^^^^^^ + = 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 #114095 error: aborting due to 2 previous errors @@ -52,8 +52,6 @@ error: `max` is ambiguous LL | use issue_114682_2_extern::max; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `max` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-2-extern.rs:17:9 @@ -67,6 +65,8 @@ note: `max` could also refer to the module defined here | LL | pub use self::d::*; | ^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default Future breakage diagnostic: @@ -76,8 +76,6 @@ error: `max` is ambiguous LL | type A = issue_114682_2_extern::max; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `max` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-2-extern.rs:17:9 @@ -91,5 +89,7 @@ note: `max` could also refer to the module defined here | LL | pub use self::d::*; | ^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/issue-114682-4.stderr b/tests/ui/imports/issue-114682-4.stderr index 9c19f8e4e2f2d..dde179aa33b3c 100644 --- a/tests/ui/imports/issue-114682-4.stderr +++ b/tests/ui/imports/issue-114682-4.stderr @@ -4,8 +4,6 @@ error: `Result` is ambiguous LL | fn a() -> Result { | ^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Result` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-4-extern.rs:9:9 @@ -19,6 +17,8 @@ note: `Result` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error[E0107]: type alias takes 1 generic argument but 2 generic arguments were supplied @@ -45,8 +45,6 @@ error: `Result` is ambiguous LL | fn a() -> Result { | ^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `Result` could refer to the type alias defined here --> $DIR/auxiliary/issue-114682-4-extern.rs:9:9 @@ -60,5 +58,7 @@ note: `Result` could also refer to the type alias defined here | LL | pub use b::*; | ^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/issue-114682-5.stderr b/tests/ui/imports/issue-114682-5.stderr index f74f428f1a54f..66b0744f2e1f0 100644 --- a/tests/ui/imports/issue-114682-5.stderr +++ b/tests/ui/imports/issue-114682-5.stderr @@ -32,8 +32,6 @@ error: `issue_114682_5_extern_1` is ambiguous LL | use issue_114682_5_extern_1::Url; | ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `issue_114682_5_extern_1` could refer to the module defined here --> $DIR/auxiliary/issue-114682-5-extern-2.rs:6:13 @@ -48,6 +46,8 @@ note: `issue_114682_5_extern_1` could also refer to the crate defined here LL | pub use crate::*; | ^^^^^ = help: use `::issue_114682_5_extern_1` to refer to this crate unambiguously + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 3 previous errors @@ -61,8 +61,6 @@ error: `issue_114682_5_extern_1` is ambiguous LL | use issue_114682_5_extern_1::Url; | ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `issue_114682_5_extern_1` could refer to the module defined here --> $DIR/auxiliary/issue-114682-5-extern-2.rs:6:13 @@ -77,5 +75,7 @@ note: `issue_114682_5_extern_1` could also refer to the crate defined here LL | pub use crate::*; | ^^^^^ = help: use `::issue_114682_5_extern_1` to refer to this crate unambiguously + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/issue-114682-6.stderr b/tests/ui/imports/issue-114682-6.stderr index b5f0fc78df408..6443291e3c701 100644 --- a/tests/ui/imports/issue-114682-6.stderr +++ b/tests/ui/imports/issue-114682-6.stderr @@ -4,8 +4,6 @@ error: `log` is ambiguous LL | let log = 2; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `log` could refer to the function defined here --> $DIR/auxiliary/issue-114682-6-extern.rs:8:9 @@ -19,6 +17,8 @@ note: `log` could also refer to the function defined here | LL | pub use self::b::*; | ^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `log` is ambiguous LL | let log = 2; | ^^^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `log` could refer to the function defined here --> $DIR/auxiliary/issue-114682-6-extern.rs:8:9 @@ -45,5 +43,7 @@ note: `log` could also refer to the function defined here | LL | pub use self::b::*; | ^^^^^^^ + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.stderr b/tests/ui/imports/local-modularized-tricky-fail-2.stderr index e5b48d2efdddc..6dae1508995da 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-2.stderr @@ -4,8 +4,6 @@ error: macro-expanded `macro_export` macros from the current crate cannot be ref LL | use crate::exported; | ^^^^^^^^^^^^^^^ | - = 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 #52234 note: the macro is defined here --> $DIR/local-modularized-tricky-fail-2.rs:5:5 | @@ -16,6 +14,8 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation + = 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 #52234 = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -25,8 +25,6 @@ error: macro-expanded `macro_export` macros from the current crate cannot be ref LL | crate::exported!(); | ^^^^^^^^^^^^^^^ | - = 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 #52234 note: the macro is defined here --> $DIR/local-modularized-tricky-fail-2.rs:5:5 | @@ -37,6 +35,8 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation + = 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 #52234 = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors @@ -48,8 +48,6 @@ error: macro-expanded `macro_export` macros from the current crate cannot be ref LL | use crate::exported; | ^^^^^^^^^^^^^^^ | - = 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 #52234 note: the macro is defined here --> $DIR/local-modularized-tricky-fail-2.rs:5:5 | @@ -60,6 +58,8 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation + = 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 #52234 = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -70,8 +70,6 @@ error: macro-expanded `macro_export` macros from the current crate cannot be ref LL | crate::exported!(); | ^^^^^^^^^^^^^^^ | - = 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 #52234 note: the macro is defined here --> $DIR/local-modularized-tricky-fail-2.rs:5:5 | @@ -82,6 +80,8 @@ LL | | } ... LL | define_exported!(); | ------------------ in this macro invocation + = 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 #52234 = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/imports/overwrite-different-ambig-2.stderr b/tests/ui/imports/overwrite-different-ambig-2.stderr index e75f552d119c1..3095aec20e504 100644 --- a/tests/ui/imports/overwrite-different-ambig-2.stderr +++ b/tests/ui/imports/overwrite-different-ambig-2.stderr @@ -4,8 +4,6 @@ error: `S` is ambiguous LL | let _: m1::S = S {}; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `S` could refer to the struct imported here --> $DIR/overwrite-different-ambig-2.rs:18:5 @@ -19,6 +17,8 @@ note: `S` could also refer to the struct imported here LL | use m2::*; | ^^^^^ = help: consider adding an explicit import of `S` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 1 previous error @@ -30,8 +30,6 @@ error: `S` is ambiguous LL | let _: m1::S = S {}; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `S` could refer to the struct imported here --> $DIR/overwrite-different-ambig-2.rs:18:5 @@ -45,5 +43,7 @@ note: `S` could also refer to the struct imported here LL | use m2::*; | ^^^^^ = help: consider adding an explicit import of `S` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr index 67316462a27e9..c21faffadfc31 100644 --- a/tests/ui/imports/unresolved-seg-after-ambiguous.stderr +++ b/tests/ui/imports/unresolved-seg-after-ambiguous.stderr @@ -10,8 +10,6 @@ error: `E` is ambiguous LL | use self::a::E::in_exist; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `E` could refer to the struct imported here --> $DIR/unresolved-seg-after-ambiguous.rs:13:17 @@ -25,6 +23,8 @@ note: `E` could also refer to the struct imported here LL | pub use self::d::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `E` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default error: aborting due to 2 previous errors @@ -37,8 +37,6 @@ error: `E` is ambiguous LL | use self::a::E::in_exist; | ^ ambiguous name | - = 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 #114095 = note: ambiguous because of multiple glob imports of a name in the same module note: `E` could refer to the struct imported here --> $DIR/unresolved-seg-after-ambiguous.rs:13:17 @@ -52,5 +50,7 @@ note: `E` could also refer to the struct imported here LL | pub use self::d::*; | ^^^^^^^^^^ = help: consider adding an explicit import of `E` to disambiguate + = 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 #114095 = note: `#[deny(ambiguous_glob_imports)]` (part of `#[deny(future_incompatible)]`) on by default diff --git a/tests/ui/let-else/let-else-irrefutable-152938.rs b/tests/ui/let-else/let-else-irrefutable-152938.rs new file mode 100644 index 0000000000000..6e0ffe3fb8706 --- /dev/null +++ b/tests/ui/let-else/let-else-irrefutable-152938.rs @@ -0,0 +1,13 @@ +//@ check-pass + +// Regression test for https://github.com/rust-lang/rust/issues/152938 +// The irrefutable `let...else` diagnostic should explain that the pattern +// always matches and point at the `else` block for removal. + +pub fn say_hello(name: Option) { + let name_str = Some(name) else { return; }; + //~^ WARN irrefutable `let...else` pattern + drop(name_str); +} + +fn main() {} diff --git a/tests/ui/let-else/let-else-irrefutable-152938.stderr b/tests/ui/let-else/let-else-irrefutable-152938.stderr new file mode 100644 index 0000000000000..57632964be9b3 --- /dev/null +++ b/tests/ui/let-else/let-else-irrefutable-152938.stderr @@ -0,0 +1,16 @@ +warning: irrefutable `let...else` pattern + --> $DIR/let-else-irrefutable-152938.rs:8:5 + | +LL | let name_str = Some(name) else { return; }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/let-else-irrefutable-152938.rs:8:36 + | +LL | let name_str = Some(name) else { return; }; + | ^^^^^^^^^^^ + = note: `#[warn(irrefutable_let_patterns)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/let-else/let-else-irrefutable.stderr b/tests/ui/let-else/let-else-irrefutable.stderr index 73d4e5f34831d..d36d227b4156a 100644 --- a/tests/ui/let-else/let-else-irrefutable.stderr +++ b/tests/ui/let-else/let-else-irrefutable.stderr @@ -4,8 +4,12 @@ warning: irrefutable `let...else` pattern LL | let x = 1 else { return }; | ^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/let-else-irrefutable.rs:4:20 + | +LL | let x = 1 else { return }; + | ^^^^^^^^^^ = note: `#[warn(irrefutable_let_patterns)]` on by default warning: irrefutable `let...else` pattern @@ -14,8 +18,16 @@ warning: irrefutable `let...else` pattern LL | let x = 1 else { | ^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/let-else-irrefutable.rs:7:20 + | +LL | let x = 1 else { + | ____________________^ +LL | | eprintln!("problem case encountered"); +LL | | return +LL | | }; + | |_____^ warning: 2 warnings emitted diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr index 0f3a5d7ba547f..5a426be83f861 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr @@ -7,10 +7,10 @@ LL | true; LL | foo!(warn_in_block) | ------------------- in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` + = 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 #79813 note: the lint level is defined here --> $DIR/semicolon-in-expressions-from-macros.rs:4:9 | @@ -69,10 +69,10 @@ LL | true; LL | foo!(first) | ----------- in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` + = 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 #79813 = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -127,10 +127,10 @@ LL | true; LL | foo!(warn_in_block) | ------------------- in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` + = 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 #79813 note: the lint level is defined here --> $DIR/semicolon-in-expressions-from-macros.rs:4:9 | diff --git a/tests/ui/macros/lint-trailing-macro-call.stderr b/tests/ui/macros/lint-trailing-macro-call.stderr index cf836abb80f4a..1ff8c0c6f66f2 100644 --- a/tests/ui/macros/lint-trailing-macro-call.stderr +++ b/tests/ui/macros/lint-trailing-macro-call.stderr @@ -7,10 +7,10 @@ LL | #[cfg(false)] 25; LL | expand_it!() | ------------ in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it` + = 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 #79813 = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,10 +26,10 @@ LL | #[cfg(false)] 25; LL | expand_it!() | ------------ in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `expand_it` + = 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 #79813 = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `expand_it` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/macro-in-expression-context.stderr b/tests/ui/macros/macro-in-expression-context.stderr index ce5abdb94b2e2..27d9490809a99 100644 --- a/tests/ui/macros/macro-in-expression-context.stderr +++ b/tests/ui/macros/macro-in-expression-context.stderr @@ -22,10 +22,10 @@ LL | assert_eq!("A", "A"); LL | foo!() | ------ in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` + = 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 #79813 = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -41,10 +41,10 @@ LL | assert_eq!("A", "A"); LL | foo!() | ------ in this macro invocation | - = 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 #79813 = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` + = 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 #79813 = note: `#[deny(semicolon_in_expressions_from_macros)]` (part of `#[deny(future_incompatible)]`) on by default = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/parser/bad-let-else-statement.stderr b/tests/ui/parser/bad-let-else-statement.stderr index ba56452998312..8545d95f507f6 100644 --- a/tests/ui/parser/bad-let-else-statement.stderr +++ b/tests/ui/parser/bad-let-else-statement.stderr @@ -268,8 +268,16 @@ LL | | 1 LL | | } else { | |_____^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/bad-let-else-statement.rs:98:12 + | +LL | } else { + | ____________^ +LL | | +LL | | return; +LL | | }; + | |_____^ = note: `#[warn(irrefutable_let_patterns)]` on by default warning: irrefutable `let...else` pattern @@ -281,8 +289,16 @@ LL | | x LL | | } else { | |_____^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/bad-let-else-statement.rs:163:12 + | +LL | } else { + | ____________^ +LL | | +LL | | return; +LL | | }; + | |_____^ warning: irrefutable `let...else` pattern --> $DIR/bad-let-else-statement.rs:170:5 @@ -290,8 +306,12 @@ warning: irrefutable `let...else` pattern LL | let ok = format_args!("") else { return; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/bad-let-else-statement.rs:170:36 + | +LL | let ok = format_args!("") else { return; }; + | ^^^^^^^^^^^ warning: irrefutable `let...else` pattern --> $DIR/bad-let-else-statement.rs:173:5 @@ -299,8 +319,12 @@ warning: irrefutable `let...else` pattern LL | let bad = format_args! {""} else { return; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/bad-let-else-statement.rs:173:38 + | +LL | let bad = format_args! {""} else { return; }; + | ^^^^^^^^^^^ warning: irrefutable `let...else` pattern --> $DIR/bad-let-else-statement.rs:204:5 @@ -311,8 +335,16 @@ LL | | 8 LL | | } else { | |_____^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/bad-let-else-statement.rs:207:12 + | +LL | } else { + | ____________^ +LL | | +LL | | return; +LL | | }; + | |_____^ error: aborting due to 19 previous errors; 5 warnings emitted diff --git a/tests/ui/span/let-offset-of.stderr b/tests/ui/span/let-offset-of.stderr index 6ea9b2194a36a..df9b1e695b1e4 100644 --- a/tests/ui/span/let-offset-of.stderr +++ b/tests/ui/span/let-offset-of.stderr @@ -14,8 +14,12 @@ warning: irrefutable `let...else` pattern LL | let x = offset_of!(Foo, field) else { return; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this pattern will always match, so the `else` clause is useless - = help: consider removing the `else` clause + = note: this pattern always matches, so the else clause is unreachable +help: remove this `else` block + --> $DIR/let-offset-of.rs:17:41 + | +LL | let x = offset_of!(Foo, field) else { return; }; + | ^^^^^^^^^^^ warning: 2 warnings emitted