diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index c5addc5926901..07da107a55c58 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -231,7 +231,9 @@ impl Lit { /// `Parser::eat_token_lit` (excluding unary negation). pub fn from_token(token: &Token) -> Option { match token.uninterpolate().kind { - Ident(name, IdentIsRaw::No) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)), + Ident(name, IdentKind::Normal) if name.is_bool_lit() => { + Some(Lit::new(Bool, name, None)) + } Literal(token_lit) => Some(token_lit), OpenInvisible(InvisibleOrigin::MetaVar( MetaVarKind::Literal | MetaVarKind::Expr { .. }, @@ -307,11 +309,11 @@ impl LitKind { } } -pub fn ident_can_begin_expr(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool { +pub fn ident_can_begin_expr(name: Symbol, span: Span, kind: IdentKind) -> bool { // WARNING: Take care when modifying this function! It will change the stable(!) set of // tokens that are allowed to match an `expr` nonterminal which is user observable. - let ident_token = Token::new(Ident(name, is_raw), span); + let ident_token = Token::new(Ident(name, kind), span); // FIXME: Remove `box` from this list given we officially no longer support box expressions // (#108471) (needs lang FCP as it affects stable macro matching behavior). @@ -344,11 +346,11 @@ pub fn ident_can_begin_expr(name: Symbol, span: Span, is_raw: IdentIsRaw) -> boo .contains(&name) } -fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool { +fn ident_can_begin_type(name: Symbol, span: Span, kind: IdentKind) -> bool { // WARNING: Take care when modifying this function! It will change the stable(!) set of // tokens that are allowed to match an `ty` nonterminal which is user observable. - let ident_token = Token::new(Ident(name, is_raw), span); + let ident_token = Token::new(Ident(name, kind), span); !ident_token.is_reserved_ident() || ident_token.is_path_segment_keyword() @@ -357,32 +359,26 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool { } #[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, StableHash)] -pub enum IdentIsRaw { - No, - Yes, +pub enum IdentKind { + Normal, + Raw, } -impl IdentIsRaw { +impl IdentKind { pub fn to_print_mode_ident(self) -> IdentPrintMode { match self { - IdentIsRaw::No => IdentPrintMode::Normal, - IdentIsRaw::Yes => IdentPrintMode::RawIdent, + IdentKind::Normal => IdentPrintMode::Normal, + IdentKind::Raw => IdentPrintMode::RawIdent, } } pub fn to_print_mode_lifetime(self) -> IdentPrintMode { match self { - IdentIsRaw::No => IdentPrintMode::Normal, - IdentIsRaw::Yes => IdentPrintMode::RawLifetime, + IdentKind::Normal => IdentPrintMode::Normal, + IdentKind::Raw => IdentPrintMode::RawLifetime, } } } -impl From for IdentIsRaw { - fn from(b: bool) -> Self { - if b { Self::Yes } else { Self::No } - } -} - #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, StableHash)] pub enum TokenKind { /* Expression-operator symbols. */ @@ -507,22 +503,22 @@ pub enum TokenKind { /// It's recommended to use `Token::{ident,uninterpolate}` and /// `Parser::token_uninterpolated_span` to treat regular and interpolated /// identifiers in the same way. - Ident(Symbol, IdentIsRaw), + Ident(Symbol, IdentKind), /// This identifier (and its span) is the identifier passed to the /// declarative macro. The span in the surrounding `Token` is the span of /// the `ident` metavariable in the macro's RHS. - NtIdent(sp::Ident, IdentIsRaw), + NtIdent(sp::Ident, IdentKind), /// Lifetime identifier token. /// Do not forget about `NtLifetime` when you want to match on lifetime identifiers. /// It's recommended to use `Token::{ident,uninterpolate}` and /// `Parser::token_uninterpolated_span` to treat regular and interpolated /// identifiers in the same way. - Lifetime(Symbol, IdentIsRaw), + Lifetime(Symbol, IdentKind), /// This identifier (and its span) is the lifetime passed to the /// declarative macro. The span in the surrounding `Token` is the span of /// the `lifetime` metavariable in the macro's RHS. - NtLifetime(sp::Ident, IdentIsRaw), + NtLifetime(sp::Ident, IdentKind), /// A doc comment token. /// `Symbol` is the doc comment's data excluding its "quotes" (`///`, `/**`, etc) @@ -643,7 +639,8 @@ impl Token { /// Recovers a `Token` from an `Ident`. This creates a raw identifier if necessary. pub fn from_ast_ident(ident: sp::Ident) -> Self { - Token::new(Ident(ident.name, ident.is_raw_guess().into()), ident.span) + let kind = if ident.is_raw_guess() { IdentKind::Raw } else { IdentKind::Normal }; + Token::new(Ident(ident.name, kind), ident.span) } pub fn is_range_separator(&self) -> bool { @@ -674,8 +671,8 @@ impl Token { // tokens that are allowed to match an `expr` nonterminal which is user observable. match self.uninterpolate().kind { - Ident(name, is_raw) => - ident_can_begin_expr(name, self.span, is_raw), // value name or keyword + Ident(name, kind) => + ident_can_begin_expr(name, self.span, kind), // value name or keyword OpenParen | // tuple OpenBrace | // block OpenBracket | // array @@ -743,8 +740,8 @@ impl Token { // object types (consider `use<>+` and `use + Trait` for example). match self.uninterpolate().kind { - Ident(name, is_raw) => - ident_can_begin_type(name, self.span, is_raw), // type name or keyword + Ident(name, kind) => + ident_can_begin_type(name, self.span, kind), // type name or keyword OpenParen // tuple | OpenBracket // array | Bang // never @@ -766,7 +763,7 @@ impl Token { pub fn can_begin_const_arg(&self) -> bool { match self.kind { OpenBrace | Literal(..) | Minus => true, - Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true, + Ident(name, IdentKind::Normal) if name.is_bool_lit() => true, OpenInvisible(InvisibleOrigin::MetaVar( MetaVarKind::Expr { .. } | MetaVarKind::Block | MetaVarKind::Literal, )) => true, @@ -815,7 +812,7 @@ impl Token { pub fn can_begin_literal_maybe_minus(&self) -> bool { match self.uninterpolate().kind { Literal(..) | Minus => true, - Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true, + Ident(name, IdentKind::Normal) if name.is_bool_lit() => true, OpenInvisible(InvisibleOrigin::MetaVar(mv_kind)) => match mv_kind { MetaVarKind::Literal => true, MetaVarKind::Expr { can_begin_literal_maybe_minus, .. } => { @@ -845,9 +842,9 @@ impl Token { /// otherwise returns the original token. pub fn uninterpolate(&self) -> Cow<'_, Token> { match self.kind { - NtIdent(ident, is_raw) => Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span)), - NtLifetime(ident, is_raw) => { - Cow::Owned(Token::new(Lifetime(ident.name, is_raw), ident.span)) + NtIdent(ident, kind) => Cow::Owned(Token::new(Ident(ident.name, kind), ident.span)), + NtLifetime(ident, kind) => { + Cow::Owned(Token::new(Lifetime(ident.name, kind), ident.span)) } _ => Cow::Borrowed(self), } @@ -855,22 +852,22 @@ impl Token { /// Returns an identifier if this token is an identifier. #[inline] - pub fn ident(&self) -> Option<(sp::Ident, IdentIsRaw)> { + pub fn ident(&self) -> Option<(sp::Ident, IdentKind)> { // We avoid using `Token::uninterpolate` here because it's slow. match self.kind { - Ident(name, is_raw) => Some((sp::Ident::new(name, self.span), is_raw)), - NtIdent(ident, is_raw) => Some((ident, is_raw)), + Ident(name, kind) => Some((sp::Ident::new(name, self.span), kind)), + NtIdent(ident, kind) => Some((ident, kind)), _ => None, } } /// Returns a lifetime identifier if this token is a lifetime. #[inline] - pub fn lifetime(&self) -> Option<(sp::Ident, IdentIsRaw)> { + pub fn lifetime(&self) -> Option<(sp::Ident, IdentKind)> { // We avoid using `Token::uninterpolate` here because it's slow. match self.kind { - Lifetime(name, is_raw) => Some((sp::Ident::new(name, self.span), is_raw)), - NtLifetime(ident, is_raw) => Some((ident, is_raw)), + Lifetime(name, kind) => Some((sp::Ident::new(name, self.span), kind)), + NtLifetime(ident, kind) => Some((ident, kind)), _ => None, } } @@ -929,7 +926,7 @@ impl Token { /// Returns `true` if the token is a given keyword, `kw`. pub fn is_keyword(&self, kw: Symbol) -> bool { - self.is_non_raw_ident_where(|id| id.name == kw) + self.non_raw_ident().is_some_and(|id| id.name == kw) } /// Returns `true` if the token is a given keyword, `kw` or if `case` is `Insensitive` and this @@ -937,35 +934,35 @@ impl Token { pub fn is_keyword_case(&self, kw: Symbol, case: Case) -> bool { self.is_keyword(kw) || (case == Case::Insensitive - && self.is_non_raw_ident_where(|id| { + && self.non_raw_ident().is_some_and(|id| { // Do an ASCII case-insensitive match, because all keywords are ASCII. id.name.as_str().eq_ignore_ascii_case(kw.as_str()) })) } pub fn is_path_segment_keyword(&self) -> bool { - self.is_non_raw_ident_where(sp::Ident::is_path_segment_keyword) + self.non_raw_ident().is_some_and(sp::Ident::is_path_segment_keyword) } /// Returns true for reserved identifiers used internally for elided lifetimes, /// unnamed method parameters, crate root module, error recovery etc. pub fn is_special_ident(&self) -> bool { - self.is_non_raw_ident_where(sp::Ident::is_special) + self.non_raw_ident().is_some_and(sp::Ident::is_special) } /// Returns `true` if the token is a keyword used in the language. pub fn is_used_keyword(&self) -> bool { - self.is_non_raw_ident_where(sp::Ident::is_used_keyword) + self.non_raw_ident().is_some_and(sp::Ident::is_used_keyword) } /// Returns `true` if the token is a keyword reserved for possible future use. pub fn is_unused_keyword(&self) -> bool { - self.is_non_raw_ident_where(sp::Ident::is_unused_keyword) + self.non_raw_ident().is_some_and(sp::Ident::is_unused_keyword) } /// Returns `true` if the token is either a special identifier or a keyword. pub fn is_reserved_ident(&self) -> bool { - self.is_non_raw_ident_where(sp::Ident::is_reserved) + self.non_raw_ident().is_some_and(sp::Ident::is_reserved) } pub fn is_non_reserved_ident(&self) -> bool { @@ -974,13 +971,21 @@ impl Token { pub fn non_reserved_ident(&self) -> Option { self.ident() - .filter(|&(id, raw)| raw == IdentIsRaw::Yes || !sp::Ident::is_reserved(id)) + .filter(|&(id, kind)| kind == IdentKind::Raw || !id.is_reserved()) .map(|(id, _)| id) } + /// If this token is a non-raw identifier, return the identifier in question. + pub fn non_raw_ident(&self) -> Option { + match self.ident() { + Some((id, IdentKind::Normal)) => Some(id), + _ => None, + } + } + /// Returns `true` if the token is the identifier `true` or `false`. pub fn is_bool_lit(&self) -> bool { - self.is_non_raw_ident_where(|id| id.name.is_bool_lit()) + self.non_raw_ident().is_some_and(|id| id.name.is_bool_lit()) } pub fn is_numeric_lit(&self) -> bool { @@ -995,14 +1000,6 @@ impl Token { matches!(self.kind, Literal(Lit { kind: LitKind::Integer, .. })) } - /// Returns `true` if the token is a non-raw identifier for which `pred` holds. - pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(sp::Ident) -> bool) -> bool { - match self.ident() { - Some((id, IdentIsRaw::No)) => pred(id), - _ => false, - } - } - /// Is this an invisible open delimiter at the start of a token sequence /// from an expanded metavar? pub fn is_metavar_seq(&self) -> Option { @@ -1076,8 +1073,8 @@ impl Token { (Colon, Colon) => PathSep, (Colon, _) => return None, - (SingleQuote, Ident(name, is_raw)) => { - Lifetime(Symbol::intern(&format!("'{name}")), *is_raw) + (SingleQuote, Ident(name, kind)) => { + Lifetime(Symbol::intern(&format!("'{name}")), *kind) } (SingleQuote, _) => return None, diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index df71aad0111cd..164d1cb8fd731 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -793,7 +793,7 @@ impl TokenStream { DelimSpacing::new(Spacing::JointHidden, Spacing::Alone), Delimiter::Bracket, [ - TokenTree::token_alone(token::Ident(sym::doc, token::IdentIsRaw::No), span), + TokenTree::token_alone(token::Ident(sym::doc, token::IdentKind::Normal), span), TokenTree::token_alone(token::Eq, span), TokenTree::token_alone( TokenKind::lit(token::StrRaw(num_of_hashes), data, None), diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 977eb0ee4592d..d97bf7a2a6db3 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -364,20 +364,18 @@ fn space_between(tt1: &TokenTree, tt2: &TokenTree) -> bool { // IDENT + `!`: `println!()`, but `if !x { ... }` needs a space after the `if` ( - Tok(tk::Token { kind: tk::Ident(sym, is_raw), span }, _), + Tok(tk::Token { kind: tk::Ident(sym, kind), span }, _), Tok(tk::Token { kind: tk::Bang, .. }, _), - ) if !Ident::new(*sym, *span).is_reserved() || matches!(is_raw, tk::IdentIsRaw::Yes) => { - false - } + ) if !Ident::new(*sym, *span).is_reserved() || matches!(kind, tk::IdentKind::Raw) => false, // IDENT|`fn`|`Self`|`pub` + `(`: `f(3)`, `fn(x: u8)`, `Self()`, `pub(crate)`, // but `let (a, b) = (1, 2)` needs a space after the `let` - (Tok(tk::Token { kind: tk::Ident(sym, is_raw), span }, _), Del(_, _, Parenthesis, _)) + (Tok(tk::Token { kind: tk::Ident(sym, kind), span }, _), Del(_, _, Parenthesis, _)) if !Ident::new(*sym, *span).is_reserved() || *sym == kw::Fn || *sym == kw::SelfUpper || *sym == kw::Pub - || matches!(is_raw, tk::IdentIsRaw::Yes) => + || matches!(kind, tk::IdentKind::Raw) => { false } @@ -1076,17 +1074,17 @@ pub trait PrintState<'a>: std::ops::Deref + std::ops::Dere tk::Literal(lit) => literal_to_string(lit).into(), /* Name components */ - tk::Ident(name, is_raw) => { - IdentPrinter::new(name, is_raw.to_print_mode_ident(), convert_dollar_crate) + tk::Ident(name, kind) => { + IdentPrinter::new(name, kind.to_print_mode_ident(), convert_dollar_crate) .to_string() .into() } - tk::NtIdent(ident, is_raw) => { - IdentPrinter::for_ast_ident(ident, is_raw.to_print_mode_ident()).to_string().into() + tk::NtIdent(ident, kind) => { + IdentPrinter::for_ast_ident(ident, kind.to_print_mode_ident()).to_string().into() } - tk::Lifetime(name, is_raw) | tk::NtLifetime(Ident { name, .. }, is_raw) => { - IdentPrinter::new(name, is_raw.to_print_mode_lifetime(), None).to_string().into() + tk::Lifetime(name, kind) | tk::NtLifetime(Ident { name, .. }, kind) => { + IdentPrinter::new(name, kind.to_print_mode_lifetime(), None).to_string().into() } /* Other */ diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 546d91187e05e..ad47dce0f15e6 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -361,7 +361,6 @@ fn borrowck_collect_region_constraints<'tcx>( deferred_closure_requirements, polonius_context, } = type_check::type_check( - root_cx, &infcx, body, &promoted, diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 6418c73173df0..4c5acd58638fb 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -47,7 +47,7 @@ use crate::region_infer::values::{LivenessValues, PlaceholderIndex, PlaceholderI use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst}; use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations}; use crate::universal_regions::{DefiningTy, UniversalRegions}; -use crate::{BorrowCheckRootCtxt, BorrowckInferCtxt, DeferredClosureRequirements, path_utils}; +use crate::{BorrowckInferCtxt, DeferredClosureRequirements, path_utils}; macro_rules! span_mirbug { ($context:expr, $elem:expr, $($message:tt)*) => ({ @@ -94,7 +94,6 @@ mod relate_tys; /// - `move_data` -- move-data constructed when performing the maybe-init dataflow analysis /// - `location_map` -- map between MIR `Location` and `PointIndex` pub(crate) fn type_check<'tcx>( - root_cx: &BorrowCheckRootCtxt<'_, 'tcx>, infcx: &BorrowckInferCtxt<'tcx>, body: &Body<'tcx>, promoted: &IndexSlice>, @@ -145,7 +144,6 @@ pub(crate) fn type_check<'tcx>( let mut deferred_closure_requirements = Default::default(); let mut typeck = TypeChecker { - root_cx, infcx, last_span: body.span, body, @@ -227,7 +225,6 @@ enum FieldAccessError { /// way, it accrues region constraints -- these can later be used by /// NLL region checking. struct TypeChecker<'a, 'tcx> { - root_cx: &'a BorrowCheckRootCtxt<'a, 'tcx>, infcx: &'a BorrowckInferCtxt<'tcx>, last_span: Span, body: &'a Body<'tcx>, @@ -2715,7 +2712,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { args: GenericArgsRef<'tcx>, location: Location, ) -> ty::InstantiatedClauses<'tcx> { - let root_def_id = self.root_cx.root_def_id(); + let root_def_id = self.infcx.root_def_id; // We will have to handle propagated closure requirements for this closure, // but need to defer this until the nested body has been fully borrow checked. self.deferred_closure_requirements.push((def_id, args, location.to_locations())); diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs index ef39ca049b811..aa339ce7f4252 100644 --- a/compiler/rustc_builtin_macros/src/assert/context.rs +++ b/compiler/rustc_builtin_macros/src/assert/context.rs @@ -1,4 +1,4 @@ -use rustc_ast::token::{self, Delimiter, IdentIsRaw}; +use rustc_ast::token::{self, Delimiter, IdentKind}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; use rustc_ast::{ BinOpKind, BorrowKind, DUMMY_NODE_ID, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall, @@ -163,7 +163,7 @@ impl<'cx, 'a> Context<'cx, 'a> { let captures = self.capture_decls.iter().flat_map(|cap| { [ TokenTree::token_joint( - token::Ident(cap.ident.name, IdentIsRaw::No), + token::Ident(cap.ident.name, IdentKind::Normal), cap.ident.span, ), TokenTree::token_alone(token::Comma, self.span), diff --git a/compiler/rustc_builtin_macros/src/autodiff.rs b/compiler/rustc_builtin_macros/src/autodiff.rs index 5a9988e076b0d..0c81b9080c6cf 100644 --- a/compiler/rustc_builtin_macros/src/autodiff.rs +++ b/compiler/rustc_builtin_macros/src/autodiff.rs @@ -10,7 +10,7 @@ mod llvm_enzyme { use rustc_ast::expand::autodiff_attrs::{ DiffActivity, DiffMode, valid_input_activity, valid_ret_activity, valid_ty_for_activity, }; - use rustc_ast::token::{Lit, LitKind, Token, TokenKind}; + use rustc_ast::token::{IdentKind, Lit, LitKind, Token, TokenKind}; use rustc_ast::tokenstream::*; use rustc_ast::visit::AssocCtxt::*; use rustc_ast::{ @@ -264,7 +264,8 @@ mod llvm_enzyme { }; // Insert mode token - let mode_token = Token::new(TokenKind::Ident(mode_symbol, false.into()), Span::default()); + let mode_token = + Token::new(TokenKind::Ident(mode_symbol, IdentKind::Normal), Span::default()); ts.insert(0, TokenTree::Token(mode_token, Spacing::Joint)); ts.insert( 1, @@ -299,7 +300,7 @@ mod llvm_enzyme { if !has_ret { // We don't want users to provide a return activity if the function doesn't return anything. // For simplicity, we just add a dummy token to the end of the list. - let t = Token::new(TokenKind::Ident(sym::None, false.into()), Span::default()); + let t = Token::new(TokenKind::Ident(sym::None, IdentKind::Normal), Span::default()); ts.push(TokenTree::Token(t, Spacing::Joint)); ts.push(TokenTree::Token(comma, Spacing::Alone)); } @@ -346,7 +347,7 @@ mod llvm_enzyme { Box::new(ast::NormalAttr::from_ident(Ident::with_dummy_span(sym::rustc_autodiff))); let ts2: Vec = vec![TokenTree::Token( - Token::new(TokenKind::Ident(sym::never, false.into()), span), + Token::new(TokenKind::Ident(sym::never, IdentKind::Normal), span), Spacing::Joint, )]; let never_arg = ast::DelimArgs { diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 050b2e793f501..39bfaf40681c6 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -179,7 +179,7 @@ use std::{iter, vec}; pub(crate) use SubstructureFields::*; pub(crate) use rustc_ast as ast; -use rustc_ast::token::{IdentIsRaw, LitKind, Token, TokenKind}; +use rustc_ast::token::{IdentKind, LitKind, Token, TokenKind}; use rustc_ast::tokenstream::{DelimSpan, Spacing, TokenTree}; use rustc_ast::{ AttrArgs, DelimArgs, EnumDef, Expr, GenericArg, GenericParamKind, Generics, Safety, SelfKind, @@ -771,11 +771,11 @@ impl<'a> TraitDef<'a> { dspan: DelimSpan::from_single(self.span), delim: rustc_ast::token::Delimiter::Parenthesis, tokens: [ - TokenKind::Ident(sym::feature, IdentIsRaw::No), + TokenKind::Ident(sym::feature, IdentKind::Normal), TokenKind::Eq, TokenKind::lit(LitKind::Str, sym::derive_const, None), TokenKind::Comma, - TokenKind::Ident(sym::issue, IdentIsRaw::No), + TokenKind::Ident(sym::issue, IdentKind::Normal), TokenKind::Eq, TokenKind::lit(LitKind::Str, sym::derive_const_issue, None), ] diff --git a/compiler/rustc_builtin_macros/src/offload.rs b/compiler/rustc_builtin_macros/src/offload.rs index 4111843b0c9d8..53bf0f4ca6b86 100644 --- a/compiler/rustc_builtin_macros/src/offload.rs +++ b/compiler/rustc_builtin_macros/src/offload.rs @@ -1,5 +1,5 @@ use rustc_ast::ast; -use rustc_ast::token::{Delimiter, Token, TokenKind}; +use rustc_ast::token::{Delimiter, IdentKind, Token, TokenKind}; use rustc_ast::tokenstream::{DelimSpan, Spacing, TokenStream, TokenTree}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_session::config::Offload; @@ -149,7 +149,7 @@ pub(crate) fn expand_kernel( // inline(never) attr let ts: Vec = vec![TokenTree::Token( - Token::new(TokenKind::Ident(sym::never, false.into()), span), + Token::new(TokenKind::Ident(sym::never, IdentKind::Normal), span), Spacing::Joint, )]; diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index 46f90aed0fd1d..b20a89859388e 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -752,8 +752,13 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) -> // We use i32 as the type for discarded outputs 'w' }; - if class == 'x' && reg == InlineAsmReg::AArch64(AArch64InlineAsmReg::x30) { - // LLVM doesn't recognize x30. use lr instead. + + if class == 'x' + && reg == InlineAsmReg::AArch64(AArch64InlineAsmReg::x30) + && llvm_util::get_version() < (23, 0, 0) + { + // FIXME(llvm): LLVM <23 does not recognize `x30` as a register name. + // This workaround can be removed when support for LLVM 22 is dropped. "{lr}".to_string() } else { format!("{{{}{}}}", class, idx) @@ -786,8 +791,12 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) -> } else if let Some(idx) = hexagon_vreg_pair_index(reg) { // LLVM uses `wN` for Hexagon HVX vector pair registers. format!("{{w{}}}", idx) - } else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14) { - // LLVM doesn't recognize r14 + } else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14) + && llvm_util::get_version() < (23, 0, 0) + { + // FIXME(llvm): LLVM <23 does not recognize `r14` as a register name + // in inline assembly. + // This workaround can be removed when support for LLVM 22 is dropped. "{lr}".to_string() } else if let InlineAsmReg::Sparc(reg) = reg && let Some(num) = reg.dreg_number() diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index fce99655f54ab..e720fa048582b 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -191,7 +191,9 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) HandledOptions::HelpOnly(matches) => (matches, true), }; - let sopts = config::build_session_options(&mut default_early_dcx, &matches); + let input = make_input(&default_early_dcx, &matches.free); + let has_input = input.is_some(); + let sopts = config::build_session_options(&mut default_early_dcx, &matches, has_input); // fully initialize ice path static once unstable options are available as context let ice_file = ice_path_with_config(Some(&sopts.unstable_opts)).clone(); @@ -200,8 +202,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) return; } - let input = make_input(&default_early_dcx, &matches.free); - let has_input = input.is_some(); let (odir, ofile) = make_output(&matches); drop(default_early_dcx); diff --git a/compiler/rustc_error_codes/src/error_codes/E0091.md b/compiler/rustc_error_codes/src/error_codes/E0091.md index 3bf4e907ecb1f..5fbc4b7a63e25 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0091.md +++ b/compiler/rustc_error_codes/src/error_codes/E0091.md @@ -4,7 +4,9 @@ Erroneous code example: ```compile_fail,E0091 type Foo = u32; // error: type parameter `T` is never used -// or: +``` +or: +```compile_fail,E0091 type Foo = Box; // error: type parameter `B` is never used ``` @@ -12,5 +14,7 @@ Please check you didn't write too many parameters. Example: ``` type Foo = u32; // ok! -type Foo2 = Box; // ok! +``` +``` +type Foo = Box; // ok! ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0634.md b/compiler/rustc_error_codes/src/error_codes/E0634.md index 0c4ed2596e2aa..6b6563a2e8128 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0634.md +++ b/compiler/rustc_error_codes/src/error_codes/E0634.md @@ -5,7 +5,8 @@ Erroneous code examples: ```compile_fail,E0634 #[repr(packed, packed(2))] // error! struct Company(i32); - +``` +```compile_fail,E0634 #[repr(packed(2))] // error! #[repr(packed)] struct Company(i32); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 749b58e5d4b82..aee5afdfd3b04 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -166,8 +166,8 @@ pub trait Emitter { let has_macro_spans: Vec<_> = iter::once(&*span) .chain(children.iter().map(|child| &child.span)) .flat_map(|span| span.primary_spans()) - .flat_map(|sp| sp.macro_backtrace()) - .filter_map(|expn_data| { + .flat_map(|sp| sp.macro_backtrace().map(move |expn_data| (sp, expn_data))) + .filter_map(|(sp, expn_data)| { match expn_data.kind { ExpnKind::Root => None, @@ -176,7 +176,16 @@ pub trait Emitter { ExpnKind::Desugaring(..) | ExpnKind::AstPass(..) => None, ExpnKind::Macro(macro_kind, name) => { - Some((macro_kind, name, expn_data.diagnostic_opaque)) + let same_line = sp + .overlaps(expn_data.def_site) + .then(|| expn_data.def_site.with_hi(sp.lo())); + Some(( + macro_kind, + name, + expn_data.diagnostic_opaque, + expn_data.def_site, + same_line, + )) } } }) @@ -188,27 +197,47 @@ pub trait Emitter { self.render_multispans_macro_backtrace(span, children, backtrace); - if !backtrace { + if !backtrace // Skip macros annotated with `#[diagnostic::opaque]`. Builtin macros are "opaque" too. - if let Some((macro_kind, name, _)) = has_macro_spans.first() - && let Some((_, _, false)) = has_macro_spans.last() + && let Some((macro_kind, name, _, sp, same_line_span)) = has_macro_spans.first() + && let Some((_, _, false, _, _)) = has_macro_spans.last() + { + // Mark the actual macro this originates from + let and_then = if let Some((macro_kind, last_name, _, _, _)) = has_macro_spans.last() + && last_name != name { - // Mark the actual macro this originates from - let and_then = if let Some((macro_kind, last_name, _)) = has_macro_spans.last() - && last_name != name + let descr = macro_kind.descr(); + format!(" which comes from the expansion of the {descr} `{last_name}`") + } else { + "".to_string() + }; + + let descr = macro_kind.descr(); + let msg = format!("this {level} originates in the {descr} `{name}`{and_then}"); + + if let Some(source_map) = self.source_map() { + if source_map.is_imported(*sp) || same_line_span.is_none() { + let msg = format!( + "{msg} (in Nightly builds, run with -Z macro-backtrace for more info)" + ); + children.push(Subdiag { + level: Sublevel::Note, + messages: vec![(DiagMessage::from(msg), Style::NoStyle)], + span: MultiSpan::new(), + }); + } else if let Some(def) = same_line_span + && source_map.is_multiline(*def) + && !and_then.is_empty() { - let descr = macro_kind.descr(); - format!(" which comes from the expansion of the {descr} `{last_name}`") + // We only point at the macro definition when it is not on the same line as the + // error produced and there are more levels of macro nesting. + span.push_span_label(*sp, msg); } else { - "".to_string() - }; - - let descr = macro_kind.descr(); - let msg = format!( - "this {level} originates in the {descr} `{name}`{and_then} \ - (in Nightly builds, run with -Z macro-backtrace for more info)", - ); - + // We point at the macro def line, but without an underline or message, we + // leave it implied. + span.push_span_context(sp.shrink_to_lo()); + } + } else { children.push(Subdiag { level: Sublevel::Note, messages: vec![(DiagMessage::from(msg), Style::NoStyle)], diff --git a/compiler/rustc_expand/src/mbe/macro_check.rs b/compiler/rustc_expand/src/mbe/macro_check.rs index 7ab595dc73d89..e28044d7632a9 100644 --- a/compiler/rustc_expand/src/mbe/macro_check.rs +++ b/compiler/rustc_expand/src/mbe/macro_check.rs @@ -105,7 +105,7 @@ //! stored when entering a macro definition starting from the state in which the meta-variable is //! bound. -use rustc_ast::token::{Delimiter, IdentIsRaw, Token, TokenKind}; +use rustc_ast::token::{Delimiter, IdentKind, Token, TokenKind}; use rustc_ast::{DUMMY_NODE_ID, NodeId}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::DecorateDiagCompat; @@ -396,7 +396,9 @@ fn check_nested_occurrences( match (state, tt) { ( NestedMacroState::Empty, - &TokenTree::Token(Token { kind: TokenKind::Ident(name, IdentIsRaw::No), .. }), + &TokenTree::Token(Token { + kind: TokenKind::Ident(name, IdentKind::Normal), .. + }), ) => { if name == kw::MacroRules { state = NestedMacroState::MacroRules; diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 2212724c68bc1..91989b91c7861 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -3,7 +3,7 @@ use std::collections::hash_map::Entry; use std::sync::Arc; use std::{mem, slice}; -use ast::token::IdentIsRaw; +use ast::token::IdentKind; use rustc_ast::token::NtPatKind::*; use rustc_ast::token::TokenKind::*; use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind}; @@ -1750,7 +1750,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { match tok { TokenTree::Token(token) => match token.kind { FatArrow | Comma | Eq | Or => IsInFollow::Yes, - Ident(name, IdentIsRaw::No) if name == kw::If || name == kw::In => { + Ident(name, IdentKind::Normal) if name == kw::If || name == kw::In => { IsInFollow::Yes } _ => IsInFollow::No(TOKENS), @@ -1764,7 +1764,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { match tok { TokenTree::Token(token) => match token.kind { FatArrow | Comma | Eq => IsInFollow::Yes, - Ident(name, IdentIsRaw::No) if name == kw::If || name == kw::In => { + Ident(name, IdentKind::Normal) if name == kw::If || name == kw::In => { IsInFollow::Yes } _ => IsInFollow::No(TOKENS), @@ -1792,7 +1792,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { TokenTree::Token(token) => match token.kind { OpenBrace | OpenBracket | Comma | FatArrow | Colon | Eq | Gt | Shr | Semi | Or => IsInFollow::Yes, - Ident(name, IdentIsRaw::No) if name == kw::As || name == kw::Where => { + Ident(name, IdentKind::Normal) if name == kw::As || name == kw::Where => { IsInFollow::Yes } _ => IsInFollow::No(TOKENS), @@ -1820,7 +1820,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { match tok { TokenTree::Token(token) => match token.kind { Comma => IsInFollow::Yes, - Ident(_, IdentIsRaw::Yes) => IsInFollow::Yes, + Ident(_, IdentKind::Raw) => IsInFollow::Yes, Ident(name, _) if name != kw::Priv => IsInFollow::Yes, _ => { if token.can_begin_type() { diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs index a02b84204cb39..76a8d0497b1ad 100644 --- a/compiler/rustc_expand/src/mbe/metavar_expr.rs +++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs @@ -1,4 +1,4 @@ -use rustc_ast::token::{self, Delimiter, IdentIsRaw, Lit, Token, TokenKind}; +use rustc_ast::token::{self, Delimiter, IdentKind, Lit, Token, TokenKind}; use rustc_ast::tokenstream::{TokenStream, TokenStreamIter, TokenTree}; use rustc_ast::{LitIntType, LitKind}; use rustc_ast_pretty::pprust; @@ -272,8 +272,8 @@ fn parse_ident_from_token<'psess>( psess: &'psess ParseSess, token: &Token, ) -> PResult<'psess, Ident> { - if let Some((elem, is_raw)) = token.ident() { - if let IdentIsRaw::Yes = is_raw { + if let Some((elem, kind)) = token.ident() { + if let IdentKind::Raw = kind { return Err(psess.dcx().struct_span_err(elem.span, RAW_IDENT_ERR)); } return Ok(elem); diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs index 2779291abf361..aed69c9f5d938 100644 --- a/compiler/rustc_expand/src/mbe/quoted.rs +++ b/compiler/rustc_expand/src/mbe/quoted.rs @@ -1,4 +1,4 @@ -use rustc_ast::token::{self, Delimiter, IdentIsRaw, NonterminalKind, Token}; +use rustc_ast::token::{self, Delimiter, IdentKind, NonterminalKind, Token}; use rustc_ast::tokenstream::TokenStreamIter; use rustc_ast::{NodeId, tokenstream}; use rustc_ast_pretty::pprust; @@ -325,10 +325,10 @@ fn parse_tree<'a>( // `tree` is followed by an `ident`. This could be `$meta_var` or the `$crate` // special metavariable that names the crate of the invocation. Some(tokenstream::TokenTree::Token(token, _)) if token.is_ident() => { - let (ident, is_raw) = token.ident().unwrap(); + let (ident, kind) = token.ident().unwrap(); let span = ident.span.with_lo(dollar_span.lo()); - if ident.name == kw::Crate && matches!(is_raw, IdentIsRaw::No) { - TokenTree::token(token::Ident(kw::DollarCrate, is_raw), span) + if ident.name == kw::Crate && matches!(kind, IdentKind::Normal) { + TokenTree::token(token::Ident(kw::DollarCrate, kind), span) } else { TokenTree::MetaVar(span, ident) } diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs index 2627e327c0f71..c258d9e471079 100644 --- a/compiler/rustc_expand/src/mbe/transcribe.rs +++ b/compiler/rustc_expand/src/mbe/transcribe.rs @@ -1,7 +1,7 @@ use std::mem; use rustc_ast::token::{ - self, Delimiter, IdentIsRaw, InvisibleOrigin, Lit, LitKind, MetaVarKind, Token, TokenKind, + self, Delimiter, IdentKind, InvisibleOrigin, Lit, LitKind, MetaVarKind, Token, TokenKind, }; use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree}; use rustc_ast::{ExprKind, StmtKind, TyKind, UnOp}; @@ -498,10 +498,10 @@ fn transcribe_pnr<'tx>( // parsing priorities. maybe_use_metavar_location(tscx.psess, &tscx.stack, sp, tt, &mut tscx.marker) } - ParseNtResult::Ident(ident, is_raw) => { + ParseNtResult::Ident(ident, kind) => { tscx.marker.mark_span(&mut sp); with_metavar_spans(|mspans| mspans.insert(ident.span, sp)); - let kind = token::NtIdent(*ident, *is_raw); + let kind = token::NtIdent(*ident, *kind); TokenTree::token_alone(kind, sp) } ParseNtResult::Lifetime(ident, is_raw) => { @@ -575,7 +575,7 @@ fn transcribe_pnr<'tx>( let leading_if_span = guard.span_with_leading_if.with_hi(guard.span_with_leading_if.lo() + BytePos(2)); let ts = std::iter::once(TokenTree::token_alone( - token::Ident(kw::If, IdentIsRaw::No), + token::Ident(kw::If, IdentKind::Normal), leading_if_span, )) .chain(TokenStream::from_ast(&guard.cond).iter().cloned()) @@ -1004,18 +1004,18 @@ fn extract_symbol_from_pnr<'a>( span_err: Span, ) -> PResult<'a, Symbol> { match pnr { - ParseNtResult::Ident(nt_ident, is_raw) => { - if let IdentIsRaw::Yes = is_raw { + ParseNtResult::Ident(nt_ident, kind) => { + if let IdentKind::Raw = kind { Err(dcx.struct_span_err(span_err, RAW_IDENT_ERR)) } else { Ok(nt_ident.name) } } ParseNtResult::Tt(TokenTree::Token( - Token { kind: TokenKind::Ident(symbol, is_raw), .. }, + Token { kind: TokenKind::Ident(symbol, kind), .. }, _, )) => { - if let IdentIsRaw::Yes = is_raw { + if let IdentKind::Raw = kind { Err(dcx.struct_span_err(span_err, RAW_IDENT_ERR)) } else { Ok(*symbol) diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index c0a9a43c64cdf..be837cf9eacc0 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -228,31 +228,31 @@ impl FromInternal for Vec> { tk::Question => op("?"), tk::SingleQuote => op("'"), - tk::Ident(sym, is_raw) => trees.push(TokenTree::Ident(Ident { + tk::Ident(sym, kind) => trees.push(TokenTree::Ident(Ident { sym, - is_raw: matches!(is_raw, tk::IdentIsRaw::Yes), + is_raw: matches!(kind, tk::IdentKind::Raw), span, })), - tk::NtIdent(ident, is_raw) => trees.push(TokenTree::Ident(Ident { + tk::NtIdent(ident, kind) => trees.push(TokenTree::Ident(Ident { sym: ident.name, - is_raw: matches!(is_raw, tk::IdentIsRaw::Yes), + is_raw: matches!(kind, tk::IdentKind::Raw), span: ident.span, })), - tk::Lifetime(name, is_raw) => { + tk::Lifetime(name, kind) => { let ident = rustc_span::Ident::new(name, span).without_first_quote(); trees.extend([ TokenTree::Punct(Punct { ch: b'\'', joint: true, span }), TokenTree::Ident(Ident { sym: ident.name, - is_raw: matches!(is_raw, tk::IdentIsRaw::Yes), + is_raw: matches!(kind, tk::IdentKind::Raw), span, }), ]); } - tk::NtLifetime(ident, is_raw) => { + tk::NtLifetime(ident, kind) => { let stream = - TokenStream::token_alone(tk::Lifetime(ident.name, is_raw), ident.span); + TokenStream::token_alone(tk::Lifetime(ident.name, kind), ident.span); trees.push(TokenTree::Group(Group { delimiter: rustc_proc_macro::Delimiter::None, stream: Some(stream), @@ -274,7 +274,7 @@ impl FromInternal for Vec> { escaped.extend(ch.escape_debug()); } let stream = [ - tk::Ident(sym::doc, tk::IdentIsRaw::No), + tk::Ident(sym::doc, tk::IdentKind::Normal), tk::Eq, tk::TokenKind::lit(tk::Str, Symbol::intern(&escaped), None), ] @@ -366,7 +366,8 @@ impl ToInternal> } TokenTree::Ident(self::Ident { sym, is_raw, span }) => { rustc.psess().symbol_gallery.insert(sym, span); - smallvec![tokenstream::TokenTree::token_alone(tk::Ident(sym, is_raw.into()), span)] + let kind = if is_raw { tk::IdentKind::Raw } else { tk::IdentKind::Normal }; + smallvec![tokenstream::TokenTree::token_alone(tk::Ident(sym, kind), span)] } TokenTree::Literal(self::Literal { kind: self::LitKind::Integer, @@ -625,7 +626,7 @@ impl server::Server for Rustc<'_, '_> { match &expr.kind { ast::ExprKind::Lit(token_lit) if token_lit.kind == tk::Bool => { Ok(tokenstream::TokenStream::token_alone( - tk::Ident(token_lit.symbol, tk::IdentIsRaw::No), + tk::Ident(token_lit.symbol, tk::IdentKind::Normal), expr.span, )) } diff --git a/compiler/rustc_hir_typeck/src/diagnostics.rs b/compiler/rustc_hir_typeck/src/diagnostics.rs index 3b7de7790ac02..fb1b33b0bdd64 100644 --- a/compiler/rustc_hir_typeck/src/diagnostics.rs +++ b/compiler/rustc_hir_typeck/src/diagnostics.rs @@ -584,6 +584,14 @@ impl Subdiagnostic for RemoveSemiForCoerce { } } +#[derive(Diagnostic)] +#[diag("runtime values cannot be referenced in patterns", code = E0080)] +pub(crate) struct NonConstPathInPattern { + #[primary_span] + #[label("references a runtime value")] + pub spans: Vec, +} + #[derive(Diagnostic)] #[diag("union patterns should have exactly one field")] pub(crate) struct UnionPatMultipleFields { diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index a017b0dfcb507..a668f7eaee1f8 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1039,13 +1039,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Some((fail, ty, expr.span)) } }; + let endpoints = [lhs, rhs]; let mut lhs = calc_side(lhs); let mut rhs = calc_side(rhs); if let (Some((true, ..)), _) | (_, Some((true, ..))) = (lhs, rhs) { // There exists a side that didn't meet our criteria that the end-point // be of a numeric or char type, as checked in `calc_side` above. - let guar = self.emit_err_pat_range(span, lhs, rhs); + let guar = self.emit_err_pat_range(span, lhs, rhs, endpoints); return Ty::new_error(self.tcx, guar); } @@ -1081,7 +1082,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some((ref mut fail, _, _)) = rhs { *fail = true; } - let guar = self.emit_err_pat_range(span, lhs, rhs); + let guar = self.emit_err_pat_range(span, lhs, rhs, endpoints); return Ty::new_error(self.tcx, guar); } ty @@ -1098,7 +1099,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span: Span, lhs: Option<(bool, Ty<'tcx>, Span)>, rhs: Option<(bool, Ty<'tcx>, Span)>, + endpoints: [Option<&hir::PatExpr<'tcx>>; 2], ) -> ErrorGuaranteed { + if !(lhs, rhs).references_error() { + // Range endpoints must resolve to constants, not local variables. + // Label both runtime endpoints before the type error. + let mut spans = Vec::new(); + for expr in endpoints.into_iter().flatten() { + if let hir::PatExprKind::Path(hir::QPath::Resolved(_, path)) = expr.kind + && matches!(path.res, Res::Local(_)) + { + spans.push(expr.span); + } + } + if !spans.is_empty() { + return self.dcx().emit_err(diagnostics::NonConstPathInPattern { spans }); + } + } + let span = match (lhs, rhs) { (Some((true, ..)), Some((true, ..))) => span, (Some((true, _, sp)), _) => sp, @@ -1462,7 +1480,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } _ if let Some((sp, msg, sugg)) = mut_var_suggestion => { - err.span_suggestion(sp, msg, sugg, Applicability::MachineApplicable); + err.span_suggestion_verbose(sp, msg, sugg, Applicability::MachineApplicable); } _ => {} // don't provide suggestions in other cases #55175 } diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 0d584be4ad0b0..3f59afa31de84 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -42,7 +42,7 @@ where { let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); let matches = optgroups().parse(args).unwrap(); - let sessopts = build_session_options(&mut early_dcx, &matches); + let sessopts = build_session_options(&mut early_dcx, &matches, true); let target = rustc_session::config::build_target_config( &early_dcx, &sessopts.target_triple, @@ -941,7 +941,7 @@ fn test_edition_parsing() { let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap(); - let sessopts = build_session_options(&mut early_dcx, &matches); + let sessopts = build_session_options(&mut early_dcx, &matches, false); assert!(sessopts.edition == Edition::Edition2018) } @@ -952,7 +952,7 @@ fn test_assumptions_on_binders_enables_next_solver_globally() { // `-Zassumptions-on-binders` alone enables the next solver globally. let matches = optgroups().parse(&["-Zassumptions-on-binders".to_string()]).unwrap(); - let opts = build_session_options(&mut early_dcx, &matches); + let opts = build_session_options(&mut early_dcx, &matches, false); assert!(opts.unstable_opts.assumptions_on_binders); assert_eq!(opts.unstable_opts.next_solver, globally); @@ -963,7 +963,7 @@ fn test_assumptions_on_binders_enables_next_solver_globally() { ["-Znext-solver=coherence".to_string(), "-Zassumptions-on-binders".to_string()], ] { let matches = optgroups().parse(&args).unwrap(); - let opts = build_session_options(&mut early_dcx, &matches); + let opts = build_session_options(&mut early_dcx, &matches, false); assert!(opts.unstable_opts.assumptions_on_binders); assert_eq!(opts.unstable_opts.next_solver, globally); } @@ -976,7 +976,7 @@ fn test_assumptions_on_binders_enables_next_solver_globally() { ["-Znext-solver=no".to_string(), "-Zassumptions-on-binders".to_string()], ] { let matches = optgroups().parse(&args).unwrap(); - let opts = build_session_options(&mut early_dcx, &matches); + let opts = build_session_options(&mut early_dcx, &matches, false); assert!(opts.unstable_opts.assumptions_on_binders); assert_eq!(opts.unstable_opts.next_solver, globally); } diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 2d571d8b8e13d..c41071a8cf7d9 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1757,11 +1757,11 @@ impl KeywordIdents { match tt { // Only report non-raw idents. TokenTree::Token(token, _) => { - if let Some((ident, token::IdentIsRaw::No)) = token.ident() { + if let Some((ident, token::IdentKind::Normal)) = token.ident() { if !prev_dollar { self.check_ident_token(cx, UnderMacro(true), ident, ""); } - } else if let Some((ident, token::IdentIsRaw::No)) = token.lifetime() { + } else if let Some((ident, token::IdentKind::Normal)) = token.lifetime() { self.check_ident_token( cx, UnderMacro(true), diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 2afb55b02e2e6..ddb1f6c77c1fd 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -1,6 +1,6 @@ use diagnostics::make_errors_for_mismatched_closing_delims; use rustc_ast::ast::{self, AttrStyle}; -use rustc_ast::token::{self, CommentKind, Delimiter, IdentIsRaw, Token, TokenKind}; +use rustc_ast::token::{self, CommentKind, Delimiter, IdentKind, Token, TokenKind}; use rustc_ast::tokenstream::TokenStream; use rustc_ast::util::unicode::{TEXT_FLOW_CONTROL_CHARS, contains_text_flow_control_chars}; use rustc_errors::codes::*; @@ -238,7 +238,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { self.dcx().emit_err(crate::diagnostics::CannotBeRawIdent { span, ident: sym }); } self.psess.raw_identifier_spans.push(span); - token::Ident(sym, IdentIsRaw::Yes) + token::Ident(sym, IdentKind::Raw) } rustc_lexer::TokenKind::UnknownPrefix => { self.report_unknown_prefix(start); @@ -252,7 +252,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { let lifetime_name = self.str_from(start); self.last_lifetime = Some(self.mk_sp(start, start + BytePos(1))); let ident = Symbol::intern(lifetime_name); - token::Lifetime(ident, IdentIsRaw::No) + token::Lifetime(ident, IdentKind::Normal) } rustc_lexer::TokenKind::InvalidIdent // Do not recover an identifier with emoji if the codepoint is a confusable @@ -270,7 +270,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { .entry(sym) .or_default() .push(span); - token::Ident(sym, IdentIsRaw::No) + token::Ident(sym, IdentKind::Normal) } // split up (raw) c string literals to an ident and a string literal when edition < // 2021. @@ -337,7 +337,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { .with_span(span) .stash(span, StashKey::LifetimeIsChar); } - token::Lifetime(lifetime_name, IdentIsRaw::No) + token::Lifetime(lifetime_name, IdentKind::Normal) } rustc_lexer::TokenKind::RawLifetime => { self.last_lifetime = Some(self.mk_sp(start, start + BytePos(1))); @@ -387,7 +387,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { // Make sure we mark this as a raw identifier. self.psess.raw_identifier_spans.push(span); - token::Lifetime(sym, IdentIsRaw::Yes) + token::Lifetime(sym, IdentKind::Raw) } else { // Reset the state so we just lex the `'r`. self.pos = start + BytePos(2); @@ -407,7 +407,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { ); let lifetime_name = nfc_normalize(self.str_from(start)); - token::Lifetime(lifetime_name, IdentIsRaw::No) + token::Lifetime(lifetime_name, IdentKind::Normal) } } rustc_lexer::TokenKind::Semi => token::Semi, @@ -497,7 +497,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { let sym = nfc_normalize(self.str_from(start)); let span = self.mk_sp(start, self.pos); self.psess.symbol_gallery.insert(sym, span); - token::Ident(sym, IdentIsRaw::No) + token::Ident(sym, IdentKind::Normal) } /// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index 826d193634a45..a934bb62d6a9c 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -307,7 +307,7 @@ pub(super) static UNICODE_ARRAY: &[(char, &str, &str)] = &[ // fancier error recovery to it, as there will be less overall work to do this way. const ASCII_ARRAY: &[(&str, &str, Option)] = &[ (" ", "Space", None), - ("_", "Underscore", Some(token::Ident(kw::Underscore, token::IdentIsRaw::No))), + ("_", "Underscore", Some(token::Ident(kw::Underscore, token::IdentKind::Normal))), ("-", "Minus/Hyphen", Some(token::Minus)), (",", "Comma", Some(token::Comma)), (";", "Semicolon", Some(token::Semi)), diff --git a/compiler/rustc_parse/src/parser/asm.rs b/compiler/rustc_parse/src/parser/asm.rs index 5c177af086565..92b0b96fab165 100644 --- a/compiler/rustc_parse/src/parser/asm.rs +++ b/compiler/rustc_parse/src/parser/asm.rs @@ -1,7 +1,7 @@ use rustc_ast::{self as ast, AsmMacro}; use rustc_span::{Span, Symbol, kw}; -use super::{ExpKeywordPair, ForceCollect, IdentIsRaw, Trailing, UsePreAttrPos}; +use super::{ExpKeywordPair, ForceCollect, IdentKind, Trailing, UsePreAttrPos}; use crate::{PResult, Parser, diagnostics, exp, token}; /// An argument to one of the `asm!` macros. The argument is syntactically valid, but is otherwise @@ -368,7 +368,7 @@ fn parse_clobber_abi<'a>(p: &mut Parser<'a>) -> PResult<'a, Vec<(Symbol, Span)>> fn parse_reg<'a>(p: &mut Parser<'a>) -> PResult<'a, ast::InlineAsmRegOrRegClass> { p.expect(exp!(OpenParen))?; let result = match p.token.uninterpolate().kind { - token::Ident(name, IdentIsRaw::No) => ast::InlineAsmRegOrRegClass::RegClass(name), + token::Ident(name, IdentKind::Normal) => ast::InlineAsmRegOrRegClass::RegClass(name), token::Literal(token::Lit { kind: token::LitKind::Str, symbol, suffix: _ }) => { ast::InlineAsmRegOrRegClass::Reg(symbol) } diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index f5fa592585099..700b1813a87fb 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1,7 +1,7 @@ use std::mem::take; use std::ops::{Deref, DerefMut}; -use ast::token::IdentIsRaw; +use ast::token::IdentKind; use rustc_ast::token::{self, Lit, LitKind, Token, TokenKind}; use rustc_ast::util::parser::AssocOp; use rustc_ast::{ @@ -200,7 +200,7 @@ impl<'a> Parser<'a> { pub(super) fn expected_ident_found( &mut self, recover: bool, - ) -> PResult<'a, (Ident, IdentIsRaw)> { + ) -> PResult<'a, (Ident, IdentKind)> { let valid_follow = &[ TokenKind::Eq, TokenKind::Colon, @@ -228,11 +228,11 @@ impl<'a> Parser<'a> { let bad_token = self.token; // suggest prepending a keyword in identifier position with `r#` - let suggest_raw = if let Some((ident, IdentIsRaw::No)) = self.token.ident() + let suggest_raw = if let Some((ident, IdentKind::Normal)) = self.token.ident() && ident.is_raw_guess() && self.look_ahead(1, |t| valid_follow.contains(&t.kind)) { - recovered_ident = Some((ident, IdentIsRaw::Yes)); + recovered_ident = Some((ident, IdentKind::Raw)); // `Symbol::to_string()` is different from `Symbol::into_diag_arg()`, // which uses `Symbol::to_ident_string()` and "helpfully" adds an implicit `r#` @@ -258,7 +258,7 @@ impl<'a> Parser<'a> { let help_cannot_start_number = self.is_lit_bad_ident().map(|(len, valid_portion)| { let (invalid, valid) = self.token.span.split_at(len as u32); - recovered_ident = Some((Ident::new(valid_portion, valid), IdentIsRaw::No)); + recovered_ident = Some((Ident::new(valid_portion, valid), IdentKind::Normal)); HelpIdentifierStartsWithNumber { num_span: invalid } }); @@ -277,7 +277,7 @@ impl<'a> Parser<'a> { if self.token == token::Lt { // Let's check if the previous token could denote the start of an item // whose kind can have generics. - if let Some((Ident { name, .. }, IdentIsRaw::No)) = self.prev_token.ident() + if let Some(Ident { name, .. }) = self.prev_token.non_raw_ident() && let kw::Fn | kw::Type | kw::Struct | kw::Enum | kw::Union | kw::Trait = name { match self.parse_generics() { @@ -508,7 +508,7 @@ impl<'a> Parser<'a> { ); } - if let Some((ident, IdentIsRaw::No)) = self.prev_token.ident() + if let Some(ident) = self.prev_token.non_raw_ident() && let "def" | "fun" | "func" | "function" = ident.name.as_str() { err.span_suggestion_short( @@ -542,9 +542,9 @@ impl<'a> Parser<'a> { // positive for a `cr#` that wasn't intended to start a c-string literal, but identifying // that in the parser requires unbounded lookahead, so we only add a hint to the existing // error rather than replacing it entirely. - if ((self.prev_token == TokenKind::Ident(sym::character('c'), IdentIsRaw::No) + if ((self.prev_token == TokenKind::Ident(sym::character('c'), IdentKind::Normal) && matches!(&self.token.kind, TokenKind::Literal(token::Lit { kind: token::Str, .. }))) - || (self.prev_token == TokenKind::Ident(sym::cr, IdentIsRaw::No) + || (self.prev_token == TokenKind::Ident(sym::cr, IdentKind::Normal) && matches!( &self.token.kind, TokenKind::Literal(token::Lit { kind: token::Str, .. }) | token::Pound diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 6bc42a0a40734..6297537e2ecbe 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -4,7 +4,7 @@ use core::mem; use core::ops::{Bound, ControlFlow}; use ast::mut_visit::{self, MutVisitor}; -use ast::token::IdentIsRaw; +use ast::token::IdentKind; use ast::{ForLoopKind, MatchKind, Pat, Path, PathSegment, Recovered}; use rustc_ast::token::{self, Delimiter, InvisibleOrigin, MetaVarKind, Token, TokenKind}; use rustc_ast::util::case::Case; @@ -501,7 +501,7 @@ impl<'a> Parser<'a> { let token_cannot_continue_expr = |t: &Token| match t.uninterpolate().kind { // These tokens can start an expression after `!`, but // can't continue an expression after an ident - token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw), + token::Ident(name, kind) => token::ident_can_begin_expr(name, t.span, kind), token::Literal(..) | token::Pound => true, _ => t.is_metavar_expr(), }; @@ -741,7 +741,8 @@ impl<'a> Parser<'a> { lo: Span, ) -> PResult<'a, Box> { let mut res = loop { - let has_question = if self.prev_token == TokenKind::Ident(kw::Return, IdentIsRaw::No) { + let has_question = if self.prev_token == TokenKind::Ident(kw::Return, IdentKind::Normal) + { // We are using noexpect here because we don't expect a `?` directly after // a `return` which could be suggested otherwise. self.eat_noexpect(&token::Question) @@ -753,7 +754,7 @@ impl<'a> Parser<'a> { e = self.mk_expr(lo.to(self.prev_token.span), ExprKind::Try(e)); continue; } - let has_dot = if self.prev_token == TokenKind::Ident(kw::Return, IdentIsRaw::No) { + let has_dot = if self.prev_token == TokenKind::Ident(kw::Return, IdentKind::Normal) { // We are using noexpect here because we don't expect a `.` directly after // a `return` which could be suggested otherwise. self.eat_noexpect(&token::Dot) @@ -823,7 +824,7 @@ impl<'a> Parser<'a> { // We end up with the `sym` (`1`) token in `self.prev_token` and a dot in // `self.token`. assert!(suffix.is_none()); - self.token = Token::new(token::Ident(sym, IdentIsRaw::No), ident_span); + self.token = Token::new(token::Ident(sym, IdentKind::Normal), ident_span); self.bump_with((Token::new(token::Dot, dot_span), self.token_spacing)); self.mk_expr_tuple_field_access(lo, ident_span, base, sym, None) } @@ -839,7 +840,7 @@ impl<'a> Parser<'a> { // the `sym2` (`2` or `2e3`) token in `self.prev_token` and the following // token in `self.token`. let next_token2 = - Token::new(token::Ident(sym2, IdentIsRaw::No), ident2_span); + Token::new(token::Ident(sym2, IdentKind::Normal), ident2_span); self.bump_with((next_token2, self.token_spacing)); self.bump(); let base1 = @@ -1902,7 +1903,7 @@ impl<'a> Parser<'a> { self.bump(); // `builtin` self.bump(); // `#` - let Some((ident, IdentIsRaw::No)) = self.token.ident() else { + let Some((ident, IdentKind::Normal)) = self.token.ident() else { let err = self .dcx() .create_err(crate::diagnostics::ExpectedBuiltinIdent { span: self.token.span }); @@ -2017,7 +2018,7 @@ impl<'a> Parser<'a> { }; // On an error path, eagerly consider a lifetime to be an unclosed character lit, if that // makes sense. - if let Some((ident, IdentIsRaw::No)) = self.token.lifetime() + if let Some((ident, IdentKind::Normal)) = self.token.lifetime() && could_be_unclosed_char_literal(ident) { let lt = self.expect_lifetime(); @@ -2089,7 +2090,7 @@ impl<'a> Parser<'a> { } }; match self.token.uninterpolate().kind { - token::Ident(name, IdentIsRaw::No) if name.is_bool_lit() => { + token::Ident(name, IdentKind::Normal) if name.is_bool_lit() => { self.bump(); Some(token::Lit::new(token::Bool, name, None)) } @@ -3002,9 +3003,9 @@ impl<'a> Parser<'a> { } pub(crate) fn eat_label(&mut self) -> Option; +//@ only-x86_64 +#![feature(generic_assert)] +fn main() { + const I = 0; + std::arch::x86_64::_mm_shuffle_ps(todo!(), todo!(), const { + assert!(N != 0); + }); } ->> ; diff --git a/tests/run-make/broken-pipe-no-ice/rmake.rs b/tests/run-make/broken-pipe-no-ice/rmake.rs index b0a28b6c899da..0e43ebda9c3e1 100644 --- a/tests/run-make/broken-pipe-no-ice/rmake.rs +++ b/tests/run-make/broken-pipe-no-ice/rmake.rs @@ -68,7 +68,7 @@ fn check_broken_pipe_handled_gracefully(bin: Binary, mut cmd: Command) { fn main() { let mut rustc = bare_rustc(); - rustc.arg("--print=sysroot"); + rustc.arg("--print=sysroot").edition("2015"); let rustc = rustc.into_raw_command(); check_broken_pipe_handled_gracefully(Binary::Rustc, rustc); diff --git a/tests/run-make/compressed-debuginfo/rmake.rs b/tests/run-make/compressed-debuginfo/rmake.rs index 45bfaa6041d97..4a5305a87cbfb 100644 --- a/tests/run-make/compressed-debuginfo/rmake.rs +++ b/tests/run-make/compressed-debuginfo/rmake.rs @@ -12,6 +12,7 @@ use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc}; fn check_compression(compression: &str, to_find: &str) { run_in_tmpdir(|| { let out = rustc() + .edition("2015") .crate_name("foo") .crate_type("lib") .emit("obj") diff --git a/tests/run-make/const-destruct-stable-toolchain/rmake.rs b/tests/run-make/const-destruct-stable-toolchain/rmake.rs index 0f36d71f2c874..18d78710f5849 100644 --- a/tests/run-make/const-destruct-stable-toolchain/rmake.rs +++ b/tests/run-make/const-destruct-stable-toolchain/rmake.rs @@ -11,6 +11,7 @@ use run_make_support::{diff, rustc}; fn main() { let out = rustc() .input("const-drop.rs") + .edition("2015") .env("RUSTC_BOOTSTRAP", "-1") .run_fail() .assert_stderr_not_contains("consider restricting type parameter `T`") @@ -18,6 +19,7 @@ fn main() { diff().expected_file("const-drop-stable.stderr").actual_text("(rustc)", &out).run(); let out = rustc() .input("const-drop.rs") + .edition("2015") .ui_testing() .run_fail() .assert_stderr_contains( diff --git a/tests/run-make/const-trait-stable-toolchain/rmake.rs b/tests/run-make/const-trait-stable-toolchain/rmake.rs index e2ec58f03db19..20679cdb2ed29 100644 --- a/tests/run-make/const-trait-stable-toolchain/rmake.rs +++ b/tests/run-make/const-trait-stable-toolchain/rmake.rs @@ -9,6 +9,7 @@ use run_make_support::{diff, rustc}; fn main() { let out = rustc() + .edition("2015") .input("const-super-trait.rs") .env("RUSTC_BOOTSTRAP", "-1") .cfg("feature_enabled") @@ -24,6 +25,7 @@ fn main() { .actual_text("(rustc)", &out) .run(); let out = rustc() + .edition("2015") .input("const-super-trait.rs") .cfg("feature_enabled") .ui_testing() @@ -36,6 +38,7 @@ fn main() { .actual_text("(rustc)", &out) .run(); let out = rustc() + .edition("2015") .input("const-super-trait.rs") .env("RUSTC_BOOTSTRAP", "-1") .run_fail() @@ -47,6 +50,7 @@ fn main() { .actual_text("(rustc)", &out) .run(); let out = rustc() + .edition("2015") .input("const-super-trait.rs") .ui_testing() .run_fail() diff --git a/tests/run-make/crate-loading-crate-depends-on-itself/rmake.rs b/tests/run-make/crate-loading-crate-depends-on-itself/rmake.rs index 57e0cab92f1ef..f49a848052411 100644 --- a/tests/run-make/crate-loading-crate-depends-on-itself/rmake.rs +++ b/tests/run-make/crate-loading-crate-depends-on-itself/rmake.rs @@ -10,9 +10,10 @@ use run_make_support::{diff, rust_lib_name, rustc}; fn main() { - rustc().input("foo-prev.rs").run(); + rustc().edition("2015").input("foo-prev.rs").run(); let out = rustc() + .edition("2015") .extra_filename("current") .metadata("current") .input("foo-current.rs") diff --git a/tests/run-make/crate-loading-multiple-candidates/rmake.rs b/tests/run-make/crate-loading-multiple-candidates/rmake.rs index ce090850500b8..9775a1672f0cb 100644 --- a/tests/run-make/crate-loading-multiple-candidates/rmake.rs +++ b/tests/run-make/crate-loading-multiple-candidates/rmake.rs @@ -9,8 +9,18 @@ use run_make_support::{bare_rustc, diff, rfs, rustc}; fn main() { // Check that relative paths are preserved in the diagnostic rfs::create_dir("mylibs"); - rustc().input("crateresolve1-1.rs").out_dir("mylibs").extra_filename("-1").run(); - rustc().input("crateresolve1-2.rs").out_dir("mylibs").extra_filename("-2").run(); + rustc() + .edition("2015") + .input("crateresolve1-1.rs") + .out_dir("mylibs") + .extra_filename("-1") + .run(); + rustc() + .edition("2015") + .input("crateresolve1-2.rs") + .out_dir("mylibs") + .extra_filename("-2") + .run(); check("./mylibs"); // Check that symlinks aren't followed when printing the diagnostic @@ -21,6 +31,7 @@ fn main() { fn check(library_path: &str) { let out = rustc() + .edition("2015") .input("multiple-candidates.rs") .library_search_path(library_path) .ui_testing() diff --git a/tests/run-make/crate-loading/rmake.rs b/tests/run-make/crate-loading/rmake.rs index 8f2577861239d..79f14e1851eff 100644 --- a/tests/run-make/crate-loading/rmake.rs +++ b/tests/run-make/crate-loading/rmake.rs @@ -6,11 +6,16 @@ use run_make_support::{diff, rust_lib_name, rustc}; fn main() { - rustc().input("dependency-1.rs").run(); - rustc().input("dependency-2.rs").extra_filename("2").metadata("2").run(); - rustc().input("dep-2-reexport.rs").extern_("dependency", rust_lib_name("dependency2")).run(); + rustc().edition("2015").input("dependency-1.rs").run(); + rustc().edition("2015").input("dependency-2.rs").extra_filename("2").metadata("2").run(); + rustc() + .edition("2015") + .input("dep-2-reexport.rs") + .extern_("dependency", rust_lib_name("dependency2")) + .run(); let out = rustc() + .edition("2015") .input("multiple-dep-versions.rs") .extern_("dependency", rust_lib_name("dependency")) .extern_("dep_2_reexport", rust_lib_name("foo")) diff --git a/tests/run-make/emit-to-stdout/rmake.rs b/tests/run-make/emit-to-stdout/rmake.rs index 19c15b72fe475..851ab3cb45881 100644 --- a/tests/run-make/emit-to-stdout/rmake.rs +++ b/tests/run-make/emit-to-stdout/rmake.rs @@ -13,8 +13,9 @@ use run_make_support::{diff, run_in_tmpdir, rustc}; // Test emitting text outputs to stdout works correctly fn run_diff(name: &str, file_args: &[&str]) { - rustc().emit(format!("{name}={name}")).input("test.rs").args(file_args).run(); - let out = rustc().emit(format!("{name}=-")).input("test.rs").run().stdout_utf8(); + rustc().edition("2015").emit(format!("{name}={name}")).input("test.rs").args(file_args).run(); + let out = + rustc().edition("2015").emit(format!("{name}=-")).input("test.rs").run().stdout_utf8(); diff().expected_file(name).actual_text("stdout", &out).run(); } @@ -29,7 +30,13 @@ fn run_terminal_err_diff(name: &str) { let terminal = File::options().read(true).write(true).open(r"\\.\CONOUT$").unwrap(); let err = File::create(name).unwrap(); - rustc().emit(format!("{name}=-")).input("test.rs").stdout(terminal).stderr(err).run_fail(); + rustc() + .edition("2015") + .emit(format!("{name}=-")) + .input("test.rs") + .stdout(terminal) + .stderr(err) + .run_fail(); diff().expected_file(format!("emit-{name}.stderr")).actual_file(name).run(); } @@ -47,6 +54,7 @@ fn main() { // Test error for emitting multiple types to stdout rustc() + .edition("2015") .input("test.rs") .emit("asm=-") .emit("llvm-ir=-") @@ -58,6 +66,7 @@ fn main() { // Same as above, but using `-o` rustc() + .edition("2015") .input("test.rs") .output("-") .emit("asm,llvm-ir,dep-info,mir") @@ -69,6 +78,11 @@ fn main() { .run(); // Test that `-o -` redirected to a file works correctly (#26719) - rustc().input("test.rs").output("-").stdout(File::create("out-stdout").unwrap()).run(); + rustc() + .edition("2015") + .input("test.rs") + .output("-") + .stdout(File::create("out-stdout").unwrap()) + .run(); }); } diff --git a/tests/run-make/jobserver-error/rmake.rs b/tests/run-make/jobserver-error/rmake.rs index 265eec7190d4e..80c1562299e72 100644 --- a/tests/run-make/jobserver-error/rmake.rs +++ b/tests/run-make/jobserver-error/rmake.rs @@ -16,6 +16,7 @@ use run_make_support::{diff, rustc}; fn main() { let out = rustc() + .edition("2015") .stdin_buf(("fn main() {}").as_bytes()) .env("MAKEFLAGS", "--jobserver-auth=1000,1000") .run_fail() @@ -23,6 +24,7 @@ fn main() { diff().expected_file("cannot_open_fd.stderr").actual_text("actual", out).run(); let out = rustc() + .edition("2015") .stdin_buf(("fn main() {}").as_bytes()) .input("-") .env("MAKEFLAGS", "--jobserver-auth=3,3") diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs index b25d892507907..bf6ef980265f1 100644 --- a/tests/run-make/linker-warning/rmake.rs +++ b/tests/run-make/linker-warning/rmake.rs @@ -5,6 +5,7 @@ use run_make_support::{Rustc, diff, regex, rustc}; fn run_rustc() -> Rustc { let mut rustc = rustc(); rustc + .edition("2015") .arg("main.rs") // NOTE: `link-self-contained` can vary depending on bootstrap.toml. // Make sure we use a consistent value. @@ -23,9 +24,9 @@ fn run_rustc() -> Rustc { fn main() { // first, compile our linker and our dependencies - rustc().arg("fake-linker.rs").output("fake-linker").run(); - rustc().arg("foo.rs").crate_type("rlib").run(); - rustc().arg("bar.rs").crate_type("rlib").run(); + rustc().edition("2015").arg("fake-linker.rs").output("fake-linker").run(); + rustc().edition("2015").arg("foo.rs").crate_type("rlib").run(); + rustc().edition("2015").arg("bar.rs").crate_type("rlib").run(); // Run rustc with our fake linker, and make sure it shows warnings let warnings = run_rustc().link_arg("run_make_warn").run(); @@ -92,12 +93,14 @@ fn main() { // Make sure we show linker warnings even across `-Z no-link` rustc() + .edition("2015") .arg("-Zno-link") .input("-") .stdin_buf("#![deny(linker_messages)] \n fn main() {}") .run() .assert_stderr_equals(""); rustc() + .edition("2015") .arg("-Zlink-only") .arg("rust_out.rlink") .linker("./fake-linker") @@ -111,6 +114,7 @@ fn main() { // Same thing, but with json output. rustc() + .edition("2015") .error_format("json") .arg("-Zlink-only") .arg("rust_out.rlink") diff --git a/tests/run-make/missing-unstable-trait-bound/rmake.rs b/tests/run-make/missing-unstable-trait-bound/rmake.rs index 753f4abcf32fd..c77475e15abb9 100644 --- a/tests/run-make/missing-unstable-trait-bound/rmake.rs +++ b/tests/run-make/missing-unstable-trait-bound/rmake.rs @@ -12,6 +12,7 @@ use run_make_support::{diff, rustc}; fn main() { let out = rustc() + .edition("2015") .env("RUSTC_BOOTSTRAP", "-1") .input("missing-bound.rs") .run_fail() diff --git a/tests/run-make/multiline-args-value/rmake.rs b/tests/run-make/multiline-args-value/rmake.rs index 3964cbbc1e605..f9e6290f7d919 100644 --- a/tests/run-make/multiline-args-value/rmake.rs +++ b/tests/run-make/multiline-args-value/rmake.rs @@ -3,7 +3,8 @@ use run_make_support::{cwd, diff, rustc}; fn test_and_compare(test_name: &str, flag: &str, val: &str) { let mut cmd = rustc(); - let output = cmd.input("").arg("--crate-type=lib").arg(flag).arg(val).run_fail(); + let output = + cmd.edition("2015").input("").arg("--crate-type=lib").arg(flag).arg(val).run_fail(); assert_eq!(output.stdout_utf8(), ""); diff() diff --git a/tests/run-make/non-unicode-env/rmake.rs b/tests/run-make/non-unicode-env/rmake.rs index b7a3c51db5bfd..7a1c7e4322ddc 100644 --- a/tests/run-make/non-unicode-env/rmake.rs +++ b/tests/run-make/non-unicode-env/rmake.rs @@ -6,7 +6,11 @@ fn main() { let non_unicode: &std::ffi::OsStr = std::os::unix::ffi::OsStrExt::from_bytes(&[0xFF]); #[cfg(windows)] let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]); - let output = rustc().input("non_unicode_env.rs").env("NON_UNICODE_VAR", non_unicode).run_fail(); + let output = rustc() + .edition("2015") + .input("non_unicode_env.rs") + .env("NON_UNICODE_VAR", non_unicode) + .run_fail(); let expected = rfs::read_to_string("non_unicode_env.stderr"); output.assert_stderr_equals(expected); } diff --git a/tests/run-make/option-output-no-space/rmake.rs b/tests/run-make/option-output-no-space/rmake.rs index 63d2389890155..d77ae4bef12a8 100644 --- a/tests/run-make/option-output-no-space/rmake.rs +++ b/tests/run-make/option-output-no-space/rmake.rs @@ -7,6 +7,7 @@ use run_make_support::rustc; fn main() { // test fake args rustc() + .edition("2015") .input("main.rs") .arg("-optimize") .run() @@ -17,6 +18,7 @@ fn main() { "= note: output filename `-o ptimize` is applied instead of a flag named `optimize`", ); rustc() + .edition("2015") .input("main.rs") .arg("-o0") .run() @@ -26,9 +28,10 @@ fn main() { .assert_stderr_contains( "= note: output filename `-o 0` is applied instead of a flag named `o0`", ); - rustc().input("main.rs").arg("-o1").run(); + rustc().edition("2015").input("main.rs").arg("-o1").run(); // test real args by iter optgroups rustc() + .edition("2015") .input("main.rs") .arg("-out-dir") .run() @@ -43,6 +46,7 @@ fn main() { ); // test real args by iter CG_OPTIONS rustc() + .edition("2015") .input("main.rs") .arg("-opt_level") .run() @@ -58,6 +62,7 @@ fn main() { ); // separater in-sensitive rustc() + .edition("2015") .input("main.rs") .arg("-opt-level") .run() @@ -72,6 +77,7 @@ fn main() { `-o pt-level`", ); rustc() + .edition("2015") .input("main.rs") .arg("-overflow-checks") .run() @@ -88,10 +94,28 @@ fn main() { ); // No warning for Z_OPTIONS - rustc().input("main.rs").arg("-oom").run().assert_stderr_equals(""); + rustc().edition("2015").input("main.rs").arg("-oom").run().assert_stderr_equals(""); // test no warning when there is space between `-o` and arg - rustc().input("main.rs").arg("-o").arg("ptimize").run().assert_stderr_equals(""); - rustc().input("main.rs").arg("--out-dir").arg("xxx").run().assert_stderr_equals(""); - rustc().input("main.rs").arg("-o").arg("out-dir").run().assert_stderr_equals(""); + rustc() + .edition("2015") + .input("main.rs") + .arg("-o") + .arg("ptimize") + .run() + .assert_stderr_equals(""); + rustc() + .edition("2015") + .input("main.rs") + .arg("--out-dir") + .arg("xxx") + .run() + .assert_stderr_equals(""); + rustc() + .edition("2015") + .input("main.rs") + .arg("-o") + .arg("out-dir") + .run() + .assert_stderr_equals(""); } diff --git a/tests/run-make/overwrite-input/rmake.rs b/tests/run-make/overwrite-input/rmake.rs index bdf7860caa8a0..581fee8fe0136 100644 --- a/tests/run-make/overwrite-input/rmake.rs +++ b/tests/run-make/overwrite-input/rmake.rs @@ -8,8 +8,9 @@ use run_make_support::{diff, rustc}; fn main() { - let file_out = rustc().input("main.rs").output("main.rs").run_fail().stderr_utf8(); - let folder_out = rustc().input("main.rs").output(".").run_fail().stderr_utf8(); + let file_out = + rustc().edition("2015").input("main.rs").output("main.rs").run_fail().stderr_utf8(); + let folder_out = rustc().edition("2015").input("main.rs").output(".").run_fail().stderr_utf8(); diff().expected_file("file.stderr").actual_text("actual-file-stderr", file_out).run(); diff().expected_file("folder.stderr").actual_text("actual-folder-stderr", folder_out).run(); } diff --git a/tests/run-make/pointer-auth-link-with-c/rmake.rs b/tests/run-make/pointer-auth-link-with-c/rmake.rs index 1ac68c95559c6..e5793130c6550 100644 --- a/tests/run-make/pointer-auth-link-with-c/rmake.rs +++ b/tests/run-make/pointer-auth-link-with-c/rmake.rs @@ -16,6 +16,7 @@ use run_make_support::{build_native_static_lib, cc, is_windows_msvc, llvm_ar, ru fn main() { build_native_static_lib("test"); rustc() + .edition("2015") .arg("-Cunsafe-allow-abi-mismatch=branch-protection") .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") .input("test.rs") @@ -30,6 +31,7 @@ fn main() { let obj_file = if is_windows_msvc() { "test.obj" } else { "test" }; llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); rustc() + .edition("2015") .arg("-Cunsafe-allow-abi-mismatch=branch-protection") .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") .input("test.rs") @@ -46,6 +48,7 @@ fn main() { // let obj_file = if is_windows_msvc() { "test.obj" } else { "test" }; // llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); // rustc() + // .edition("2015") // .arg("-Cunsafe-allow-abi-mismatch=branch-protection") // .arg("-Zbranch-protection=bti,pac-ret,pc,leaf") // .input("test.rs") diff --git a/tests/run-make/print-request-help-stable-unstable/rmake.rs b/tests/run-make/print-request-help-stable-unstable/rmake.rs index 62cf0483f320d..695ebec5cb68e 100644 --- a/tests/run-make/print-request-help-stable-unstable/rmake.rs +++ b/tests/run-make/print-request-help-stable-unstable/rmake.rs @@ -9,6 +9,7 @@ use run_make_support::{diff, rustc, similar}; fn main() { let stable_invalid_print_request_help = rustc() + .edition("2015") .env("RUSTC_BOOTSTRAP", "-1") .cfg("force_stable") .print("xxx") @@ -20,7 +21,8 @@ fn main() { .actual_text("stable_invalid_print_request_help", &stable_invalid_print_request_help) .run(); - let unstable_invalid_print_request_help = rustc().print("xxx").run_fail().stderr_utf8(); + let unstable_invalid_print_request_help = + rustc().edition("2015").print("xxx").run_fail().stderr_utf8(); assert!(unstable_invalid_print_request_help.contains("all-target-specs-json")); diff() .expected_file("unstable-invalid-print-request-help.err") diff --git a/tests/run-make/rustdoc/doctest/test_harness/rmake.rs b/tests/run-make/rustdoc/doctest/test_harness/rmake.rs index 608adebbd54f2..87d57ca1f76ac 100644 --- a/tests/run-make/rustdoc/doctest/test_harness/rmake.rs +++ b/tests/run-make/rustdoc/doctest/test_harness/rmake.rs @@ -19,6 +19,7 @@ fn main() { rustc().input(runtool_path).run(); let output = rustdoc() + .edition("2015") .input(doctests_path) .arg("--test") // for the outer test suite diff --git a/tests/run-make/target-cpu-native/rmake.rs b/tests/run-make/target-cpu-native/rmake.rs index 5791bf01bba2b..dbea1bda2cab5 100644 --- a/tests/run-make/target-cpu-native/rmake.rs +++ b/tests/run-make/target-cpu-native/rmake.rs @@ -9,6 +9,7 @@ use run_make_support::{run, rustc}; fn main() { let out = rustc() + .edition("2015") .input("foo.rs") .arg("-Ctarget-cpu=native") .arg("-Zverify-llvm-ir") diff --git a/tests/run-make/unknown-mod-stdin/rmake.rs b/tests/run-make/unknown-mod-stdin/rmake.rs index 101711b0d2c70..56833569e54bf 100644 --- a/tests/run-make/unknown-mod-stdin/rmake.rs +++ b/tests/run-make/unknown-mod-stdin/rmake.rs @@ -14,7 +14,8 @@ use run_make_support::{diff, rustc}; fn main() { - let out = rustc().crate_type("rlib").stdin_buf(b"mod unknown;").arg("-").run_fail(); + let out = + rustc().edition("2015").crate_type("rlib").stdin_buf(b"mod unknown;").arg("-").run_fail(); diff() .actual_text("actual-stdout", out.stdout_utf8()) .expected_file("unknown-mod.stdout") diff --git a/tests/run-make/unspecified-edition/help-unspecified-edition.stdout b/tests/run-make/unspecified-edition/help-unspecified-edition.stdout new file mode 100644 index 0000000000000..eea9ae297848a --- /dev/null +++ b/tests/run-make/unspecified-edition/help-unspecified-edition.stdout @@ -0,0 +1,74 @@ +Usage: rustc [OPTIONS] INPUT + +Options: + -h, --help Display this message + --cfg Configure the compilation environment. + SPEC supports the syntax `[=""]`. + --check-cfg + Provide list of expected cfgs for checking + -L [=] Add a directory to the library search path. The + optional KIND can be one of + (default: + all). + -l [[:]=][:] + Link the generated crate(s) to the specified native + library NAME. The optional KIND can be one of + (default: dylib). + Optional comma separated MODIFIERS + + may be specified each with a prefix of either '+' to + enable or '-' to disable. + --crate-type + Comma separated list of types of crates + for the compiler to emit + --crate-name + Specify the name of the crate being built + --edition <2015|2018|2021|2024|future> + Specify which edition of the compiler to use when + compiling code. The default is 2015 and the latest + stable edition is 2024. + --emit [=] + Comma separated list of types of output for the + compiler to emit. + Each TYPE has the default FILE name: + * asm - CRATE_NAME.s + * llvm-bc - CRATE_NAME.bc + * dep-info - CRATE_NAME.d + * link - (platform and crate-type dependent) + * llvm-ir - CRATE_NAME.ll + * metadata - libCRATE_NAME.rmeta + * mir - CRATE_NAME.mir + * obj - CRATE_NAME.o + * thin-link-bitcode - CRATE_NAME.indexing.o + --print [=] + Compiler information to print on stdout (or to a file) + INFO may be one of + . + -g Equivalent to -C debuginfo=2 + -O Equivalent to -C opt-level=3 + -o Write output to FILENAME + --out-dir Write output to compiler-chosen filename in DIR + --explain Provide a detailed explanation of an error message + --test Build a test harness + --target + Target tuple for which the code is compiled + -A, --allow Set lint allowed + -W, --warn Set lint warnings + --force-warn + Set lint force-warn + -D, --deny Set lint denied + -F, --forbid Set lint forbidden + --cap-lints + Set the most restrictive lint level. More restrictive + lints are capped at this level + -C, --codegen [=] + Set a codegen option + -V, --version Print version info and exit + -v, --verbose Use verbose output + +Additional help: + -C help Print codegen options + -W help Print 'lint' options and default settings + -Z help Print unstable compiler options + --help -v Print the full set of options rustc accepts + diff --git a/tests/run-make/unspecified-edition/main.rs b/tests/run-make/unspecified-edition/main.rs new file mode 100644 index 0000000000000..f328e4d9d04c3 --- /dev/null +++ b/tests/run-make/unspecified-edition/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/unspecified-edition/rmake.rs b/tests/run-make/unspecified-edition/rmake.rs new file mode 100644 index 0000000000000..26b6b7d511200 --- /dev/null +++ b/tests/run-make/unspecified-edition/rmake.rs @@ -0,0 +1,37 @@ +// When calling `rustc` without an explicit edition, emit a note asking the user to specify one, +// clarifying that the default is 2015. + +use run_make_support::{bare_rustc, diff, rustc, rustdoc}; + +fn main() { + rustc().edition("2015").input("main.rs").run().assert_stderr_not_contains("--edition"); + let out = rustc().input("main.rs").run().assert_stderr_contains("--edition").stderr_utf8(); + diff().expected_file("unspecified-edition.stderr").actual_text("(rustc)", &out).run(); + + // Ensure that we only mention --edition when compiling code. + let out = rustc().run_fail().assert_stderr_not_contains("--edition").stderr_utf8(); + diff() + .expected_file("unspecified-edition-without-compiling.stderr") + .actual_text("(rustc)", &out) + .run(); + + // Ensure that we dont mention --edition when running rustdoc. + let out = rustdoc().run_fail().assert_stderr_not_contains("--edition").stderr_utf8(); + diff() + .expected_text("(test)", "error: missing file operand\n\n") + .actual_text("(rustc)", &out) + .run(); + + let out = + rustdoc().input("main.rs").run().assert_stderr_not_contains("--edition").stderr_utf8(); + diff().expected_text("(test)", "").actual_text("(rustc)", &out).run(); + + // Ensure that we don't mention --edition when getting help. + let result = rustc().arg("--help").run(); + result.assert_stderr_not_contains("--edition"); + let out = result.stdout_utf8(); + let err = result.stderr_utf8(); + diff().expected_file("help-unspecified-edition.stdout").actual_text("(rustc)", &out).run(); + diff().expected_text("(test)", "").actual_text("(rustc)", &err).run(); + bare_rustc().arg("--version").run().assert_stderr_not_contains("--edition"); +} diff --git a/tests/run-make/unspecified-edition/unspecified-edition-without-compiling.stderr b/tests/run-make/unspecified-edition/unspecified-edition-without-compiling.stderr new file mode 100644 index 0000000000000..c36ecca4af4a2 --- /dev/null +++ b/tests/run-make/unspecified-edition/unspecified-edition-without-compiling.stderr @@ -0,0 +1,4 @@ +error: no input filename given + +error: aborting due to 1 previous error + diff --git a/tests/run-make/unspecified-edition/unspecified-edition.stderr b/tests/run-make/unspecified-edition/unspecified-edition.stderr new file mode 100644 index 0000000000000..0a15e47d49fae --- /dev/null +++ b/tests/run-make/unspecified-edition/unspecified-edition.stderr @@ -0,0 +1,2 @@ +`--edition` is unspecified, defaulting to `2015` while the latest is `2024`; it must be one of: <2015|2018|2021|2024|future> + diff --git a/tests/rustdoc-ui/lints/bare-urls.fixed b/tests/rustdoc-ui/lints/bare-urls.fixed index 996214b5ff14f..8d4d132e49510 100644 --- a/tests/rustdoc-ui/lints/bare-urls.fixed +++ b/tests/rustdoc-ui/lints/bare-urls.fixed @@ -92,3 +92,72 @@ pub fn trailing_period() {} /// ] //~^ ERROR this URL is not a hyperlink pub fn lint_with_brackets() {} + +/// See +//~^ ERROR this URL is not a hyperlink +pub fn underscore_without_parens_1() {} + +/// See +//~^ ERROR this URL is not a hyperlink +pub fn underscore_without_parens_2() {} + +/// See _ +//~^ ERROR this URL is not a hyperlink +pub fn underscore_emphasis_without_parens() {} + +/// See +//~^ ERROR this URL is not a hyperlink +pub fn wikipedia_example() {} + +/// See () +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_1() {} + +/// See (1()) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_2() {} + +/// See (1( +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_3() {} + +/// See ) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_1() {} + +/// See (. +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_2() {} + +/// See .( +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_3() {} + +/// See ). +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_4() {} + +/// See .) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_5() {} + +/// See http://ex(amp)le.com/ +pub fn nested_parens_cannot_appear_in_host() {} + +/// The path component of a URL must be separated from the rest by a `/`, +/// so the `=a` isn't part of the URL. +/// =a +//~^ ERROR this URL is not a hyperlink +pub fn equal_sign_after_host() {} + +/// A URL can, however, have a fragment or query without a slash. +/// or +//~^ ERROR this URL is not a hyperlink +//~| ERROR this URL is not a hyperlink +pub fn hash_or_question_after_host() {} + +/// This URL contains italics, +/// but should still produce a suggestion that wraps the whole thing. +/// +//~^ ERROR this URL is not a hyperlink +pub fn italics() {} diff --git a/tests/rustdoc-ui/lints/bare-urls.rs b/tests/rustdoc-ui/lints/bare-urls.rs index 9b4fe68e00322..9bcfa2c8b3a0c 100644 --- a/tests/rustdoc-ui/lints/bare-urls.rs +++ b/tests/rustdoc-ui/lints/bare-urls.rs @@ -92,3 +92,72 @@ pub fn trailing_period() {} /// https://bloob.blob] //~^ ERROR this URL is not a hyperlink pub fn lint_with_brackets() {} + +/// See https://example.com/test_.html +//~^ ERROR this URL is not a hyperlink +pub fn underscore_without_parens_1() {} + +/// See https://example.com/test._html +//~^ ERROR this URL is not a hyperlink +pub fn underscore_without_parens_2() {} + +/// See _https://example.com/test.html_ +//~^ ERROR this URL is not a hyperlink +pub fn underscore_emphasis_without_parens() {} + +/// See https://en.wikipedia.org/wiki/Rust_(programming_language) +//~^ ERROR this URL is not a hyperlink +pub fn wikipedia_example() {} + +/// See (http://example.com/(1(2))) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_1() {} + +/// See (1(http://example.com/1(2))) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_2() {} + +/// See (1(http://example.com/1(.) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_balanced_3() {} + +/// See http://example.com/(1(2))) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_1() {} + +/// See http://example.com/test(. +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_2() {} + +/// See http://example.com/test.( +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_3() {} + +/// See http://example.com/test). +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_4() {} + +/// See http://example.com/test.) +//~^ ERROR this URL is not a hyperlink +pub fn nested_parens_unbalanced_5() {} + +/// See http://ex(amp)le.com/ +pub fn nested_parens_cannot_appear_in_host() {} + +/// The path component of a URL must be separated from the rest by a `/`, +/// so the `=a` isn't part of the URL. +/// https://foo.bar=a +//~^ ERROR this URL is not a hyperlink +pub fn equal_sign_after_host() {} + +/// A URL can, however, have a fragment or query without a slash. +/// https://foo.bar#a or https://foo.bar?a +//~^ ERROR this URL is not a hyperlink +//~| ERROR this URL is not a hyperlink +pub fn hash_or_question_after_host() {} + +/// This URL contains italics, +/// but should still produce a suggestion that wraps the whole thing. +/// https://example.com/_foo_/bar +//~^ ERROR this URL is not a hyperlink +pub fn italics() {} diff --git a/tests/rustdoc-ui/lints/bare-urls.stderr b/tests/rustdoc-ui/lints/bare-urls.stderr index 05ddd2ed42ab1..aa22a4a4f62f3 100644 --- a/tests/rustdoc-ui/lints/bare-urls.stderr +++ b/tests/rustdoc-ui/lints/bare-urls.stderr @@ -364,5 +364,197 @@ help: use an automatic link instead LL | /// ] | + + -error: aborting due to 30 previous errors +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:96:9 + | +LL | /// See https://example.com/test_.html + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:100:9 + | +LL | /// See https://example.com/test._html + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:104:10 + | +LL | /// See _https://example.com/test.html_ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See _ + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:108:9 + | +LL | /// See https://en.wikipedia.org/wiki/Rust_(programming_language) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:112:10 + | +LL | /// See (http://example.com/(1(2))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See () + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:116:12 + | +LL | /// See (1(http://example.com/1(2))) + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See (1()) + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:120:12 + | +LL | /// See (1(http://example.com/1(.) + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See (1( + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:124:9 + | +LL | /// See http://example.com/(1(2))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See ) + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:128:9 + | +LL | /// See http://example.com/test(. + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See (. + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:132:9 + | +LL | /// See http://example.com/test.( + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See .( + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:136:9 + | +LL | /// See http://example.com/test). + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See ). + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:140:9 + | +LL | /// See http://example.com/test.) + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// See .) + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:149:5 + | +LL | /// https://foo.bar=a + | ^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// =a + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:154:5 + | +LL | /// https://foo.bar#a or https://foo.bar?a + | ^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// or https://foo.bar?a + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:154:26 + | +LL | /// https://foo.bar#a or https://foo.bar?a + | ^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// https://foo.bar#a or + | + + + +error: this URL is not a hyperlink + --> $DIR/bare-urls.rs:161:5 + | +LL | /// https://example.com/_foo_/bar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +help: use an automatic link instead + | +LL | /// + | + + + +error: aborting due to 46 previous errors diff --git a/tests/rustdoc-ui/macro-docs.stderr b/tests/rustdoc-ui/macro-docs.stderr index 2b136f5be16b0..7c4a5d69747c1 100644 --- a/tests/rustdoc-ui/macro-docs.stderr +++ b/tests/rustdoc-ui/macro-docs.stderr @@ -1,6 +1,8 @@ warning: unresolved link to `long_cat` --> $DIR/macro-docs.rs:5:9 | +LL | macro_rules! m { +LL | () => { LL | /// A | ^^^^^ ... @@ -14,7 +16,6 @@ LL | m!(); = note: no item named `long_cat` in scope = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default - = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 1 warning emitted diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs index 06804e637ae06..fc87af19eee53 100644 --- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs +++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs @@ -1,4 +1,6 @@ //@ compile-flags: -Z unstable-options +// FIXME(bootstrap): Remove the ignore once we promote the next beta. +//@ ignore-stage1 #![feature(rustc_private)] #![deny(rustc::lint_pass_impl_without_macro)] diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr index 055d66360a4bb..cb245a7ccd66e 100644 --- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr +++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr @@ -1,19 +1,21 @@ error: implementing `LintPass` by hand - --> $DIR/lint_pass_impl_without_macro.rs:19:6 + --> $DIR/lint_pass_impl_without_macro.rs:21:6 | LL | impl LintPass for Foo { | ^^^^^^^^ | = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead note: the lint level is defined here - --> $DIR/lint_pass_impl_without_macro.rs:4:9 + --> $DIR/lint_pass_impl_without_macro.rs:6:9 | LL | #![deny(rustc::lint_pass_impl_without_macro)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementing `LintPass` by hand - --> $DIR/lint_pass_impl_without_macro.rs:33:14 + --> $DIR/lint_pass_impl_without_macro.rs:35:14 | +LL | macro_rules! custom_lint_pass_macro { +... LL | impl LintPass for Custom { | ^^^^^^^^ ... @@ -21,7 +23,6 @@ LL | custom_lint_pass_macro!(); | ------------------------- in this macro invocation | = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead - = note: this error originates in the macro `custom_lint_pass_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui-fulldeps/rustc_public/check_abi.rs b/tests/ui-fulldeps/rustc_public/check_abi.rs index f6c95fb745409..ed616cc4d9bb0 100644 --- a/tests/ui-fulldeps/rustc_public/check_abi.rs +++ b/tests/ui-fulldeps/rustc_public/check_abi.rs @@ -110,7 +110,12 @@ fn check_primitive(abi: &ArgAbi) { panic!("Expected PassMode::Direct for char, got: {:?}", abi.mode); }; // A char (32-bit) doesn't need sign/zero extension on most platforms. + #[cfg(not(any(target_arch = "loongarch64", target_arch = "riscv64")))] assert_eq!(attrs.arg_extension(), ArgExtension::None); + // However, LoongArch64 and RiscV64 ABIs require that 32-bit integers + // (signed or unsigned) are sign-extended when passed in registers. + #[cfg(any(target_arch = "loongarch64", target_arch = "riscv64"))] + assert_eq!(attrs.arg_extension(), ArgExtension::Sext); // Direct arguments are not pointers, so no pointee alignment. assert_eq!(attrs.pointee_align(), None); let layout = abi.layout.shape(); diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr index 0c80ae8acc433..56e827a3cb70e 100644 --- a/tests/ui/argument-suggestions/extra_arguments.stderr +++ b/tests/ui/argument-suggestions/extra_arguments.stderr @@ -270,6 +270,8 @@ LL - 1, error[E0061]: this function takes 0 arguments but 2 arguments were supplied --> $DIR/extra_arguments.rs:9:9 | +LL | macro_rules! foo { +LL | ($x:expr, ~) => { LL | empty($x, 1); | ^^^^^ - unexpected argument #2 of type `{integer}` ... @@ -284,11 +286,12 @@ note: function defined here | LL | fn empty() {} | ^^^^^ - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0061]: this function takes 0 arguments but 2 arguments were supplied --> $DIR/extra_arguments.rs:15:9 | +LL | macro_rules! foo { +... LL | empty(1, $y); | ^^^^^ - unexpected argument #1 of type `{integer}` ... @@ -303,11 +306,12 @@ note: function defined here | LL | fn empty() {} | ^^^^^ - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0061]: this function takes 0 arguments but 2 arguments were supplied --> $DIR/extra_arguments.rs:12:9 | +LL | macro_rules! foo { +... LL | empty($x, $y); | ^^^^^ ... @@ -323,7 +327,6 @@ note: function defined here | LL | fn empty() {} | ^^^^^ - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:54:3 diff --git a/tests/ui/asm/aarch64/interpolated-idents.stderr b/tests/ui/asm/aarch64/interpolated-idents.stderr index 8537a5ebf46b2..cd612221d7487 100644 --- a/tests/ui/asm/aarch64/interpolated-idents.stderr +++ b/tests/ui/asm/aarch64/interpolated-idents.stderr @@ -1,6 +1,8 @@ error: the `nomem` and `readonly` options are mutually exclusive --> $DIR/interpolated-idents.rs:20:13 | +LL | macro_rules! m { +... LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -8,12 +10,12 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack options); | |________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `pure` and `noreturn` options are mutually exclusive --> $DIR/interpolated-idents.rs:20:13 | +LL | macro_rules! m { +... LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -21,12 +23,12 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack options); | |________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm outputs are not allowed with the `noreturn` option --> $DIR/interpolated-idents.rs:17:32 | +LL | macro_rules! m { +... LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, | ^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ... @@ -34,8 +36,6 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack options); | |________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/asm/x86_64/interpolated-idents.stderr b/tests/ui/asm/x86_64/interpolated-idents.stderr index 1fb817ec8de0c..51ef89f035ed7 100644 --- a/tests/ui/asm/x86_64/interpolated-idents.stderr +++ b/tests/ui/asm/x86_64/interpolated-idents.stderr @@ -1,6 +1,8 @@ error: the `nomem` and `readonly` options are mutually exclusive --> $DIR/interpolated-idents.rs:19:13 | +LL | macro_rules! m { +... LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -8,12 +10,12 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack att_syntax options); | |___________________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `pure` and `noreturn` options are mutually exclusive --> $DIR/interpolated-idents.rs:19:13 | +LL | macro_rules! m { +... LL | $options($pure, $nomem, $readonly, $preserves_flags, $noreturn, $nostack, $att_syntax)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -21,12 +23,12 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack att_syntax options); | |___________________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm outputs are not allowed with the `noreturn` option --> $DIR/interpolated-idents.rs:16:32 | +LL | macro_rules! m { +... LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $inlateout(x) x, | ^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ... @@ -34,8 +36,6 @@ LL | / m!(in out lateout inout inlateout const sym LL | | pure nomem readonly preserves_flags LL | | noreturn nostack att_syntax options); | |___________________________________________- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/async-fn/macro-async-trait-bound-theoretical-regression.stderr b/tests/ui/async-await/async-fn/macro-async-trait-bound-theoretical-regression.stderr index 0292c53fb1c17..c10129f2c7012 100644 --- a/tests/ui/async-await/async-fn/macro-async-trait-bound-theoretical-regression.stderr +++ b/tests/ui/async-await/async-fn/macro-async-trait-bound-theoretical-regression.stderr @@ -1,24 +1,22 @@ error: ty --> $DIR/macro-async-trait-bound-theoretical-regression.rs:8:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { impl async Trait } | -------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error: ty --> $DIR/macro-async-trait-bound-theoretical-regression.rs:8:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { dyn async Trait } | ------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: `async` trait bounds are unstable --> $DIR/macro-async-trait-bound-theoretical-regression.rs:18:14 diff --git a/tests/ui/async-await/issue-73541-2.stderr b/tests/ui/async-await/issue-73541-2.stderr index 584b71ce643f5..0ca8befc65566 100644 --- a/tests/ui/async-await/issue-73541-2.stderr +++ b/tests/ui/async-await/issue-73541-2.stderr @@ -3,7 +3,8 @@ error[E0767]: use of unreachable label `'a` | LL | 'a: loop { | -- unreachable label defined here -... +LL | macro_rules! b { +LL | () => { LL | continue 'a | ^^ unreachable label `'a` ... @@ -11,7 +12,6 @@ LL | b!(); | ---- in this macro invocation | = note: labels are unreachable through functions, closures, async blocks and modules - = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr index f60b4ecb99098..81ae26a1f28d7 100644 --- a/tests/ui/async-await/unnecessary-await.stderr +++ b/tests/ui/async-await/unnecessary-await.stderr @@ -37,6 +37,8 @@ LL + e!(); error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:22:15 | +LL | macro_rules! f { +LL | ($expr:expr) => { LL | $expr.await | ^^^^^ | | @@ -49,7 +51,6 @@ LL | f!(()); = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:36:20 diff --git a/tests/ui/attributes/key-value-expansion.stderr b/tests/ui/attributes/key-value-expansion.stderr index 54d79c5bebb7f..c975f88425cef 100644 --- a/tests/ui/attributes/key-value-expansion.stderr +++ b/tests/ui/attributes/key-value-expansion.stderr @@ -7,24 +7,24 @@ LL | bug!((column!())); error: attribute value must be a literal --> $DIR/key-value-expansion.rs:27:14 | +LL | macro_rules! bug { +LL | () => { LL | bug!("bug" + stringify!(found)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bug!(); | ------ in this macro invocation - | - = note: this error originates in the macro `bug` (in Nightly builds, run with -Z macro-backtrace for more info) error: attribute value must be a literal --> $DIR/key-value-expansion.rs:48:23 | +LL | macro_rules! some_macro { +LL | ($t1: ty) => { LL | doc_comment! {format!("{coor}", coor = stringify!($t1)).as_str()} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | some_macro!(u8); | --------------- in this macro invocation - | - = note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/attributes/nonterminal-expansion.stderr b/tests/ui/attributes/nonterminal-expansion.stderr index 21912de210610..035b39e8581e1 100644 --- a/tests/ui/attributes/nonterminal-expansion.stderr +++ b/tests/ui/attributes/nonterminal-expansion.stderr @@ -1,13 +1,13 @@ error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/nonterminal-expansion.rs:7:22 | +LL | macro_rules! pass_nonterminal { +LL | ($n:expr) => { LL | #[repr(align($n))] | ^^ ... LL | pass_nonterminal!(n!()); | ----------------------- in this macro invocation - | - = note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-25793.stderr b/tests/ui/borrowck/issue-25793.stderr index e2efc405faba4..71db5a0a11e56 100644 --- a/tests/ui/borrowck/issue-25793.stderr +++ b/tests/ui/borrowck/issue-25793.stderr @@ -1,6 +1,8 @@ error[E0503]: cannot use `self.width` because it was mutably borrowed --> $DIR/issue-25793.rs:4:9 | +LL | macro_rules! width( +LL | ($this:expr) => { LL | $this.width.unwrap() | ^^^^^^^^^^^ use of borrowed `*self` ... @@ -10,8 +12,6 @@ LL | r.get_size(width!(self)) | -------- ------------ in this macro invocation | | | borrow later used by call - | - = note: this error originates in the macro `width` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/move-error-snippets.stderr b/tests/ui/borrowck/move-error-snippets.stderr index 97d140515184a..ea05dd5a7ca6c 100644 --- a/tests/ui/borrowck/move-error-snippets.stderr +++ b/tests/ui/borrowck/move-error-snippets.stderr @@ -1,13 +1,18 @@ error[E0507]: cannot move out of static item `D` --> $DIR/move-error-snippets-ext.rs:5:17 | -LL | let a = $c; - | ^^ move occurs because `D` has type `A`, which does not implement the `Copy` trait +LL | / macro_rules! aaa { +LL | | ($c:ident) => {{ +LL | | let a = $c; + | | ^^ move occurs because `D` has type `A`, which does not implement the `Copy` trait +LL | | }} +LL | | } + | |_- this error originates in the macro `aaa` which comes from the expansion of the macro `sss` | ::: $DIR/move-error-snippets.rs:21:1 | -LL | sss!(); - | ------ in this macro invocation +LL | sss!(); + | ------ in this macro invocation | note: if `A` implemented `Clone`, you could clone the value --> $DIR/move-error-snippets.rs:9:1 @@ -19,7 +24,6 @@ LL | struct A; | LL | let a = $c; | -- you could clone this value - = note: this error originates in the macro `aaa` which comes from the expansion of the macro `sss` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider borrowing here | LL | let a = &$c; diff --git a/tests/ui/borrowck/span-semicolon-issue-139049.stderr b/tests/ui/borrowck/span-semicolon-issue-139049.stderr index 8d2de67382bd8..a125e313c8f5a 100644 --- a/tests/ui/borrowck/span-semicolon-issue-139049.stderr +++ b/tests/ui/borrowck/span-semicolon-issue-139049.stderr @@ -14,7 +14,6 @@ LL | { let l = (); perform!(l) }; | | in this macro invocation | binding `l` declared here | - = note: this error originates in the macro `perform` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | LL | { let l = (); perform!(l); }; @@ -38,7 +37,6 @@ LL | let _x = { let l = (); perform!(l) }; | = note: the temporary is part of an expression at the end of a block; consider forcing this temporary to be dropped sooner, before the block's local variables are dropped - = note: this error originates in the macro `perform` (in Nightly builds, run with -Z macro-backtrace for more info) help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block | LL | let _x = { let l = (); let x = perform!(l); x }; diff --git a/tests/ui/cfg/cfg-eval-derive-invalid-reparse-no-ice.stderr b/tests/ui/cfg/cfg-eval-derive-invalid-reparse-no-ice.stderr index 0248b6636fb7a..63400b2b2e202 100644 --- a/tests/ui/cfg/cfg-eval-derive-invalid-reparse-no-ice.stderr +++ b/tests/ui/cfg/cfg-eval-derive-invalid-reparse-no-ice.stderr @@ -1,6 +1,8 @@ error: expected expression, found `ty` metavariable --> $DIR/cfg-eval-derive-invalid-reparse-no-ice.rs:8:25 | +LL | macro_rules! values { +... LL | pub enum TokenKind { | --------- while parsing this enum LL | #[cfg(test)] @@ -11,7 +13,6 @@ LL | values!(String); | --------------- in this macro invocation | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - = note: this error originates in the macro `values` (in Nightly builds, run with -Z macro-backtrace for more info) error: macro expansion ignores `)` and any tokens following --> $DIR/cfg-eval-derive-invalid-reparse-no-ice.rs:8:32 diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 44f3d8d058e04..f2f514db0a584 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -7,13 +7,14 @@ LL | cbor_map! { #[cfg(test)] 4}; error[E0689]: can't call method `signum` on ambiguous numeric type `{integer}` --> $DIR/cfg-method-receiver.rs:3:14 | +LL | macro_rules! cbor_map { +LL | ($key:expr) => { LL | $key.signum(); | ^^^^^^ ... LL | cbor_map! { #[cfg(test)] 4}; | --------------------------- in this macro invocation | - = note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `i32` | LL | cbor_map! { #[cfg(test)] 4_i32}; diff --git a/tests/ui/cfg/path-kw-as-cfg-pred.stderr b/tests/ui/cfg/path-kw-as-cfg-pred.stderr index 02128acb281e4..5cfb2f48a8370 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred.stderr @@ -485,6 +485,8 @@ LL + #[cfg_attr(predicate, attr1, attr2, ...)] error[E0565]: malformed `cfg` attribute input --> $DIR/path-kw-as-cfg-pred.rs:9:11 | +LL | macro_rules! foo { +LL | () => { LL | #[cfg($crate)] | ^^^^------^ | | @@ -494,7 +496,6 @@ LL | foo!(); | ------ in this macro invocation | = note: for more information, visit - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: must be of the form | LL - #[cfg($crate)] @@ -504,6 +505,8 @@ LL + #[cfg(predicate)] error[E0565]: malformed `cfg_attr` attribute input --> $DIR/path-kw-as-cfg-pred.rs:11:11 | +LL | macro_rules! foo { +... LL | #[cfg_attr($crate, path = "foo")] | ^^^^^^^^^------^^^^^^^^^^^^^^^ | | @@ -513,7 +516,6 @@ LL | foo!(); | ------ in this macro invocation | = note: for more information, visit - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: must be of the form | LL - #[cfg_attr($crate, path = "foo")] @@ -523,6 +525,8 @@ LL + #[cfg_attr(predicate, attr1, attr2, ...)] error[E0565]: malformed `cfg` attribute input --> $DIR/path-kw-as-cfg-pred.rs:13:26 | +LL | macro_rules! foo { +... LL | #[cfg_attr(true, cfg($crate))] | ^^^^------^ | | @@ -532,7 +536,6 @@ LL | foo!(); | ------ in this macro invocation | = note: for more information, visit - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: must be of the form | LL - #[cfg_attr(true, cfg($crate))] diff --git a/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr b/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr index c49b1d2d0e069..bdd536ea2a4df 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr @@ -1,6 +1,8 @@ warning: changes to closure capture in Rust 2021 will affect drop order --> $DIR/closure-body-macro-fragment.rs:16:17 | +LL | macro_rules! m { +LL | (@ $body:expr) => {{ LL | let f = || $body; | ^^ ... @@ -22,7 +24,6 @@ note: the lint level is defined here LL | #![warn(rust_2021_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(rust_2021_incompatible_closure_captures)]` implied by `#[warn(rust_2021_compatibility)]` - = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: add a dummy let to cause `a` to be fully captured | LL ~ m!({ diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index b4ec634adeb35..44e9e09c88847 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -132,13 +132,13 @@ LL | #[cfg(a = b"hi")] error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/cfg-attr-syntax-validation.rs:53:25 | +LL | macro_rules! generate_s10 { +LL | ($expr: expr) => { LL | #[cfg(feature = $expr)] | ^^^^^ ... LL | generate_s10!(concat!("nonexistent")); | ------------------------------------- in this macro invocation - | - = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors diff --git a/tests/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/tests/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr index bdddbd68cdaf2..52045e7178f21 100644 --- a/tests/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -1,13 +1,13 @@ error: cannot find attribute `unknown` in this scope --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:3:26 | +LL | macro_rules! foo { +LL | () => { LL | #[cfg_attr(true, unknown)] | ^^^^^^^ ... LL | foo!(); | ------ in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr index f21c791cdf7f4..e901460a4eb88 100644 --- a/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg_attr-attr-syntax-validation.stderr @@ -123,6 +123,8 @@ LL + #[cfg_attr(predicate, attr1, attr2, ...)] error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/cfg_attr-attr-syntax-validation.rs:30:30 | +LL | macro_rules! generate_s10 { +LL | ($expr: expr) => { LL | #[cfg_attr(feature = $expr)] | ^^^^^ ... @@ -130,7 +132,6 @@ LL | generate_s10!(concat!("nonexistent")); | ------------------------------------- in this macro invocation | = note: for more information, visit - = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info) help: must be of the form | LL - #[cfg_attr(feature = $expr)] diff --git a/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.stderr b/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.stderr index 26d80c85e1610..f4318b9e9b8ee 100644 --- a/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.stderr +++ b/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-2.stderr @@ -18,13 +18,14 @@ LL | const _: A< error[E0425]: cannot find value `x` in this scope --> $DIR/const_arg_trivial_macro_expansion-2.rs:7:9 | +LL | macro_rules! y { +LL | ( $($matcher:tt)*) => { LL | x | ^ not found in this scope ... LL | y! { test.tou8 } | ---------------- in this macro invocation | - = note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might be missing a const parameter | LL | const _: A< diff --git a/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-4.stderr b/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-4.stderr index 994f9158d5d80..d4d95168caf28 100644 --- a/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-4.stderr +++ b/tests/ui/const-generics/early/const_arg_trivial_macro_expansion-4.stderr @@ -1,6 +1,8 @@ error: generic parameters may not be used in const operations --> $DIR/const_arg_trivial_macro_expansion-4.rs:7:9 | +LL | macro_rules! arg { +LL | () => { LL | N | ^ cannot perform const operation using `N` ... @@ -10,11 +12,12 @@ LL | fn foo() -> Foo<{ arg!{} arg!{} }> { loop {} } = help: const parameters may only be used as standalone arguments here, i.e. `N` = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions = help: alternatively, you can use `#![feature(generic_const_args)]` and extract the expression into a `type const` item - = note: this error originates in the macro `arg` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic parameters may not be used in const operations --> $DIR/const_arg_trivial_macro_expansion-4.rs:7:9 | +LL | macro_rules! arg { +LL | () => { LL | N | ^ cannot perform const operation using `N` ... @@ -24,7 +27,6 @@ LL | fn foo() -> Foo<{ arg!{} arg!{} }> { loop {} } = help: const parameters may only be used as standalone arguments here, i.e. `N` = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions = help: alternatively, you can use `#![feature(generic_const_args)]` and extract the expression into a `type const` item - = note: this error originates in the macro `arg` (in Nightly builds, run with -Z macro-backtrace for more info) error: generic parameters may not be used in const operations --> $DIR/const_arg_trivial_macro_expansion-4.rs:15:46 diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces-2.stderr b/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces-2.stderr index a1db1f26077df..334b72a2f8416 100644 --- a/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces-2.stderr +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces-2.stderr @@ -1,6 +1,8 @@ error: generic parameters may not be used in const operations --> $DIR/trivial-const-arg-macro-nested-braces-2.rs:3:9 | +LL | macro_rules! y { +LL | () => { LL | N | ^ cannot perform const operation using `N` ... @@ -10,7 +12,6 @@ LL | fn foo() -> A<{{ y!() }}> { = help: const parameters may only be used as standalone arguments here, i.e. `N` = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions = help: alternatively, you can use `#![feature(generic_const_args)]` and extract the expression into a `type const` item - = note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces.stderr b/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces.stderr index 2a826f657d68d..068091e6cc933 100644 --- a/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces.stderr +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-nested-braces.stderr @@ -1,6 +1,8 @@ error: generic parameters may not be used in const operations --> $DIR/trivial-const-arg-macro-nested-braces.rs:4:11 | +LL | macro_rules! y { +LL | () => { LL | { N } | ^ cannot perform const operation using `N` ... @@ -10,7 +12,6 @@ LL | fn foo() -> A<{ y!() }> { = help: const parameters may only be used as standalone arguments here, i.e. `N` = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions = help: alternatively, you can use `#![feature(generic_const_args)]` and extract the expression into a `type const` item - = note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr index ab289e5a6b78f..bc1899d98b105 100644 --- a/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `target` in this scope --> $DIR/trivial-const-arg-macro-res-error.rs:5:9 | +LL | macro_rules! len { +LL | () => { LL | target | ^^^^^^ not found in this scope ... LL | let val: [str; len!()] = []; | ------ in this macro invocation - | - = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/trivial-const-arg-macro-res-error.rs:11:14 diff --git a/tests/ui/const-generics/mgca/macro-const-arg-infer.stderr b/tests/ui/const-generics/mgca/macro-const-arg-infer.stderr index 0d745517e4406..b46114bf4bd5f 100644 --- a/tests/ui/const-generics/mgca/macro-const-arg-infer.stderr +++ b/tests/ui/const-generics/mgca/macro-const-arg-infer.stderr @@ -10,6 +10,8 @@ LL | struct A; error[E0747]: constant provided when a type was expected --> $DIR/macro-const-arg-infer.rs:6:9 | +LL | macro_rules! y { +LL | ( $($matcher:tt)*) => { LL | _ | ^ ... @@ -18,12 +20,12 @@ LL | core::direct_const_arg!(y! { LL | | x LL | | }), | |_____- in this macro invocation - | - = note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/macro-const-arg-infer.rs:6:9 | +LL | macro_rules! y { +LL | ( $($matcher:tt)*) => { LL | _ | ^ not allowed in type signatures ... @@ -32,8 +34,6 @@ LL | core::direct_const_arg!(y! { LL | | x LL | | }), | |_____- in this macro invocation - | - = note: this error originates in the macro `y` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr b/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr index 2d8cb50834bce..2fa529c750d10 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr @@ -7,10 +7,9 @@ LL | fn make_marker() -> impl Marker { | this macro call doesn't expand to a type | in this macro invocation ... +LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} | ^ expected type - | - = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected type, found `{` --> $DIR/macro-fail-const.rs:16:27 @@ -21,10 +20,9 @@ LL | Example:: | this macro call doesn't expand to a type | in this macro invocation ... +LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} | ^ expected type - | - = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0747]: type provided when a constant was expected --> $DIR/macro-fail-const.rs:5:33 diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.stderr b/tests/ui/const-generics/min_const_generics/macro-fail.stderr index b1d766cbfb644..23eeec7f6daa0 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail.stderr @@ -7,10 +7,9 @@ LL | fn make_marker() -> impl Marker { | this macro call doesn't expand to a type | in this macro invocation ... +LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} | ^ expected type - | - = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected type, found `{` --> $DIR/macro-fail.rs:27:27 @@ -21,14 +20,14 @@ LL | Example:: | this macro call doesn't expand to a type | in this macro invocation ... +LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} | ^ expected type - | - = note: this error originates in the macro `gimme_a_const` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected type, found `{` --> $DIR/macro-fail.rs:4:10 | +LL | macro_rules! external_macro { LL | () => {{ | ^ expected type ... @@ -37,8 +36,6 @@ LL | let _fail = Example::; | | | this macro call doesn't expand to a type | in this macro invocation - | - = note: this error originates in the macro `external_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: unexpected end of macro invocation --> $DIR/macro-fail.rs:36:25 diff --git a/tests/ui/consts/const-item-no-type/in-macro.stderr b/tests/ui/consts/const-item-no-type/in-macro.stderr index e2da412137433..81a7a21fbee30 100644 --- a/tests/ui/consts/const-item-no-type/in-macro.stderr +++ b/tests/ui/consts/const-item-no-type/in-macro.stderr @@ -1,6 +1,8 @@ error[E0428]: the name `A` is defined multiple times --> $DIR/in-macro.rs:4:13 | +LL | macro_rules! suite { +... LL | const A = "A".$fn(); | ^^^^^^^^^^^^^^^^^^^^ `A` redefined here ... @@ -11,11 +13,12 @@ LL | | } | |_- in this macro invocation | = note: `A` must be defined only once in the value namespace of this module - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) error: missing type for `const` item --> $DIR/in-macro.rs:4:20 | +LL | macro_rules! suite { +... LL | const A = "A".$fn(); | ^ ... @@ -25,7 +28,6 @@ LL | | is_empty; LL | | } | |_- in this macro invocation | - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) help: provide a type for the item | LL | const A: = "A".$fn(); @@ -34,6 +36,8 @@ LL | const A: = "A".$fn(); error[E0121]: missing type for item --> $DIR/in-macro.rs:4:20 | +LL | macro_rules! suite { +... LL | const A = "A".$fn(); | ^ not allowed in type signatures ... @@ -42,8 +46,6 @@ LL | | len; LL | | is_empty; LL | | } | |_- in this macro invocation - | - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/consts/enum-discr-type-err.stderr b/tests/ui/consts/enum-discr-type-err.stderr index c676a96ad34a0..dba81198fcdf7 100644 --- a/tests/ui/consts/enum-discr-type-err.stderr +++ b/tests/ui/consts/enum-discr-type-err.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/enum-discr-type-err.rs:18:21 | +LL | macro_rules! mac { +... LL | $( $v = $s::V, )* | ^^^^^ expected `isize`, found `i32` ... @@ -11,11 +13,12 @@ LL | | } | |_- in this macro invocation | = note: enum variant discriminant can only be of a primitive type compatible with the enum's `repr` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/enum-discr-type-err.rs:18:21 | +LL | macro_rules! mac { +... LL | $( $v = $s::V, )* | ^^^^^ expected `isize`, found `i32` ... @@ -27,7 +30,6 @@ LL | | } | = note: enum variant discriminant can only be of a primitive type compatible with the enum's `repr` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/coroutine/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr index 0dd97c538a87c..3536ce5bc39e7 100644 --- a/tests/ui/coroutine/parent-expression.stderr +++ b/tests/ui/coroutine/parent-expression.stderr @@ -1,6 +1,8 @@ error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:25:13 | +LL | macro_rules! type_combinations { +... LL | assert_send(g); | ^^^^^^^^^^^^^^ coroutine is not `Send` ... @@ -38,11 +40,12 @@ note: required by a bound in `assert_send` | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:25:13 | +LL | macro_rules! type_combinations { +... LL | assert_send(g); | ^^^^^^^^^^^^^^ coroutine is not `Send` ... @@ -80,11 +83,12 @@ note: required by a bound in `assert_send` | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: coroutine cannot be sent between threads safely --> $DIR/parent-expression.rs:25:13 | +LL | macro_rules! type_combinations { +... LL | assert_send(g); | ^^^^^^^^^^^^^^ coroutine is not `Send` ... @@ -122,7 +126,6 @@ note: required by a bound in `assert_send` | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/delegation/self-hygiene.stderr b/tests/ui/delegation/self-hygiene.stderr index a0e14ed3cc259..5f6ba6e26d9a7 100644 --- a/tests/ui/delegation/self-hygiene.stderr +++ b/tests/ui/delegation/self-hygiene.stderr @@ -11,7 +11,6 @@ LL | | } | |_____- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters | = note: a module named `self` exists in another namespace - = note: this error originates in the macro `emit_self` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0424]: cannot find value `self` in this scope --> $DIR/self-hygiene.rs:3:34 @@ -26,7 +25,6 @@ LL | | } | |_- delegation supports a `self` parameter, but a macro invocation can only access identifiers it receives from parameters | = note: a module named `self` exists in another namespace - = note: this error originates in the macro `emit_self` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr b/tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr index 6244806e8af37..11e1c72ec170f 100644 --- a/tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr +++ b/tests/ui/delegation/unused-target-expr-in-glob-or-list.stderr @@ -7,24 +7,24 @@ LL | reuse UnresolvedTrait::* { self.0 } error: delegation's target expression is specified for function with no params --> $DIR/unused-target-expr-in-glob-or-list.rs:107:49 | +LL | macro_rules! delegation { +... LL | reuse ::static_self { self.0 } | ^^^^^^^^^^ ... LL | delegation!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error: delegation's target expression is specified for function with no params --> $DIR/unused-target-expr-in-glob-or-list.rs:127:45 | +LL | macro_rules! delegation2 { +LL | () => { LL | reuse ::static_self { self.0 } | ^^^^^^^^^^ ... LL | delegation2!(); | -------------- in this macro invocation - | - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error: delegation's target expression is specified for function with no params --> $DIR/unused-target-expr-in-glob-or-list.rs:154:45 @@ -163,6 +163,8 @@ LL | reuse to_reuse::{value, mut_ref, r#ref} { () } error[E0053]: method `static_self` has an incompatible type for trait --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | +LL | macro_rules! delegation { +... LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^ expected `F`, found `()` ... @@ -176,7 +178,6 @@ LL | fn static_self() -> F { F } | ^ = note: expected signature `fn() -> F` found signature `fn() -> ()` - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) help: change the output type to match the trait | LL - reuse ::static_self { self.0 } @@ -186,6 +187,8 @@ LL + reuse :: -> F { self.0 } error[E0053]: method `static_self` has an incompatible type for trait --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | +LL | macro_rules! delegation2 { +LL | () => { LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^ expected `F`, found `()` ... @@ -199,7 +202,6 @@ LL | fn static_self() -> F { F } | ^ = note: expected signature `fn() -> F` found signature `fn() -> ()` - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) help: change the output type to match the trait | LL - reuse ::static_self { self.0 } @@ -209,6 +211,8 @@ LL + reuse :: -> F { self.0 } error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | +LL | macro_rules! delegation { +... LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^ ---------- unexpected argument ... @@ -220,11 +224,12 @@ note: associated function defined here | LL | fn static_self() -> F { F } | ^^^^^^^^^^^ - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/unused-target-expr-in-glob-or-list.rs:107:37 | +LL | macro_rules! delegation { +... LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^- help: consider using a semicolon here: `;` | | @@ -233,45 +238,45 @@ LL | reuse ::static_self { self.0 } ... LL | delegation!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `F` --> $DIR/unused-target-expr-in-glob-or-list.rs:112:57 | +LL | macro_rules! delegation { +... LL | reuse ::static_value { self.0 } | ^ unknown field ... LL | delegation!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `&mut F` --> $DIR/unused-target-expr-in-glob-or-list.rs:114:59 | +LL | macro_rules! delegation { +... LL | reuse ::static_mut_ref { self.0 } | ^ unknown field ... LL | delegation!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `&F` --> $DIR/unused-target-expr-in-glob-or-list.rs:116:55 | +LL | macro_rules! delegation { +... LL | reuse ::static_ref { self.0 } | ^ unknown field ... LL | delegation!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `delegation` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | +LL | macro_rules! delegation2 { +LL | () => { LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^ ---------- unexpected argument ... @@ -283,11 +288,12 @@ note: associated function defined here | LL | fn static_self() -> F { F } | ^^^^^^^^^^^ - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/unused-target-expr-in-glob-or-list.rs:127:33 | +LL | macro_rules! delegation2 { +LL | () => { LL | reuse ::static_self { self.0 } | ^^^^^^^^^^^- help: consider using a semicolon here: `;` | | @@ -296,41 +302,39 @@ LL | reuse ::static_self { self.0 } ... LL | delegation2!(); | -------------- in this macro invocation - | - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `F` --> $DIR/unused-target-expr-in-glob-or-list.rs:132:53 | +LL | macro_rules! delegation2 { +... LL | reuse ::static_value { self.0 } | ^ unknown field ... LL | delegation2!(); | -------------- in this macro invocation - | - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `&mut F` --> $DIR/unused-target-expr-in-glob-or-list.rs:134:55 | +LL | macro_rules! delegation2 { +... LL | reuse ::static_mut_ref { self.0 } | ^ unknown field ... LL | delegation2!(); | -------------- in this macro invocation - | - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `0` on type `&F` --> $DIR/unused-target-expr-in-glob-or-list.rs:136:51 | +LL | macro_rules! delegation2 { +... LL | reuse ::static_ref { self.0 } | ^ unknown field ... LL | delegation2!(); | -------------- in this macro invocation - | - = note: this error originates in the macro `delegation2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0061]: this function takes 0 arguments but 1 argument was supplied --> $DIR/unused-target-expr-in-glob-or-list.rs:154:22 diff --git a/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr index 9cd6f17587151..035d140d9ecec 100644 --- a/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr +++ b/tests/ui/diagnostic_namespace/on_unknown/point_at_macro_argument.stderr @@ -1,6 +1,8 @@ error[E0432]: unresolved import `things::what` --> $DIR/point_at_macro_argument.rs:12:17 | +LL | macro_rules! mac { +... LL | use things::$thing; | ^^^^^^^^^^^^^^ ... @@ -9,12 +11,12 @@ LL | mac!(what); | | | | | you did the bad thing | in this macro invocation - | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `things::what2` --> $DIR/point_at_macro_argument.rs:12:17 | +LL | macro_rules! mac { +... LL | use things::$thing; | ^^^^^^^^^^^^^^ ... @@ -25,8 +27,6 @@ LL | | what2 ... | LL | | ); | |_____- in this macro invocation - | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/did_you_mean/bad-assoc-expr.stderr b/tests/ui/did_you_mean/bad-assoc-expr.stderr index b83078e21b6a1..a401327705930 100644 --- a/tests/ui/did_you_mean/bad-assoc-expr.stderr +++ b/tests/ui/did_you_mean/bad-assoc-expr.stderr @@ -89,13 +89,13 @@ LL | ::clone(&0); error: missing angle brackets in associated item path --> $DIR/bad-assoc-expr.rs:23:19 | +LL | macro_rules! expr { LL | ($ty: ty) => ($ty::clone(&0)) | ^^^ ... LL | expr!(u8); | --------- in this macro invocation | - = note: this error originates in the macro `expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths | LL | ($ty: ty) => (<$ty>::clone(&0)) diff --git a/tests/ui/did_you_mean/bad-assoc-pat.stderr b/tests/ui/did_you_mean/bad-assoc-pat.stderr index aff3d97eadaeb..87d4baa54c250 100644 --- a/tests/ui/did_you_mean/bad-assoc-pat.stderr +++ b/tests/ui/did_you_mean/bad-assoc-pat.stderr @@ -56,13 +56,13 @@ LL | ::AssocItem => {} error: missing angle brackets in associated item path --> $DIR/bad-assoc-pat.rs:21:19 | +LL | macro_rules! pat { LL | ($ty: ty) => ($ty::AssocItem) | ^^^ ... LL | pat!(u8) => {} | -------- in this macro invocation | - = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info) help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths | LL | ($ty: ty) => (<$ty>::AssocItem) @@ -95,13 +95,12 @@ LL | &(u8,)::AssocItem => {} error[E0599]: no associated function or constant named `AssocItem` found for type `u8` in the current scope --> $DIR/bad-assoc-pat.rs:21:24 | +LL | macro_rules! pat { LL | ($ty: ty) => ($ty::AssocItem) | ^^^^^^^^^ associated function or constant not found in `u8` ... LL | pat!(u8) => {} | -------- in this macro invocation - | - = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: no associated function or constant named `AssocItem` found for type `u8` in the current scope --> $DIR/bad-assoc-pat.rs:32:16 diff --git a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr index a7966f87ad379..bab27ed3fbff9 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr @@ -89,13 +89,13 @@ LL | type I = ::AssocTy; error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:44:19 | +LL | macro_rules! ty { LL | ($ty: ty) => ($ty::AssocTy); | ^^^ ... LL | type J = ty!(u8); | ------- in this macro invocation | - = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths | LL | ($ty: ty) => (<$ty>::AssocTy); @@ -207,13 +207,13 @@ LL | type H = Fn(u8) -> (u8) + /* 'a */::Output; error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:44:19 | +LL | macro_rules! ty { LL | ($ty: ty) => ($ty::AssocTy); | ^^^^^^^^^^^^ ... LL | type J = ty!(u8); | ------- in this macro invocation | - = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | LL - ($ty: ty) => ($ty::AssocTy); diff --git a/tests/ui/did_you_mean/bad-assoc-ty.edition2021.stderr b/tests/ui/did_you_mean/bad-assoc-ty.edition2021.stderr index 2ee8ab2760a92..bb3d0f862f9ce 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.edition2021.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.edition2021.stderr @@ -89,13 +89,13 @@ LL | type I = ::AssocTy; error: missing angle brackets in associated item path --> $DIR/bad-assoc-ty.rs:44:19 | +LL | macro_rules! ty { LL | ($ty: ty) => ($ty::AssocTy); | ^^^ ... LL | type J = ty!(u8); | ------- in this macro invocation | - = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths | LL | ($ty: ty) => (<$ty>::AssocTy); @@ -193,13 +193,13 @@ LL | type H = (u8)>::Output; error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:44:19 | +LL | macro_rules! ty { LL | ($ty: ty) => ($ty::AssocTy); | ^^^^^^^^^^^^ ... LL | type J = ty!(u8); | ------- in this macro invocation | - = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | LL - ($ty: ty) => ($ty::AssocTy); diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 08166355748b5..82399b4ad02c4 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -38,11 +38,12 @@ error[E0560]: struct `Crate` has no field named `fiel` | LL | environment!(); | -------------- in this macro invocation +LL | +LL | macro environment() { ... LL | const CRATE: Crate = Crate { fiel: () }; | ^^^^ unknown field | - = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info) help: a field with a similar name exists | LL | const CRATE: Crate = Crate { field: () }; diff --git a/tests/ui/did_you_mean/recursion_limit_deref.stderr b/tests/ui/did_you_mean/recursion_limit_deref.stderr index faa85dc5ae98c..8aa4ee1ac6519 100644 --- a/tests/ui/did_you_mean/recursion_limit_deref.stderr +++ b/tests/ui/did_you_mean/recursion_limit_deref.stderr @@ -9,6 +9,8 @@ error: reached the recursion limit finding the struct tail for `Bottom` error: reached the recursion limit finding the struct tail for `Bottom` --> $DIR/recursion_limit_deref.rs:14:9 | +LL | macro_rules! link { +LL | ($outer:ident, $inner:ident) => { LL | struct $outer($inner); | ^^^^^^^^^^^^^^^^^^^^^^ ... @@ -16,7 +18,6 @@ LL | link!(A, B); | ----------- in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` - = note: this error originates in the macro `link` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0055]: reached the recursion limit while auto-dereferencing `J` --> $DIR/recursion_limit_deref.rs:55:22 diff --git a/tests/ui/did_you_mean/recursion_limit_macro.stderr b/tests/ui/did_you_mean/recursion_limit_macro.stderr index dc4189ed9ab68..311faeabaeb7c 100644 --- a/tests/ui/did_you_mean/recursion_limit_macro.stderr +++ b/tests/ui/did_you_mean/recursion_limit_macro.stderr @@ -1,6 +1,8 @@ error: recursion limit reached while expanding `recurse!` --> $DIR/recursion_limit_macro.rs:10:31 | +LL | macro_rules! recurse { +LL | () => { }; LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; | ^^^^^^^^^^^^^^^^^^^ ... @@ -8,7 +10,6 @@ LL | recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); | ------------------------------------------------- in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit_macro`) - = note: this error originates in the macro `recurse` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/directory_ownership/macro-expanded-mod.stderr b/tests/ui/directory_ownership/macro-expanded-mod.stderr index cb00a3fe60823..cd56f37cee656 100644 --- a/tests/ui/directory_ownership/macro-expanded-mod.stderr +++ b/tests/ui/directory_ownership/macro-expanded-mod.stderr @@ -1,6 +1,8 @@ error: cannot declare a file module inside a block unless it has a path attribute --> $DIR/macro-expanded-mod.rs:5:9 | +LL | macro_rules! mod_decl { +LL | ($i:ident) => { LL | mod $i; | ^^^^^^^ ... @@ -8,7 +10,6 @@ LL | mod_decl!(foo); | -------------- in this macro invocation | = note: file modules are usually placed outside of blocks, at the top level of the file - = note: this error originates in the macro `mod_decl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr index 413d51701be19..43d1a330a4354 100644 --- a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr +++ b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr @@ -1,35 +1,35 @@ error: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:5:16 | +LL | macro_rules! m { +LL | () => { LL | use a::$crate; | ^^^^^^ ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:6:16 | +LL | macro_rules! m { +... LL | use a::$crate::b; | ^^^^^^ can only be used in path start position ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:8:21 | +LL | macro_rules! m { +... LL | type A = a::$crate; | ^^^^^^ can only be used in path start position ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/dollar-crate/dollar-crate-is-keyword.stderr b/tests/ui/dollar-crate/dollar-crate-is-keyword.stderr index 224380c7ba919..a6f3c1e10fad7 100644 --- a/tests/ui/dollar-crate/dollar-crate-is-keyword.stderr +++ b/tests/ui/dollar-crate/dollar-crate-is-keyword.stderr @@ -1,35 +1,36 @@ error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:6:20 | +LL | macro_rules! m { +... LL | struct $crate {} | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:10:23 | +LL | macro_rules! m { +... LL | use $crate as $crate; | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: imports need to be explicitly named --> $DIR/dollar-crate-is-keyword.rs:9:13 | +LL | macro_rules! m { +... LL | use $crate; | ^^^^^^ ... LL | m!(); | ---- in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate as name; diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr index a13c84f0e527d..d4432ffb7f245 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr @@ -1,6 +1,8 @@ error: `if let` assigns a shorter lifetime since Edition 2024 --> $DIR/lint-if-let-rescope-with-macro.rs:12:12 | +LL | macro_rules! edition_2021_if_let { +LL | ($p:pat, $e:expr, { $($conseq:tt)* } { $($alt:tt)* }) => { LL | if let $p = $e { $($conseq)* } else { $($alt)* } | ^^^^^^^^^^^ ... @@ -38,7 +40,6 @@ note: the lint level is defined here | LL | #![deny(if_let_rescope)] | ^^^^^^^^^^^^^^ - = note: this error originates in the macro `edition_2021_if_let` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.rs b/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.rs index 34ba998c1dc60..27794bdafa215 100644 --- a/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.rs +++ b/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.rs @@ -4,9 +4,6 @@ struct NonGeneric {} #[derive(Default)] struct NonGeneric<'a, const N: usize> {} -//~^ ERROR: struct takes 0 lifetime arguments but 1 lifetime argument was supplied -//~| ERROR: struct takes 0 generic arguments but 1 generic argument was supplied -//~| ERROR: lifetime parameter `'a` is never used -//~| ERROR: the name `NonGeneric` is defined multiple times +//~^ ERROR: the name `NonGeneric` is defined multiple times pub fn main() {} diff --git a/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.stderr b/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.stderr index d758cb13f9939..9cb0a56d44aca 100644 --- a/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.stderr +++ b/tests/ui/duplicate/multiple-types-with-same-name-and-derive-default-133965.stderr @@ -9,43 +9,6 @@ LL | struct NonGeneric<'a, const N: usize> {} | = note: `NonGeneric` must be defined only once in the type namespace of this module -error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:6:8 - | -LL | struct NonGeneric<'a, const N: usize> {} - | ^^^^^^^^^^ -- help: remove the lifetime argument - | | - | expected 0 lifetime arguments - | -note: struct defined here, with 0 lifetime parameters - --> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8 - | -LL | struct NonGeneric {} - | ^^^^^^^^^^ - -error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:6:8 - | -LL | struct NonGeneric<'a, const N: usize> {} - | ^^^^^^^^^^ - help: remove the unnecessary generic argument - | | - | expected 0 generic arguments - | -note: struct defined here, with 0 generic parameters - --> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:3:8 - | -LL | struct NonGeneric {} - | ^^^^^^^^^^ - -error[E0392]: lifetime parameter `'a` is never used - --> $DIR/multiple-types-with-same-name-and-derive-default-133965.rs:6:19 - | -LL | struct NonGeneric<'a, const N: usize> {} - | ^^ unused lifetime parameter - | - = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` - -error: aborting due to 4 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0107, E0392, E0428. -For more information about an error, try `rustc --explain E0107`. +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/duplicate/multiple-types-with-same-name-and-derive.rs b/tests/ui/duplicate/multiple-types-with-same-name-and-derive.rs index 3caf5434cd008..408780b187fb5 100644 --- a/tests/ui/duplicate/multiple-types-with-same-name-and-derive.rs +++ b/tests/ui/duplicate/multiple-types-with-same-name-and-derive.rs @@ -9,9 +9,6 @@ struct NotSM; #[derive(PartialEq, Eq)] struct NotSM(T); -//~^ ERROR: struct takes 0 generic arguments -//~| ERROR: struct takes 0 generic arguments -//~| ERROR: struct takes 0 generic arguments -//~| ERROR: the name `NotSM` is defined multiple times +//~^ ERROR: the name `NotSM` is defined multiple times fn main() {} diff --git a/tests/ui/duplicate/multiple-types-with-same-name-and-derive.stderr b/tests/ui/duplicate/multiple-types-with-same-name-and-derive.stderr index e745b3ce8fc2f..e12acc708eb70 100644 --- a/tests/ui/duplicate/multiple-types-with-same-name-and-derive.stderr +++ b/tests/ui/duplicate/multiple-types-with-same-name-and-derive.stderr @@ -9,45 +9,6 @@ LL | struct NotSM(T); | = note: `NotSM` must be defined only once in the type namespace of this module -error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/multiple-types-with-same-name-and-derive.rs:11:8 - | -LL | struct NotSM(T); - | ^^^^^ expected 0 generic arguments - | -note: struct defined here, with 0 generic parameters - --> $DIR/multiple-types-with-same-name-and-derive.rs:8:8 - | -LL | struct NotSM; - | ^^^^^ - -error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/multiple-types-with-same-name-and-derive.rs:11:8 - | -LL | struct NotSM(T); - | ^^^^^ expected 0 generic arguments - | -note: struct defined here, with 0 generic parameters - --> $DIR/multiple-types-with-same-name-and-derive.rs:8:8 - | -LL | struct NotSM; - | ^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/multiple-types-with-same-name-and-derive.rs:11:8 - | -LL | struct NotSM(T); - | ^^^^^ expected 0 generic arguments - | -note: struct defined here, with 0 generic parameters - --> $DIR/multiple-types-with-same-name-and-derive.rs:8:8 - | -LL | struct NotSM; - | ^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 4 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0107, E0428. -For more information about an error, try `rustc --explain E0107`. +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/editions/edition-cstr-2015-2018.stderr b/tests/ui/editions/edition-cstr-2015-2018.stderr index bcc9d65405bd1..f4db7cfcb0356 100644 --- a/tests/ui/editions/edition-cstr-2015-2018.stderr +++ b/tests/ui/editions/edition-cstr-2015-2018.stderr @@ -45,8 +45,6 @@ LL | macro_rules! construct { ($x:ident) => { $x"str" } } ... LL | construct!(c); | ------------- in this macro invocation - | - = note: this error originates in the macro `construct` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"` --> $DIR/edition-cstr-2015-2018.rs:6:33 @@ -61,7 +59,6 @@ LL | contain!(); = note: c-string literals require Rust 2021 or later = help: pass `--edition 2024` to `rustc` = note: for more on editions, read https://doc.rust-lang.org/edition-guide - = note: this error originates in the macro `contain` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/tests/ui/enum/enum-and-module-in-same-scope.rs b/tests/ui/enum/enum-and-module-in-same-scope.rs index 8e69c89d792ff..cc6e199bd7ca0 100644 --- a/tests/ui/enum/enum-and-module-in-same-scope.rs +++ b/tests/ui/enum/enum-and-module-in-same-scope.rs @@ -5,7 +5,6 @@ enum Foo { mod Foo { //~ ERROR the name `Foo` is defined multiple times pub static X: isize = 42; fn f() { f() } // Check that this does not result in a resolution error - //~^ WARN cannot return without recursing } fn main() {} diff --git a/tests/ui/enum/enum-and-module-in-same-scope.stderr b/tests/ui/enum/enum-and-module-in-same-scope.stderr index f1c02af595ffd..0293acd6201b2 100644 --- a/tests/ui/enum/enum-and-module-in-same-scope.stderr +++ b/tests/ui/enum/enum-and-module-in-same-scope.stderr @@ -9,17 +9,6 @@ LL | mod Foo { | = note: `Foo` must be defined only once in the type namespace of this module -warning: function cannot return without recursing - --> $DIR/enum-and-module-in-same-scope.rs:7:5 - | -LL | fn f() { f() } // Check that this does not result in a resolution error - | ^^^^^^ --- recursive call site - | | - | cannot return without recursing - | - = help: a `loop` may express intention better if this is on purpose - = note: `#[warn(unconditional_recursion)]` on by default - -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/expr/if/if-let.stderr b/tests/ui/expr/if/if-let.stderr index 792504a9772f6..2671e65ca2cf7 100644 --- a/tests/ui/expr/if/if-let.stderr +++ b/tests/ui/expr/if/if-let.stderr @@ -1,6 +1,8 @@ warning: irrefutable `if let` pattern --> $DIR/if-let.rs:6:16 | +LL | macro_rules! foo { +LL | ($p:pat, $e:expr, $b:block) => {{ LL | if let $p = $e $b | ^^^^^^^^^^^ ... @@ -12,13 +14,18 @@ LL | | }); = note: this pattern will always match, so the `if let` is useless = help: consider replacing the `if let` with a `let` = note: `#[warn(irrefutable_let_patterns)]` on by default - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `if let` pattern --> $DIR/if-let.rs:6:16 | -LL | if let $p = $e $b - | ^^^ +LL | / macro_rules! foo { +LL | | ($p:pat, $e:expr, $b:block) => {{ +LL | | if let $p = $e $b + | | ^^^ +... | +LL | | }} +LL | | } + | |_____- this warning originates in the macro `foo` which comes from the expansion of the macro `bar` ... LL | / bar!(a, 1, { LL | | println!("irrefutable pattern"); @@ -27,7 +34,6 @@ LL | | }); | = note: this pattern will always match, so the `if let` is useless = help: consider replacing the `if let` with a `let` - = note: this warning originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `if let` pattern --> $DIR/if-let.rs:26:8 diff --git a/tests/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr b/tests/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr index ef50447434a5a..24fde629cca9c 100644 --- a/tests/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr +++ b/tests/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr @@ -1,6 +1,8 @@ error[E0658]: the `allow_internal_unsafe` attribute side-steps the `unsafe_code` lint --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:8:11 | +LL | macro_rules! bar { +... LL | #[allow_internal_unsafe] | ^^^^^^^^^^^^^^^^^^^^^ ... @@ -9,7 +11,6 @@ LL | bar!(); | = help: add `#![feature(allow_internal_unsafe)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr index 823589c443334..a756a8a52dfd1 100644 --- a/tests/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr +++ b/tests/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -1,6 +1,8 @@ error[E0658]: the `allow_internal_unstable` attribute side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:8:11 | +LL | macro_rules! bar { +... LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -9,7 +11,6 @@ LL | bar!(); | = help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-check-nested-macro-invocation.stderr b/tests/ui/feature-gates/feature-gate-check-nested-macro-invocation.stderr index 7838d8a32b292..cd6e6e385fbe9 100644 --- a/tests/ui/feature-gates/feature-gate-check-nested-macro-invocation.stderr +++ b/tests/ui/feature-gates/feature-gate-check-nested-macro-invocation.stderr @@ -1,6 +1,8 @@ error[E0658]: the `allow_internal_unstable` attribute side-steps feature gating and stability checks --> $DIR/feature-gate-check-nested-macro-invocation.rs:8:11 | +LL | macro_rules! foo ( +LL | () => ( LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -9,11 +11,12 @@ LL | foo!(); | = help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `allow_internal_unstable` attribute cannot be used on macro calls --> $DIR/feature-gate-check-nested-macro-invocation.rs:8:11 | +LL | macro_rules! foo ( +LL | () => ( LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -22,7 +25,6 @@ LL | foo!(); | = help: the `allow_internal_unstable` attribute can be applied to functions and macro defs = note: placing this attribute on a macro invocation does nothing even if the macro expands to what would be a valid target for the attribute - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/trace_macros-gate.stderr b/tests/ui/feature-gates/trace_macros-gate.stderr index 6ca9d1573d920..dc9ef09308a59 100644 --- a/tests/ui/feature-gates/trace_macros-gate.stderr +++ b/tests/ui/feature-gates/trace_macros-gate.stderr @@ -37,6 +37,7 @@ LL | trace_macros!(false); error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/trace_macros-gate.rs:10:26 | +LL | macro_rules! expando { LL | ($x: ident) => { trace_macros!($x) } | ^^^^^^^^^^^^ ... @@ -46,7 +47,6 @@ LL | expando!(true); = note: see issue #29598 for more information = help: add `#![feature(trace_macros)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `expando` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/tests/ui/fmt/format-args-capture-macro-hygiene.stderr b/tests/ui/fmt/format-args-capture-macro-hygiene.stderr index 47ef581629e20..4dd6b60816a9b 100644 --- a/tests/ui/fmt/format-args-capture-macro-hygiene.stderr +++ b/tests/ui/fmt/format-args-capture-macro-hygiene.stderr @@ -19,6 +19,7 @@ LL | format!(concat!("{ba", "r} {}"), 1); error: there is no argument named `foo` --> $DIR/format-args-capture-macro-hygiene.rs:7:13 | +LL | macro_rules! def_site { LL | () => { "{foo}" } | ^^^^^^^ ... @@ -27,7 +28,6 @@ LL | format!(def_site!()); | = note: did you intend to capture a variable `foo` from the surrounding scope? = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro - = note: this error originates in the macro `def_site` (in Nightly builds, run with -Z macro-backtrace for more info) error: there is no argument named `foo` --> $DIR/format-args-capture-macro-hygiene.rs:19:24 diff --git a/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr index dda9b398a833c..905f4ad65e026 100644 --- a/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr +++ b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr @@ -1,6 +1,8 @@ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/fn-arg-count-mismatch-diagnostics.rs:24:9 | +LL | macro_rules! delegate_local { +LL | ($method:ident) => { LL | ::$method(8) | ^^^^^^^^^^^^^^^--- argument #2 of type `u8` is missing ... @@ -12,7 +14,6 @@ note: associated function defined here | LL | fn foo(a: u8, b: u8) {} | ^^^ ----- - = note: this error originates in the macro `delegate_local` (in Nightly builds, run with -Z macro-backtrace for more info) help: provide the argument | LL | ::$method(8, /* u8 */) @@ -34,6 +35,8 @@ LL | fn foo(a: u8, b: u8) {} error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/fn-arg-count-mismatch-diagnostics.rs:31:9 | +LL | macro_rules! delegate_from { +LL | ($from:ident, $method:ident) => { LL | <$from>::$method(8) | ^^^^^^^^^^^^^^^^--- argument #2 of type `u8` is missing ... @@ -45,7 +48,6 @@ note: associated function defined here | LL | fn foo(a: u8, b: u8) {} | ^^^ ----- - = note: this error originates in the macro `delegate_from` (in Nightly builds, run with -Z macro-backtrace for more info) help: provide the argument | LL | <$from>::$method(8, /* u8 */) diff --git a/tests/ui/for-loop-while/label_break_value_invalid.stderr b/tests/ui/for-loop-while/label_break_value_invalid.stderr index f6999c4ab116a..011e29183e8c4 100644 --- a/tests/ui/for-loop-while/label_break_value_invalid.stderr +++ b/tests/ui/for-loop-while/label_break_value_invalid.stderr @@ -1,13 +1,13 @@ error[E0426]: use of undeclared label `'a` --> $DIR/label_break_value_invalid.rs:6:19 | +LL | macro_rules! mac2 { +LL | ($val:expr) => { LL | break 'a $val; | ^^ undeclared label `'a` ... LL | mac2!(2); | -------- in this macro invocation - | - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0426]: use of undeclared label `'a` --> $DIR/label_break_value_invalid.rs:28:19 diff --git a/tests/ui/for-loop-while/while-let-2.stderr b/tests/ui/for-loop-while/while-let-2.stderr index 355ae6f718ec8..8c49cfcb3dbee 100644 --- a/tests/ui/for-loop-while/while-let-2.stderr +++ b/tests/ui/for-loop-while/while-let-2.stderr @@ -1,6 +1,8 @@ warning: irrefutable `while let` pattern --> $DIR/while-let-2.rs:7:19 | +LL | macro_rules! foo{ +LL | ($p:pat, $e:expr, $b:block) => {{ LL | while let $p = $e $b | ^^^^^^^^^^^ ... @@ -12,13 +14,18 @@ LL | | }); = note: this pattern will always match, so the loop will never exit = help: consider instead using a `loop { ... }` with a `let` inside it = note: `#[warn(irrefutable_let_patterns)]` on by default - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `while let` pattern --> $DIR/while-let-2.rs:7:19 | -LL | while let $p = $e $b - | ^^^ +LL | / macro_rules! foo{ +LL | | ($p:pat, $e:expr, $b:block) => {{ +LL | | while let $p = $e $b + | | ^^^ +... | +LL | | }} +LL | | } + | |_____- this warning originates in the macro `foo` which comes from the expansion of the macro `bar` ... LL | / bar!(_a, 1, { LL | | println!("irrefutable pattern"); @@ -27,7 +34,6 @@ LL | | }); | = note: this pattern will always match, so the loop will never exit = help: consider instead using a `loop { ... }` with a `let` inside it - = note: this warning originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `while let` pattern --> $DIR/while-let-2.rs:27:11 diff --git a/tests/ui/generics/generics-on-self-mod-segment.stderr b/tests/ui/generics/generics-on-self-mod-segment.stderr index 4a2d5939a3ec8..eeef8e8584b25 100644 --- a/tests/ui/generics/generics-on-self-mod-segment.stderr +++ b/tests/ui/generics/generics-on-self-mod-segment.stderr @@ -17,6 +17,8 @@ LL | fn crate_(_: crate::::Ty) {} error[E0109]: type arguments are not allowed on module `generics_on_self_mod_segment` --> $DIR/generics-on-self-mod-segment.rs:11:38 | +LL | macro_rules! dollar_crate { +LL | () => { LL | fn dollar_crate_(_: $crate::::Ty) {} | ------ ^^^ type argument not allowed | | @@ -24,8 +26,6 @@ LL | fn dollar_crate_(_: $crate::::Ty) {} ... LL | dollar_crate!(); | --------------- in this macro invocation - | - = note: this error originates in the macro `dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/generics/wrong-number-of-args-in-macro.stderr b/tests/ui/generics/wrong-number-of-args-in-macro.stderr index 62a5eb9414ed5..f882423937e6c 100644 --- a/tests/ui/generics/wrong-number-of-args-in-macro.stderr +++ b/tests/ui/generics/wrong-number-of-args-in-macro.stderr @@ -1,13 +1,14 @@ error[E0425]: cannot find type `a` in this scope --> $DIR/wrong-number-of-args-in-macro.rs:7:13 | +LL | macro_rules! foo_ty { +LL | ($a:ty, $b:ty) => { LL | Foo | ^ not found in this scope ... LL | fn foo<'a, 'b>() -> foo_ty!(&'b (), &'b ()) {} | ----------------------- in this macro invocation | - = note: this error originates in the macro `foo_ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might be missing a type parameter | LL | fn foo<'a, 'b, a>() -> foo_ty!(&'b (), &'b ()) {} @@ -16,6 +17,8 @@ LL | fn foo<'a, 'b, a>() -> foo_ty!(&'b (), &'b ()) {} error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args-in-macro.rs:7:9 | +LL | macro_rules! foo_ty { +LL | ($a:ty, $b:ty) => { LL | Foo | ^^^ expected 1 generic argument ... @@ -27,7 +30,6 @@ note: struct defined here, with 1 generic parameter: `T` | LL | struct Foo; | ^^^ - - = note: this error originates in the macro `foo_ty` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0392]: type parameter `T` is never used --> $DIR/wrong-number-of-args-in-macro.rs:3:12 diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr index ec0e09a302ea1..8474fa038c47d 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr @@ -49,13 +49,14 @@ LL + ..=0.0f32 => {} error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 | +LL | macro_rules! mac { +LL | ($e:expr) => { LL | let ...$e; | ^^^ ... LL | mac!(0); | ------- in this macro invocation | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..=` instead | LL - let ...$e; @@ -65,6 +66,8 @@ LL + let ..=$e; error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 | +LL | macro_rules! mac { +LL | ($e:expr) => { LL | let ...$e; | ^^^^^ pattern `1_i32..=i32::MAX` not covered ... @@ -74,7 +77,6 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr index 63258f3538313..baf613e859246 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr @@ -53,6 +53,8 @@ LL + if let X.. = 1 {} error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:18:19 | +LL | macro_rules! mac { +LL | ($e:expr) => { LL | let $e...; | ^^^ ... @@ -60,7 +62,6 @@ LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..` instead | LL - let $e...; @@ -70,6 +71,8 @@ LL + let $e..; error[E0586]: inclusive range with no end --> $DIR/half-open-range-pats-inclusive-no-end.rs:20:19 | +LL | macro_rules! mac { +... LL | let $e..=; | ^^^ ... @@ -77,7 +80,6 @@ LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..` instead | LL - let $e..=; @@ -87,6 +89,8 @@ LL + let $e..; error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-no-end.rs:18:17 | +LL | macro_rules! mac { +LL | ($e:expr) => { LL | let $e...; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered ... @@ -96,11 +100,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-no-end.rs:20:17 | +LL | macro_rules! mac { +... LL | let $e..=; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered ... @@ -110,7 +115,6 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr index d7f0860a026ac..08f226e6b202a 100644 --- a/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr +++ b/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... @@ -10,7 +12,6 @@ LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) } | = note: expected enum `Option fn(&'a _, &'b _) -> &'a _>` found enum `Option fn(&'a _, &'a _) -> &'a _>` - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_vs_free_x.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_vs_free_x.stderr index 9b5ca3b2056aa..af50fb333de35 100644 --- a/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_vs_free_x.stderr +++ b/tests/ui/higher-ranked/subtype/hr-subtype.bound_a_vs_free_x.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... @@ -10,7 +12,6 @@ LL | | fn(&'x u32)) } | = note: expected enum `Option fn(&'a _)>` found enum `Option` - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr index 48703186cc634..263617a2657ee 100644 --- a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr +++ b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... @@ -10,11 +12,12 @@ LL | | for<'a> fn(Inv<'a>, Inv<'a>)) } | = note: expected enum `Option fn(Inv<'a>, Inv<'b>)>` found enum `Option fn(Inv<'a>, Inv<'a>)>` - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other ... @@ -25,7 +28,6 @@ LL | | for<'a> fn(Inv<'a>, Inv<'a>)) } = note: expected enum `Option fn(Inv<'a>, Inv<'b>)>` found enum `Option fn(Inv<'a>, Inv<'a>)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr index 31d36d7168b61..078ecde8775de 100644 --- a/tests/ui/higher-ranked/subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr +++ b/tests/ui/higher-ranked/subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr @@ -1,6 +1,8 @@ error: lifetime may not live long enough --> $DIR/hr-subtype.rs:48:13 | +LL | macro_rules! check { +... LL | fn subtype<'x, 'y: 'x, 'z: 'y>() { | -- -- lifetime `'y` defined here | | @@ -16,11 +18,12 @@ LL | | fn(Inv<'y>)) } = note: requirement occurs because of the type `Inv<'_>`, which makes the generic argument `'_` invariant = note: the struct `Inv<'a>` is invariant over the parameter `'a` = help: see for more information about variance - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: lifetime may not live long enough --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { | -- -- lifetime `'y` defined here | | @@ -36,7 +39,6 @@ LL | | fn(Inv<'y>)) } = note: requirement occurs because of the type `Inv<'_>`, which makes the generic argument `'_` invariant = note: the struct `Inv<'a>` is invariant over the parameter `'a` = help: see for more information about variance - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.free_x_vs_free_y.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.free_x_vs_free_y.stderr index a8e00125fc63a..bb734ca3e7190 100644 --- a/tests/ui/higher-ranked/subtype/hr-subtype.free_x_vs_free_y.stderr +++ b/tests/ui/higher-ranked/subtype/hr-subtype.free_x_vs_free_y.stderr @@ -1,6 +1,8 @@ error: lifetime may not live long enough --> $DIR/hr-subtype.rs:54:13 | +LL | macro_rules! check { +... LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { | -- -- lifetime `'y` defined here | | @@ -13,7 +15,6 @@ LL | | fn(&'y u32)) } | |______________- in this macro invocation | = help: consider adding the following bound: `'x: 'y` - = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/assoc_item_ctxt.stderr b/tests/ui/hygiene/assoc_item_ctxt.stderr index effa9e8d65592..30925a8b17dd7 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.stderr +++ b/tests/ui/hygiene/assoc_item_ctxt.stderr @@ -1,6 +1,8 @@ error[E0407]: method `method` is not a member of trait `Tr` --> $DIR/assoc_item_ctxt.rs:33:13 | +LL | macro mac_trait_impl() { +LL | impl Tr for u8 { LL | fn method() {} | ^^^------^^^^^ | | | @@ -9,8 +11,6 @@ LL | fn method() {} ... LL | mac_trait_impl!(); | ----------------- in this macro invocation - | - = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0046]: not all trait items implemented, missing: `method` --> $DIR/assoc_item_ctxt.rs:32:9 @@ -18,13 +18,12 @@ error[E0046]: not all trait items implemented, missing: `method` LL | fn method(); | ------------ `method` from trait ... +LL | macro mac_trait_impl() { LL | impl Tr for u8 { | ^^^^^^^^^^^^^^ missing `method` in implementation ... LL | mac_trait_impl!(); | ----------------- in this macro invocation - | - = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/hygiene/duplicate_lifetimes.stderr b/tests/ui/hygiene/duplicate_lifetimes.stderr index 9f1a75147272d..1d43c4becd27c 100644 --- a/tests/ui/hygiene/duplicate_lifetimes.stderr +++ b/tests/ui/hygiene/duplicate_lifetimes.stderr @@ -1,6 +1,7 @@ error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/duplicate_lifetimes.rs:8:14 | +LL | macro m($a:lifetime) { LL | fn g<$a, 'a>() {} | ^^ already used ... @@ -9,12 +10,11 @@ LL | m!('a); | | | | | first use of `'a` | in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0403]: the name `'a` is already used for a generic parameter in this item's generic parameters --> $DIR/duplicate_lifetimes.rs:13:14 | +LL | macro n($a:lifetime) { LL | fn h<$a, 'a>() {} | ^^ already used ... @@ -23,8 +23,6 @@ LL | n!('a); | | | | | first use of `'a` | in this macro invocation - | - = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr index db1a56d7d8169..22c0a3068cf12 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr @@ -7,17 +7,19 @@ LL | use my_core; error[E0432]: unresolved import `my_core` --> $DIR/extern-prelude-from-opaque-fail-2018.rs:8:13 | +LL | macro a() { +... LL | use my_core; | ^^^^^^^ no external crate `my_core` ... LL | a!(); | ---- in this macro invocation - | - = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18 | +LL | macro a() { +... LL | fn f() { my_core::mem::drop(0); } | ^^^^^^^ use of unresolved module or unlinked crate `my_core` ... @@ -27,7 +29,6 @@ LL | a!(); = help: you might be missing a crate named `my_core` = help: consider importing this module: std::mem - = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14 diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr index f3a43fa0127c8..fd33b1b394283 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr @@ -7,17 +7,19 @@ LL | use my_core; error[E0432]: unresolved import `my_core` --> $DIR/extern-prelude-from-opaque-fail.rs:8:13 | +LL | macro a() { +... LL | use my_core; | ^^^^^^^ no `my_core` in the root ... LL | a!(); | ---- in this macro invocation - | - = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail.rs:12:18 | +LL | macro a() { +... LL | fn f() { my_core::mem::drop(0); } | ^^^^^^^ use of unresolved module or unlinked crate `my_core` ... @@ -27,7 +29,6 @@ LL | a!(); = help: you might be missing a crate named `my_core` = help: consider importing this module: my_core::mem - = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail.rs:25:14 diff --git a/tests/ui/hygiene/fields-definition.stderr b/tests/ui/hygiene/fields-definition.stderr index 701986ea76e7f..78e2df984b18e 100644 --- a/tests/ui/hygiene/fields-definition.stderr +++ b/tests/ui/hygiene/fields-definition.stderr @@ -1,6 +1,8 @@ error[E0124]: field `a` is already declared --> $DIR/fields-definition.rs:14:13 | +LL | macro_rules! legacy { +... LL | a: u8, | ----- `a` first declared here LL | $a: u8, @@ -8,8 +10,6 @@ LL | $a: u8, ... LL | legacy!(a); | ---------- in this macro invocation - | - = note: this error originates in the macro `legacy` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/fields-move.stderr b/tests/ui/hygiene/fields-move.stderr index b5b507c7daa55..43c538e0d9579 100644 --- a/tests/ui/hygiene/fields-move.stderr +++ b/tests/ui/hygiene/fields-move.stderr @@ -1,6 +1,8 @@ error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:18:9 | +LL | macro_rules! copy_legacy { +LL | ($foo: ident) => { LL | $foo.x | ^^^^^^ value used here after move ... @@ -10,7 +12,6 @@ LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait - = note: this error originates in the macro `copy_legacy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:28:42 diff --git a/tests/ui/hygiene/fields.stderr b/tests/ui/hygiene/fields.stderr index 99252c4b752cc..d32d0b15ef4db 100644 --- a/tests/ui/hygiene/fields.stderr +++ b/tests/ui/hygiene/fields.stderr @@ -1,46 +1,46 @@ error: type `foo::S` is private --> $DIR/fields.rs:13:17 | +LL | pub macro m($S:ident, $x:ident) {{ +... LL | let s = S { x: 0 }; | ^^^^^^^^^^ private type ... LL | let s = foo::m!(S, x); | ------------- in this macro invocation - | - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `foo::S` is private --> $DIR/fields.rs:14:17 | +LL | pub macro m($S:ident, $x:ident) {{ +... LL | let _ = s.x; | ^ private type ... LL | let s = foo::m!(S, x); | ------------- in this macro invocation - | - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private --> $DIR/fields.rs:16:17 | +LL | pub macro m($S:ident, $x:ident) {{ +... LL | let t = T(0); | ^^^^ private type ... LL | let s = foo::m!(S, x); | ------------- in this macro invocation - | - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private --> $DIR/fields.rs:17:17 | +LL | pub macro m($S:ident, $x:ident) {{ +... LL | let _ = t.0; | ^ private type ... LL | let s = foo::m!(S, x); | ------------- in this macro invocation - | - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/hygiene/generate-mod.stderr b/tests/ui/hygiene/generate-mod.stderr index bfdb72c22cb9b..740ae98ce77c0 100644 --- a/tests/ui/hygiene/generate-mod.stderr +++ b/tests/ui/hygiene/generate-mod.stderr @@ -19,46 +19,46 @@ LL | genmod!(FromOutside, Outer); error[E0425]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:19:18 | +LL | macro genmod_transparent() { +... LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_transparent!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `genmod_transparent` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:20:22 | +LL | macro genmod_transparent() { +... LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_transparent!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `genmod_transparent` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:28:18 | +LL | macro_rules! genmod_legacy { () => { +... LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_legacy!(); | ---------------- in this macro invocation - | - = note: this error originates in the macro `genmod_legacy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:29:22 | +LL | macro_rules! genmod_legacy { () => { +... LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_legacy!(); | ---------------- in this macro invocation - | - = note: this error originates in the macro `genmod_legacy` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index 7decdab3a3954..a35cd12205d4d 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -22,6 +22,8 @@ LL + use foo::f; error[E0425]: cannot find function `g` in this scope --> $DIR/globs.rs:16:5 | +LL | macro m($($t:tt)*) { +... LL | g(); | ^ not found in this scope ... @@ -37,7 +39,6 @@ note: similarly named function `f` defined here | LL | pub fn f() {} | ^^^^^^^^^^ - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: a function with a similar name exists | LL - g(); @@ -56,14 +57,13 @@ LL | n!(f); | | | | | you might have meant to refer to this function | in this macro invocation +LL | macro n($i:ident) { ... LL | $j(); | -- due to this macro variable ... LL | n!(f); | ^ not found in this scope - | - = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find function `f` in this scope --> $DIR/globs.rs:66:17 @@ -73,14 +73,13 @@ LL | n!(f); | | | | | you might have meant to refer to this function | in this macro invocation +LL | macro n($i:ident) { ... LL | $j(); | -- due to this macro variable ... LL | f | ^ not found in this scope - | - = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/hygiene/hygienic-label-1.stderr b/tests/ui/hygiene/hygienic-label-1.stderr index 5529d8dc83656..3bb2f340fb7bc 100644 --- a/tests/ui/hygiene/hygienic-label-1.stderr +++ b/tests/ui/hygiene/hygienic-label-1.stderr @@ -1,13 +1,12 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-1.rs:2:19 | +LL | macro_rules! foo { LL | () => { break 'x; } | ^^ undeclared label `'x` ... LL | 'x: loop { foo!(); } | ------ in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/hygienic-label-3.stderr b/tests/ui/hygiene/hygienic-label-3.stderr index 495afc69a9543..f620622c9f3ee 100644 --- a/tests/ui/hygiene/hygienic-label-3.stderr +++ b/tests/ui/hygiene/hygienic-label-3.stderr @@ -1,13 +1,12 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-3.rs:2:19 | +LL | macro_rules! foo { LL | () => { break 'x; } | ^^ undeclared label `'x` ... LL | foo!(); | ------ in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/impl_items.stderr b/tests/ui/hygiene/impl_items.stderr index 35f2750403de4..05d8f2b998c48 100644 --- a/tests/ui/hygiene/impl_items.stderr +++ b/tests/ui/hygiene/impl_items.stderr @@ -1,13 +1,12 @@ error: type `for<'a> fn(&'a foo::S) {foo::S::f}` is private --> $DIR/impl_items.rs:10:23 | +LL | pub macro m() { LL | let _: () = S.f(); | ^ private type ... LL | foo::m!(); | --------- in this macro invocation - | - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/missing-self-diag.stderr b/tests/ui/hygiene/missing-self-diag.stderr index 21be48b859eb4..8af5e1209a028 100644 --- a/tests/ui/hygiene/missing-self-diag.stderr +++ b/tests/ui/hygiene/missing-self-diag.stderr @@ -1,6 +1,8 @@ error[E0424]: cannot find value `self` in this scope --> $DIR/missing-self-diag.rs:10:9 | +LL | macro_rules! call_bar { +LL | () => { LL | self.bar(); | ^^^^ `self` value is a keyword only available in methods with a `self` parameter ... @@ -11,7 +13,6 @@ LL | | } | |_____- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters | = note: a module named `self` exists in another namespace - = note: this error originates in the macro `call_bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 5461ee527b880..10573662fc442 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -4,10 +4,10 @@ error[E0433]: cannot find type `Vec` in this scope LL | fn f() { ::bar::m!(); } | ----------- in this macro invocation ... +LL | pub macro m() { LL | Vec::new(); | ^^^ use of undeclared type `Vec` | - = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct | LL + use std::vec::Vec; @@ -19,11 +19,12 @@ error[E0599]: no method named `clone` found for unit type `()` in the current sc LL | fn f() { ::bar::m!(); } | ----------- in this macro invocation ... +LL | pub macro m() { +LL | Vec::new(); LL | ().clone() | ^^^^^ | = help: items from traits can only be used if the trait is in scope - = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: trait `Clone` which provides `clone` is implemented but not in scope; perhaps you want to import it | LL + use std::clone::Clone; diff --git a/tests/ui/hygiene/pattern-macro.stderr b/tests/ui/hygiene/pattern-macro.stderr index 047244ba9edef..be25ee7532d35 100644 --- a/tests/ui/hygiene/pattern-macro.stderr +++ b/tests/ui/hygiene/pattern-macro.stderr @@ -1,6 +1,8 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/pattern-macro.rs:5:5 | +LL | macro_rules! foo { () => ( x ) } +... LL | x + 1; | ^ not found in this scope | @@ -12,7 +14,6 @@ LL | macro_rules! foo { () => ( x ) } ... LL | let foo!() = 2; | ------ in this macro invocation - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/privacy-early.stderr b/tests/ui/hygiene/privacy-early.stderr index 556c6e3fe02ca..22a8db986ad3d 100644 --- a/tests/ui/hygiene/privacy-early.stderr +++ b/tests/ui/hygiene/privacy-early.stderr @@ -1,6 +1,7 @@ error[E0364]: `f` is private, and cannot be re-exported --> $DIR/privacy-early.rs:10:13 | +LL | pub macro m() { LL | use f as g; | ^^^^^^ ... @@ -15,11 +16,11 @@ LL | use f as g; ... LL | foo::m!(); | --------- in this macro invocation - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0364]: `f` is private, and cannot be re-exported --> $DIR/privacy-early.rs:10:13 | +LL | pub macro m() { LL | use f as g; | ^^^^^^ ... @@ -35,7 +36,6 @@ LL | use f as g; LL | foo::m!(); | --------- in this macro invocation = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/hygiene/rustc-macro-transparency.stderr b/tests/ui/hygiene/rustc-macro-transparency.stderr index 597d2f6f9d837..10c725600ba37 100644 --- a/tests/ui/hygiene/rustc-macro-transparency.stderr +++ b/tests/ui/hygiene/rustc-macro-transparency.stderr @@ -7,6 +7,8 @@ LL | Opaque; error[E0423]: cannot find value `semiopaque` in this scope --> $DIR/rustc-macro-transparency.rs:29:5 | +LL | macro semiopaque() { +... LL | semiopaque; | ^^^^^^^^^^ not found in this scope | @@ -19,7 +21,6 @@ LL | struct SemiOpaque; ... LL | semiopaque!(); | ------------- in this macro invocation - = note: this error originates in the macro `semiopaque` (in Nightly builds, run with -Z macro-backtrace for more info) help: a unit struct with a similar name exists (notice the capitalization) | LL - semiopaque; diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr index e5212ce1f56c0..3609fac714f3d 100644 --- a/tests/ui/hygiene/trait_items.stderr +++ b/tests/ui/hygiene/trait_items.stderr @@ -11,7 +11,6 @@ LL | pub macro m() { ().f() } | ^ method not found in `()` | = help: items from traits can only be used if the trait is in scope - = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info) help: trait `T` which provides `f` is implemented but not in scope; perhaps you want to import it | LL + use foo::T; diff --git a/tests/ui/impl-trait/in-trait/dont-probe-missing-item-name-4.stderr b/tests/ui/impl-trait/in-trait/dont-probe-missing-item-name-4.stderr index b4c022d352193..a0ce4a2a2e080 100644 --- a/tests/ui/impl-trait/in-trait/dont-probe-missing-item-name-4.stderr +++ b/tests/ui/impl-trait/in-trait/dont-probe-missing-item-name-4.stderr @@ -1,6 +1,8 @@ error[E0271]: type mismatch resolving `::Output == i64` --> $DIR/dont-probe-missing-item-name-4.rs:21:13 | +LL | macro_rules! f { +... LL | problem(MyServerFn {}); | ------- ^^^^^^^^^^^^^ type mismatch resolving `::Output == i64` | | @@ -19,7 +21,6 @@ note: required by a bound in `problem` | LL | fn problem>(_: T) {} | ^^^^^^^^^^^^ required by this bound in `problem` - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/imports/ambiguous-import-visibility-macro.stderr b/tests/ui/imports/ambiguous-import-visibility-macro.stderr index 6f5f1c4dd3ec6..ee6976624c7c5 100644 --- a/tests/ui/imports/ambiguous-import-visibility-macro.stderr +++ b/tests/ui/imports/ambiguous-import-visibility-macro.stderr @@ -1,6 +1,8 @@ warning: ambiguous import visibility: pub(crate) or pub --> $DIR/ambiguous-import-visibility-macro.rs:17:9 | +LL | macro_rules! globbing{ +... LL | pub use RustEmbed as Embed; | ^^^^^^^^^ | @@ -23,7 +25,6 @@ LL | #[macro_use] // this imports the `RustEmbed` macro with `pub(crate)` visibi = 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) warning: 1 warning emitted diff --git a/tests/ui/imports/ambiguous-import-visibility-module.stderr b/tests/ui/imports/ambiguous-import-visibility-module.stderr index 1532bcfe7f4e6..03d1f05c4a8c4 100644 --- a/tests/ui/imports/ambiguous-import-visibility-module.stderr +++ b/tests/ui/imports/ambiguous-import-visibility-module.stderr @@ -1,6 +1,8 @@ warning: ambiguous import visibility: pub or pub(in crate::reexport) --> $DIR/ambiguous-import-visibility-module.rs:18:13 | +LL | macro_rules! mac { +... LL | pub use S as Z; | ^ | @@ -23,7 +25,6 @@ LL | pub use m::*; = 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) warning: 1 warning emitted diff --git a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr index 42735ff90c90b..9b31544f250c1 100644 --- a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr +++ b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr @@ -1,13 +1,13 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/extern-prelude-extern-crate-fail.rs:16:9 | +LL | macro_rules! define_std_as_non_existent { +LL | () => { LL | extern crate std as non_existent; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_std_as_non_existent!(); | ----------------------------- in this macro invocation - | - = note: this error originates in the macro `define_std_as_non_existent` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find module or crate `two_macros` in this scope --> $DIR/extern-prelude-extern-crate-fail.rs:10:9 diff --git a/tests/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/tests/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index d09d14b27f90f..4ea0f0f1a66b0 100644 --- a/tests/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/tests/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -1,17 +1,19 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:20:9 | +LL | macro_rules! define_other_core { +LL | () => { LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_other_core!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `Vec` is ambiguous --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:14:9 | +LL | macro_rules! define_vec { +... LL | Vec::panic!(); | ^^^ ambiguous name | @@ -26,7 +28,6 @@ LL | define_vec!(); | ------------- in this macro invocation note: `Vec` could also refer to a struct from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL - = note: this error originates in the macro `define_vec` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/imports/import-prefix-macro-1.stderr b/tests/ui/imports/import-prefix-macro-1.stderr index bdc0e85b43ed0..fa77bc5082398 100644 --- a/tests/ui/imports/import-prefix-macro-1.stderr +++ b/tests/ui/imports/import-prefix-macro-1.stderr @@ -1,13 +1,12 @@ error: expected one of `::`, `;`, or `as`, found `{` --> $DIR/import-prefix-macro-1.rs:11:27 | +LL | macro_rules! import { LL | ($p: path) => (use $p {S, Z}); | ^ expected one of `::`, `;`, or `as` ... LL | import! { a::b::c } | ------------------- in this macro invocation - | - = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/imports/import-prefix-macro-2.stderr b/tests/ui/imports/import-prefix-macro-2.stderr index fbeca99b13800..e1670b8dcf5d9 100644 --- a/tests/ui/imports/import-prefix-macro-2.stderr +++ b/tests/ui/imports/import-prefix-macro-2.stderr @@ -1,13 +1,12 @@ error: expected identifier, found metavariable --> $DIR/import-prefix-macro-2.rs:11:26 | +LL | macro_rules! import { LL | ($p: path) => (use ::$p {S, Z}); | ^^ expected identifier, found metavariable ... LL | import! { a::b::c } | ------------------- in this macro invocation - | - = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-109148.stderr b/tests/ui/imports/issue-109148.stderr index ee047385ae328..499fb1b461b4e 100644 --- a/tests/ui/imports/issue-109148.stderr +++ b/tests/ui/imports/issue-109148.stderr @@ -1,17 +1,19 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/issue-109148.rs:6:9 | +LL | macro_rules! m { +LL | () => { LL | extern crate core as std; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `std` is ambiguous --> $DIR/issue-109148.rs:13:5 | +LL | macro_rules! m { +... LL | use std::mem; | ^^^ ambiguous name | @@ -26,11 +28,12 @@ LL | extern crate core as std; LL | m!(); | ---- in this macro invocation = help: use `crate::std` to refer to this crate unambiguously - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `std` is ambiguous --> $DIR/issue-109148.rs:14:7 | +LL | macro_rules! m { +... LL | use ::std::mem as _; | ^^^ ambiguous name | @@ -44,7 +47,6 @@ LL | extern crate core as std; ... LL | m!(); | ---- in this macro invocation - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/imports/issue-114682-1.stderr b/tests/ui/imports/issue-114682-1.stderr index fd2776f50ad77..fa7354f774fd1 100644 --- a/tests/ui/imports/issue-114682-1.stderr +++ b/tests/ui/imports/issue-114682-1.stderr @@ -1,6 +1,8 @@ error[E0659]: `A` is ambiguous --> $DIR/issue-114682-1.rs:23:5 | +LL | macro_rules! mac { +... LL | A!(); | ^ ambiguous name | @@ -22,7 +24,6 @@ note: `A` could also refer to the macro imported here LL | pub use m::*; | ^^^^ = help: use `crate::A` to refer to this macro unambiguously - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/imports/local-modularized-tricky-fail-1.stderr b/tests/ui/imports/local-modularized-tricky-fail-1.stderr index 0d1a29027845e..b69051140ed25 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-1.stderr @@ -1,6 +1,8 @@ error[E0659]: `exported` is ambiguous --> $DIR/local-modularized-tricky-fail-1.rs:29:1 | +LL | macro_rules! define_exported { () => { +... LL | exported!(); | ^^^^^^^^ ambiguous name | @@ -22,11 +24,12 @@ note: `exported` could also refer to the macro imported here LL | use inner1::*; | ^^^^^^^^^ = help: use `crate::exported` to refer to this macro unambiguously - = note: this error originates in the macro `define_exported` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `panic` is ambiguous --> $DIR/local-modularized-tricky-fail-1.rs:36:5 | +LL | macro_rules! define_panic { () => { +... LL | panic!(); | ^^^^^ ambiguous name | @@ -44,11 +47,12 @@ LL | define_panic!(); = help: 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 - = note: this error originates in the macro `define_panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `include` is ambiguous --> $DIR/local-modularized-tricky-fail-1.rs:47:1 | +LL | macro_rules! define_include { () => { +... LL | include!(); | ^^^^^^^ ambiguous name | @@ -66,7 +70,6 @@ LL | define_include!(); = help: use `crate::include` to refer to this macro unambiguously note: `include` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL - = note: this error originates in the macro `define_include` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.stderr b/tests/ui/imports/local-modularized-tricky-fail-2.stderr index 6dae1508995da..3457cfed58459 100644 --- a/tests/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/tests/ui/imports/local-modularized-tricky-fail-2.stderr @@ -1,6 +1,8 @@ error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:13:9 | +LL | macro_rules! define_exported { () => { +... LL | use crate::exported; | ^^^^^^^^^^^^^^^ | @@ -17,11 +19,12 @@ LL | define_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: `#[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) error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:19:5 | +LL | macro_rules! define_exported { () => { +... LL | crate::exported!(); | ^^^^^^^^^^^^^^^ | @@ -37,7 +40,6 @@ 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 @@ -45,6 +47,8 @@ Future incompatibility report: Future breakage diagnostic: error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:13:9 | +LL | macro_rules! define_exported { () => { +... LL | use crate::exported; | ^^^^^^^^^^^^^^^ | @@ -61,12 +65,13 @@ LL | define_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: `#[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) Future breakage diagnostic: error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths --> $DIR/local-modularized-tricky-fail-2.rs:19:5 | +LL | macro_rules! define_exported { () => { +... LL | crate::exported!(); | ^^^^^^^^^^^^^^^ | @@ -83,5 +88,4 @@ LL | define_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: `#[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/multiple-extern-by-macro-for-buitlin.stderr b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr index bc9755732813c..23d8f2f99e21a 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr @@ -3,7 +3,9 @@ error[E0259]: the name `core` is defined multiple times | LL | extern crate core; | ------------------ previous import of the extern crate `core` here -... +LL | +LL | macro_rules! m { +LL | () => { LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ `core` reimported here ... @@ -11,7 +13,6 @@ LL | m!(); | ---- in this macro invocation | = note: `core` must be defined only once in the type namespace of this module - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | LL | extern crate std as other_core; diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr index f1b60bbe39d5b..3005f83f4f1c2 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr @@ -3,7 +3,9 @@ error[E0259]: the name `empty` is defined multiple times | LL | extern crate empty; | ------------------- previous import of the extern crate `empty` here -... +LL | +LL | macro_rules! m { +LL | () => { LL | extern crate std as empty; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `empty` reimported here ... @@ -11,7 +13,6 @@ LL | m!(); | ---- in this macro invocation | = note: `empty` must be defined only once in the type namespace of this module - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | LL | extern crate std as other_empty; diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr index 13e1aaacd7025..47f386073c00e 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr @@ -10,6 +10,8 @@ error[E0259]: the name `non_existent` is defined multiple times LL | extern crate non_existent; | -------------------------- previous import of the extern crate `non_existent` here ... +LL | macro_rules! m { +LL | () => { LL | extern crate std as non_existent; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `non_existent` reimported here ... @@ -17,7 +19,6 @@ LL | m!(); | ---- in this macro invocation | = note: `non_existent` must be defined only once in the type namespace of this module - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | LL | extern crate std as other_non_existent; diff --git a/tests/ui/imports/point_macro_input.stderr b/tests/ui/imports/point_macro_input.stderr index f063c8c132498..2294a971c1bf2 100644 --- a/tests/ui/imports/point_macro_input.stderr +++ b/tests/ui/imports/point_macro_input.stderr @@ -1,6 +1,8 @@ error[E0432]: unresolved import `things::what2` --> $DIR/point_macro_input.rs:15:17 | +LL | macro_rules! mac2 { +... LL | use things::$thing; | ^^^^^^^^^^^^^^ ... @@ -11,8 +13,6 @@ LL | | what2 LL | | LL | | ); | |_____- in this macro invocation - | - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `what1` in module `things` --> $DIR/point_macro_input.rs:26:9 diff --git a/tests/ui/imports/private-from-decl-macro.fail.stderr b/tests/ui/imports/private-from-decl-macro.fail.stderr index 9d6941d064767..80b6fde5e8539 100644 --- a/tests/ui/imports/private-from-decl-macro.fail.stderr +++ b/tests/ui/imports/private-from-decl-macro.fail.stderr @@ -1,6 +1,8 @@ error[E0364]: `S` is private, and cannot be re-exported --> $DIR/private-from-decl-macro.rs:18:13 | +LL | pub macro mac_glob() { +LL | #[cfg(fail)] LL | use crate::m::*; | ^^^^^^^^^^^ ... @@ -15,7 +17,6 @@ LL | use crate::m::*; ... LL | crate::m::mac_glob!(); | --------------------- in this macro invocation - = note: this error originates in the macro `crate::m::mac_glob` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: cannot find value `S` in this scope --> $DIR/private-from-decl-macro.rs:28:17 diff --git a/tests/ui/imports/shadow_builtin_macros.stderr b/tests/ui/imports/shadow_builtin_macros.stderr index 7799fb230d434..93c282ec0d952 100644 --- a/tests/ui/imports/shadow_builtin_macros.stderr +++ b/tests/ui/imports/shadow_builtin_macros.stderr @@ -18,6 +18,8 @@ note: `panic` could also refer to a macro from prelude error[E0659]: `panic` is ambiguous --> $DIR/shadow_builtin_macros.rs:33:5 | +LL | macro_rules! m { () => { +... LL | panic!(); | ^^^^^ ambiguous name | @@ -32,7 +34,6 @@ LL | m!(); | ---- in this macro invocation note: `panic` could also refer to a macro from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `n` is ambiguous --> $DIR/shadow_builtin_macros.rs:49:5 diff --git a/tests/ui/infinite/infinite-macro-expansion.stderr b/tests/ui/infinite/infinite-macro-expansion.stderr index 08fb4fa77236b..80db33b493b0f 100644 --- a/tests/ui/infinite/infinite-macro-expansion.stderr +++ b/tests/ui/infinite/infinite-macro-expansion.stderr @@ -1,6 +1,7 @@ error: recursion limit reached while expanding `recursive!` --> $DIR/infinite-macro-expansion.rs:2:12 | +LL | macro_rules! recursive { LL | () => (recursive!()) | ^^^^^^^^^^^^ ... @@ -8,7 +9,6 @@ LL | recursive!() | ------------ in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_macro_expansion`) - = note: this error originates in the macro `recursive` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr index 924d512e99836..f3e41f6c2a646 100644 --- a/tests/ui/internal/internal-unstable.stderr +++ b/tests/ui/internal/internal-unstable.stderr @@ -65,15 +65,21 @@ LL | bar!(internal_unstable::unstable()); error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:19:9 | -LL | internal_unstable::unstable(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / macro_rules! foo { +LL | | ($e: expr, $f: expr) => {{ +LL | | $e; +LL | | $f; +LL | | internal_unstable::unstable(); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | | }} +LL | | } + | |_- this error originates in the macro `foo` which comes from the expansion of the macro `bar` ... -LL | bar!(internal_unstable::unstable()); - | ----------------------------------- in this macro invocation +LL | bar!(internal_unstable::unstable()); + | ----------------------------------- in this macro invocation | = help: add `#![feature(function)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: this error originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 9 previous errors diff --git a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/macro.stderr b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/macro.stderr index 5412c943ec087..81d17c9162588 100644 --- a/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/macro.stderr +++ b/tests/ui/lifetimes/mismatched-lifetime-syntaxes-details/macro.stderr @@ -1,6 +1,8 @@ error: hiding or eliding a lifetime that's named elsewhere is confusing --> $DIR/macro.rs:10:12 | +LL | macro_rules! repeated { +LL | ($($pair:ident),+ ; $middle:ty) => { LL | ($($pair),+, $middle, $($pair),+) | ^^^^^ ^^^^^ the same lifetimes are hidden here | | @@ -19,7 +21,6 @@ note: the lint level is defined here | LL | #![deny(mismatched_lifetime_syntaxes)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `repeated` (in Nightly builds, run with -Z macro-backtrace for more info) help: consistently use `'a` | LL ~ ($($pair<'a, 'a>),+, $middle, $($pair<'a, 'a>),+) diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr index be9f8b19545b5..5a18f0f63e23d 100644 --- a/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr +++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr @@ -27,6 +27,8 @@ LL | #![deny(temporary_cstring_as_ptr)] error: this creates a dangling pointer because temporary `CString` is dropped at end of statement --> $DIR/cstring-as-ptr.rs:9:52 | +LL | macro_rules! mymacro { +LL | () => { LL | let s = CString::new("some text").unwrap().as_ptr(); | ---------------------------------- ^^^^^^ pointer created here | | @@ -39,7 +41,6 @@ LL | mymacro!(); = note: a dangling pointer is safe, but dereferencing one is undefined behavior = note: returning a pointer to a local variable will always result in a dangling pointer = note: for more information, see - = note: this error originates in the macro `mymacro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/lint/expect-future_breakage-crash-issue-126521.stderr b/tests/ui/lint/expect-future_breakage-crash-issue-126521.stderr index 72a74c1579dd4..bc9893f15f256 100644 --- a/tests/ui/lint/expect-future_breakage-crash-issue-126521.stderr +++ b/tests/ui/lint/expect-future_breakage-crash-issue-126521.stderr @@ -2,6 +2,8 @@ Future incompatibility report: Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/expect-future_breakage-crash-issue-126521.rs:7:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -10,12 +12,13 @@ LL | let _ = foo!(x); | = 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: warning: trailing semicolon in macro used in expression position --> $DIR/expect-future_breakage-crash-issue-126521.rs:13:35 | +LL | macro_rules! bar { +LL | ($val:ident) => { LL | (5_i32.overflowing_sub(3)); | ^ ... @@ -24,29 +27,28 @@ LL | let _ = bar!(x); | = 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 `bar` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/expect-future_breakage-crash-issue-126521.rs:7:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... LL | let _ = foo!(x); | ------- in this macro invocation - | - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/expect-future_breakage-crash-issue-126521.rs:13:35 | +LL | macro_rules! bar { +LL | ($val:ident) => { LL | (5_i32.overflowing_sub(3)); | ^ ... LL | let _ = bar!(x); | ------- in this macro invocation - | - = note: this warning originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lint/lint-double-negations-macro.stderr b/tests/ui/lint/lint-double-negations-macro.stderr index d6ac9be48f304..11da29fbedba2 100644 --- a/tests/ui/lint/lint-double-negations-macro.stderr +++ b/tests/ui/lint/lint-double-negations-macro.stderr @@ -1,6 +1,8 @@ warning: use of a double negation --> $DIR/lint-double-negations-macro.rs:9:9 | +LL | macro_rules! bad_macro { +LL | ($e: expr) => { LL | --$e | ^^^^ ... @@ -10,7 +12,6 @@ LL | bad_macro!(1); = note: the prefix `--` could be misinterpreted as a decrement operator which exists in other languages = note: use `-= 1` if you meant to decrement the value = note: `#[warn(double_negations)]` on by default - = note: this warning originates in the macro `bad_macro` (in Nightly builds, run with -Z macro-backtrace for more info) help: add parentheses for clarity | LL | -(-$e) diff --git a/tests/ui/lint/lint-raw-borrows-via-references.stderr b/tests/ui/lint/lint-raw-borrows-via-references.stderr index f04922b52f05a..e31c467f76ee2 100644 --- a/tests/ui/lint/lint-raw-borrows-via-references.stderr +++ b/tests/ui/lint/lint-raw-borrows-via-references.stderr @@ -90,6 +90,8 @@ LL + { &raw const y } warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers --> $DIR/lint-raw-borrows-via-references.rs:68:10 | +LL | macro_rules! ref_cast { +LL | ($e:expr) => { LL | &$e as *const i32 | ^^^^^^^^^^^^^^^^ ... @@ -97,7 +99,6 @@ LL | unsafe { ref_cast!(*x) } | ------------- in this macro invocation | = help: consider using `&raw const` for a safer and more explicit raw pointer - = note: this warning originates in the macro `ref_cast` (in Nightly builds, run with -Z macro-backtrace for more info) warning: creating an intermediate reference implies aliasing requirements even when immediately cast to a raw pointers --> $DIR/lint-raw-borrows-via-references.rs:79:13 diff --git a/tests/ui/lint/lint-strict-provenance-macro-casts.stderr b/tests/ui/lint/lint-strict-provenance-macro-casts.stderr index 08a1707490623..93caaafb483c9 100644 --- a/tests/ui/lint/lint-strict-provenance-macro-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-macro-casts.stderr @@ -1,6 +1,8 @@ error: cast from `*const u8` to `usize` implicitly exposes pointer provenance --> $DIR/lint-strict-provenance-macro-casts.rs:6:9 | +LL | macro_rules! cast { +LL | ($e:expr, $t:ty) => { LL | $e as $t | ^^^^^^^^ ... @@ -14,11 +16,12 @@ note: the lint level is defined here | LL | #![deny(implicit_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `cast` (in Nightly builds, run with -Z macro-backtrace for more info) error: cast from `usize` to `*const u8` implicitly relies on exposed provenance --> $DIR/lint-strict-provenance-macro-casts.rs:6:9 | +LL | macro_rules! cast { +LL | ($e:expr, $t:ty) => { LL | $e as $t | ^^^^^^^^ ... @@ -27,11 +30,11 @@ LL | let _ptr = cast!(0usize, *const u8); | = help: if conforming to strict provenance is not possible, use `std::ptr::with_exposed_provenance()` = note: for more information, visit - = note: this error originates in the macro `cast` (in Nightly builds, run with -Z macro-backtrace for more info) error: cast from `*const u8` to `usize` implicitly exposes pointer provenance --> $DIR/lint-strict-provenance-macro-casts.rs:13:20 | +LL | macro_rules! p2i { LL | ($e:expr) => { $e as usize }; | ^^^^^^^^^^^ ... @@ -40,11 +43,11 @@ LL | p2i!(&raw const x); | = help: if conforming to strict provenance is not possible, use `.expose_provenance()` = note: for more information, visit - = note: this error originates in the macro `p2i` (in Nightly builds, run with -Z macro-backtrace for more info) error: cast from `usize` to `*const ()` implicitly relies on exposed provenance --> $DIR/lint-strict-provenance-macro-casts.rs:18:20 | +LL | macro_rules! i2p { LL | ($e:expr) => { $e as *const () }; | ^^^^^^^^^^^^^^^ ... @@ -53,7 +56,6 @@ LL | i2p!(0x42); | = help: if conforming to strict provenance is not possible, use `std::ptr::with_exposed_provenance()` = note: for more information, visit - = note: this error originates in the macro `i2p` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/lint/lint-unsafe-code.stderr b/tests/ui/lint/lint-unsafe-code.stderr index 9b4df1273acbc..d39fddbe56806 100644 --- a/tests/ui/lint/lint-unsafe-code.stderr +++ b/tests/ui/lint/lint-unsafe-code.stderr @@ -85,13 +85,13 @@ LL | unsafe {} error: usage of an `unsafe` block --> $DIR/lint-unsafe-code.rs:34:9 | +LL | macro_rules! unsafe_in_macro { +... LL | unsafe {} | ^^^^^^^^^ ... LL | unsafe_in_macro!() | ------------------ in this macro invocation - | - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: usage of the unsafe `no_mangle` attribute --> $DIR/lint-unsafe-code.rs:38:3 @@ -144,6 +144,8 @@ LL | #[link_section = "__TEXT,__text"] static UWU: u32 = 5; error: usage of the unsafe `no_mangle` attribute --> $DIR/lint-unsafe-code.rs:28:11 | +LL | macro_rules! unsafe_in_macro { +LL | () => {{ LL | #[no_mangle] fn foo() {} | ^^^^^^^^^ ... @@ -151,11 +153,12 @@ LL | unsafe_in_macro!() | ------------------ in this macro invocation | = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: usage of the unsafe `no_mangle` attribute --> $DIR/lint-unsafe-code.rs:29:11 | +LL | macro_rules! unsafe_in_macro { +... LL | #[no_mangle] static FOO: u32 = 5; | ^^^^^^^^^ ... @@ -163,11 +166,12 @@ LL | unsafe_in_macro!() | ------------------ in this macro invocation | = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: usage of the unsafe `export_name` attribute --> $DIR/lint-unsafe-code.rs:30:11 | +LL | macro_rules! unsafe_in_macro { +... LL | #[export_name = "bar"] fn bar() {} | ^^^^^^^^^^^^^^^^^^^ ... @@ -175,11 +179,12 @@ LL | unsafe_in_macro!() | ------------------ in this macro invocation | = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: usage of the unsafe `export_name` attribute --> $DIR/lint-unsafe-code.rs:32:11 | +LL | macro_rules! unsafe_in_macro { +... LL | #[export_name = "BAR"] static BAR: u32 = 5; | ^^^^^^^^^^^^^^^^^^^ ... @@ -187,7 +192,6 @@ LL | unsafe_in_macro!() | ------------------ in this macro invocation | = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: usage of the unsafe `naked` attribute --> $DIR/lint-unsafe-code.rs:139:3 diff --git a/tests/ui/lint/lints-in-foreign-macros.stderr b/tests/ui/lint/lints-in-foreign-macros.stderr index c0164bd00ffff..4bfdd97b02983 100644 --- a/tests/ui/lint/lints-in-foreign-macros.stderr +++ b/tests/ui/lint/lints-in-foreign-macros.stderr @@ -1,6 +1,7 @@ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:11:16 | +LL | macro_rules! foo { LL | () => {use std::string::ToString;} | ^^^^^^^^^^^^^^^^^^^^^ ... @@ -12,7 +13,6 @@ note: the lint level is defined here | LL | #![warn(unused_imports)] | ^^^^^^^^^^^^^^ - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:16:18 diff --git a/tests/ui/lint/non-local-defs/inside-macro_rules.stderr b/tests/ui/lint/non-local-defs/inside-macro_rules.stderr index b6fe1a921d756..deb6f29e61f08 100644 --- a/tests/ui/lint/non-local-defs/inside-macro_rules.stderr +++ b/tests/ui/lint/non-local-defs/inside-macro_rules.stderr @@ -1,6 +1,8 @@ warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item --> $DIR/inside-macro_rules.rs:9:13 | +LL | macro_rules! m { +... LL | fn my_func() { | ------------ move the `impl` block outside of this function `my_func` LL | impl MacroTrait for OutsideStruct {} @@ -15,7 +17,6 @@ LL | m!(); = note: the macro `m` defines the non-local `impl`, and may need to be changed = note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl` = note: `#[warn(non_local_definitions)]` on by default - = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 1 warning emitted diff --git a/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr index 7a38ec318ab6a..36b0ff767e453 100644 --- a/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr +++ b/tests/ui/lint/redundant-semicolon/suggest-remove-semi-in-macro-expansion-issue-142143.stderr @@ -1,6 +1,7 @@ error: unnecessary trailing semicolon --> $DIR/suggest-remove-semi-in-macro-expansion-issue-142143.rs:6:43 | +LL | macro_rules! m { LL | ($stmt:stmt) => { #[allow(bad_style)] $stmt } | ^^^^^ ... @@ -12,7 +13,6 @@ note: the lint level is defined here | LL | #![deny(redundant_semicolons)] | ^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr index f0ee27a99151f..19a41481542b5 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_lint_from_macro.stderr @@ -14,6 +14,8 @@ LL | trigger_unused_variables_macro!(); warning: unused variable: `x` --> $DIR/expect_lint_from_macro.rs:7:13 | +LL | macro_rules! trigger_unused_variables_macro { +LL | () => { LL | let x = 0; | ^ ... @@ -33,11 +35,12 @@ note: the lint level is defined here | LL | #![warn(unused_variables)] | ^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unused variable: `x` --> $DIR/expect_lint_from_macro.rs:7:13 | +LL | macro_rules! trigger_unused_variables_macro { +LL | () => { LL | let x = 0; | ^ ... @@ -52,7 +55,6 @@ LL | let x = 0; ... LL | trigger_unused_variables_macro!(); | --------------------------------- in this macro invocation - = note: this warning originates in the macro `trigger_unused_variables_macro` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 3 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 5a426be83f861..d722ea7ee19e8 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 @@ -1,6 +1,8 @@ warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -16,11 +18,12 @@ note: the lint level is defined here | LL | #![warn(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -29,7 +32,6 @@ LL | let _ = foo!(warn_in_expr); | = 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) warning: unused attribute `allow` --> $DIR/semicolon-in-expressions-from-macros.rs:50:13 @@ -47,6 +49,8 @@ LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_ warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -55,7 +59,6 @@ LL | let _ = #[allow(semicolon_in_expressions_from_macros)] foo!(allow_does_ | = 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) warning: 4 warnings emitted @@ -63,6 +66,8 @@ Future incompatibility report: Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -73,12 +78,13 @@ LL | foo!(first) = 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: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -87,12 +93,13 @@ LL | let _ = foo!(second); | = 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: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -101,12 +108,13 @@ LL | let _ = foo!(third); | = 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: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -115,12 +123,13 @@ LL | let _ = foo!(fourth); | = 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: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -136,12 +145,13 @@ note: the lint level is defined here | LL | #![warn(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -155,12 +165,13 @@ note: the lint level is defined here | LL | #![warn(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: warning: trailing semicolon in macro used in expression position --> $DIR/semicolon-in-expressions-from-macros.rs:9:13 | +LL | macro_rules! foo { +LL | ($val:ident) => { LL | true; | ^ ... @@ -174,5 +185,4 @@ note: the lint level is defined here | LL | #![warn(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr b/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr index 9506d702f51f1..bb856fd0a1d45 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr @@ -1,6 +1,8 @@ error: trailing semicolon in macro used in expression position --> $DIR/warn-semicolon-in-expressions-from-macros.rs:5:13 | +LL | macro_rules! foo { +LL | () => { LL | true; | ^ ... @@ -10,7 +12,6 @@ LL | _ => 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) error: aborting due to 1 previous error @@ -18,6 +19,8 @@ Future incompatibility report: Future breakage diagnostic: error: trailing semicolon in macro used in expression position --> $DIR/warn-semicolon-in-expressions-from-macros.rs:5:13 | +LL | macro_rules! foo { +LL | () => { LL | true; | ^ ... @@ -27,5 +30,4 @@ LL | _ => 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/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index e616ba0aa4b28..9d12c7434b20c 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -133,6 +133,8 @@ LL | let ref _v = A.value; warning: creating a mutable reference to mutable static --> $DIR/static-mut-refs.rs:14:14 | +LL | macro_rules! bar { +LL | ($x:expr) => { LL | &mut ($x.0) | ^^^^^^ mutable reference to mutable static ... @@ -142,7 +144,6 @@ LL | let _x = bar!(FOO); = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = help: use a type that relies on "interior mutability" instead; to read more on this, visit = note: for more information, see - = note: this warning originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 12 warnings emitted diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index a8985fc8a1763..fa59f92d861aa 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -133,6 +133,8 @@ LL | let ref _v = A.value; error: creating a mutable reference to mutable static --> $DIR/static-mut-refs.rs:14:14 | +LL | macro_rules! bar { +LL | ($x:expr) => { LL | &mut ($x.0) | ^^^^^^ mutable reference to mutable static ... @@ -142,7 +144,6 @@ LL | let _x = bar!(FOO); = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = help: use a type that relies on "interior mutability" instead; to read more on this, visit = note: for more information, see - = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 12 previous errors diff --git a/tests/ui/lint/unreachable_pub.stderr b/tests/ui/lint/unreachable_pub.stderr index 5173ff1f0264d..34b48a1fbb5b0 100644 --- a/tests/ui/lint/unreachable_pub.stderr +++ b/tests/ui/lint/unreachable_pub.stderr @@ -114,6 +114,7 @@ LL | pub type Oxygen = bool; warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:44:47 | +LL | macro_rules! define_empty_struct_with_visibility { LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -124,7 +125,6 @@ LL | define_empty_struct_with_visibility!(pub, Fluorine); | in this macro invocation | = help: or consider exporting it for use by other crates - = note: this warning originates in the macro `define_empty_struct_with_visibility` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:50:9 diff --git a/tests/ui/lint/unsafe_code/lint-global-asm-as-unsafe.stderr b/tests/ui/lint/unsafe_code/lint-global-asm-as-unsafe.stderr index deb67a174f185..d5cb744babd31 100644 --- a/tests/ui/lint/unsafe_code/lint-global-asm-as-unsafe.stderr +++ b/tests/ui/lint/unsafe_code/lint-global-asm-as-unsafe.stderr @@ -14,6 +14,8 @@ LL | #![deny(unsafe_code)] error: usage of `core::arch::global_asm` --> $DIR/lint-global-asm-as-unsafe.rs:13:9 | +LL | macro_rules! unsafe_in_macro { +LL | () => { LL | global_asm!(""); | ^^^^^^^^^^^^^^^ ... @@ -21,7 +23,6 @@ LL | unsafe_in_macro!(); | ------------------ in this macro invocation | = note: using this macro is unsafe even though it does not need an `unsafe` block - = note: this error originates in the macro `unsafe_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/lint/unused-visibilities.stderr b/tests/ui/lint/unused-visibilities.stderr index e5ff2a7fcae8d..ddf3015ecf0c7 100644 --- a/tests/ui/lint/unused-visibilities.stderr +++ b/tests/ui/lint/unused-visibilities.stderr @@ -22,6 +22,8 @@ LL | pub(self) const _: () = {}; warning: visibility qualifiers have no effect on `const _` declarations --> $DIR/unused-visibilities.rs:14:9 | +LL | macro_rules! foo { +LL | () => { LL | pub const _: () = {}; | ^^^ help: remove the qualifier ... @@ -29,7 +31,6 @@ LL | foo!(); | ------ in this macro invocation | = note: `const _` does not declare a name, so there is nothing for the qualifier to apply to - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 3 warnings emitted diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr index b4a6871713c06..887fbf18fd100 100644 --- a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr +++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr @@ -1,6 +1,8 @@ error: unused variable: `var` --> $DIR/issue-117284-arg-in-macro.rs:4:13 | +LL | macro_rules! make_var { +LL | ($struct:ident, $var:ident) => { LL | let $var = $struct.$var; | ^^^^ ... @@ -20,7 +22,6 @@ note: the lint level is defined here | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `make_var` (in Nightly builds, run with -Z macro-backtrace for more info) error: unused variable: `a` --> $DIR/issue-117284-arg-in-macro.rs:16:9 diff --git a/tests/ui/lint/unused/must-use-macros.stderr b/tests/ui/lint/unused/must-use-macros.stderr index 2ad174e10b501..c5e9de20595b1 100644 --- a/tests/ui/lint/unused/must-use-macros.stderr +++ b/tests/ui/lint/unused/must-use-macros.stderr @@ -1,6 +1,8 @@ warning: unused comparison that must be used --> $DIR/must-use-macros.rs:28:17 | +LL | macro_rules! cmp { +LL | ($a:ident, $b:ident) => { LL | $a == $b | ^^^^^^^^ the comparison produces a value ... @@ -12,7 +14,6 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `let _ = ...` to ignore the resulting value | LL | let _ = cmp!(a, b); @@ -21,13 +22,14 @@ LL | let _ = cmp!(a, b); warning: unused comparison that must be used --> $DIR/must-use-macros.rs:41:17 | +LL | macro_rules! cmp { +LL | ($a:expr, $b:expr) => { LL | $a == $b | ^^^^^^^^ the comparison produces a value ... LL | cmp!(1, 1); | ---------- in this macro invocation | - = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `let _ = ...` to ignore the resulting value | LL | let _ = cmp!(1, 1); diff --git a/tests/ui/lint/unused/unused-macros.stderr b/tests/ui/lint/unused/unused-macros.stderr index 50c80b61eb5be..8fb0cf4b98563 100644 --- a/tests/ui/lint/unused/unused-macros.stderr +++ b/tests/ui/lint/unused/unused-macros.stderr @@ -13,13 +13,13 @@ LL | #![deny(unused_macros)] error: unused macro definition: `m` --> $DIR/unused-macros.rs:13:22 | +LL | macro_rules! create_macro { +LL | () => { LL | macro_rules! m { | ^ ... LL | create_macro!(); | --------------- in this macro invocation - | - = note: this error originates in the macro `create_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: unused macro definition: `unused` --> $DIR/unused-macros.rs:26:18 diff --git a/tests/ui/lint/unused/unused_parens/unused-parens-in-macro-issue-120642.stderr b/tests/ui/lint/unused/unused_parens/unused-parens-in-macro-issue-120642.stderr index b1390debec73b..69f4e0ca7f0bb 100644 --- a/tests/ui/lint/unused/unused_parens/unused-parens-in-macro-issue-120642.stderr +++ b/tests/ui/lint/unused/unused_parens/unused-parens-in-macro-issue-120642.stderr @@ -1,6 +1,8 @@ warning: unnecessary parentheses around pattern --> $DIR/unused-parens-in-macro-issue-120642.rs:26:19 | +LL | macro_rules! unused_parens { +... LL | let (_t) = 1; | ^^^^ ... @@ -12,29 +14,28 @@ note: the lint level is defined here | LL | #![warn(unused_parens)] | ^^^^^^^^^^^^^ - = note: this warning originates in the macro `unused_parens` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unnecessary parentheses around type --> $DIR/unused-parens-in-macro-issue-120642.rs:23:18 | +LL | macro_rules! unused_parens { +... LL | <($($rest),*)>::bar() | ^^^^^^^^^^^^ ... LL | unused_parens!(T1, T2, T3); | -------------------------- in this macro invocation - | - = note: this warning originates in the macro `unused_parens` (in Nightly builds, run with -Z macro-backtrace for more info) warning: unnecessary parentheses around pattern --> $DIR/unused-parens-in-macro-issue-120642.rs:26:19 | +LL | macro_rules! unused_parens { +... LL | let (_t) = 1; | ^^^^ ... LL | unused_parens!(T1, T2, T3); | -------------------------- in this macro invocation - | - = note: this warning originates in the macro `unused_parens` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 3 warnings emitted diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index 4199ff62e2a30..1d51cce2013c9 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -722,6 +722,7 @@ LL + std::ptr::eq(*a, *b) warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:148:33 | +LL | macro_rules! cmp { LL | ($a:tt, $b:tt) => { $a == $b } | ^^^^^^^^ ... @@ -730,18 +731,17 @@ LL | cmp!(a, b); | = help: use explicit `std::ptr::eq` method to compare metadata and addresses = help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses - = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:157:39 | +LL | macro_rules! cmp { LL | ($a:ident, $b:ident) => { $a == $b } | ^^^^^^^^ ... LL | cmp!(a, b); | ---------- in this macro invocation | - = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | LL - ($a:ident, $b:ident) => { $a == $b } @@ -751,6 +751,7 @@ LL + ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:167:37 | +LL | macro_rules! cmp { LL | ($a:expr, $b:expr) => { $a == $b } | ^^^^^^^^ ... @@ -759,7 +760,6 @@ LL | cmp!(&a, &b); | = help: use explicit `std::ptr::eq` method to compare metadata and addresses = help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses - = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 53 warnings emitted diff --git a/tests/ui/liveness/liveness-return-last-stmt-semi.stderr b/tests/ui/liveness/liveness-return-last-stmt-semi.stderr index de0843aa637f3..2b3c87e0b1869 100644 --- a/tests/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/tests/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -34,8 +34,6 @@ LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } } ... LL | test!(); | ------- in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/macros/assert-ne-no-invalid-help-issue-146204.stderr b/tests/ui/macros/assert-ne-no-invalid-help-issue-146204.stderr index 64e40ebdd7bdf..8c3451af7235f 100644 --- a/tests/ui/macros/assert-ne-no-invalid-help-issue-146204.stderr +++ b/tests/ui/macros/assert-ne-no-invalid-help-issue-146204.stderr @@ -37,6 +37,8 @@ LL | assert_eq!(buf, b"----"); error[E0277]: can't compare `[u8; 4]` with `&[u8; 4]` --> $DIR/assert-ne-no-invalid-help-issue-146204.rs:5:30 | +LL | macro_rules! local_assert_ne { +... LL | if *left_val == *right_val { | ^^ no implementation for `[u8; 4] == &[u8; 4]` ... @@ -44,7 +46,6 @@ LL | local_assert_ne!(buf, b"----"); | ------------------------------ in this macro invocation | = help: the trait `PartialEq<&[u8; 4]>` is not implemented for `[u8; 4]` - = note: this error originates in the macro `local_assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider dereferencing here | LL | if *left_val == **right_val { diff --git a/tests/ui/macros/attr-expr.stderr b/tests/ui/macros/attr-expr.stderr index eaad41c44fb9a..2cd707be3ce06 100644 --- a/tests/ui/macros/attr-expr.stderr +++ b/tests/ui/macros/attr-expr.stderr @@ -1,24 +1,24 @@ error: expected identifier, found metavariable --> $DIR/attr-expr.rs:3:11 | +LL | macro_rules! foo { +LL | ($e:expr) => { LL | #[$e] | ^^ expected identifier, found metavariable ... LL | foo!(inline); | ------------ in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable --> $DIR/attr-expr.rs:12:18 | +LL | macro_rules! bar { +LL | ($e:expr) => { LL | #[inline($e)] | ^^ ... LL | bar!(always); | ------------ in this macro invocation - | - = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/best-failure.stderr b/tests/ui/macros/best-failure.stderr index 914ff7fd8207f..541ffae1ecf28 100644 --- a/tests/ui/macros/best-failure.stderr +++ b/tests/ui/macros/best-failure.stderr @@ -15,7 +15,6 @@ note: while trying to match meta-variable `$self:ident` | LL | (neg false, $self:ident) => { $self }; | ^^^^^^^^^^^ - = note: this error originates in the macro `number` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/cfg_attr-expr.stderr b/tests/ui/macros/cfg_attr-expr.stderr index cd1dcaec1ade8..19c24c32afb09 100644 --- a/tests/ui/macros/cfg_attr-expr.stderr +++ b/tests/ui/macros/cfg_attr-expr.stderr @@ -1,6 +1,8 @@ error: expected identifier, found metavariable --> $DIR/cfg_attr-expr.rs:3:26 | +LL | macro_rules! foo { +LL | ($e:expr) => { LL | #[cfg_attr(true, $e)] | ^^ expected identifier, found metavariable ... @@ -8,7 +10,6 @@ LL | foo!(inline); | ------------ in this macro invocation | = note: for more information, visit - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: must be of the form | LL - #[cfg_attr(true, $e)] diff --git a/tests/ui/macros/cross-crate-nested-macro-rules-span.stderr b/tests/ui/macros/cross-crate-nested-macro-rules-span.stderr index edf3d575b972d..5ed3932a8a841 100644 --- a/tests/ui/macros/cross-crate-nested-macro-rules-span.stderr +++ b/tests/ui/macros/cross-crate-nested-macro-rules-span.stderr @@ -9,13 +9,17 @@ LL | all_trigger_fields!(make_event_subscription); error[E0223]: ambiguous associated type --> $DIR/cross-crate-nested-macro-rules-span.rs:10:40 | -LL | pub struct EventSubscription($($channel::ReaderId),*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | all_trigger_fields!(make_event_subscription); - | -------------------------------------------- in this macro invocation +LL | / macro_rules! make_event_subscription { +LL | | ($(( $field:ident, $ty:ident, $channel:ident )),*) => { +LL | | pub struct EventSubscription($($channel::ReaderId),*); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... | +LL | | } + | |_- this error originates in the macro `make_event_subscription` which comes from the expansion of the macro `all_trigger_fields` +LL | +LL | all_trigger_fields!(make_event_subscription); + | -------------------------------------------- in this macro invocation | - = note: this error originates in the macro `make_event_subscription` which comes from the expansion of the macro `all_trigger_fields` (in Nightly builds, run with -Z macro-backtrace for more info) help: if there were a trait named `Example` with associated type `ReaderId` implemented for `nested_macro_rules_definition::NotificationChannel`, you could use the fully-qualified path | LL - pub struct EventSubscription($($channel::ReaderId),*); diff --git a/tests/ui/macros/cross-file-errors.stderr b/tests/ui/macros/cross-file-errors.stderr index 70db7d5185eac..7a44fa5f0ad5c 100644 --- a/tests/ui/macros/cross-file-errors.stderr +++ b/tests/ui/macros/cross-file-errors.stderr @@ -1,6 +1,8 @@ error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/underscore.rs:5:9 | +LL | macro_rules! underscore { +LL | () => ( LL | _ | ^ `_` not allowed here | @@ -8,8 +10,6 @@ LL | _ | LL | underscore!(); | ------------- in this macro invocation - | - = note: this error originates in the macro `underscore` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/deref-raw-pointer-issue-158158.stderr b/tests/ui/macros/deref-raw-pointer-issue-158158.stderr index d93ac0eac1638..513e082d32b5b 100644 --- a/tests/ui/macros/deref-raw-pointer-issue-158158.stderr +++ b/tests/ui/macros/deref-raw-pointer-issue-158158.stderr @@ -1,13 +1,13 @@ error[E0609]: no field `val` on type `*mut Demo` --> $DIR/deref-raw-pointer-issue-158158.rs:13:21 | +LL | macro_rules! get_value { +LL | ($d:expr) => { LL | as_ptr!($d).val | ^^^ unknown field ... LL | let _ = get_value!(d); | ------------- in this macro invocation - | - = note: this error originates in the macro `get_value` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/derive-in-eager-expansion-hang.stderr b/tests/ui/macros/derive-in-eager-expansion-hang.stderr index b61ef2a9babe8..c8232143688b5 100644 --- a/tests/ui/macros/derive-in-eager-expansion-hang.stderr +++ b/tests/ui/macros/derive-in-eager-expansion-hang.stderr @@ -1,6 +1,7 @@ error: format argument must be a string literal --> $DIR/derive-in-eager-expansion-hang.rs:4:5 | +LL | macro_rules! hang { () => { LL | / { LL | | #[derive(Clone)] LL | | struct S; @@ -11,7 +12,6 @@ LL | | } LL | format_args!(hang!()); | ------- in this macro invocation | - = note: this error originates in the macro `hang` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might be missing a string literal to format with | LL | format_args!("{}", hang!()); diff --git a/tests/ui/macros/expand-full-no-resolution.stderr b/tests/ui/macros/expand-full-no-resolution.stderr index 42e79bb122fb7..2892f80b0d461 100644 --- a/tests/ui/macros/expand-full-no-resolution.stderr +++ b/tests/ui/macros/expand-full-no-resolution.stderr @@ -1,6 +1,8 @@ error: cannot find macro `a` in this scope --> $DIR/expand-full-no-resolution.rs:18:18 | +LL | macro_rules! wrap { +... LL | format_args!(a!()); | ^ | @@ -12,7 +14,6 @@ LL | macro_rules! _a { ... LL | wrap!(); | ------- in this macro invocation - = note: this error originates in the macro `wrap` (in Nightly builds, run with -Z macro-backtrace for more info) help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | LL - macro_rules! _a { @@ -22,6 +23,8 @@ LL + macro_rules! a { error: cannot find macro `a` in this scope --> $DIR/expand-full-no-resolution.rs:19:10 | +LL | macro_rules! wrap { +... LL | env!(a!()); | ^ | @@ -33,7 +36,6 @@ LL | macro_rules! _a { ... LL | wrap!(); | ------- in this macro invocation - = note: this error originates in the macro `wrap` (in Nightly builds, run with -Z macro-backtrace for more info) help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | LL - macro_rules! _a { diff --git a/tests/ui/macros/invalid-assignment-in-macro-26093.stderr b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr index 99f188c718361..ad347a2544a2c 100644 --- a/tests/ui/macros/invalid-assignment-in-macro-26093.stderr +++ b/tests/ui/macros/invalid-assignment-in-macro-26093.stderr @@ -1,6 +1,8 @@ error[E0070]: invalid left-hand side of assignment --> $DIR/invalid-assignment-in-macro-26093.rs:4:16 | +LL | macro_rules! not_a_place { +LL | ($thing:expr) => { LL | $thing = 42; | ^ ... @@ -9,12 +11,12 @@ LL | not_a_place!(99); | | | | | cannot assign to this expression | in this macro invocation - | - = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0067]: invalid left-hand side of assignment --> $DIR/invalid-assignment-in-macro-26093.rs:6:16 | +LL | macro_rules! not_a_place { +... LL | $thing += 42; | ^^ ... @@ -23,8 +25,6 @@ LL | not_a_place!(99); | | | | | cannot assign to this expression | in this macro invocation - | - = note: this error originates in the macro `not_a_place` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/issue-109237.stderr b/tests/ui/macros/issue-109237.stderr index 9d25420af2561..3ba1158655947 100644 --- a/tests/ui/macros/issue-109237.stderr +++ b/tests/ui/macros/issue-109237.stderr @@ -1,6 +1,7 @@ error: expected expression, found `;` --> $DIR/issue-109237.rs:2:12 | +LL | macro_rules! statement { LL | () => {;}; | ^ expected expression ... @@ -8,7 +9,6 @@ LL | let _ = statement!(); | ------------ in this macro invocation | = note: the macro call doesn't expand to an expression, but it can expand to a statement - = note: this error originates in the macro `statement` (in Nightly builds, run with -Z macro-backtrace for more info) help: surround the macro invocation with `{}` to interpret the expansion as a statement | LL - let _ = statement!(); diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr index 02b26e5a1f31b..3ffa5d67b0a16 100644 --- a/tests/ui/macros/issue-118786.stderr +++ b/tests/ui/macros/issue-118786.stderr @@ -24,6 +24,8 @@ LL | make_macro!((meow)); error: cannot find macro `macro_rules` in this scope --> $DIR/issue-118786.rs:10:9 | +LL | macro_rules! make_macro { +LL | ($macro_name:tt) => { LL | macro_rules! $macro_name { | ^^^^^^^^^^^ ... @@ -38,7 +40,6 @@ LL | macro_rules! $macro_name { ... LL | make_macro!((meow)); | ------------------- in this macro invocation - = note: this error originates in the macro `make_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/macros/issue-16098.stderr b/tests/ui/macros/issue-16098.stderr index a7249981648c0..ca5a597293c87 100644 --- a/tests/ui/macros/issue-16098.stderr +++ b/tests/ui/macros/issue-16098.stderr @@ -1,6 +1,8 @@ error: recursion limit reached while expanding `prob1!` --> $DIR/issue-16098.rs:7:18 | +LL | macro_rules! prob1 { +... LL | $n + prob1!($n - 1); | ^^^^^^^^^^^^^^ ... @@ -8,7 +10,6 @@ LL | println!("Problem 1: {}", prob1!(1000)); | ------------ in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_16098`) - = note: this error originates in the macro `prob1` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-25385.stderr b/tests/ui/macros/issue-25385.stderr index 39dbdd753a6ff..4f21a4e17dbbc 100644 --- a/tests/ui/macros/issue-25385.stderr +++ b/tests/ui/macros/issue-25385.stderr @@ -1,13 +1,12 @@ error[E0599]: no method named `foo` found for type `i32` in the current scope --> $DIR/issue-25385.rs:2:23 | +LL | macro_rules! foo { LL | ($e:expr) => { $e.foo() } | ^^^ method not found in `i32` ... LL | foo!(a); | ------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: no method named `foo` found for type `i32` in the current scope --> $DIR/issue-25385.rs:10:15 diff --git a/tests/ui/macros/issue-29084.stderr b/tests/ui/macros/issue-29084.stderr index 6e7474c5b3f74..de64f46747059 100644 --- a/tests/ui/macros/issue-29084.stderr +++ b/tests/ui/macros/issue-29084.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/issue-29084.rs:6:13 | +LL | macro_rules! foo { +... LL | bar(&mut $d); | --- ^^^^^^^ expected `u8`, found `&mut u8` | | @@ -17,7 +19,6 @@ LL | fn bar(d: u8) { } ... LL | foo!(0u8); | --------- in this macro invocation - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr b/tests/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr index 00139662d619b..9be3c6f88a67b 100644 --- a/tests/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr +++ b/tests/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr @@ -1,6 +1,8 @@ error: expected expression, found keyword `struct` --> $DIR/issue-34421-mac-expr-bad-stmt-good-add-semi.rs:3:9 | +LL | macro_rules! make_item { +LL | ($a:ident) => { LL | struct $a; | ^^^^^^ expected expression ... @@ -8,7 +10,6 @@ LL | make_item!(A) | ------------- in this macro invocation | = note: the macro call doesn't expand to an expression, but it can expand to a statement - = note: this error originates in the macro `make_item` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `;` to interpret the expansion as a statement | LL | make_item!(A); @@ -17,6 +18,8 @@ LL | make_item!(A); error: expected expression, found keyword `struct` --> $DIR/issue-34421-mac-expr-bad-stmt-good-add-semi.rs:3:9 | +LL | macro_rules! make_item { +LL | ($a:ident) => { LL | struct $a; | ^^^^^^ expected expression ... @@ -24,7 +27,6 @@ LL | make_item!(B) | ------------- in this macro invocation | = note: the macro call doesn't expand to an expression, but it can expand to a statement - = note: this error originates in the macro `make_item` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `;` to interpret the expansion as a statement | LL | make_item!(B); diff --git a/tests/ui/macros/issue-42954.stderr b/tests/ui/macros/issue-42954.stderr index d5a8a117f9a37..111376d8ecdd1 100644 --- a/tests/ui/macros/issue-42954.stderr +++ b/tests/ui/macros/issue-42954.stderr @@ -1,6 +1,8 @@ error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison --> $DIR/issue-42954.rs:7:19 | +LL | macro_rules! is_plainly_printable { +LL | ($i: ident) => { LL | $i as u32 < 0 | ^ - interpreted as generic arguments | | @@ -9,7 +11,6 @@ LL | $i as u32 < 0 LL | is_plainly_printable!(c); | ------------------------ in this macro invocation | - = note: this error originates in the macro `is_plainly_printable` (in Nightly builds, run with -Z macro-backtrace for more info) help: try comparing the cast value | LL | ($i as u32) < 0 diff --git a/tests/ui/macros/issue-51848.stderr b/tests/ui/macros/issue-51848.stderr index 30b64113d731e..fb9e28b57c586 100644 --- a/tests/ui/macros/issue-51848.stderr +++ b/tests/ui/macros/issue-51848.stderr @@ -1,6 +1,8 @@ error: invalid format string: expected `}` but string was terminated --> $DIR/issue-51848.rs:6:20 | +LL | macro_rules! macro_with_error { +LL | ( ) => { LL | println!("{"); | -^ expected `}` in format string | | @@ -10,7 +12,6 @@ LL | macro_with_error!(); | ------------------- in this macro invocation | = note: if you intended to print `{`, you can escape it using `{{` - = note: this error originates in the macro `macro_with_error` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid format string: unmatched `}` found --> $DIR/issue-51848.rs:18:15 diff --git a/tests/ui/macros/issue-6596-1.stderr b/tests/ui/macros/issue-6596-1.stderr index 92998abfa68cf..57eb39f8b78bf 100644 --- a/tests/ui/macros/issue-6596-1.stderr +++ b/tests/ui/macros/issue-6596-1.stderr @@ -1,6 +1,8 @@ error: cannot find macro parameter `$nonexistent` in this scope --> $DIR/issue-6596-1.rs:3:9 | +LL | macro_rules! e { +LL | ($inp:ident) => ( LL | $nonexistent | ^^^^^^^^^^^^ not found in this scope ... @@ -8,18 +10,17 @@ LL | e!(foo); | ------- in this macro invocation | = note: available metavariable names are: $inp - = note: this error originates in the macro `e` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find macro parameter `$x` in this scope --> $DIR/issue-6596-1.rs:10:9 | +LL | macro_rules! m { +LL | () => ( LL | $x | ^^ not found in this scope ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/issue-6596-2.stderr b/tests/ui/macros/issue-6596-2.stderr index e6281eb54270a..3c47269076828 100644 --- a/tests/ui/macros/issue-6596-2.stderr +++ b/tests/ui/macros/issue-6596-2.stderr @@ -1,13 +1,13 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `$` --> $DIR/issue-6596-2.rs:3:16 | +LL | macro_rules! g { +LL | ($inp:ident) => ( LL | { $inp $nonexistent } | ^^^^^^^^^^^^ expected one of 8 possible tokens ... LL | g!(foo); | ------- in this macro invocation - | - = note: this error originates in the macro `g` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-78325-inconsistent-resolution.stderr b/tests/ui/macros/issue-78325-inconsistent-resolution.stderr index 7c745040640ce..400c040cc3161 100644 --- a/tests/ui/macros/issue-78325-inconsistent-resolution.stderr +++ b/tests/ui/macros/issue-78325-inconsistent-resolution.stderr @@ -1,17 +1,19 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/issue-78325-inconsistent-resolution.rs:5:9 | +LL | macro_rules! define_other_core { +LL | ( ) => { LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_other_core!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `core` is ambiguous --> $DIR/issue-78325-inconsistent-resolution.rs:11:5 | +LL | macro_rules! define_other_core { +... LL | core::panic!(); | ^^^^ ambiguous name | @@ -26,11 +28,12 @@ LL | extern crate std as core; LL | define_other_core!(); | -------------------- in this macro invocation = help: use `crate::core` to refer to this crate unambiguously - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `core` is ambiguous --> $DIR/issue-78325-inconsistent-resolution.rs:12:7 | +LL | macro_rules! define_other_core { +... LL | ::core::panic!(); | ^^^^ ambiguous name | @@ -44,7 +47,6 @@ LL | extern crate std as core; ... LL | define_other_core!(); | -------------------- in this macro invocation - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/macros/issue-84195-lint-anon-const.stderr b/tests/ui/macros/issue-84195-lint-anon-const.stderr index d9042adfc375a..e0b84734e8a73 100644 --- a/tests/ui/macros/issue-84195-lint-anon-const.stderr +++ b/tests/ui/macros/issue-84195-lint-anon-const.stderr @@ -1,6 +1,7 @@ error: trailing semicolon in macro used in expression position --> $DIR/issue-84195-lint-anon-const.rs:8:14 | +LL | macro_rules! len { LL | () => { 0; }; | ^ ... @@ -14,7 +15,6 @@ note: the lint level is defined here | LL | #![deny(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error @@ -22,6 +22,7 @@ Future incompatibility report: Future breakage diagnostic: error: trailing semicolon in macro used in expression position --> $DIR/issue-84195-lint-anon-const.rs:8:14 | +LL | macro_rules! len { LL | () => { 0; }; | ^ ... @@ -35,5 +36,4 @@ note: the lint level is defined here | LL | #![deny(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr b/tests/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr index c395e0c9100d3..7ed69037c8c82 100644 --- a/tests/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr +++ b/tests/ui/macros/issue-84632-eager-expansion-recursion-limit.stderr @@ -1,6 +1,8 @@ error: recursion limit reached while expanding `concat!` --> $DIR/issue-84632-eager-expansion-recursion-limit.rs:8:28 | +LL | macro_rules! a { +... LL | (A, $($A:ident),*) => (concat!("", a!($($A),*))) | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -8,7 +10,6 @@ LL | a!(A, A, A, A, A, A, A, A, A, A, A); | ----------------------------------- in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "30"]` attribute to your crate (`issue_84632_eager_expansion_recursion_limit`) - = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/lint-trailing-macro-call.stderr b/tests/ui/macros/lint-trailing-macro-call.stderr index 1ff8c0c6f66f2..fb2eaa42b1eec 100644 --- a/tests/ui/macros/lint-trailing-macro-call.stderr +++ b/tests/ui/macros/lint-trailing-macro-call.stderr @@ -1,6 +1,8 @@ error: trailing semicolon in macro used in expression position --> $DIR/lint-trailing-macro-call.rs:7:25 | +LL | macro_rules! expand_it { +LL | () => { LL | #[cfg(false)] 25; | ^ ... @@ -12,7 +14,6 @@ LL | 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) error: aborting due to 1 previous error @@ -20,6 +21,8 @@ Future incompatibility report: Future breakage diagnostic: error: trailing semicolon in macro used in expression position --> $DIR/lint-trailing-macro-call.rs:7:25 | +LL | macro_rules! expand_it { +LL | () => { LL | #[cfg(false)] 25; | ^ ... @@ -31,5 +34,4 @@ LL | 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-adjacent-ident-on-token.stderr b/tests/ui/macros/macro-adjacent-ident-on-token.stderr index b13a3d45828d3..0b2c562c8ecc8 100644 --- a/tests/ui/macros/macro-adjacent-ident-on-token.stderr +++ b/tests/ui/macros/macro-adjacent-ident-on-token.stderr @@ -1,6 +1,8 @@ error: expected `{`, found identifier `foo` --> $DIR/macro-adjacent-ident-on-token.rs:6:21 | +LL | macro_rules! get_opt { +LL | ($tgt:expr, $field:ident) => { LL | if $tgt.has_$field() {} | ^^^^^^ expected `{` ... @@ -15,7 +17,6 @@ LL | if $tgt.has_$field() {} ... LL | get_opt!(bar, foo); | ------------------ in this macro invocation - = note: this error originates in the macro `get_opt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to write a method call | LL | if $tgt.has_.$field() {} diff --git a/tests/ui/macros/macro-backtrace-complex.default.stderr b/tests/ui/macros/macro-backtrace-complex.default.stderr index 6aae85c1501ad..48a4bf7eb64a9 100644 --- a/tests/ui/macros/macro-backtrace-complex.default.stderr +++ b/tests/ui/macros/macro-backtrace-complex.default.stderr @@ -1,35 +1,36 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/macro-backtrace-complex.rs:12:20 | +LL | macro_rules! pong { LL | () => { syntax error }; | ^^^^^ expected one of 8 possible tokens ... LL | pong!(); | ------- in this macro invocation - | - = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/macro-backtrace-complex.rs:12:20 | -LL | () => { syntax error }; - | ^^^^^ expected one of 8 possible tokens +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |_- this error originates in the macro `pong` which comes from the expansion of the macro `ping` ... -LL | ping!(); - | ------- in this macro invocation - | - = note: this error originates in the macro `pong` which comes from the expansion of the macro `ping` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | ping!(); + | ------- in this macro invocation error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/macro-backtrace-complex.rs:12:20 | -LL | () => { syntax error }; - | ^^^^^ expected one of 8 possible tokens +LL | / macro_rules! pong { +LL | | () => { syntax error }; + | | ^^^^^ expected one of 8 possible tokens +LL | | } + | |_- this error originates in the macro `pong` which comes from the expansion of the macro `deep` ... -LL | deep!(); - | ------- in this macro invocation - | - = note: this error originates in the macro `pong` which comes from the expansion of the macro `deep` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | deep!(); + | ------- in this macro invocation error: aborting due to 3 previous errors diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index 836098bd9c04e..cf0ec52980a59 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -1,46 +1,47 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:5:13 | +LL | macro_rules! fake_method_stmt { +LL | () => { LL | 1.fake() | ^^^^ method not found in `{integer}` ... LL | fake_method_stmt!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `fake_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:11:13 | +LL | macro_rules! fake_field_stmt { +LL | () => { LL | 1.fake | ^^^^ ... LL | fake_field_stmt!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `fake_field_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:17:15 | +LL | macro_rules! fake_anon_field_stmt { +LL | () => { LL | (1).0 | ^ ... LL | fake_anon_field_stmt!(); | ----------------------- in this macro invocation - | - = note: this error originates in the macro `fake_anon_field_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:41:15 | +LL | macro_rules! real_method_stmt { +LL | () => { LL | 2.0.neg() | ^^^ ... LL | real_method_stmt!(); | ------------------- in this macro invocation | - = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() @@ -49,46 +50,47 @@ LL | 2.0_f32.neg() error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 | +LL | macro_rules! fake_method_expr { +LL | () => { LL | 1.fake() | ^^^^ method not found in `{integer}` ... LL | let _ = fake_method_expr!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `fake_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:29:13 | +LL | macro_rules! fake_field_expr { +LL | () => { LL | 1.fake | ^^^^ ... LL | let _ = fake_field_expr!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `fake_field_expr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:35:15 | +LL | macro_rules! fake_anon_field_expr { +LL | () => { LL | (1).0 | ^ ... LL | let _ = fake_anon_field_expr!(); | ----------------------- in this macro invocation - | - = note: this error originates in the macro `fake_anon_field_expr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:47:15 | +LL | macro_rules! real_method_expr { +LL | () => { LL | 2.0.neg() | ^^^ ... LL | let _ = real_method_expr!(); | ------------------- in this macro invocation | - = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() diff --git a/tests/ui/macros/macro-backtrace-nested.stderr b/tests/ui/macros/macro-backtrace-nested.stderr index dadedfbe8f671..ad3969350d8a1 100644 --- a/tests/ui/macros/macro-backtrace-nested.stderr +++ b/tests/ui/macros/macro-backtrace-nested.stderr @@ -1,24 +1,28 @@ error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) - | ^^^^ not found in this scope +LL | / macro_rules! nested_expr { +LL | | () => (fake) + | | ^^^^ not found in this scope +LL | | +LL | | } + | |_- this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr` ... -LL | 1 + call_nested_expr!(); - | ------------------- in this macro invocation - | - = note: this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | 1 + call_nested_expr!(); + | ------------------- in this macro invocation error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) - | ^^^^ not found in this scope +LL | / macro_rules! nested_expr { +LL | | () => (fake) + | | ^^^^ not found in this scope +LL | | +LL | | } + | |_- this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr_sum` ... -LL | call_nested_expr_sum!(); - | ----------------------- in this macro invocation - | - = note: this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr_sum` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | call_nested_expr_sum!(); + | ----------------------- in this macro invocation error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-context.stderr b/tests/ui/macros/macro-context.stderr index f468f77ba657c..d8d17ab674d3a 100644 --- a/tests/ui/macros/macro-context.stderr +++ b/tests/ui/macros/macro-context.stderr @@ -34,24 +34,23 @@ LL | m!() => {} error: expected expression, found reserved keyword `typeof` --> $DIR/macro-context.rs:3:17 | +LL | macro_rules! m { LL | () => ( i ; typeof ); | ^^^^^^ expected expression ... LL | m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `i` in this scope --> $DIR/macro-context.rs:3:13 | +LL | macro_rules! m { LL | () => ( i ; typeof ); | ^ not found in this scope ... LL | let a: m!(); | ---- in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: a builtin type with a similar name exists | LL | () => ( i8 ; typeof ); @@ -60,17 +59,17 @@ LL | () => ( i8 ; typeof ); error[E0425]: cannot find value `i` in this scope --> $DIR/macro-context.rs:3:13 | +LL | macro_rules! m { LL | () => ( i ; typeof ); | ^ not found in this scope ... LL | let i = m!(); | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: trailing semicolon in macro used in expression position --> $DIR/macro-context.rs:3:15 | +LL | macro_rules! m { LL | () => ( i ; typeof ); | ^ ... @@ -80,7 +79,6 @@ LL | let i = m!(); = 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 `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 7 previous errors @@ -89,6 +87,7 @@ Future incompatibility report: Future breakage diagnostic: error: trailing semicolon in macro used in expression position --> $DIR/macro-context.rs:3:15 | +LL | macro_rules! m { LL | () => ( i ; typeof ); | ^ ... @@ -98,5 +97,4 @@ LL | let i = m!(); = 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 `m` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/macro-expansion-empty-span-147408.stderr b/tests/ui/macros/macro-expansion-empty-span-147408.stderr index 97eab0dc7233f..c64be0c436cdf 100644 --- a/tests/ui/macros/macro-expansion-empty-span-147408.stderr +++ b/tests/ui/macros/macro-expansion-empty-span-147408.stderr @@ -21,6 +21,8 @@ LL + for _ in dbg!([1, 2]) {} warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/macro-expansion-empty-span-147408.rs:11:16 | +LL | macro_rules! mac { +... LL | $e.into_iter() | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` ... @@ -29,7 +31,6 @@ LL | for _ in mac!(into_iter [1, 2]) {} | = warning: this changes meaning in Rust 2021 = note: for more information, see - = note: this warning originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-guard-matcher-recursion.stderr b/tests/ui/macros/macro-guard-matcher-recursion.stderr index e12b2de765100..96f0d07904d87 100644 --- a/tests/ui/macros/macro-guard-matcher-recursion.stderr +++ b/tests/ui/macros/macro-guard-matcher-recursion.stderr @@ -1,6 +1,8 @@ error: recursion limit reached while expanding `m!` --> $DIR/macro-guard-matcher-recursion.rs:6:13 | +LL | macro_rules! m { +LL | ($g : guard) => { LL | m!($g) | ^^^^^^ ... @@ -8,7 +10,6 @@ LL | m!(if x) | -------- in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`macro_guard_matcher_recursion`) - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-hygiene-help-issue-148580.stderr b/tests/ui/macros/macro-hygiene-help-issue-148580.stderr index 56e021078855e..7af1520c7ce90 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-148580.stderr +++ b/tests/ui/macros/macro-hygiene-help-issue-148580.stderr @@ -12,7 +12,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | let it = (); | ^^ - = note: this error originates in the macro `print_it` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-hygiene-help-issue-149604.stderr b/tests/ui/macros/macro-hygiene-help-issue-149604.stderr index 6df7c009e668b..13e2256c6c23c 100644 --- a/tests/ui/macros/macro-hygiene-help-issue-149604.stderr +++ b/tests/ui/macros/macro-hygiene-help-issue-149604.stderr @@ -1,6 +1,8 @@ error[E0425]: cannot find value `it` in this scope --> $DIR/macro-hygiene-help-issue-149604.rs:8:14 | +LL | macro_rules! let_it { {} => { let it = (); } } +... LL | let () = it; | ^^ not found in this scope | @@ -12,7 +14,6 @@ LL | macro_rules! let_it { {} => { let it = (); } } ... LL | let_it!(); | --------- in this macro invocation - = note: this error originates in the macro `let_it` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `it` in this scope --> $DIR/macro-hygiene-help-issue-149604.rs:3:50 @@ -31,7 +32,6 @@ LL | macro_rules! let_it { {} => { let it = (); } } ... LL | let_it!(); | --------- in this macro invocation - = note: this error originates in the macro `print_it` which comes from the expansion of the macro `let_it` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-hygiene-scope-15167.stderr b/tests/ui/macros/macro-hygiene-scope-15167.stderr index dbb0514ba1aab..cff1eb71e93fd 100644 --- a/tests/ui/macros/macro-hygiene-scope-15167.stderr +++ b/tests/ui/macros/macro-hygiene-scope-15167.stderr @@ -12,7 +12,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | for n in 0..1 { | ^ - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope --> $DIR/macro-hygiene-scope-15167.rs:6:25 @@ -28,7 +27,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | if let Some(n) = None { | ^ - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope --> $DIR/macro-hygiene-scope-15167.rs:6:25 @@ -44,7 +42,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | } else if let Some(n) = None { | ^ - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `n` in this scope --> $DIR/macro-hygiene-scope-15167.rs:6:25 @@ -60,7 +57,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | while let Some(n) = None { | ^ - = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/macros/macro-in-expression-context.stderr b/tests/ui/macros/macro-in-expression-context.stderr index 27d9490809a99..3bdef604ceda4 100644 --- a/tests/ui/macros/macro-in-expression-context.stderr +++ b/tests/ui/macros/macro-in-expression-context.stderr @@ -16,6 +16,8 @@ LL | foo!(); error: trailing semicolon in macro used in expression position --> $DIR/macro-in-expression-context.rs:5:29 | +LL | macro_rules! foo { +LL | () => { LL | assert_eq!("A", "A"); | ^ ... @@ -27,7 +29,6 @@ LL | 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) error: aborting due to 2 previous errors @@ -35,6 +36,8 @@ Future incompatibility report: Future breakage diagnostic: error: trailing semicolon in macro used in expression position --> $DIR/macro-in-expression-context.rs:5:29 | +LL | macro_rules! foo { +LL | () => { LL | assert_eq!("A", "A"); | ^ ... @@ -46,5 +49,4 @@ LL | 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/macros/macro-interpolation.stderr b/tests/ui/macros/macro-interpolation.stderr index bc24a15861295..3dc6ef6132d2a 100644 --- a/tests/ui/macros/macro-interpolation.stderr +++ b/tests/ui/macros/macro-interpolation.stderr @@ -1,6 +1,8 @@ error: expected identifier, found metavariable --> $DIR/macro-interpolation.rs:21:19 | +LL | macro_rules! qpath { +... LL | <$type as $trait>::$name | ^^^^^^ expected identifier, found metavariable ... @@ -9,8 +11,6 @@ LL | let _: qpath!(ty, ::Owned); | | | this macro call doesn't expand to a type | in this macro invocation - | - = note: this error originates in the macro `qpath` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-metavar-expr-concat/empty-input.stderr b/tests/ui/macros/macro-metavar-expr-concat/empty-input.stderr index e95032dd2478d..1e3f18ae0fe68 100644 --- a/tests/ui/macros/macro-metavar-expr-concat/empty-input.stderr +++ b/tests/ui/macros/macro-metavar-expr-concat/empty-input.stderr @@ -7,13 +7,12 @@ LL | () => { ${concat()} } error: expected expression, found `$` --> $DIR/empty-input.rs:6:13 | +LL | macro_rules! empty { LL | () => { ${concat()} } | ^ expected expression ... LL | let x = empty!(); | -------- in this macro invocation - | - = note: this error originates in the macro `empty` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-rules-attr-error.stderr b/tests/ui/macros/macro-rules-attr-error.stderr index 27527a2da7ef2..3a7f5a9f26fd0 100644 --- a/tests/ui/macros/macro-rules-attr-error.stderr +++ b/tests/ui/macros/macro-rules-attr-error.stderr @@ -1,13 +1,13 @@ error: local_attr: struct S; --> $DIR/macro-rules-attr-error.rs:5:9 | +LL | macro_rules! local_attr { +LL | attr() { $($body:tt)* } => { LL | compile_error!(concat!("local_attr: ", stringify!($($body)*))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | #[local_attr] | ------------- in this attribute macro expansion - | - = note: this error originates in the attribute macro `local_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: unnecessary `unsafe` on safe attribute invocation --> $DIR/macro-rules-attr-error.rs:63:3 diff --git a/tests/ui/macros/macro-rules-attr-infinite-recursion.stderr b/tests/ui/macros/macro-rules-attr-infinite-recursion.stderr index 7d9a94338f51f..327619dafa991 100644 --- a/tests/ui/macros/macro-rules-attr-infinite-recursion.stderr +++ b/tests/ui/macros/macro-rules-attr-infinite-recursion.stderr @@ -1,6 +1,8 @@ error: recursion limit reached while expanding `#[attr]` --> $DIR/macro-rules-attr-infinite-recursion.rs:6:9 | +LL | macro_rules! attr { +LL | attr() { $($body:tt)* } => { LL | #[attr] $($body)* | ^^^^^^^ ... @@ -8,7 +10,6 @@ LL | #[attr] | ------- in this attribute macro expansion | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`macro_rules_attr_infinite_recursion`) - = note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-rules-derive-error.stderr b/tests/ui/macros/macro-rules-derive-error.stderr index bf6f58a3686d2..b0962ea53c241 100644 --- a/tests/ui/macros/macro-rules-derive-error.stderr +++ b/tests/ui/macros/macro-rules-derive-error.stderr @@ -1,13 +1,13 @@ error: MyDerive: struct S1; --> $DIR/macro-rules-derive-error.rs:5:9 | +LL | macro_rules! MyDerive { +LL | derive() { $($body:tt)* } => { LL | compile_error!(concat!("MyDerive: ", stringify!($($body)*))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | #[derive(MyDerive)] | -------- in this derive macro expansion - | - = note: this error originates in the derive macro `MyDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find macro `MyDerive` in this scope --> $DIR/macro-rules-derive-error.rs:28:5 diff --git a/tests/ui/macros/macro-shadowing.stderr b/tests/ui/macros/macro-shadowing.stderr index cf2a57d6319dd..96992aee649a4 100644 --- a/tests/ui/macros/macro-shadowing.stderr +++ b/tests/ui/macros/macro-shadowing.stderr @@ -1,6 +1,8 @@ error: `macro_two` is already in scope --> $DIR/macro-shadowing.rs:14:5 | +LL | macro_rules! m1 { () => { +... LL | #[macro_use] | ^^^^^^^^^^^^ ... @@ -8,11 +10,12 @@ LL | m1!(); | ----- in this macro invocation | = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560) - = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `foo` is ambiguous --> $DIR/macro-shadowing.rs:19:1 | +LL | macro_rules! m1 { () => { +... LL | foo!(); | ^^^ ambiguous name | @@ -30,7 +33,6 @@ note: `foo` could also refer to the macro defined here | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro-span-issue-116502.stderr b/tests/ui/macros/macro-span-issue-116502.stderr index 024656e685f5b..ea0b2e85b2c04 100644 --- a/tests/ui/macros/macro-span-issue-116502.stderr +++ b/tests/ui/macros/macro-span-issue-116502.stderr @@ -1,35 +1,35 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/macro-span-issue-116502.rs:7:13 | +LL | macro_rules! m { +LL | () => { LL | _ | ^ not allowed in type signatures ... LL | struct S(m!(), T) | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/macro-span-issue-116502.rs:7:13 | +LL | macro_rules! m { +LL | () => { LL | _ | ^ not allowed in type signatures ... LL | T: Trait; | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/macro-span-issue-116502.rs:7:13 | +LL | macro_rules! m { +LL | () => { LL | _ | ^ not allowed in type signatures ... LL | struct S(m!(), T) | ---- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/macros/metavar-expressions/concat-hygiene.stderr b/tests/ui/macros/metavar-expressions/concat-hygiene.stderr index 9520f5182f4a7..2ef13306b3e33 100644 --- a/tests/ui/macros/metavar-expressions/concat-hygiene.stderr +++ b/tests/ui/macros/metavar-expressions/concat-hygiene.stderr @@ -1,6 +1,8 @@ error[E0425]: cannot find value `abcdef` in this scope --> $DIR/concat-hygiene.rs:5:10 | +LL | macro_rules! join { +LL | ($lhs:ident, $rhs:ident) => { LL | ${concat($lhs, $rhs)} | ^^^^^^^^^^^^^^^^^^^^ not found in this scope ... @@ -12,7 +14,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | let abcdef = 1; | ^^^^^^ - = note: this error originates in the macro `join` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/metavar-expressions/concat-raw-identifiers.stderr b/tests/ui/macros/metavar-expressions/concat-raw-identifiers.stderr index 7abab6a510358..236637f1fc0c9 100644 --- a/tests/ui/macros/metavar-expressions/concat-raw-identifiers.stderr +++ b/tests/ui/macros/metavar-expressions/concat-raw-identifiers.stderr @@ -83,13 +83,13 @@ LL | let ${concat($lhs, $rhs)}: () = (); error: expected pattern, found `$` --> $DIR/concat-raw-identifiers.rs:28:13 | +LL | macro_rules! no_params { +LL | () => { LL | let ${concat(r#abc, abc)}: () = (); | ^ expected pattern ... LL | no_params!(); | ------------ in this macro invocation - | - = note: this error originates in the macro `no_params` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 14 previous errors diff --git a/tests/ui/macros/metavar-expressions/concat-trace-errors.stderr b/tests/ui/macros/metavar-expressions/concat-trace-errors.stderr index a6fc67d415d9c..4f06cc0ed1f92 100644 --- a/tests/ui/macros/metavar-expressions/concat-trace-errors.stderr +++ b/tests/ui/macros/metavar-expressions/concat-trace-errors.stderr @@ -1,6 +1,8 @@ error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-trace-errors.rs:17:24 | +LL | macro_rules! post_expansion { +LL | ($a:literal) => { LL | const _: () = ${concat("hi", $a, "bye")}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -9,11 +11,12 @@ LL | post_expansion!("!"); | = note: this `${concat(..)}` invocation generated `hi!bye`, but '!' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `post_expansion` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-trace-errors.rs:31:24 | +LL | macro_rules! post_expansion_many { +LL | ($a:ident, $b:ident, $c:ident, $d:literal, $e:ident) => { LL | const _: () = ${concat($a, $b, $c, $d, $e)}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -22,7 +25,6 @@ LL | post_expansion_many!(a, b, c, ".d", e); | = note: this `${concat(..)}` invocation generated `abc.de`, but '.' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `post_expansion_many` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/metavar-expressions/concat-usage-errors.stderr b/tests/ui/macros/metavar-expressions/concat-usage-errors.stderr index 2ba81551289df..6bb06f5ca92a1 100644 --- a/tests/ui/macros/metavar-expressions/concat-usage-errors.stderr +++ b/tests/ui/macros/metavar-expressions/concat-usage-errors.stderr @@ -141,6 +141,8 @@ LL | const ${concat(FOO, $foo)}: i32 = 2; error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:45:14 | +LL | macro_rules! starting_number { +LL | ($ident:ident) => {{ LL | let ${concat("1", $ident)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^ ... @@ -149,11 +151,12 @@ LL | starting_number!(_abc); | = note: this `${concat(..)}` invocation generated `1_abc`, but '1' is neither '_' nor XID_Start = note: see for the definition of valid identifiers - = note: this error originates in the macro `starting_number` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:59:14 | +LL | macro_rules! starting_invalid_unicode { +LL | ($ident:ident) => {{ LL | let ${concat("\u{00BD}", $ident)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -162,11 +165,12 @@ LL | starting_invalid_unicode!(_abc); | = note: this `${concat(..)}` invocation generated `\u{00BD}_abc`, but '\' is neither '_' nor XID_Start = note: see for the definition of valid identifiers - = note: this error originates in the macro `starting_invalid_unicode` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:80:14 | +LL | macro_rules! ending_invalid_unicode { +LL | ($ident:ident) => {{ LL | let ${concat($ident, "\u{00BD}")}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -175,22 +179,23 @@ LL | ending_invalid_unicode!(_abc); | = note: this `${concat(..)}` invocation generated `_abc\u{00BD}`, but '\' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `ending_invalid_unicode` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected pattern, found `$` --> $DIR/concat-usage-errors.rs:96:13 | +LL | macro_rules! unsupported_literals { +LL | ($ident:ident) => {{ LL | let ${concat(_a, 'b')}: () = (); | ^ expected pattern ... LL | unsupported_literals!(_abc); | --------------------------- in this macro invocation - | - = note: this error originates in the macro `unsupported_literals` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:88:14 | +LL | macro_rules! empty { +LL | () => {{ LL | let ${concat("", "")}: () = (); | ^^^^^^^^^^^^^^^^ ... @@ -198,11 +203,12 @@ LL | empty!(); | -------- in this macro invocation | = note: this `${concat(..)}` invocation generated an empty ident - = note: this error originates in the macro `empty` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -211,11 +217,12 @@ LL | bad_literal_string!("\u{00BD}"); | = note: this `${concat(..)}` invocation generated `_foo\u{00BD}`, but '\' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -224,11 +231,12 @@ LL | bad_literal_string!("\x41"); | = note: this `${concat(..)}` invocation generated `_foo\x41`, but '\' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -237,11 +245,12 @@ LL | bad_literal_string!("🤷"); | = note: this `${concat(..)}` invocation generated `_foo🤷`, but '🤷' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -250,11 +259,12 @@ LL | bad_literal_string!("d[-_-]b"); | = note: this `${concat(..)}` invocation generated `_food[-_-]b`, but '[' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -263,11 +273,12 @@ LL | bad_literal_string!("-1"); | = note: this `${concat(..)}` invocation generated `_foo-1`, but '-' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -276,11 +287,12 @@ LL | bad_literal_string!("1.0"); | = note: this `${concat(..)}` invocation generated `_foo1.0`, but '.' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: `${concat(..)}` is not generating a valid identifier --> $DIR/concat-usage-errors.rs:131:16 | +LL | macro_rules! bad_literal_string { +LL | ($literal:literal) => { LL | const ${concat(_foo, $literal)}: () = (); | ^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -289,7 +301,6 @@ LL | bad_literal_string!("'1'"); | = note: this `${concat(..)}` invocation generated `_foo'1'`, but '\'' is not XID_Continue = note: see for the definition of valid identifiers - = note: this error originates in the macro `bad_literal_string` (in Nightly builds, run with -Z macro-backtrace for more info) error: metavariables of `${concat(..)}` must be of type `ident`, `literal` or `tt` --> $DIR/concat-usage-errors.rs:146:31 diff --git a/tests/ui/macros/metavar-expressions/count-empty-index-arg.stderr b/tests/ui/macros/metavar-expressions/count-empty-index-arg.stderr index e1f9d020b7f86..348ef3cd595d0 100644 --- a/tests/ui/macros/metavar-expressions/count-empty-index-arg.stderr +++ b/tests/ui/macros/metavar-expressions/count-empty-index-arg.stderr @@ -7,13 +7,12 @@ LL | ( $( $($t:ident),* );* ) => { ${count($t,)} } error: expected expression, found `$` --> $DIR/count-empty-index-arg.rs:7:35 | +LL | macro_rules! foo { LL | ( $( $($t:ident),* );* ) => { ${count($t,)} } | ^ expected expression ... LL | foo!(a, a; b, b); | ---------------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/metavar-expressions/usage-errors.stderr b/tests/ui/macros/metavar-expressions/usage-errors.stderr index 3d22e3ac4b30c..06b36de44a95a 100644 --- a/tests/ui/macros/metavar-expressions/usage-errors.stderr +++ b/tests/ui/macros/metavar-expressions/usage-errors.stderr @@ -13,13 +13,13 @@ LL | ( $i:ident ) => { ${ count($i) } }; error: missing `fn` or `struct` for function or struct definition --> $DIR/usage-errors.rs:28:30 | +LL | macro_rules! no_curly__no_rhs_dollar__round { LL | ( $( $i:ident ),* ) => { count(i) }; | ^^^^^ ... LL | no_curly__no_rhs_dollar__round !(a, b, c); | ----------------------------------------- in this macro invocation | - = note: this error originates in the macro `no_curly__no_rhs_dollar__round` (in Nightly builds, run with -Z macro-backtrace for more info) help: if you meant to call a macro, try | LL | ( $( $i:ident ),* ) => { count!(i) }; @@ -28,13 +28,13 @@ LL | ( $( $i:ident ),* ) => { count!(i) }; error: missing `fn` or `struct` for function or struct definition --> $DIR/usage-errors.rs:36:23 | +LL | macro_rules! no_curly__no_rhs_dollar__no_round { LL | ( $i:ident ) => { count(i) }; | ^^^^^ ... LL | no_curly__no_rhs_dollar__no_round !(a); | -------------------------------------- in this macro invocation | - = note: this error originates in the macro `no_curly__no_rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) help: if you meant to call a macro, try | LL | ( $i:ident ) => { count!(i) }; @@ -58,13 +58,12 @@ LL | const _: u32 = no_curly__rhs_dollar__no_round! (a); error[E0425]: cannot find function `count` in this scope --> $DIR/usage-errors.rs:51:23 | +LL | macro_rules! no_curly__rhs_dollar__no_round { LL | ( $i:ident ) => { count($i) }; | ^^^^^ not found in this scope ... LL | const _: u32 = no_curly__rhs_dollar__no_round! (a); | ----------------------------------- in this macro invocation - | - = note: this error originates in the macro `no_curly__rhs_dollar__no_round` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 7 previous errors diff --git a/tests/ui/macros/no-field-error-in-macro-expansion-for-generic.stderr b/tests/ui/macros/no-field-error-in-macro-expansion-for-generic.stderr index 600a569a84ce2..0a6b7fe255db4 100644 --- a/tests/ui/macros/no-field-error-in-macro-expansion-for-generic.stderr +++ b/tests/ui/macros/no-field-error-in-macro-expansion-for-generic.stderr @@ -1,6 +1,8 @@ error[E0609]: no field `trace` on type `&T` --> $DIR/no-field-error-in-macro-expansion-for-generic.rs:7:17 | +LL | macro_rules! log { +LL | ( $ctx:expr, $( $args:expr),* ) => { LL | if $ctx.trace { | ^^^^^ unknown field ... @@ -9,8 +11,6 @@ LL | fn wrap(context: &T) -> () LL | { LL | log!(context, "entered wrapper"); | -------------------------------- in this macro invocation - | - = note: this error originates in the macro `log` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/nonterminal-matching.stderr b/tests/ui/macros/nonterminal-matching.stderr index d01561415664c..8816d779e3b5b 100644 --- a/tests/ui/macros/nonterminal-matching.stderr +++ b/tests/ui/macros/nonterminal-matching.stderr @@ -1,6 +1,7 @@ error: no rules expected `item` metavariable --> $DIR/nonterminal-matching.rs:19:10 | +LL | macro complex_nonterminal($nt_item: item) { LL | macro n(a $nt_item b) { | --------------------- when calling this macro ... @@ -21,11 +22,12 @@ LL | complex_nonterminal!(enum E {}); = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens = note: see for more information = help: try using `:tt` instead in the macro definition - = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) error: no rules expected `expr` metavariable --> $DIR/nonterminal-matching.rs:32:35 | +LL | macro_rules! foo { +... LL | (expr $x:expr) => { bar!(expr $x); }; | ^^ no rules expected this token in macro call ... @@ -43,11 +45,12 @@ LL | (expr 3) => {}; = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens = note: see for more information = help: try using `:tt` instead in the macro definition - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: no rules expected `literal` metavariable --> $DIR/nonterminal-matching.rs:33:44 | +LL | macro_rules! foo { +... LL | (literal $x:literal) => { bar!(literal $x); }; | ^^ no rules expected this token in macro call ... @@ -65,11 +68,12 @@ LL | (literal 4) => {}; = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens = note: see for more information = help: try using `:tt` instead in the macro definition - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: no rules expected `path` metavariable --> $DIR/nonterminal-matching.rs:34:35 | +LL | macro_rules! foo { +... LL | (path $x:path) => { bar!(path $x); }; | ^^ no rules expected this token in macro call ... @@ -87,11 +91,12 @@ LL | (path a::b::c) => {}; = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens = note: see for more information = help: try using `:tt` instead in the macro definition - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: no rules expected `stmt` metavariable --> $DIR/nonterminal-matching.rs:35:35 | +LL | macro_rules! foo { +... LL | (stmt $x:stmt) => { bar!(stmt $x); }; | ^^ no rules expected this token in macro call ... @@ -109,7 +114,6 @@ LL | (stmt let abc = 0) => {}; = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens = note: see for more information = help: try using `:tt` instead in the macro definition - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/tests/ui/macros/private-struct-member-macro-access-25386.stderr b/tests/ui/macros/private-struct-member-macro-access-25386.stderr index d02a41848f478..e687c820b33e8 100644 --- a/tests/ui/macros/private-struct-member-macro-access-25386.stderr +++ b/tests/ui/macros/private-struct-member-macro-access-25386.stderr @@ -1,13 +1,13 @@ error[E0616]: field `c_object` of struct `Item` is private --> $DIR/private-struct-member-macro-access-25386.rs:20:16 | +LL | macro_rules! check_ptr_exist { +LL | ($var:expr, $member:ident) => ( LL | (*$var.c_object).$member.is_some() | ^^^^^^^^ private field ... LL | println!("{}", check_ptr_exist!(item, name)); | ---------------------------- in this macro invocation - | - = note: this error originates in the macro `check_ptr_exist` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/macros/reparse-expr-issue-139495.stderr b/tests/ui/macros/reparse-expr-issue-139495.stderr index e2e05d67ecc22..0a7b71a8c55ef 100644 --- a/tests/ui/macros/reparse-expr-issue-139495.stderr +++ b/tests/ui/macros/reparse-expr-issue-139495.stderr @@ -1,24 +1,22 @@ error: expected expression, found keyword `extern` --> $DIR/reparse-expr-issue-139495.rs:2:24 | +LL | macro_rules! m1 { LL | ($abi: literal) => { extern $abi } | ^^^^^^ expected expression ... LL | m1!(-2) | ------- in this macro invocation - | - = note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found keyword `extern` --> $DIR/reparse-expr-issue-139495.rs:6:21 | +LL | macro_rules! m2 { LL | ($abi: expr) => { extern $abi } | ^^^^^^ expected expression ... LL | m2!(-2) | ------- in this macro invocation - | - = note: this error originates in the macro `m2` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/repeated-macro-expansion-error.stderr b/tests/ui/macros/repeated-macro-expansion-error.stderr index f820fac144842..e17540596e2b0 100644 --- a/tests/ui/macros/repeated-macro-expansion-error.stderr +++ b/tests/ui/macros/repeated-macro-expansion-error.stderr @@ -1,6 +1,8 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/repeated-macro-expansion-error.rs:12:20 | +LL | macro_rules! impl_add { +... LL | S::f::(); | ^------- help: remove the unnecessary generics | | @@ -14,11 +16,12 @@ note: associated function defined here, with 0 generic parameters | LL | fn f() {} | ^ - = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/repeated-macro-expansion-error.rs:12:20 | +LL | macro_rules! impl_add { +... LL | S::f::(); | ^------- help: remove the unnecessary generics | | @@ -33,7 +36,6 @@ note: associated function defined here, with 0 generic parameters LL | fn f() {} | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/macros/restricted-shadowing-legacy.stderr b/tests/ui/macros/restricted-shadowing-legacy.stderr index b8865112ed52e..6183d8383dfc0 100644 --- a/tests/ui/macros/restricted-shadowing-legacy.stderr +++ b/tests/ui/macros/restricted-shadowing-legacy.stderr @@ -1,11 +1,15 @@ error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:101:13 | -LL | m!(); - | ^ ambiguous name +LL | / macro_rules! gen_gen_inner_invoc { () => { +LL | | gen_inner!(); +LL | | m!(); + | | ^ ambiguous name +LL | | }} + | |__________- this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` ... -LL | include!(); - | ---------- in this macro invocation +LL | include!(); + | ---------- in this macro invocation | = 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: `m` could refer to the macro defined here @@ -24,7 +28,6 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:139:42 @@ -52,11 +55,12 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:148:9 | +LL | macro_rules! include { () => { +... LL | m!(); | ^ ambiguous name ... @@ -80,11 +84,12 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:164:9 | +LL | macro_rules! include { () => { +... LL | m!(); | ^ ambiguous name ... @@ -108,16 +113,19 @@ LL | macro_rules! m { () => { Wrong } } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:180:13 | -LL | m!(); - | ^ ambiguous name +LL | / macro_rules! gen_gen_inner_invoc { () => { +LL | | gen_inner!(); +LL | | m!(); + | | ^ ambiguous name +LL | | }} + | |__________- this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` ... -LL | include!(); - | ---------- in this macro invocation +LL | include!(); + | ---------- in this macro invocation | = 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: `m` could refer to the macro defined here @@ -136,7 +144,6 @@ LL | macro_rules! m { () => { Wrong } } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:218:42 @@ -164,11 +171,12 @@ LL | macro_rules! m { () => { Wrong } } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:232:9 | +LL | macro_rules! include { () => { +... LL | m!(); | ^ ambiguous name ... @@ -192,7 +200,6 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:262:42 @@ -220,7 +227,6 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/tests/ui/macros/restricted-shadowing-modern.stderr b/tests/ui/macros/restricted-shadowing-modern.stderr index 27665bfc31044..4cb9762f279b5 100644 --- a/tests/ui/macros/restricted-shadowing-modern.stderr +++ b/tests/ui/macros/restricted-shadowing-modern.stderr @@ -1,11 +1,15 @@ error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:104:17 | -LL | m!(); - | ^ ambiguous name +LL | / macro gen_gen_inner_invoc() { +LL | | gen_inner!(); +LL | | m!(); + | | ^ ambiguous name +LL | | } + | |_____________- this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` ... -LL | include!(); - | ---------- in this macro invocation +LL | include!(); + | ---------- in this macro invocation | = 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: `m` could refer to the macro defined here @@ -24,7 +28,6 @@ LL | macro m() {} ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:147:33 @@ -52,11 +55,12 @@ LL | macro m() {} ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:156:13 | +LL | macro include() { +... LL | m!(); | ^ ambiguous name ... @@ -80,11 +84,12 @@ LL | macro m() {} ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:172:13 | +LL | macro include() { +... LL | m!(); | ^ ambiguous name ... @@ -108,16 +113,19 @@ LL | macro m() { Wrong } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:190:17 | -LL | m!(); - | ^ ambiguous name +LL | / macro gen_gen_inner_invoc() { +LL | | gen_inner!(); +LL | | m!(); + | | ^ ambiguous name +LL | | } + | |_____________- this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` ... -LL | include!(); - | ---------- in this macro invocation +LL | include!(); + | ---------- in this macro invocation | = 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: `m` could refer to the macro defined here @@ -136,7 +144,6 @@ LL | macro m() { Wrong } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:233:33 @@ -164,7 +171,6 @@ LL | macro m() { Wrong } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/tests/ui/macros/span-covering-argument-1.stderr b/tests/ui/macros/span-covering-argument-1.stderr index 9ad2bc73a4ff5..dd2213be59329 100644 --- a/tests/ui/macros/span-covering-argument-1.stderr +++ b/tests/ui/macros/span-covering-argument-1.stderr @@ -1,13 +1,14 @@ error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable --> $DIR/span-covering-argument-1.rs:5:14 | +LL | macro_rules! bad { +... LL | *&mut $s = 0; | ^^^^^^^ cannot borrow as mutable ... LL | bad!(foo whatever); | ------------------ in this macro invocation | - = note: this error originates in the macro `bad` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider changing this to be mutable | LL | let mut $s = 0; diff --git a/tests/ui/macros/syntax-error-recovery.stderr b/tests/ui/macros/syntax-error-recovery.stderr index a2059aa1aa802..b73727b9b9fa1 100644 --- a/tests/ui/macros/syntax-error-recovery.stderr +++ b/tests/ui/macros/syntax-error-recovery.stderr @@ -1,6 +1,8 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `ty` metavariable --> $DIR/syntax-error-recovery.rs:7:26 | +LL | macro_rules! values { +... LL | $token $($inner)? = $value, | ^^^^^^ expected one of `(`, `,`, `=`, `{`, or `}` ... @@ -8,7 +10,6 @@ LL | values!(STRING(1) as (String) => cfg(test),); | -------------------------------------------- in this macro invocation | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - = note: this error originates in the macro `values` (in Nightly builds, run with -Z macro-backtrace for more info) error: macro expansion ignores `ty` metavariable and any tokens following --> $DIR/syntax-error-recovery.rs:7:26 diff --git a/tests/ui/macros/trace_faulty_macros.stderr b/tests/ui/macros/trace_faulty_macros.stderr index e90d7a98db4c7..fd1633dba6aff 100644 --- a/tests/ui/macros/trace_faulty_macros.stderr +++ b/tests/ui/macros/trace_faulty_macros.stderr @@ -11,7 +11,6 @@ LL | my_faulty_macro!(); | ------------------ in this macro invocation | = note: while trying to match end of macro - = note: this error originates in the macro `my_faulty_macro` (in Nightly builds, run with -Z macro-backtrace for more info) note: trace_macro --> $DIR/trace_faulty_macros.rs:31:5 @@ -26,6 +25,8 @@ LL | my_faulty_macro!(); error: recursion limit reached while expanding `my_recursive_macro!` --> $DIR/trace_faulty_macros.rs:22:9 | +LL | macro_rules! my_recursive_macro { +LL | () => { LL | my_recursive_macro!(); | ^^^^^^^^^^^^^^^^^^^^^ ... @@ -33,7 +34,6 @@ LL | my_recursive_macro!(); | --------------------- in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`trace_faulty_macros`) - = note: this error originates in the macro `my_recursive_macro` (in Nightly builds, run with -Z macro-backtrace for more info) note: trace_macro --> $DIR/trace_faulty_macros.rs:32:5 @@ -53,13 +53,13 @@ LL | my_recursive_macro!(); error: expected expression, found `pat` metavariable --> $DIR/trace_faulty_macros.rs:16:9 | +LL | macro_rules! pat_macro { +... LL | $a | ^^ expected expression ... LL | let a = pat_macro!(); | ------------ in this macro invocation - | - = note: this error originates in the macro `pat_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0774]: `derive` may only be applied to `struct`s, `enum`s and `union`s --> $DIR/trace_faulty_macros.rs:42:1 @@ -72,13 +72,13 @@ LL | fn use_derive_macro_as_attr() {} error: expected expression, found `pat` metavariable --> $DIR/trace_faulty_macros.rs:49:37 | +LL | macro_rules! test { +... LL | (($p:pat, $e:pat)) => {let $p = $e;}; | ^^ expected expression ... LL | test!(let x = 1+1); | ------------------ in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) note: trace_macro --> $DIR/trace_faulty_macros.rs:36:13 diff --git a/tests/ui/macros/typo-in-norepeat-expr-2.stderr b/tests/ui/macros/typo-in-norepeat-expr-2.stderr index 50d5dea040be9..406e00ed2a3e7 100644 --- a/tests/ui/macros/typo-in-norepeat-expr-2.stderr +++ b/tests/ui/macros/typo-in-norepeat-expr-2.stderr @@ -1,6 +1,8 @@ error: cannot find macro parameter `$follow` in this scope --> $DIR/typo-in-norepeat-expr-2.rs:6:10 | +LL | macro_rules! err { +... LL | [$follow] | ^------ | || @@ -9,19 +11,18 @@ LL | [$follow] ... LL | let _ = err![begin1 x end ig]; | ---------------------- in this macro invocation - | - = note: this error originates in the macro `err` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find macro parameter `$follo` in this scope --> $DIR/typo-in-norepeat-expr-2.rs:17:10 | +LL | macro_rules! err1 { +... LL | [$follo] | ^^^^^^ not found in this scope ... LL | let _ = err1![begin1 x end]; | -------------------- in this macro invocation | - = note: this error originates in the macro `err1` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a macro metavariable with a similar name in another macro matcher | LL | [$follow] @@ -30,6 +31,8 @@ LL | [$follow] error: cannot find macro parameter `$xyz` in this scope --> $DIR/typo-in-norepeat-expr-2.rs:28:10 | +LL | macro_rules! err2 { +... LL | [$xyz] | ^^^^ not found in this scope ... @@ -37,7 +40,6 @@ LL | let _ = err2![begin1 x end]; | -------------------- in this macro invocation | = note: available metavariable names are: $arg1 - = note: this error originates in the macro `err2` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/macros/typo-in-norepeat-expr.stderr b/tests/ui/macros/typo-in-norepeat-expr.stderr index 72fdac0e24cd3..8aa5814eba297 100644 --- a/tests/ui/macros/typo-in-norepeat-expr.stderr +++ b/tests/ui/macros/typo-in-norepeat-expr.stderr @@ -1,13 +1,14 @@ error: cannot find macro parameter `$arg` in this scope --> $DIR/typo-in-norepeat-expr.rs:4:10 | +LL | macro_rules! m { +LL | (begin $ard:ident end) => { LL | [$arg] | ^^^^ not found in this scope ... LL | let _ = m![begin x end]; | --------------- in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a macro metavariable with a similar name | LL - [$arg] diff --git a/tests/ui/mismatched_types/issue-26480.stderr b/tests/ui/mismatched_types/issue-26480.stderr index da8d73225f317..ec91caed5e940 100644 --- a/tests/ui/mismatched_types/issue-26480.stderr +++ b/tests/ui/mismatched_types/issue-26480.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/issue-26480.rs:16:19 | +LL | macro_rules! write { +... LL | write(stdout, $arr.as_ptr() as *const i8, | ----- arguments to this function are incorrect LL | $arr.len() * size_of($arr[0])); @@ -14,7 +16,6 @@ note: function defined here | LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64; | ^^^^^ ----- - = note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit | LL | ($arr.len() * size_of($arr[0])).try_into().unwrap()); @@ -23,13 +24,12 @@ LL | ($arr.len() * size_of($arr[0])).try_into().unwrap()); error[E0605]: non-primitive cast: `{integer}` as `()` --> $DIR/issue-26480.rs:22:19 | +LL | macro_rules! cast { LL | ($x:expr) => ($x as ()) | ^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object ... LL | cast!(2); | -------- in this macro invocation - | - = note: this error originates in the macro `cast` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr index d3b605fabf5c5..bfd3ad80bffbf 100644 --- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr @@ -314,10 +314,14 @@ LL | let &mut _a = 0; | ^^^^^^^ - this expression has type `{integer}` | | | expected integer, found `&mut _` - | help: to declare a mutable variable use: `mut _a` | = note: expected type `{integer}` found mutable reference `&mut _` +help: to declare a mutable variable use + | +LL - let &mut _a = 0; +LL + let mut _a = 0; + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:30:15 diff --git a/tests/ui/modules/issue-56411.stderr b/tests/ui/modules/issue-56411.stderr index 6732a8a3d7324..6e8912146883d 100644 --- a/tests/ui/modules/issue-56411.stderr +++ b/tests/ui/modules/issue-56411.stderr @@ -1,6 +1,8 @@ error[E0255]: the name `issue_56411_aux` is defined multiple times --> $DIR/issue-56411.rs:6:21 | +LL | macro_rules! import { +... LL | mod $name; | ---------- previous definition of the module `issue_56411_aux` here LL | pub use self::$name; @@ -13,11 +15,12 @@ LL | import!(("issue-56411-aux.rs", issue_56411_aux)); | ------------------------------------------------ in this macro invocation | = note: `issue_56411_aux` must be defined only once in the type namespace of this module - = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0365]: `issue_56411_aux` is only public within the crate, and cannot be re-exported outside --> $DIR/issue-56411.rs:6:21 | +LL | macro_rules! import { +... LL | pub use self::$name; | ^^^^^^^^^^^ re-export of crate public `issue_56411_aux` ... @@ -25,7 +28,6 @@ LL | import!(("issue-56411-aux.rs", issue_56411_aux)); | ------------------------------------------------ in this macro invocation | = note: consider declaring type or module `issue_56411_aux` with `pub` - = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr index 020713d03d34a..5de73060d41ad 100644 --- a/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr +++ b/tests/ui/never_type/fallback_change/lint-never-type-fallback-flowing-into-unsafe.stderr @@ -102,6 +102,8 @@ LL | S(marker::PhantomData).create_out_of_thin_air() error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:136:19 | +LL | macro_rules! msg_send { +LL | () => { LL | match send_message::<_ /* ?0 */>() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... @@ -109,7 +111,6 @@ LL | msg_send!(); | ----------- in this macro invocation | = help: specify the type explicitly - = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) warning: the type `!` does not permit zero-initialization --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:9:18 diff --git a/tests/ui/never_type/regress/never-in-range-pat.rs b/tests/ui/never_type/regress/never-in-range-pat.rs index 9b2847f882d2a..7631dd6fa3868 100644 --- a/tests/ui/never_type/regress/never-in-range-pat.rs +++ b/tests/ui/never_type/regress/never-in-range-pat.rs @@ -2,13 +2,12 @@ // // Make sure we don't ICE when there's `!` in a range pattern. // -// This shouldn't be allowed anyways, but we only deny it during MIR -// building, so make sure we handle it semi-gracefully during typeck. +// Report the invalid runtime endpoint during typeck, before MIR building. fn main() { let x: !; match 1 { 0..x => {} - //~^ ERROR only `char` and numeric types are allowed in range patterns + //~^ ERROR runtime values cannot be referenced in patterns } } diff --git a/tests/ui/never_type/regress/never-in-range-pat.stderr b/tests/ui/never_type/regress/never-in-range-pat.stderr index 977f486f598b7..a9f7aa5ed5cf5 100644 --- a/tests/ui/never_type/regress/never-in-range-pat.stderr +++ b/tests/ui/never_type/regress/never-in-range-pat.stderr @@ -1,11 +1,9 @@ -error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/never-in-range-pat.rs:11:12 +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/never-in-range-pat.rs:10:12 | LL | 0..x => {} - | - ^ this is of type `!` but it should be `char` or numeric - | | - | this is of type `{integer}` + | ^ references a runtime value error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0029`. +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index 6ddc059566539..acc3ecb865949 100644 --- a/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -237,6 +237,8 @@ LL | (true | false, None | Some(true error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 | +LL | macro_rules! t_or_f { +LL | () => { LL | (true | ^^^^ no value can reach this ... @@ -255,7 +257,6 @@ LL | (false, Some(true)) => {} | ---- matches some of the same values LL | (true | false, None | Some(t_or_f!())) => {} | --------- in this macro invocation - = note: this error originates in the macro `t_or_f` (in Nightly builds, run with -Z macro-backtrace for more info) error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:127:14 diff --git a/tests/ui/panic-handler/weak-lang-item.rs b/tests/ui/panic-handler/weak-lang-item.rs index 43a235fd6b418..6c3a5b2b271c2 100644 --- a/tests/ui/panic-handler/weak-lang-item.rs +++ b/tests/ui/panic-handler/weak-lang-item.rs @@ -8,6 +8,3 @@ extern crate core; //~ ERROR the name `core` is defined multiple times extern crate weak_lang_items; fn main() {} - -//~? ERROR `#[panic_handler]` function required, but not found -//~? ERROR unwinding panics are not supported without std diff --git a/tests/ui/panic-handler/weak-lang-item.stderr b/tests/ui/panic-handler/weak-lang-item.stderr index 5acd3e3187051..d7b453c96e488 100644 --- a/tests/ui/panic-handler/weak-lang-item.stderr +++ b/tests/ui/panic-handler/weak-lang-item.stderr @@ -10,13 +10,6 @@ help: you can use `as` to change the binding name of the import LL | extern crate core as other_core; | +++++++++++++ -error: `#[panic_handler]` function required, but not found - -error: unwinding panics are not supported without std - | - = help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding - = note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0259`. diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr index 8f4edca226d3b..de0f3c27bf726 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr @@ -13,13 +13,13 @@ LL + #[cfg(feature = 1)] error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `meta` metavariable --> $DIR/attr-bad-meta-4.rs:3:15 | +LL | macro_rules! mac { +LL | ($attr_item: meta) => { LL | #[cfg($attr_item)] | ^^^^^^^^^^ ... LL | mac!(an(arbitrary token stream)); | -------------------------------- in this macro invocation - | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.stderr b/tests/ui/parser/attribute/attr-unquoted-ident.stderr index 48ca499ba78fb..b7204a2669c2c 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.stderr +++ b/tests/ui/parser/attribute/attr-unquoted-ident.stderr @@ -34,13 +34,13 @@ LL | #[cfg(key="foo 1 bar 2.0 baz.")] error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found expression --> $DIR/attr-unquoted-ident.rs:28:38 | +LL | macro_rules! make { LL | ($name:ident) => { #[doc(alias = $name)] pub struct S; } | ^^^^^ expressions are not allowed here ... LL | make!(nickname); | --------------- in this macro invocation | - = note: this error originates in the macro `make` (in Nightly builds, run with -Z macro-backtrace for more info) help: surround the identifier with quotation marks to make it into a string literal | LL | ($name:ident) => { #[doc(alias = "$name")] pub struct S; } diff --git a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr index 41e7b5ab759dd..0e380ae4fd00e 100644 --- a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr +++ b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr @@ -1,6 +1,8 @@ error: expected `;`, found `#` --> $DIR/properly-recover-from-trailing-outer-attribute-in-body-2.rs:6:13 | +LL | macro_rules! the_macro { +LL | ( $foo:stmt ; $bar:stmt ; ) => { LL | #[cfg()] | -------- only `;` terminated statements or tail expressions are allowed after this attribute LL | $foo @@ -12,7 +14,6 @@ LL | #[cfg(false)] LL | the_macro!( (); (); ); | --------------------- in this macro invocation | - = note: this error originates in the macro `the_macro` (in Nightly builds, run with -Z macro-backtrace for more info) help: add `;` here | LL | $foo; diff --git a/tests/ui/parser/bad-interpolated-block.stderr b/tests/ui/parser/bad-interpolated-block.stderr index 651036c51c948..687ec36fe2021 100644 --- a/tests/ui/parser/bad-interpolated-block.stderr +++ b/tests/ui/parser/bad-interpolated-block.stderr @@ -1,6 +1,8 @@ error: cannot use a `block` macro fragment here --> $DIR/bad-interpolated-block.rs:5:15 | +LL | macro_rules! m { +LL | ($b:block) => { LL | 'lab: $b; | ------^^ | | @@ -9,7 +11,6 @@ LL | 'lab: $b; LL | m!({}); | ------ in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap this in another block | LL | 'lab: { $b }; @@ -18,6 +19,8 @@ LL | 'lab: { $b }; error: cannot use a `block` macro fragment here --> $DIR/bad-interpolated-block.rs:6:16 | +LL | macro_rules! m { +... LL | unsafe $b; | -------^^ | | @@ -26,7 +29,6 @@ LL | unsafe $b; LL | m!({}); | ------ in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap this in another block | LL | unsafe { $b }; @@ -35,13 +37,14 @@ LL | unsafe { $b }; error: cannot use a `block` macro fragment here --> $DIR/bad-interpolated-block.rs:7:23 | +LL | macro_rules! m { +... LL | |x: u8| -> () $b; | ^^ the `block` fragment is within this context ... LL | m!({}); | ------ in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap this in another block | LL | |x: u8| -> () { $b }; diff --git a/tests/ui/parser/bad-let-else-statement.stderr b/tests/ui/parser/bad-let-else-statement.stderr index 76fbbbb8c1e10..0c56be17b8756 100644 --- a/tests/ui/parser/bad-let-else-statement.stderr +++ b/tests/ui/parser/bad-let-else-statement.stderr @@ -243,13 +243,14 @@ LL ~ ) else { error: right curly brace `}` before `else` in a `let...else` statement not allowed --> $DIR/bad-let-else-statement.rs:190:25 | +LL | macro_rules! b { +... LL | let 0 = a! {} else { return; }; | ^ ... LL | b!(2); | ----- in this macro invocation | - = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) help: use parentheses instead of braces for this macro | LL - let 0 = a! {} else { return; }; diff --git a/tests/ui/parser/const-block-items/macro-stmt.stderr b/tests/ui/parser/const-block-items/macro-stmt.stderr index dce90e5daa4ca..0132a8f4b62c9 100644 --- a/tests/ui/parser/const-block-items/macro-stmt.stderr +++ b/tests/ui/parser/const-block-items/macro-stmt.stderr @@ -1,13 +1,13 @@ error: expected expression, found `` --> $DIR/macro-stmt.rs:7:9 | +LL | macro_rules! foo { +LL | ($item:item) => { LL | $item | ^^^^^ expected expression ... LL | foo!(const {}); | -------------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/float-field-interpolated.stderr b/tests/ui/parser/float-field-interpolated.stderr index e2b7e3a7dbe75..6e227e54d5938 100644 --- a/tests/ui/parser/float-field-interpolated.stderr +++ b/tests/ui/parser/float-field-interpolated.stderr @@ -1,46 +1,46 @@ error: unexpected token: `literal` metavariable --> $DIR/float-field-interpolated.rs:8:13 | +LL | macro_rules! generate_field_accesses { +... LL | { s.$b; } | ^^ ... LL | generate_field_accesses!(1.1, 1.1, 1.1); | --------------------------------------- in this macro invocation - | - = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected one of `.`, `;`, `?`, `}`, or an operator, found `literal` metavariable --> $DIR/float-field-interpolated.rs:8:13 | +LL | macro_rules! generate_field_accesses { +... LL | { s.$b; } | ^^ expected one of `.`, `;`, `?`, `}`, or an operator ... LL | generate_field_accesses!(1.1, 1.1, 1.1); | --------------------------------------- in this macro invocation - | - = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) error: unexpected token: `expr` metavariable --> $DIR/float-field-interpolated.rs:10:13 | +LL | macro_rules! generate_field_accesses { +... LL | { s.$c; } | ^^ ... LL | generate_field_accesses!(1.1, 1.1, 1.1); | --------------------------------------- in this macro invocation - | - = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected one of `.`, `;`, `?`, `}`, or an operator, found `expr` metavariable --> $DIR/float-field-interpolated.rs:10:13 | +LL | macro_rules! generate_field_accesses { +... LL | { s.$c; } | ^^ expected one of `.`, `;`, `?`, `}`, or an operator ... LL | generate_field_accesses!(1.1, 1.1, 1.1); | --------------------------------------- in this macro invocation - | - = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index b2367ce15ea8a..89036b8b44b43 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -1,13 +1,14 @@ error: invalid `struct` delimiters or `fn` call arguments --> $DIR/issue-44406.rs:3:9 | +LL | macro_rules! foo { +LL | ($rest: tt) => { LL | bar(baz: $rest) | ^^^^^^^^^^^^^^^ ... LL | foo!(true); | ---------- in this macro invocation | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: if `bar` is a struct, use braces as delimiters | LL - bar(baz: $rest) diff --git a/tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr b/tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr index fdef8ff6df923..d091006d82df5 100644 --- a/tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr +++ b/tests/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr @@ -9,6 +9,8 @@ LL | struct BadS; error: enum is not supported in `trait`s or `impl`s --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9 | +LL | macro_rules! expand_to_enum { +LL | () => { LL | enum BadE {} | ^^^^^^^^^ ... @@ -16,7 +18,6 @@ LL | expand_to_enum!(); | ----------------- in this macro invocation | = help: consider moving the enum out to a nearby module scope - = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info) error: struct is not supported in `trait`s or `impl`s --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:31:5 @@ -29,6 +30,8 @@ LL | struct BadS; error: enum is not supported in `trait`s or `impl`s --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9 | +LL | macro_rules! expand_to_enum { +LL | () => { LL | enum BadE {} | ^^^^^^^^^ ... @@ -36,7 +39,6 @@ LL | expand_to_enum!(); | ----------------- in this macro invocation | = help: consider moving the enum out to a nearby module scope - = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info) error: struct is not supported in `extern` blocks --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:42:5 @@ -49,6 +51,8 @@ LL | struct BadS; error: enum is not supported in `extern` blocks --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9 | +LL | macro_rules! expand_to_enum { +LL | () => { LL | enum BadE {} | ^^^^^^^^^ ... @@ -56,7 +60,6 @@ LL | expand_to_enum!(); | ----------------- in this macro invocation | = help: consider moving the enum out to a nearby module scope - = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr index 59e1b64686b46..a2ad6e619adad 100644 --- a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr +++ b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr @@ -1,6 +1,8 @@ error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:6:13 | +LL | macro_rules! mac1 { +LL | ($eval:expr) => { LL | let mut $eval = (); | ^^^^ ... @@ -8,7 +10,6 @@ LL | mac1! { does_not_exist!() } | --------------------------- in this macro invocation | = note: `mut` may be followed by `variable` and `variable @ pattern` - = note: this error originates in the macro `mac1` (in Nightly builds, run with -Z macro-backtrace for more info) help: remove the `mut` prefix | LL - let mut $eval = (); @@ -18,17 +19,19 @@ LL + let $eval = (); error: expected identifier, found metavariable --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17 | +LL | macro_rules! mac2 { +LL | ($eval:pat) => { LL | let mut $eval = (); | ^^^^^ expected identifier, found metavariable ... LL | mac2! { does_not_exist!() } | --------------------------- in this macro invocation - | - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13 | +LL | macro_rules! mac2 { +LL | ($eval:pat) => { LL | let mut $eval = (); | ^^^^ ... @@ -36,7 +39,6 @@ LL | mac2! { does_not_exist!() } | --------------------------- in this macro invocation | = note: `mut` may be followed by `variable` and `variable @ pattern` - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) help: remove the `mut` prefix | LL - let mut $eval = (); diff --git a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr index a68fae1a36ec8..d611ba247bfd7 100644 --- a/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr +++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr @@ -1,6 +1,8 @@ error: missing condition for `if` expression --> $DIR/issue-68091-unicode-ident-after-if.rs:3:13 | +LL | macro_rules! x { +LL | ($($c:tt)*) => { LL | $($c)ö* {} | ^ - if this block is the condition of the `if` expression, then it must be followed by another block | | @@ -8,8 +10,6 @@ LL | $($c)ö* {} ... LL | x!(if); | ------ in this macro invocation - | - = note: this error originates in the macro `x` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr index f967d4a8b3e01..bd931a484e8fc 100644 --- a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr +++ b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr @@ -24,13 +24,14 @@ LL | fn y<'a>(y: &mut ('a + Send)) { error: lifetime must precede `mut` --> $DIR/issue-73568-lifetime-after-mut.rs:6:22 | +LL | macro_rules! mac { +LL | ($lt:lifetime) => { LL | fn w<$lt>(w: &mut $lt i32) {} | ^^^^^^^^ ... LL | mac!('a); | -------- in this macro invocation | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: place the lifetime before `mut` | LL - fn w<$lt>(w: &mut $lt i32) {} diff --git a/tests/ui/parser/issues/issue-87812-path.stderr b/tests/ui/parser/issues/issue-87812-path.stderr index fbe26ea39595a..df734726a7474 100644 --- a/tests/ui/parser/issues/issue-87812-path.stderr +++ b/tests/ui/parser/issues/issue-87812-path.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/issue-87812-path.rs:3:24 | +LL | macro_rules! foo { +LL | ( $f:path ) => {{ LL | let _: usize = $f; | ----- ^^ expected `usize`, found `Baz` | | @@ -8,8 +10,6 @@ LL | let _: usize = $f; ... LL | foo!(Baz); | --------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87812.stderr b/tests/ui/parser/issues/issue-87812.stderr index 35dc66a528a99..f41b4a2e3bd55 100644 --- a/tests/ui/parser/issues/issue-87812.stderr +++ b/tests/ui/parser/issues/issue-87812.stderr @@ -1,6 +1,8 @@ error: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression --> $DIR/issue-87812.rs:6:13 | +LL | macro_rules! foo { +... LL | break '_l $f; | ^^^^^^^^^^^^ ... @@ -12,7 +14,6 @@ note: the lint level is defined here | LL | #![deny(break_with_label_and_loop)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap this expression in parentheses | LL | break '_l ($f); diff --git a/tests/ui/parser/labeled-no-colon-expr.stderr b/tests/ui/parser/labeled-no-colon-expr.stderr index 2478319281569..d5f0bb0b0e840 100644 --- a/tests/ui/parser/labeled-no-colon-expr.stderr +++ b/tests/ui/parser/labeled-no-colon-expr.stderr @@ -83,6 +83,8 @@ LL | 'l4: 0; error: cannot use a `block` macro fragment here --> $DIR/labeled-no-colon-expr.rs:11:17 | +LL | macro_rules! m { +LL | ($b:block) => { LL | 'l5 $b; | ----^^ | | @@ -91,7 +93,6 @@ LL | 'l5 $b; LL | m!({}); | ------ in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap this in another block | LL | 'l5 { $b }; diff --git a/tests/ui/parser/macro/break-in-unlabeled-block-in-macro.stderr b/tests/ui/parser/macro/break-in-unlabeled-block-in-macro.stderr index 2f46cb36750be..b0c1bf492e669 100644 --- a/tests/ui/parser/macro/break-in-unlabeled-block-in-macro.stderr +++ b/tests/ui/parser/macro/break-in-unlabeled-block-in-macro.stderr @@ -1,24 +1,24 @@ error[E0268]: `break` outside of a loop or labeled block --> $DIR/break-in-unlabeled-block-in-macro.rs:3:9 | +LL | macro_rules! foo { +LL | () => { LL | break (); | ^^^^^^^^ cannot `break` outside of a loop or labeled block ... LL | foo!(); | ------ in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0268]: `break` outside of a loop or labeled block --> $DIR/break-in-unlabeled-block-in-macro.rs:6:9 | +LL | macro_rules! foo { +... LL | break $e; | ^^^^^^^^ cannot `break` outside of a loop or labeled block ... LL | foo!(()); | -------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0268]: `break` outside of a loop or labeled block --> $DIR/break-in-unlabeled-block-in-macro.rs:33:17 @@ -29,24 +29,25 @@ LL | foo!(=> break ()); error[E0268]: `break` outside of a loop or labeled block --> $DIR/break-in-unlabeled-block-in-macro.rs:38:17 | +LL | macro_rules! bar { +LL | () => { LL | break () | ^^^^^^^^ cannot `break` outside of a loop or labeled block ... LL | bar!() | ------ in this macro invocation - | - = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0268]: `break` outside of a loop or labeled block --> $DIR/break-in-unlabeled-block-in-macro.rs:12:11 | +LL | macro_rules! foo { +... LL | { break $e; } | ^^^^^^^^ cannot `break` outside of a loop or labeled block ... LL | foo!(@ ()); | ---------- in this macro invocation | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider labeling this block to be able to break within it | LL | 'block: { break 'block $e; } diff --git a/tests/ui/parser/macro/issue-37113.stderr b/tests/ui/parser/macro/issue-37113.stderr index 560329df5ccbd..89944ec3e15cd 100644 --- a/tests/ui/parser/macro/issue-37113.stderr +++ b/tests/ui/parser/macro/issue-37113.stderr @@ -1,6 +1,8 @@ error: expected identifier, found metavariable --> $DIR/issue-37113.rs:4:16 | +LL | macro_rules! test_macro { +LL | ( $( $t:ty ),* $(),*) => { LL | enum SomeEnum { | -------- while parsing this enum LL | $( $t, )* @@ -10,7 +12,6 @@ LL | test_macro!(String,); | -------------------- in this macro invocation | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - = note: this error originates in the macro `test_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/issue-37234.stderr b/tests/ui/parser/macro/issue-37234.stderr index cd91ea441226a..2e8fecf81f7b4 100644 --- a/tests/ui/parser/macro/issue-37234.stderr +++ b/tests/ui/parser/macro/issue-37234.stderr @@ -1,13 +1,13 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `""` --> $DIR/issue-37234.rs:3:19 | +LL | macro_rules! failed { +LL | () => {{ LL | let x = 5 ""; | ^^ expected one of `.`, `;`, `?`, `else`, or an operator ... LL | failed!(); | --------- in this macro invocation - | - = note: this error originates in the macro `failed` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/lit-err-in-macro.stderr b/tests/ui/parser/macro/lit-err-in-macro.stderr index 08fe58643d40a..8661afc0aefc8 100644 --- a/tests/ui/parser/macro/lit-err-in-macro.stderr +++ b/tests/ui/parser/macro/lit-err-in-macro.stderr @@ -7,6 +7,8 @@ LL | f!("Foo"__); warning: `extern` declarations without an explicit ABI are deprecated --> $DIR/lit-err-in-macro.rs:3:9 | +LL | macro_rules! f { +LL | ($abi:literal) => { LL | extern $abi fn f() {} | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` ... @@ -14,7 +16,6 @@ LL | f!("Foo"__); | ----------- in this macro invocation | = note: `#[warn(missing_abi)]` on by default - = note: this warning originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/parser/macro/macro-attr-recovery.stderr b/tests/ui/parser/macro/macro-attr-recovery.stderr index e1f8dccf1b8c9..bc292b293ef5a 100644 --- a/tests/ui/parser/macro/macro-attr-recovery.stderr +++ b/tests/ui/parser/macro/macro-attr-recovery.stderr @@ -13,6 +13,8 @@ LL + attr($($args:tt)*) { $($body:tt)* } => { error: attr: args="" body="struct S;" --> $DIR/macro-attr-recovery.rs:8:9 | +LL | macro_rules! attr { +... LL | / compile_error!(concat!( LL | | "attr: args=\"", LL | | stringify!($($args)*), @@ -24,8 +26,6 @@ LL | | )); ... LL | #[attr] | ------- in this attribute macro expansion - | - = note: this error originates in the attribute macro `attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/parser/macro/macro-incomplete-parse.stderr b/tests/ui/parser/macro/macro-incomplete-parse.stderr index 096b5f718ae1c..17d49c66e0820 100644 --- a/tests/ui/parser/macro/macro-incomplete-parse.stderr +++ b/tests/ui/parser/macro/macro-incomplete-parse.stderr @@ -12,13 +12,12 @@ LL | ignored_item!(); error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` --> $DIR/macro-incomplete-parse.rs:10:14 | +LL | macro_rules! ignored_expr { LL | () => ( 1, | ^ expected one of `.`, `;`, `?`, `}`, or an operator ... LL | ignored_expr!(); | --------------- in this macro invocation - | - = note: this error originates in the macro `ignored_expr` (in Nightly builds, run with -Z macro-backtrace for more info) error: macro expansion ignores `,` and any tokens following --> $DIR/macro-incomplete-parse.rs:16:14 diff --git a/tests/ui/parser/macro/pub-item-macro.stderr b/tests/ui/parser/macro/pub-item-macro.stderr index 14f0b0908d1cb..c6d19cf819b41 100644 --- a/tests/ui/parser/macro/pub-item-macro.stderr +++ b/tests/ui/parser/macro/pub-item-macro.stderr @@ -1,6 +1,7 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-item-macro.rs:10:5 | +LL | macro_rules! pub_x { () => { LL | pub priv_x!(); | ^^^ ... @@ -8,7 +9,6 @@ LL | pub_x!(); | -------- in this macro invocation | = help: try adjusting the macro to put `pub` inside the invocation - = note: this error originates in the macro `pub_x` (in Nightly builds, run with -Z macro-backtrace for more info) help: remove the visibility | LL - pub priv_x!(); @@ -18,8 +18,15 @@ LL + priv_x!(); error[E0603]: static `x` is private --> $DIR/pub-item-macro.rs:20:23 | -LL | let y: u32 = foo::x; - | ^ private static +LL | / macro_rules! priv_x { +LL | | () => { +LL | | static x: u32 = 0; +LL | | }; +LL | | } + | |_- this error originates in the macro `priv_x` which comes from the expansion of the macro `pub_x` +... +LL | let y: u32 = foo::x; + | ^ private static | note: the static `x` is defined here --> $DIR/pub-item-macro.rs:5:9 @@ -29,7 +36,6 @@ LL | static x: u32 = 0; ... LL | pub_x!(); | -------- in this macro invocation - = note: this error originates in the macro `priv_x` which comes from the expansion of the macro `pub_x` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/parser/missing-semicolon.stderr b/tests/ui/parser/missing-semicolon.stderr index 4108cced366a6..fbd4a5985113c 100644 --- a/tests/ui/parser/missing-semicolon.stderr +++ b/tests/ui/parser/missing-semicolon.stderr @@ -1,13 +1,13 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found keyword `let` --> $DIR/missing-semicolon.rs:3:12 | +LL | macro_rules! m { +LL | ($($e1:expr),*; $($e2:expr),*) => { LL | $( let x = $e1 )*; | ^^^ expected one of `.`, `;`, `?`, `else`, or an operator ... LL | fn main() { m!(0, 0; 0, 0); } | -------------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index 4d5b3e77c05db..d070ad1805f9d 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -161,13 +161,13 @@ LL + let W(mut a, W(mut b, W(ref c, W(mut d, B { mut f })))) error: expected identifier, found metavariable --> $DIR/mut-patterns.rs:48:21 | +LL | macro_rules! foo { +LL | ($p:pat) => { LL | let mut $p = 0; | ^^ expected identifier, found metavariable ... LL | foo!(x); | ------- in this macro invocation - | - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 14 previous errors diff --git a/tests/ui/parser/recover/recover-pat-range-macro-span-overlap.stderr b/tests/ui/parser/recover/recover-pat-range-macro-span-overlap.stderr index 901a327980efa..502ab78a28383 100644 --- a/tests/ui/parser/recover/recover-pat-range-macro-span-overlap.stderr +++ b/tests/ui/parser/recover/recover-pat-range-macro-span-overlap.stderr @@ -1,6 +1,8 @@ error: expected a pattern range bound, found an expression --> $DIR/recover-pat-range-macro-span-overlap.rs:5:19 | +LL | macro_rules! m { +... LL | Bar = $value, | ___________________^ LL | | @@ -14,7 +16,6 @@ LL | m!(1); | ----- in this macro invocation | = note: arbitrary expressions are not allowed in patterns: - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index 436dad620a98c..e93b180143c15 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -285,13 +285,14 @@ LL + if let ..=.3 = 0 {} error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:153:17 | +LL | macro_rules! mac { +... LL | let ...$e; | ^^^ ... LL | mac!(0); | ------- in this macro invocation | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..=` instead | LL - let ...$e; @@ -301,6 +302,8 @@ LL + let ..=$e; error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:160:19 | +LL | macro_rules! mac { +... LL | let $e...; | ^^^ ... @@ -308,7 +311,6 @@ LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..` instead | LL - let $e...; @@ -318,6 +320,8 @@ LL + let $e..; error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:162:19 | +LL | macro_rules! mac { +... LL | let $e..=; | ^^^ ... @@ -325,7 +329,6 @@ LL | mac!(0); | ------- in this macro invocation | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..` instead | LL - let $e..=; @@ -412,6 +415,8 @@ LL | if let X... .0 = 0 {} error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:138:20 | +LL | macro_rules! mac2 { +... LL | let $e1...$e2; | ^^^ help: use `..=` for an inclusive range ... @@ -420,7 +425,6 @@ LL | mac2!(0, 1); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0029]: only `char` and numeric types are allowed in range patterns --> $DIR/recover-range-pats.rs:19:12 @@ -611,6 +615,8 @@ LL | if let ....3 = 0 {} error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:136:17 | +LL | macro_rules! mac2 { +LL | ($e1:expr, $e2:expr) => { LL | let $e1..$e2; | ^^^^^^^^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered ... @@ -620,11 +626,12 @@ LL | mac2!(0, 1); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:138:17 | +LL | macro_rules! mac2 { +... LL | let $e1...$e2; | ^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `2_i32..=i32::MAX` not covered ... @@ -634,11 +641,12 @@ LL | mac2!(0, 1); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:142:17 | +LL | macro_rules! mac2 { +... LL | let $e1..=$e2; | ^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `2_i32..=i32::MAX` not covered ... @@ -648,11 +656,12 @@ LL | mac2!(0, 1); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:151:17 | +LL | macro_rules! mac { +LL | ($e:expr) => { LL | let ..$e; | ^^^^ pattern `0_i32..=i32::MAX` not covered ... @@ -662,11 +671,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:153:17 | +LL | macro_rules! mac { +... LL | let ...$e; | ^^^^^ pattern `1_i32..=i32::MAX` not covered ... @@ -676,11 +686,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:156:17 | +LL | macro_rules! mac { +... LL | let ..=$e; | ^^^^^ pattern `1_i32..=i32::MAX` not covered ... @@ -690,11 +701,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:158:17 | +LL | macro_rules! mac { +... LL | let $e..; | ^^^^ pattern `i32::MIN..=-1_i32` not covered ... @@ -704,11 +716,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:160:17 | +LL | macro_rules! mac { +... LL | let $e...; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered ... @@ -718,11 +731,12 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding --> $DIR/recover-range-pats.rs:162:17 | +LL | macro_rules! mac { +... LL | let $e..=; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered ... @@ -732,7 +746,6 @@ LL | mac!(0); = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html = note: the matched value is of type `i32` - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 69 previous errors diff --git a/tests/ui/pattern/issue-92074-macro-ice.stderr b/tests/ui/pattern/issue-92074-macro-ice.stderr index 025592116e511..062cc10f87321 100644 --- a/tests/ui/pattern/issue-92074-macro-ice.stderr +++ b/tests/ui/pattern/issue-92074-macro-ice.stderr @@ -1,6 +1,7 @@ error: arbitrary expressions aren't allowed in patterns --> $DIR/issue-92074-macro-ice.rs:18:25 | +LL | macro_rules! make_vec { LL | () => { force_expr!(Vec::new()) } | ^^^^^^^^^^ ... @@ -8,11 +9,11 @@ LL | assert!(matches!(x, En::A(make_vec!()))); | ----------- in this macro invocation | = note: the `expr` fragment specifier forces the metavariable's content to be an expression - = note: this error originates in the macro `make_vec` (in Nightly builds, run with -Z macro-backtrace for more info) error: arbitrary expressions aren't allowed in patterns --> $DIR/issue-92074-macro-ice.rs:22:24 | +LL | macro_rules! make_pat { LL | () => { force_pat!(get_usize(), get_usize()) } | ^^^^^^^^^^^ ... @@ -20,11 +21,11 @@ LL | assert!(matches!(5, make_pat!())); | ----------- in this macro invocation | = note: the `expr` fragment specifier forces the metavariable's content to be an expression - = note: this error originates in the macro `make_pat` (in Nightly builds, run with -Z macro-backtrace for more info) error: arbitrary expressions aren't allowed in patterns --> $DIR/issue-92074-macro-ice.rs:22:37 | +LL | macro_rules! make_pat { LL | () => { force_pat!(get_usize(), get_usize()) } | ^^^^^^^^^^^ ... @@ -32,7 +33,6 @@ LL | assert!(matches!(5, make_pat!())); | ----------- in this macro invocation | = note: the `expr` fragment specifier forces the metavariable's content to be an expression - = note: this error originates in the macro `make_pat` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/rest-pat-semantic-disallowed.stderr b/tests/ui/pattern/rest-pat-semantic-disallowed.stderr index d3985b830c74a..e795ac606ce74 100644 --- a/tests/ui/pattern/rest-pat-semantic-disallowed.stderr +++ b/tests/ui/pattern/rest-pat-semantic-disallowed.stderr @@ -1,6 +1,7 @@ error: `..` patterns are not allowed here --> $DIR/rest-pat-semantic-disallowed.rs:8:13 | +LL | macro_rules! mk_pat { LL | () => { .. } | ^^ ... @@ -8,7 +9,6 @@ LL | let mk_pat!(); | --------- in this macro invocation | = note: only allowed in tuple, tuple struct, and slice patterns - = note: this error originates in the macro `mk_pat` (in Nightly builds, run with -Z macro-backtrace for more info) error: `..` patterns are not allowed here --> $DIR/rest-pat-semantic-disallowed.rs:16:9 diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.both.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.both.stderr new file mode 100644 index 0000000000000..b2b83a1c24f84 --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.both.stderr @@ -0,0 +1,11 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:29:9 + | +LL | start..=end => (), + | ^^^^^ ^^^ references a runtime value + | | + | references a runtime value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.chars.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.chars.stderr new file mode 100644 index 0000000000000..da20e76d9c75a --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.chars.stderr @@ -0,0 +1,9 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:20:11 + | +LL | ..y => (), + | ^ references a runtime value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.generic.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.generic.stderr new file mode 100644 index 0000000000000..88a9c54825808 --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.generic.stderr @@ -0,0 +1,9 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:10:11 + | +LL | ..y => smaller, + | ^ references a runtime value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.inferred.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.inferred.stderr new file mode 100644 index 0000000000000..96ec685a3f0cd --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.inferred.stderr @@ -0,0 +1,9 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:40:11 + | +LL | ..end => (), + | ^^^ references a runtime value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.late_inferred.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.late_inferred.stderr new file mode 100644 index 0000000000000..ffdb398b3cfd1 --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.late_inferred.stderr @@ -0,0 +1,9 @@ +error[E0080]: runtime values cannot be referenced in patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:68:11 + | +LL | ..end => (), + | ^^^ references a runtime value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.rs b/tests/ui/pattern/runtime-range-endpoints-issue-131327.rs new file mode 100644 index 0000000000000..c232d391b26ab --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.rs @@ -0,0 +1,74 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/131327. +//! A runtime range endpoint is invalid regardless of its type. + +//@ revisions: generic chars both inferred wrong_type late_inferred +#![allow(dead_code, unreachable_patterns, unused_variables)] + +#[cfg(generic)] +fn cmp(x: T, y: T, smaller: R, equal: R, greater: R) -> R { + match x { + ..y => smaller, + //[generic]~^ ERROR runtime values cannot be referenced in patterns + y => equal, + _ => greater, + } +} + +#[cfg(chars)] +fn chars(x: char, y: char) { + match x { + ..y => (), + //[chars]~^ ERROR runtime values cannot be referenced in patterns + _ => (), + } +} + +#[cfg(both)] +fn both(x: T, start: T, end: T) { + match x { + start..=end => (), + //[both]~^ ERROR runtime values cannot be referenced in patterns + // Both endpoints are labeled by the same diagnostic. + _ => (), + } +} + +#[cfg(inferred)] +fn inferred() { + let end = Default::default(); + match 0 { + ..end => (), + //[inferred]~^ ERROR runtime values cannot be referenced in patterns + _ => (), + } +} + +const LOWER: u8 = 1; +const UPPER: u8 = 9; +fn constants(x: u8) -> bool { + matches!(x, LOWER..=UPPER) +} + +#[cfg(wrong_type)] +fn wrong_type(x: bool) { + match x { + false..=true => (), + //[wrong_type]~^ ERROR only `char` and numeric types are allowed in range patterns + _ => (), + } +} + +#[cfg(late_inferred)] +fn late_inferred() { + #[derive(Default)] + struct Bound; + + let end = Default::default(); + match Bound { + ..end => (), + //[late_inferred]~^ ERROR runtime values cannot be referenced in patterns + _ => (), + } +} + +fn main() {} diff --git a/tests/ui/pattern/runtime-range-endpoints-issue-131327.wrong_type.stderr b/tests/ui/pattern/runtime-range-endpoints-issue-131327.wrong_type.stderr new file mode 100644 index 0000000000000..b96ba91d2657f --- /dev/null +++ b/tests/ui/pattern/runtime-range-endpoints-issue-131327.wrong_type.stderr @@ -0,0 +1,12 @@ +error[E0029]: only `char` and numeric types are allowed in range patterns + --> $DIR/runtime-range-endpoints-issue-131327.rs:55:9 + | +LL | false..=true => (), + | -----^^^---- + | | | + | | this is of type `bool` but it should be `char` or numeric + | this is of type `bool` but it should be `char` or numeric + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0029`. diff --git a/tests/ui/privacy/associated-item-privacy-inherent.stderr b/tests/ui/privacy/associated-item-privacy-inherent.stderr index f4d4ee459204d..8cb23cface4de 100644 --- a/tests/ui/privacy/associated-item-privacy-inherent.stderr +++ b/tests/ui/privacy/associated-item-privacy-inherent.stderr @@ -1,233 +1,229 @@ error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private --> $DIR/associated-item-privacy-inherent.rs:13:21 | +LL | pub macro mac() { LL | let value = Pub::method; | ^^^^^^^^^^^ private type ... LL | priv_nominal::mac!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private --> $DIR/associated-item-privacy-inherent.rs:15:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_nominal::mac!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `for<'a> fn(&'a priv_nominal::Pub) {priv_nominal::Pub::method}` is private --> $DIR/associated-item-privacy-inherent.rs:17:13 | +LL | pub macro mac() { +... LL | Pub.method(); | ^^^^^^ private type ... LL | priv_nominal::mac!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: associated constant `CONST` is private --> $DIR/associated-item-privacy-inherent.rs:19:9 | +LL | pub macro mac() { +... LL | Pub::CONST; | ^^^^^^^^^^ private associated constant ... LL | priv_nominal::mac!(); | -------------------- in this macro invocation - | - = note: this error originates in the macro `priv_nominal::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:37:21 | +LL | pub macro mac() { LL | let value = Pub::method; | ^^^^^^^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:39:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:41:13 | +LL | pub macro mac() { +... LL | Pub.method(loop {}); | ^^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:57:21 | +LL | pub macro mac() { LL | let value = Pub::method::; | ^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:59:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:61:9 | +LL | pub macro mac() { +... LL | Pub.method::(); | ^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:80:21 | +LL | pub macro mac() { LL | let value = ::method; | ^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:82:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:84:21 | +LL | pub macro mac() { +... LL | let value = Pub::method; | ^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:86:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:88:21 | +LL | pub macro mac() { +... LL | let value = ::static_method; | ^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:90:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:92:21 | +LL | pub macro mac() { +... LL | let value = Pub::static_method; | ^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:94:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:96:19 | +LL | pub macro mac() { +... LL | Pub(Priv).method(); | ^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:99:10 | +LL | pub macro mac() { +... LL | ::CONST; | ^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-inherent.rs:101:9 | +LL | pub macro mac() { +... LL | Pub::CONST; | ^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 21 previous errors diff --git a/tests/ui/privacy/associated-item-privacy-trait.stderr b/tests/ui/privacy/associated-item-privacy-trait.stderr index 4e9dfa4a83519..4dc96cc856c2a 100644 --- a/tests/ui/privacy/associated-item-privacy-trait.stderr +++ b/tests/ui/privacy/associated-item-privacy-trait.stderr @@ -1,332 +1,328 @@ error: type `for<'a> fn(&'a priv_trait::Pub) {::method}` is private --> $DIR/associated-item-privacy-trait.rs:15:21 | +LL | pub macro mac() { LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `for<'a> fn(&'a priv_trait::Pub) {::method}` is private --> $DIR/associated-item-privacy-trait.rs:17:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `for<'a> fn(&'a Self) {::method}` is private --> $DIR/associated-item-privacy-trait.rs:19:13 | +LL | pub macro mac() { +... LL | Pub.method(); | ^^^^^^ private type ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: associated constant `PrivTr::CONST` is private --> $DIR/associated-item-privacy-trait.rs:21:9 | +LL | pub macro mac() { +... LL | ::CONST; | ^^^^^^^^^^^^^^^^^^^^^^ private associated constant ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: associated type `PrivTr::AssocTy` is private --> $DIR/associated-item-privacy-trait.rs:23:16 | +LL | pub macro mac() { +... LL | let _: ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^ private associated type ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: associated type `PrivTr::AssocTy` is private --> $DIR/associated-item-privacy-trait.rs:25:34 | +LL | pub macro mac() { +... LL | pub type InSignatureTy = ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^ private associated type ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-trait.rs:27:34 | +LL | pub macro mac() { +... LL | pub trait InSignatureTr: PrivTr {} | ^^^^^^ private trait ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-trait.rs:29:14 | +LL | pub macro mac() { +... LL | impl PrivTr for u8 {} | ^^^^^^ private trait ... LL | priv_trait::mac!(); | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-trait.rs:46:21 | +LL | pub macro mac() { LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-trait.rs:48:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-trait.rs:50:13 | +LL | pub macro mac() { +... LL | Pub.method(loop {}); | ^^^^^^ private type ... LL | priv_signature::mac!(); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `priv_signature::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:67:21 | +LL | pub macro mac() { LL | let value = ::method::; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:69:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:71:9 | +LL | pub macro mac() { +... LL | Pub.method::(); | ^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_substs::mac!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:91:21 | +LL | pub macro mac() { LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:93:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:95:21 | +LL | pub macro mac() { +... LL | let value = >::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:97:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:99:9 | +LL | pub macro mac() { +... LL | Pub.method(); | ^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:102:21 | +LL | pub macro mac() { +... LL | let value = >::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:104:9 | +LL | pub macro mac() { +... LL | value; | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:106:9 | +LL | pub macro mac() { +... LL | Priv.method(); | ^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:109:9 | +LL | pub macro mac() { +... LL | ::CONST; | ^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:111:9 | +LL | pub macro mac() { +... LL | >::CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:113:9 | +LL | pub macro mac() { +... LL | >::CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:117:30 | +LL | pub macro mac() { +... LL | let _: >::AssocTy; | ^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:119:17 | +LL | pub macro mac() { +... LL | let _: >::AssocTy; | ^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:122:35 | +LL | pub macro mac() { +... LL | pub type InSignatureTy1 = ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:124:35 | +LL | pub macro mac() { +... LL | pub type InSignatureTy2 = >::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `priv_parent_substs::Priv` is private --> $DIR/associated-item-privacy-trait.rs:126:14 | +LL | pub macro mac() { +... LL | impl PubTr for u8 {} | ^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 30 previous errors diff --git a/tests/ui/privacy/associated-item-privacy-type-binding.stderr b/tests/ui/privacy/associated-item-privacy-type-binding.stderr index 52bfa3c2ab889..f51427abcfa05 100644 --- a/tests/ui/privacy/associated-item-privacy-type-binding.stderr +++ b/tests/ui/privacy/associated-item-privacy-type-binding.stderr @@ -1,178 +1,172 @@ error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:11:13 | +LL | pub macro mac1() { LL | let _: Box>; | ^ private trait ... LL | priv_trait::mac1!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:11:16 | +LL | pub macro mac1() { LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private trait ... LL | priv_trait::mac1!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:14:31 | +LL | pub macro mac1() { +... LL | type InSignatureTy2 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private trait ... LL | priv_trait::mac1!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:16:37 | +LL | pub macro mac1() { +... LL | trait InSignatureTr2: PubTr {} | ^^^^^^^^^^^^ private trait ... LL | priv_trait::mac1!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac1` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:20:13 | +LL | pub macro mac2() { LL | let _: Box>; | ^ private trait ... LL | priv_trait::mac2!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:20:16 | +LL | pub macro mac2() { LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private trait ... LL | priv_trait::mac2!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:23:31 | +LL | pub macro mac2() { +... LL | type InSignatureTy1 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private trait ... LL | priv_trait::mac2!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `PrivTr` is private --> $DIR/associated-item-privacy-type-binding.rs:25:31 | +LL | pub macro mac2() { +... LL | trait InSignatureTr1: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^ private trait ... LL | priv_trait::mac2!(); | ------------------- in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:44:13 | +LL | pub macro mac() { LL | let _: Box>; | ^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:44:16 | +LL | pub macro mac() { LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:47:13 | +LL | pub macro mac() { +... LL | let _: Box>; | ^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:47:16 | +LL | pub macro mac() { +... LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:50:35 | +LL | pub macro mac() { +... LL | pub type InSignatureTy1 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:52:35 | +LL | pub macro mac() { +... LL | pub type InSignatureTy2 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:54:31 | +LL | pub macro mac() { +... LL | trait InSignatureTr1: PubTrWithParam {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `Priv` is private --> $DIR/associated-item-privacy-type-binding.rs:56:37 | +LL | pub macro mac() { +... LL | trait InSignatureTr2: PubTr {} | ^^^^^^^^^^^^ private type ... LL | priv_parent_substs::mac!(); | -------------------------- in this macro invocation - | - = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 16 previous errors diff --git a/tests/ui/privacy/effective_visibilities_invariants.rs b/tests/ui/privacy/effective_visibilities_invariants.rs index af5a2bed6ab24..92cb24e9da7df 100644 --- a/tests/ui/privacy/effective_visibilities_invariants.rs +++ b/tests/ui/privacy/effective_visibilities_invariants.rs @@ -2,9 +2,9 @@ #![feature(staged_api)] //~ ERROR module has missing stability attribute -pub mod m {} //~ ERROR module has missing stability attribute +pub mod a {} //~ ERROR module has missing stability attribute -pub mod m { //~ ERROR the name `m` is defined multiple times +pub mod b { //~ ERROR module has missing stability attribute mod inner {} type Inner = u8; } diff --git a/tests/ui/privacy/effective_visibilities_invariants.stderr b/tests/ui/privacy/effective_visibilities_invariants.stderr index 97bee1e2d8d36..1ee25606cf27a 100644 --- a/tests/ui/privacy/effective_visibilities_invariants.stderr +++ b/tests/ui/privacy/effective_visibilities_invariants.stderr @@ -1,20 +1,9 @@ -error[E0428]: the name `m` is defined multiple times - --> $DIR/effective_visibilities_invariants.rs:7:1 - | -LL | pub mod m {} - | --------- previous definition of the module `m` here -LL | -LL | pub mod m { - | ^^^^^^^^^ `m` redefined here - | - = note: `m` must be defined only once in the type namespace of this module - error: module has missing stability attribute --> $DIR/effective_visibilities_invariants.rs:3:1 | LL | / #![feature(staged_api)] LL | | -LL | | pub mod m {} +LL | | pub mod a {} ... | LL | | fn main() {} | |____________^ @@ -22,9 +11,14 @@ LL | | fn main() {} error: module has missing stability attribute --> $DIR/effective_visibilities_invariants.rs:5:1 | -LL | pub mod m {} +LL | pub mod a {} + | ^^^^^^^^^ + +error: module has missing stability attribute + --> $DIR/effective_visibilities_invariants.rs:7:1 + | +LL | pub mod b { | ^^^^^^^^^ error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/privacy/private-inferred-type.stderr b/tests/ui/privacy/private-inferred-type.stderr index 0dfa799a4d95d..c63deda6d2a9c 100644 --- a/tests/ui/privacy/private-inferred-type.stderr +++ b/tests/ui/privacy/private-inferred-type.stderr @@ -109,68 +109,67 @@ LL | adjust::S1.method_s3(); error: type `fn() {priv_fn}` is private --> $DIR/private-inferred-type.rs:39:9 | +LL | pub macro m() { LL | priv_fn; | ^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `PrivEnum` is private --> $DIR/private-inferred-type.rs:41:9 | +LL | pub macro m() { +... LL | PrivEnum::Variant; | ^^^^^^^^^^^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `fn() {::method}` is private --> $DIR/private-inferred-type.rs:43:9 | +LL | pub macro m() { +... LL | ::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `fn(u8) -> PrivTupleStruct {PrivTupleStruct}` is private --> $DIR/private-inferred-type.rs:45:9 | +LL | pub macro m() { +... LL | PrivTupleStruct; | ^^^^^^^^^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private --> $DIR/private-inferred-type.rs:47:9 | +LL | pub macro m() { +... LL | PubTupleStruct; | ^^^^^^^^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `for<'a> fn(&'a Pub) {Pub::::priv_method}` is private --> $DIR/private-inferred-type.rs:49:18 | +LL | pub macro m() { +... LL | Pub(0u8).priv_method(); | ^^^^^^^^^^^ private type ... LL | m::m!(); | ------- in this macro invocation - | - = note: this error originates in the macro `m::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: trait `m::Trait` is private --> $DIR/private-inferred-type.rs:118:5 diff --git a/tests/ui/privacy/restricted/decl-macros.stderr b/tests/ui/privacy/restricted/decl-macros.stderr index c932bb5fe9416..9b2b3c5106fbf 100644 --- a/tests/ui/privacy/restricted/decl-macros.stderr +++ b/tests/ui/privacy/restricted/decl-macros.stderr @@ -1,24 +1,24 @@ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/decl-macros.rs:6:13 | +LL | pub macro mac() { +LL | struct A {} LL | pub(self) struct B {} | ^^^^ ... LL | crate::m::mac!(); | ---------------- in this macro invocation - | - = note: this error originates in the macro `crate::m::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/decl-macros.rs:7:16 | +LL | pub macro mac() { +... LL | pub(in crate::m) struct C {} | ^^^^^^^^ ... LL | crate::m::mac!(); | ---------------- in this macro invocation - | - = note: this error originates in the macro `crate::m::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr index 921284cd54583..3a018bdcf0ad9 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr @@ -14,6 +14,8 @@ LL + use empty_helper; error: cannot find attribute `empty_helper` in this scope --> $DIR/derive-helper-shadowing.rs:17:11 | +LL | macro_rules! gen_helper_use { +LL | () => { LL | #[empty_helper] | ^^^^^^^^^^^^ ... @@ -21,7 +23,6 @@ LL | gen_helper_use!(); | ----------------- in this macro invocation | = note: `empty_helper` is an attribute that can be used by the derive macro `Empty`, you might be missing a `derive` attribute - = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this attribute macro through its public re-export | LL + use empty_helper; diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr index 1e430d154c3e3..a5c6ef25056ce 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr @@ -26,6 +26,8 @@ LL + use crate::empty_helper; error: cannot find attribute `empty_helper` in this scope --> $DIR/derive-helper-shadowing.rs:17:11 | +LL | macro_rules! gen_helper_use { +LL | () => { LL | #[empty_helper] | ^^^^^^^^^^^^ ... @@ -33,7 +35,6 @@ LL | gen_helper_use!(); | ----------------- in this macro invocation | = note: `empty_helper` is an attribute that can be used by the derive macro `Empty`, you might be missing a `derive` attribute - = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this attribute macro through its public re-export | LL + use crate::empty_helper; diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr index e13a0add8f13b..5238b26a6a74a 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr @@ -6,8 +6,6 @@ LL | gen_macro_rules!(); ... LL | generated!(); | ------------ in this macro invocation - | - = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `local_use` in this scope --> $DIR/gen-macro-rules-hygiene.rs:13:1 @@ -23,7 +21,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | let local_use = 1; | ^^^^^^^^^ - = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) help: a local variable with a similar name exists | LL - gen_macro_rules!(); @@ -33,6 +30,8 @@ LL + local_def; error[E0425]: cannot find value `local_def` in this scope --> $DIR/gen-macro-rules-hygiene.rs:22:9 | +LL | gen_macro_rules!(); +... LL | local_def; | ^^^^^^^^^ not found in this scope | @@ -44,7 +43,6 @@ LL | gen_macro_rules!(); ... LL | generated!(); | ------------ in this macro invocation - = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) help: a local variable with a similar name exists | LL - local_def; diff --git a/tests/ui/proc-macro/macro-rules-derive.stderr b/tests/ui/proc-macro/macro-rules-derive.stderr index 05ad9e559ad1c..5697d3db830d1 100644 --- a/tests/ui/proc-macro/macro-rules-derive.stderr +++ b/tests/ui/proc-macro/macro-rules-derive.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find type `MissingType` in this scope --> $DIR/macro-rules-derive.rs:10:20 | +LL | macro_rules! produce_it { +... LL | field: MissingType | ^^^^^^^^^^^ not found in this scope ... LL | produce_it!(MyName); | ------------------- in this macro invocation - | - = note: this error originates in the macro `produce_it` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 6557b0a904f3e..0c1aaaebba581 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -96,6 +96,8 @@ LL + with_crate!{krate call proc_macro_rules} error[E0432]: unresolved import `$crate::proc_macro_item` --> $DIR/mixed-site-span.rs:62:28 | +LL | macro_rules! test {() => { +LL | // crate::proc_macro_item LL | invoke_with_ident!{$crate input proc_macro_item} | ^^^^^^^^^^^^^--------------- | | @@ -104,7 +106,6 @@ LL | invoke_with_ident!{$crate input proc_macro_item} LL | test!(); | ------- in this macro invocation | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: a similar name exists in the module | LL - invoke_with_ident!{$crate input proc_macro_item} @@ -114,6 +115,8 @@ LL + invoke_with_ident!{$crate input proc_macro_rules} error[E0432]: unresolved import `$crate::proc_macro_item` --> $DIR/mixed-site-span.rs:63:21 | +LL | macro_rules! test {() => { +... LL | with_crate!{$crate input proc_macro_item} | ^^^^^^^^^^^^^--------------- | | @@ -122,7 +125,6 @@ LL | with_crate!{$crate input proc_macro_item} LL | test!(); | ------- in this macro invocation | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: a similar name exists in the module | LL - with_crate!{$crate input proc_macro_item} @@ -271,6 +273,8 @@ LL + token_site_span::TokenItem as _ error[E0432]: unresolved import `$crate::TokenItem` --> $DIR/mixed-site-span.rs:101:28 | +LL | macro_rules! test {() => { +LL | // crate::TokenItem LL | invoke_with_ident!{$crate input TokenItem} | ^^^^^^^^^^^^^--------- | | @@ -279,7 +283,6 @@ LL | invoke_with_ident!{$crate input TokenItem} LL | test!(); | ------- in this macro invocation | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead | LL - invoke_with_ident!{$crate input TokenItem} @@ -289,6 +292,8 @@ LL + invoke_with_ident!{token_site_span::TokenItem as _} error[E0432]: unresolved import `$crate::TokenItem` --> $DIR/mixed-site-span.rs:102:21 | +LL | macro_rules! test {() => { +... LL | with_crate!{$crate input TokenItem} | ^^^^^^^^^^^^^--------- | | @@ -297,7 +302,6 @@ LL | with_crate!{$crate input TokenItem} LL | test!(); | ------- in this macro invocation | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead | LL - with_crate!{$crate input TokenItem} diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index ffbeef8f2a944..5d496ab9136a6 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -1,46 +1,48 @@ error: first final: "hello" --> $DIR/parent-source-spans.rs:17:12 | -LL | three!($a, $b); - | ^^ +LL | / macro two($a:expr, $b:expr) { +LL | | three!($a, $b); + | | ^^ +... | +LL | | } + | |_- this error originates in the macro `two` which comes from the expansion of the macro `one` ... -LL | one!("hello", "world"); - | ---------------------- in this macro invocation - | - = note: this error originates in the macro `two` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | one!("hello", "world"); + | ---------------------- in this macro invocation error: second final: "world" --> $DIR/parent-source-spans.rs:17:16 | -LL | three!($a, $b); - | ^^ +LL | / macro two($a:expr, $b:expr) { +LL | | three!($a, $b); + | | ^^ +... | +LL | | } + | |_- this error originates in the macro `two` which comes from the expansion of the macro `one` ... -LL | one!("hello", "world"); - | ---------------------- in this macro invocation - | - = note: this error originates in the macro `two` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | one!("hello", "world"); + | ---------------------- in this macro invocation error: first parent: "hello" --> $DIR/parent-source-spans.rs:11:5 | +LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); | ^^^^^^^^^^^^ ... LL | one!("hello", "world"); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) error: second parent: "world" --> $DIR/parent-source-spans.rs:11:5 | +LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); | ^^^^^^^^^^^^ ... LL | one!("hello", "world"); | ---------------------- in this macro invocation - | - = note: this error originates in the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) error: first grandparent: "hello" --> $DIR/parent-source-spans.rs:37:5 @@ -69,24 +71,22 @@ LL | one!("hello", "world"); error: first final: "yay" --> $DIR/parent-source-spans.rs:17:12 | +LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); | ^^ ... LL | two!("yay", "rust"); | ------------------- in this macro invocation - | - = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) error: second final: "rust" --> $DIR/parent-source-spans.rs:17:16 | +LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); | ^^ ... LL | two!("yay", "rust"); | ------------------- in this macro invocation - | - = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) error: first parent: "yay" --> $DIR/parent-source-spans.rs:43:5 diff --git a/tests/ui/proc-macro/weird-hygiene.stderr b/tests/ui/proc-macro/weird-hygiene.stderr index aa3ef9556eb16..a3c1e7b7671e6 100644 --- a/tests/ui/proc-macro/weird-hygiene.stderr +++ b/tests/ui/proc-macro/weird-hygiene.stderr @@ -17,6 +17,8 @@ LL | let hidden_ident = "Hello1"; error[E0425]: cannot find value `hidden_ident` in this scope --> $DIR/weird-hygiene.rs:35:13 | +LL | macro_rules! invoke_it { +... LL | hidden_ident | ^^^^^^^^^^^^ not found in this scope ... @@ -28,7 +30,6 @@ help: an identifier with the same name exists, but is not accessible due to macr | LL | let hidden_ident = "Hello1"; | ^^^^^^^^^^^^ - = note: this error originates in the macro `invoke_it` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/reborrow/coerce-shared-decl-macro-hygiene.stderr b/tests/ui/reborrow/coerce-shared-decl-macro-hygiene.stderr index 0c9d89dd009ec..4755ee557b742 100644 --- a/tests/ui/reborrow/coerce-shared-decl-macro-hygiene.stderr +++ b/tests/ui/reborrow/coerce-shared-decl-macro-hygiene.stderr @@ -1,6 +1,8 @@ error: implementing `CoerceShared` currently requires source and target to have at most one non-ZST reborrow data field --> $DIR/coerce-shared-decl-macro-hygiene.rs:24:5 | +LL | macro my_macro($field:ident) { +... LL | impl<'a> CoerceShared> for MyMut<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^---------^^^^^^---------^^^ | | | | @@ -12,7 +14,6 @@ LL | my_macro!(field); | ---------------- in this macro invocation | = note: this is a temporary restriction until `CoerceShared` lowering supports non-trivially memcpy-compatible field layouts - = note: this error originates in the macro `my_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/resolve/decl-macro-use-no-ice.stderr b/tests/ui/resolve/decl-macro-use-no-ice.stderr index 619a5737090e0..1f47f757f6153 100644 --- a/tests/ui/resolve/decl-macro-use-no-ice.stderr +++ b/tests/ui/resolve/decl-macro-use-no-ice.stderr @@ -1,6 +1,7 @@ error[E0364]: `f` is private, and cannot be re-exported --> $DIR/decl-macro-use-no-ice.rs:13:13 | +LL | pub macro m() { LL | use f; | ^ ... @@ -15,7 +16,6 @@ LL | use f; ... LL | foo::m!(); | --------- in this macro invocation - = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.stderr b/tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.stderr index c477e94ceb54f..678efdcaf6b22 100644 --- a/tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.stderr +++ b/tests/ui/resolve/dot-notation-type-namespace-suggest-path-sep.stderr @@ -79,6 +79,8 @@ LL + let _ = foo::bar; error[E0423]: cannot find value `Cell` in module `::std::cell` --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:22 | +LL | macro_rules! Type { +LL | () => { LL | ::std::cell::Cell | ^^^^ ... @@ -86,7 +88,6 @@ LL | Type!().get(); | ------- in this macro invocation | = note: a struct named `::std::cell::Cell` exists in another namespace - = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type!().get(); @@ -96,6 +97,8 @@ LL + ::get(); error[E0423]: cannot find value `Cell` in module `::std::cell` --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:22 | +LL | macro_rules! Type { +LL | () => { LL | ::std::cell::Cell | ^^^^ ... @@ -103,7 +106,6 @@ LL | Type! {}.get; | -------- in this macro invocation | = note: a struct named `::std::cell::Cell` exists in another namespace - = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type! {}.get; @@ -113,6 +115,8 @@ LL + ::get; error[E0423]: cannot find value `Alias` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:43:9 | +LL | macro_rules! Type { +... LL | Alias | ^^^^^ ... @@ -120,7 +124,6 @@ LL | Type!(alias).get(); | ------------ in this macro invocation | = note: a type alias named `Alias` exists in another namespace - = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type!(alias).get(); @@ -130,6 +133,8 @@ LL + ::get(); error[E0423]: cannot find value `Alias` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:43:9 | +LL | macro_rules! Type { +... LL | Alias | ^^^^^ ... @@ -137,7 +142,6 @@ LL | Type! {alias}.get; | ------------- in this macro invocation | = note: a type alias named `Alias` exists in another namespace - = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type! {alias}.get; @@ -147,6 +151,8 @@ LL + ::get; error[E0423]: cannot find value `Vec` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:52:9 | +LL | macro_rules! create { +LL | (type method) => { LL | Vec.new() | ^^^ ... @@ -154,7 +160,6 @@ LL | let _ = create!(type method); | -------------------- in this macro invocation | = note: a struct named `Vec` exists in another namespace - = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Vec.new() @@ -164,6 +169,8 @@ LL + Vec::new() error[E0423]: cannot find value `Vec` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:57:9 | +LL | macro_rules! create { +... LL | Vec.new | ^^^ ... @@ -171,7 +178,6 @@ LL | let _ = create!(type field); | ------------------- in this macro invocation | = note: a struct named `Vec` exists in another namespace - = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Vec.new @@ -181,14 +187,19 @@ LL + Vec::new error[E0423]: cannot find value `Cell` in module `::std::cell` --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:37:22 | -LL | ::std::cell::Cell - | ^^^^ +LL | / macro_rules! Type { +LL | | () => { +LL | | ::std::cell::Cell + | | ^^^^ +... | +LL | | }; +LL | | } + | |_- this error originates in the macro `Type` which comes from the expansion of the macro `create` ... -LL | let _ = create!(macro method); - | --------------------- in this macro invocation +LL | let _ = create!(macro method); + | --------------------- in this macro invocation | = note: a struct named `::std::cell::Cell` exists in another namespace - = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type!().new(0) @@ -198,14 +209,21 @@ LL + ::new(0) error[E0423]: cannot find value `Alias` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:43:9 | -LL | Alias - | ^^^^^ +LL | / macro_rules! Type { +LL | | () => { +LL | | ::std::cell::Cell +... | +LL | | Alias + | | ^^^^^ +... | +LL | | }; +LL | | } + | |_- this error originates in the macro `Type` which comes from the expansion of the macro `create` ... -LL | let _ = create!(macro method alias); - | --------------------------- in this macro invocation +LL | let _ = create!(macro method alias); + | --------------------------- in this macro invocation | = note: a type alias named `Alias` exists in another namespace - = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Type!(alias).new(0) @@ -231,6 +249,8 @@ LL + $Ty::foo error[E0423]: cannot find value `Alias` in this scope --> $DIR/dot-notation-type-namespace-suggest-path-sep.rs:79:9 | +LL | macro_rules! check_ident { +LL | ($Ident:ident) => { LL | Alias.$Ident | ^^^^^ ... @@ -238,7 +258,6 @@ LL | let _ = check_ident!(foo); | ----------------- in this macro invocation | = note: a type alias named `Alias` exists in another namespace - = note: this error originates in the macro `check_ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Alias.$Ident diff --git a/tests/crashes/123690.rs b/tests/ui/resolve/duplicated-enum-variant.rs similarity index 95% rename from tests/crashes/123690.rs rename to tests/ui/resolve/duplicated-enum-variant.rs index 3af70e20aee18..732726c5b7a25 100644 --- a/tests/crashes/123690.rs +++ b/tests/ui/resolve/duplicated-enum-variant.rs @@ -1,4 +1,6 @@ -//@ known-bug: #123690 +// Regression test for #123690. If we allow the compiler to advance past `rustc_resolve`, it causes +// an ICE. + fn more_discriminant_overflow() { pub enum Infallible {} @@ -229,7 +231,7 @@ fn more_discriminant_overflow() { _D5(X), _D6(X), _D7(X), - _D8(X), + _D8(X), //~ ERROR: the name `_D8` is defined multiple times _D9(X), _DA(X), _DB(X), @@ -276,3 +278,5 @@ fn more_discriminant_overflow() { if let E2::V1 { .. } = E2::V3:: {} } + +fn main() {} diff --git a/tests/ui/resolve/duplicated-enum-variant.stderr b/tests/ui/resolve/duplicated-enum-variant.stderr new file mode 100644 index 0000000000000..e52ec8b729b78 --- /dev/null +++ b/tests/ui/resolve/duplicated-enum-variant.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `_D8` is defined multiple times + --> $DIR/duplicated-enum-variant.rs:234:9 + | +LL | _D8(X), + | ------ previous definition of the type `_D8` here +... +LL | _D8(X), + | ^^^^^^ `_D8` redefined here + | + = note: `_D8` must be defined only once in the type namespace of this enum + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/resolve/duplicated-item-in-const-generics.rs b/tests/ui/resolve/duplicated-item-in-const-generics.rs new file mode 100644 index 0000000000000..b3903864e8dfb --- /dev/null +++ b/tests/ui/resolve/duplicated-item-in-const-generics.rs @@ -0,0 +1,8 @@ +// Regression test for #155482. If we allow the compiler to advance past `rustc_resolve`, it causes +// an ICE. +trait TraitA < AsA = impl TraitB < { //~ ERROR: cannot find trait `TraitB` in this scope +#[derive(Hash)] + enum A; //~ ERROR: expected `{}`, found `;` + struct A; //~ ERROR: the name `A` is defined multiple times +} +>> ; //~ ERROR: expected `{}`, found `;` diff --git a/tests/ui/resolve/duplicated-item-in-const-generics.stderr b/tests/ui/resolve/duplicated-item-in-const-generics.stderr new file mode 100644 index 0000000000000..e27137a3e6db4 --- /dev/null +++ b/tests/ui/resolve/duplicated-item-in-const-generics.stderr @@ -0,0 +1,36 @@ +error: expected `{}`, found `;` + --> $DIR/duplicated-item-in-const-generics.rs:5:9 + | +LL | enum A; + | ^ + | + = help: try using `{}` instead + +error: expected `{}`, found `;` + --> $DIR/duplicated-item-in-const-generics.rs:8:4 + | +LL | >> ; + | ^ + | + = help: try using `{}` instead + +error[E0428]: the name `A` is defined multiple times + --> $DIR/duplicated-item-in-const-generics.rs:6:3 + | +LL | enum A; + | ------- previous definition of the type `A` here +LL | struct A; + | ^^^^^^^^^^^^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this block + +error[E0405]: cannot find trait `TraitB` in this scope + --> $DIR/duplicated-item-in-const-generics.rs:3:27 + | +LL | trait TraitA < AsA = impl TraitB < { + | ^^^^^^ not found in this scope + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0405, E0428. +For more information about an error, try `rustc --explain E0405`. diff --git a/tests/ui/resolve/ice-inconsistent-resolution-149821.stderr b/tests/ui/resolve/ice-inconsistent-resolution-149821.stderr index cd75a2f3e19b7..a46d643ff9edc 100644 --- a/tests/ui/resolve/ice-inconsistent-resolution-149821.stderr +++ b/tests/ui/resolve/ice-inconsistent-resolution-149821.stderr @@ -1,13 +1,13 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/ice-inconsistent-resolution-149821.rs:10:9 | +LL | macro_rules! define_other_core { +LL | () => { LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_other_core! {} | --------------------- in this macro invocation - | - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/resolve/ice-on-shadowing-std-with-macro.stderr b/tests/ui/resolve/ice-on-shadowing-std-with-macro.stderr index 8bdf809775516..fb86d34eb0f25 100644 --- a/tests/ui/resolve/ice-on-shadowing-std-with-macro.stderr +++ b/tests/ui/resolve/ice-on-shadowing-std-with-macro.stderr @@ -1,13 +1,13 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/ice-on-shadowing-std-with-macro.rs:16:9 | +LL | macro_rules! define_other_core { +LL | () => { LL | extern crate core as std; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | define_other_core! {} | --------------------- in this macro invocation - | - = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: cannot find `collections` in `std` --> $DIR/ice-on-shadowing-std-with-macro.rs:8:14 diff --git a/tests/ui/resolve/issue-100365.stderr b/tests/ui/resolve/issue-100365.stderr index d1dd5870f193a..96a14794606be 100644 --- a/tests/ui/resolve/issue-100365.stderr +++ b/tests/ui/resolve/issue-100365.stderr @@ -40,6 +40,8 @@ LL + let _ = Into::<()>::into; error[E0423]: cannot find value `Iterator` in module `::std::iter` --> $DIR/issue-100365.rs:17:22 | +LL | macro_rules! Trait { +LL | () => { LL | ::std::iter::Iterator | ^^^^^^^^ not found in `::std::iter` ... @@ -47,11 +49,12 @@ LL | Trait!().map(std::convert::identity); // no `help` here! | -------- in this macro invocation | = note: a trait named `::std::iter::Iterator` exists in another namespace - = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: cannot find value `Iterator` in module `::std::iter` --> $DIR/issue-100365.rs:17:22 | +LL | macro_rules! Trait { +LL | () => { LL | ::std::iter::Iterator | ^^^^^^^^ not found in `::std::iter` ... @@ -59,11 +62,12 @@ LL | Trait!().map; // no `help` here! | -------- in this macro invocation | = note: a trait named `::std::iter::Iterator` exists in another namespace - = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: cannot find value `Into` in this scope --> $DIR/issue-100365.rs:25:9 | +LL | macro_rules! create { +LL | () => { LL | Into::.into("") | ^^^^ ... @@ -71,7 +75,6 @@ LL | let _ = create!(); | --------- in this macro invocation | = note: a trait named `Into` exists in another namespace - = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - Into::.into("") diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr index 198f7f8e32aa4..a41267942f8b2 100644 --- a/tests/ui/resolve/issue-82865.stderr +++ b/tests/ui/resolve/issue-82865.stderr @@ -12,13 +12,12 @@ LL + extern crate x; error[E0599]: no associated function or constant named `z` found for struct `Box<_, _>` in the current scope --> $DIR/issue-82865.rs:9:10 | +LL | macro mac () { LL | Box::z | ^ associated function or constant not found in `Box<_, _>` ... LL | mac!(); | ------ in this macro invocation - | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.rs b/tests/ui/resolve/multiple_definitions_attribute_merging.rs index 9f1bff51a3d4c..ee8798fc3a0a8 100644 --- a/tests/ui/resolve/multiple_definitions_attribute_merging.rs +++ b/tests/ui/resolve/multiple_definitions_attribute_merging.rs @@ -1,20 +1,15 @@ //! This test ICEs because the `repr(packed)` attributes //! end up on the `Dealigned` struct's attribute list, but the //! derive didn't see that. - -//@known-bug: #120873 -//@ failure-status: 101 -//@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> "" -//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" -//@ rustc-env:RUST_BACKTRACE=0 +//! +//! Because we now `Fatal.raise()` in resolve when encountering +//! duplicated names, the ICE in #120873 no longer happens. #[repr(packed)] struct Dealigned(u8, T); #[derive(PartialEq)] #[repr(C)] -struct Dealigned(u8, T); +struct Dealigned(u8, T); //~ ERROR: the name `Dealigned` is defined multiple times fn main() {} diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr index b8b33e3417bf7..b8dfb7fcae02a 100644 --- a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr +++ b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Dealigned` is defined multiple times - --> $DIR/multiple_definitions_attribute_merging.rs:18:1 + --> $DIR/multiple_definitions_attribute_merging.rs:13:1 | LL | struct Dealigned(u8, T); | --------------------------- previous definition of the type `Dealigned` here @@ -7,21 +7,8 @@ LL | struct Dealigned(u8, T); LL | struct Dealigned(u8, T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Dealigned` redefined here | - = error: internal compiler error: compiler/rustc_mir_transform/src/check_packed_ref.rs:LL:CC: builtin derive created an unaligned reference - --> $DIR/multiple_definitions_attribute_merging.rs:18:25 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -LL | #[repr(C)] -LL | struct Dealigned(u8, T); - | ^ - + = note: `Dealigned` must be defined only once in the type namespace of this module -Box -query stack during panic: -#0 [mir_built] building MIR for `::eq` -#1 [check_unsafety] unsafety-checking `::eq` -... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/resolve/open-ns-9.stderr b/tests/ui/resolve/open-ns-9.stderr index 675f487823e55..11247471142af 100644 --- a/tests/ui/resolve/open-ns-9.stderr +++ b/tests/ui/resolve/open-ns-9.stderr @@ -3,6 +3,8 @@ error[E0659]: `my_api` is ambiguous | LL | use my_api::utils::get_u32; | ^^^^^^ ambiguous name +... +LL | macro_rules! define { | = 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: `my_api` could refer to a namespaced crate passed with `--extern` @@ -20,7 +22,6 @@ LL | | } LL | define!(); | --------- in this macro invocation = help: use `crate::my_api` to refer to this module unambiguously - = note: this error originates in the macro `define` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr index 9a7045617eebf..353eea3f25927 100644 --- a/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr @@ -153,6 +153,8 @@ LL + a::I() error[E0423]: cannot find value `a` in this scope --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 | +LL | macro_rules! module { +LL | () => { LL | a | ^ not found in this scope ... @@ -160,11 +162,12 @@ LL | module!().g::<()>(); // no `help` here! | --------- in this macro invocation | = note: a module named `a` exists in another namespace - = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: cannot find value `a` in this scope --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 | +LL | macro_rules! module { +LL | () => { LL | a | ^ not found in this scope ... @@ -172,11 +175,12 @@ LL | module!().g; // no `help` here! | --------- in this macro invocation | = note: a module named `a` exists in another namespace - = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: cannot find value `a` in this scope --> $DIR/suggest-path-instead-of-mod-dot-item.rs:80:9 | +LL | macro_rules! create { +LL | (method) => { LL | a.f() | ^ ... @@ -184,7 +188,6 @@ LL | let _ = create!(method); | --------------- in this macro invocation | = note: a module named `a` exists in another namespace - = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - a.f() @@ -194,6 +197,8 @@ LL + a::f() error[E0423]: cannot find value `a` in this scope --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 | +LL | macro_rules! create { +... LL | a.f | ^ ... @@ -201,7 +206,6 @@ LL | let _ = create!(field); | -------------- in this macro invocation | = note: a module named `a` exists in another namespace - = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | LL - a.f diff --git a/tests/ui/return/return-from-residual-sugg-issue-125997.stderr b/tests/ui/return/return-from-residual-sugg-issue-125997.stderr index 877995dfe1266..86981860677bc 100644 --- a/tests/ui/return/return-from-residual-sugg-issue-125997.stderr +++ b/tests/ui/return/return-from-residual-sugg-issue-125997.stderr @@ -86,6 +86,8 @@ LL + Ok(()) error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/return-from-residual-sugg-issue-125997.rs:23:52 | +LL | macro_rules! mac { +LL | () => { LL | fn test3() { | ---------- this function should return `Result` or `Option` to accept `?` LL | let mut _file = File::create("foo.txt")?; @@ -94,7 +96,6 @@ LL | let mut _file = File::create("foo.txt")?; LL | mac!(); | ------ in this macro invocation | - = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider adding return type | LL ~ fn test3() -> Result<(), Box> { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr index eda88c15f7beb..54ea8f8a22006 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr @@ -1,6 +1,7 @@ error: expected expression, found `let` statement --> $DIR/macro-expanded.rs:4:20 | +LL | macro_rules! m { LL | ($e:expr) => { let Some(x) = $e } | ^^^ ... @@ -8,7 +9,6 @@ LL | () if m!(Some(5)) => {} | ----------- in this macro invocation | = note: only supported directly in conditions of `if` and `while` expressions - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.stderr b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.stderr index d684911be3975..cda31ed346f28 100644 --- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.stderr +++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.stderr @@ -19,101 +19,101 @@ LL | struct BarWhere<'a, 'b> where 'b: 'a { error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:41:30 | +LL | macro_rules! m { +LL | ('b: 'a) => { LL | struct Foo<'a, 'b: 'a>(&'a &'b ()); | ^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:43:44 | +LL | macro_rules! m { +... LL | struct Bar<'a, 'b>(&'a &'b ()) where 'b: 'a; | ^^^^^^^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:45:61 | +LL | macro_rules! m { +... LL | struct Baz<'a, 'b>(&'a &'b ()) where (): Sized, 'b: 'a; | ^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:55:30 | +LL | macro_rules! m { +LL | ($b:lifetime: 'a) => { LL | struct Foo<'a, $b: 'a>(&'a &$b ()); | ^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:57:44 | +LL | macro_rules! m { +... LL | struct Bar<'a, $b>(&'a &$b ()) where $b: 'a; | ^^^^^^^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:59:61 | +LL | macro_rules! m { +... LL | struct Baz<'a, $b>(&'a &$b ()) where (): Sized, $b: 'a; | ^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:117:44 | +LL | macro_rules! m { +... LL | struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; | ^^^^^^^^^^^^^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:119:61 | +LL | macro_rules! m { +... LL | struct Baz<$a, $b>(&$a &$b ()) where (): Sized, $b $colon $a; | ^^^^^^^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:132:44 | +LL | macro_rules! m { +... LL | struct Bar<$a, $b>(&$a &$b ()) where $b $colon $a; | ^^^^^^^^^^^^^^^^^^ help: remove this bound ... LL | m!('b: 'a); | ---------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-macro.rs:134:61 diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-multispan.stderr b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-multispan.stderr index 1f4190665b9b0..b2d4c3d035890 100644 --- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-multispan.stderr +++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-multispan.stderr @@ -822,39 +822,41 @@ LL + union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:372:38 | +LL | macro_rules! m { +LL | ($($name:ident)+) => { LL | struct Inline<'a, $($name: 'a,)+>(&'a ($($name,)+)); | ^^^^ help: remove these bounds ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:374:64 | +LL | macro_rules! m { +... LL | struct FullWhere<'a, $($name,)+>(&'a ($($name,)+)) where $($name: 'a,)+; | ^^^^^^^^^^^^^^^^^^ help: remove these bounds ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:376:86 | +LL | macro_rules! m { +... LL | struct PartialWhere<'a, $($name,)+>(&'a ($($name,)+)) where (): Sized, $($name: 'a,)+; | ^^^^^^^^^ help: remove these bounds ... LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: outlives requirements can be inferred --> $DIR/edition-lint-infer-outlives-multispan.rs:381:19 | +LL | macro_rules! m { +... LL | $($name: 'a, $name: 'a, )+ | ^^^^^^^^^ ^^^^^^^^^ LL | $($name: 'a, $name: 'a, )+; @@ -863,7 +865,6 @@ LL | $($name: 'a, $name: 'a, )+; LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15); | --------------------------------------------------------- in this macro invocation | - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: remove these bounds | LL ~ $(, , )+ diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr index f2536c1a1e988..c3fadacc25496 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr @@ -3,6 +3,8 @@ error[E0659]: `std` is ambiguous | LL | pub use std::io; | ^^^ ambiguous name +... +LL | macro_rules! m { | = 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: `std` could refer to a built-in crate @@ -18,7 +20,6 @@ LL | | } LL | m!(); | ---- in this macro invocation = help: use `self::std` to refer to this module unambiguously - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr index 3400183df6f41..0b70e98627372 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr @@ -3,6 +3,8 @@ error[E0659]: `std` is ambiguous | LL | use std::io; | ^^^ ambiguous name +... +LL | macro_rules! m { | = 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: `std` could refer to a built-in crate @@ -18,7 +20,6 @@ LL | | } LL | m!(); | ---- in this macro invocation = help: use `crate::std` to refer to this module unambiguously - = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr index f03842139f0b8..eac3e1331e984 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr @@ -19,6 +19,8 @@ LL | tt!([unsafe(no_mangle)]); error: unsafe attribute used without unsafe --> $DIR/unsafe-attributes-fix.rs:14:11 | +LL | macro_rules! ident { +LL | ($e:ident) => { LL | #[$e] | ^^ usage of unsafe attribute ... @@ -27,7 +29,6 @@ LL | ident!(no_mangle); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see - = note: this error originates in the macro `ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | LL | #[unsafe($e)] @@ -62,6 +63,8 @@ LL | meta2!(unsafe(export_name = "baw")); error: unsafe attribute used without unsafe --> $DIR/unsafe-attributes-fix.rs:23:11 | +LL | macro_rules! ident2 { +LL | ($e:ident, $l:literal) => { LL | #[$e = $l] | ^^ usage of unsafe attribute ... @@ -70,7 +73,6 @@ LL | ident2!(export_name, "bars"); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see - = note: this error originates in the macro `ident2` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | LL | #[unsafe($e = $l)] @@ -79,6 +81,8 @@ LL | #[unsafe($e = $l)] error: unsafe attribute used without unsafe --> $DIR/unsafe-attributes-fix.rs:46:26 | +LL | macro_rules! with_cfg_attr { +LL | () => { LL | #[cfg_attr(true, link_section = "__TEXT,__custom")] | ^^^^^^^^^^^^ usage of unsafe attribute ... @@ -87,7 +91,6 @@ LL | with_cfg_attr!(); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see - = note: this error originates in the macro `with_cfg_attr` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | LL | #[cfg_attr(true, unsafe(link_section = "__TEXT,__custom"))] diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr index fa36b148bf3de..a65ccd29afe5a 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr @@ -30,8 +30,6 @@ LL | unsafe_attributes_pm_in_2024::macro_rules_missing_unsafe!(); LL | LL | make_fn!(); | ---------- in this macro invocation - | - = note: this error originates in the macro `make_fn` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/simd/not-out-of-bounds.stderr b/tests/ui/simd/not-out-of-bounds.stderr index d5bcd15d97d6c..9b3b3028ff716 100644 --- a/tests/ui/simd/not-out-of-bounds.stderr +++ b/tests/ui/simd/not-out-of-bounds.stderr @@ -1,68 +1,68 @@ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(2, u8x2, simd_shuffle); | ------------------------------------------ in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 8) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(4, u8x4, simd_shuffle); | ------------------------------------------ in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 16) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(8, u8x8, simd_shuffle); | ------------------------------------------ in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 32) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(16, u8x16, simd_shuffle); | -------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 64) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(32, u8x32, simd_shuffle); | -------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 128) --> $DIR/not-out-of-bounds.rs:53:21 | +LL | macro_rules! test_shuffle_lanes { +... LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(64, u8x64, simd_shuffle); | -------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) --> $DIR/not-out-of-bounds.rs:78:23 diff --git a/tests/ui/span/macro-span-caller-replacement.stderr b/tests/ui/span/macro-span-caller-replacement.stderr index 43be48a9e362e..00cb6938b0508 100644 --- a/tests/ui/span/macro-span-caller-replacement.stderr +++ b/tests/ui/span/macro-span-caller-replacement.stderr @@ -12,6 +12,8 @@ LL | macro_with_format!(); error[E0308]: mismatched types --> $DIR/macro-span-caller-replacement.rs:7:17 | +LL | macro_rules! macro_with_format { () => { +LL | fn check_5(arg : usize) -> String { LL | let s : &str; | ---- expected due to this type ... @@ -21,7 +23,6 @@ LL | s = String::new(); LL | macro_with_format!(); | -------------------- in this macro invocation | - = note: this error originates in the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider borrowing here | LL | s = &String::new(); diff --git a/tests/ui/static/duplicated-fields-issue-124464.rs b/tests/ui/static/duplicated-fields-issue-124464.rs index 60609edbfebb6..2997dcd600bc7 100644 --- a/tests/ui/static/duplicated-fields-issue-124464.rs +++ b/tests/ui/static/duplicated-fields-issue-124464.rs @@ -3,8 +3,6 @@ enum TestOption { TestSome(T), - TestSome(T), -//~^ ERROR the name `TestSome` is defined multiple times } pub struct Request { diff --git a/tests/ui/static/duplicated-fields-issue-124464.stderr b/tests/ui/static/duplicated-fields-issue-124464.stderr index a36192ae8d69d..5a2f3a74e6a61 100644 --- a/tests/ui/static/duplicated-fields-issue-124464.stderr +++ b/tests/ui/static/duplicated-fields-issue-124464.stderr @@ -1,22 +1,11 @@ -error[E0428]: the name `TestSome` is defined multiple times - --> $DIR/duplicated-fields-issue-124464.rs:6:5 - | -LL | TestSome(T), - | ----------- previous definition of the type `TestSome` here -LL | TestSome(T), - | ^^^^^^^^^^^ `TestSome` redefined here - | - = note: `TestSome` must be defined only once in the type namespace of this enum - error[E0124]: field `bar` is already declared - --> $DIR/duplicated-fields-issue-124464.rs:12:5 + --> $DIR/duplicated-fields-issue-124464.rs:10:5 | LL | bar: TestOption, | -------------------- `bar` first declared here LL | bar: u8, | ^^^^^^^ field already declared -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0124, E0428. -For more information about an error, try `rustc --explain E0124`. +For more information about this error, try `rustc --explain E0124`. diff --git a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr index 9016056b383f2..cadab6975fc22 100644 --- a/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr +++ b/tests/ui/suggestions/let-binding-init-expr-as-ty.stderr @@ -180,13 +180,13 @@ LL + let x = vec![]; error: expected type, found associated function call --> $DIR/let-binding-init-expr-as-ty.rs:37:23 | +LL | macro_rules! make { +LL | ($pat:pat) => { LL | let $pat: Vec::new(); | ^^^^^^^^^^ ... LL | make!(_); | -------- in this macro invocation - | - = note: this error originates in the macro `make` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 15 previous errors diff --git a/tests/ui/suggestions/suggest-ref-macro.stderr b/tests/ui/suggestions/suggest-ref-macro.stderr index 2a52c1e244502..9bb26f7f5ab3a 100644 --- a/tests/ui/suggestions/suggest-ref-macro.stderr +++ b/tests/ui/suggestions/suggest-ref-macro.stderr @@ -17,6 +17,8 @@ LL | #[hello] error[E0308]: mismatched types --> $DIR/suggest-ref-macro.rs:16:11 | +LL | macro_rules! bla { +LL | () => { LL | x(123); | - ^^^ expected `&mut i32`, found integer | | @@ -30,7 +32,6 @@ note: function defined here | LL | fn x(_: &mut i32) {} | ^ ----------- - = note: this error originates in the macro `bla` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider mutably borrowing here | LL | x(&mut 123); diff --git a/tests/ui/symbol-names/const-generics-structural-demangling.stderr b/tests/ui/symbol-names/const-generics-structural-demangling.stderr index 3ec255b3e2359..19deb1af31418 100644 --- a/tests/ui/symbol-names/const-generics-structural-demangling.stderr +++ b/tests/ui/symbol-names/const-generics-structural-demangling.stderr @@ -127,35 +127,35 @@ LL | #[rustc_dump_symbol_name] error: symbol-name(_RMsd_CsCRATE_HASH_1cINtB_4Bar_KVNtB_3BarS1xh7b_s_1xt1000_EE) --> $DIR/const-generics-structural-demangling.rs:93:5 | +LL | macro duplicate_field_name_test($x:ident) { +... LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | duplicate_field_name_test!(x); | ----------------------------- in this macro invocation - | - = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) error: demangling(>) --> $DIR/const-generics-structural-demangling.rs:93:5 | +LL | macro duplicate_field_name_test($x:ident) { +... LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | duplicate_field_name_test!(x); | ----------------------------- in this macro invocation - | - = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) error: demangling-alt(>) --> $DIR/const-generics-structural-demangling.rs:93:5 | +LL | macro duplicate_field_name_test($x:ident) { +... LL | #[rustc_dump_symbol_name] | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | duplicate_field_name_test!(x); | ----------------------------- in this macro invocation - | - = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 24 previous errors diff --git a/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr b/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr index 383936b9df155..c3e0b2ce2a890 100644 --- a/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr +++ b/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.stderr @@ -1,46 +1,42 @@ error: ty --> $DIR/macro-const-trait-bound-theoretical-regression.rs:11:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { impl const Trait } | -------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error: ty --> $DIR/macro-const-trait-bound-theoretical-regression.rs:11:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { dyn const Trait } | ------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error: ty --> $DIR/macro-const-trait-bound-theoretical-regression.rs:11:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { impl [const] Trait } | ---------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error: ty --> $DIR/macro-const-trait-bound-theoretical-regression.rs:11:19 | +LL | macro_rules! demo { LL | ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS! | ^^^^^^^^^^^^^^^^^^^^ ... LL | demo! { dyn [const] Trait } | --------------------------- in this macro invocation - | - = note: this error originates in the macro `demo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: const trait impls are experimental --> $DIR/macro-const-trait-bound-theoretical-regression.rs:26:14 diff --git a/tests/ui/traits/issue-106072.rs b/tests/ui/traits/issue-106072.rs index 74a8893d38b07..73b4ce8fbb9b0 100644 --- a/tests/ui/traits/issue-106072.rs +++ b/tests/ui/traits/issue-106072.rs @@ -1,4 +1,4 @@ #[derive(Clone)] -struct Foo; //~ ERROR: expected a type, found a trait +struct Foo; trait Foo {} //~ ERROR: the name `Foo` is defined multiple times fn main() {} diff --git a/tests/ui/traits/issue-106072.stderr b/tests/ui/traits/issue-106072.stderr index ccee54cecf498..db37d02ece1f6 100644 --- a/tests/ui/traits/issue-106072.stderr +++ b/tests/ui/traits/issue-106072.stderr @@ -8,15 +8,6 @@ LL | trait Foo {} | = note: `Foo` must be defined only once in the type namespace of this module -error[E0782]: expected a type, found a trait - --> $DIR/issue-106072.rs:2:8 - | -LL | #[derive(Clone)] - | ----- in this derive macro expansion -LL | struct Foo; - | ^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0428, E0782. -For more information about an error, try `rustc --explain E0428`. +For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/traits/non_lifetime_binders/bad-bounds.rs b/tests/ui/traits/non_lifetime_binders/bad-bounds.rs index 4fccaf1d84f3c..65fa514ce6570 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-bounds.rs +++ b/tests/ui/traits/non_lifetime_binders/bad-bounds.rs @@ -6,8 +6,8 @@ fn produce() -> for; //~ ERROR the name `A` is defined multiple times + enum B {} + struct A; }>> Trait {} //~ ERROR cannot find trait `Trait` in this scope fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/bad-bounds.stderr b/tests/ui/traits/non_lifetime_binders/bad-bounds.stderr index ffc238c3f3436..0fd41a209783c 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-bounds.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-bounds.stderr @@ -1,13 +1,3 @@ -error[E0428]: the name `A` is defined multiple times - --> $DIR/bad-bounds.rs:10:5 - | -LL | enum A {} - | ------ previous definition of the type `A` here -LL | struct A; - | ^^^^^^^^^^^^ `A` redefined here - | - = note: `A` must be defined only once in the type namespace of this block - error[E0404]: expected trait, found type parameter `A` --> $DIR/bad-bounds.rs:6:24 | @@ -17,7 +7,7 @@ LL | fn produce() -> for; LL | | }>> Trait {} | |__^ not a trait @@ -35,12 +25,12 @@ LL | fn produce() -> for; LL | | }>> Trait {} | |__^ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0404, E0405, E0428. +Some errors have detailed explanations: E0404, E0405. For more information about an error, try `rustc --explain E0404`. diff --git a/tests/ui/tuple/tuple-struct-fields/test2.stderr b/tests/ui/tuple/tuple-struct-fields/test2.stderr index 53706eb90bbb7..73106d7c01b05 100644 --- a/tests/ui/tuple/tuple-struct-fields/test2.stderr +++ b/tests/ui/tuple/tuple-struct-fields/test2.stderr @@ -1,6 +1,8 @@ error: expected one of `)` or `,`, found `(` --> $DIR/test2.rs:5:26 | +LL | macro_rules! define_struct { +... LL | struct S3(pub $t ()); | -^ expected one of `)` or `,` | | @@ -8,8 +10,6 @@ LL | struct S3(pub $t ()); ... LL | define_struct! { (foo) } | ------------------------ in this macro invocation - | - = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `foo` in this scope --> $DIR/test2.rs:11:23 diff --git a/tests/ui/tuple/tuple-struct-fields/test3.stderr b/tests/ui/tuple/tuple-struct-fields/test3.stderr index 6a30e4ba5da2a..455956ffe2d5f 100644 --- a/tests/ui/tuple/tuple-struct-fields/test3.stderr +++ b/tests/ui/tuple/tuple-struct-fields/test3.stderr @@ -1,6 +1,8 @@ error: expected one of `)` or `,`, found `(` --> $DIR/test3.rs:5:27 | +LL | macro_rules! define_struct { +... LL | struct S3(pub($t) ()); | -^ expected one of `)` or `,` | | @@ -8,8 +10,6 @@ LL | struct S3(pub($t) ()); ... LL | define_struct! { foo } | ---------------------- in this macro invocation - | - = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `foo` in this scope --> $DIR/test3.rs:11:22 diff --git a/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr index 1a3848bbcf58d..9e1ee9300ed27 100644 --- a/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr +++ b/tests/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr @@ -1,13 +1,13 @@ error: function can not have more than 65535 arguments --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:17 | +LL | macro_rules! many_args { +... LL | fn _f($($t: ()),*) {} | ^^^^^^ ... LL | many_args!{[_]########## ######} | -------------------------------- in this macro invocation - | - = note: this error originates in the macro `many_args` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr index cb7666657ef4a..8b89bdf93d04a 100644 --- a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr +++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr @@ -1,6 +1,7 @@ error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:51 | +LL | macro_rules! recursive_tt { LL | () => (recursive_tt!(VariantB)); | -------- not allowed on this type LL | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -10,7 +11,6 @@ LL | recursive_tt!(); | --------------- in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -20,6 +20,8 @@ LL + ($variant:tt) => (if let EnumUnit::::$variant {} = 5 { true } error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:30 | +LL | macro_rules! recursive_tt { +LL | () => (recursive_tt!(VariantB)); LL | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` | | @@ -30,11 +32,11 @@ LL | recursive_tt!(); | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:54 | +LL | macro_rules! recursive_ident { LL | () => (recursive_ident!(VariantB)); | -------- not allowed on this type LL | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -44,7 +46,6 @@ LL | recursive_ident!(); | ------------------ in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -54,6 +55,8 @@ LL + ($variant:ident) => (if let EnumUnit::::$variant {} = 5 { tru error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:33 | +LL | macro_rules! recursive_ident { +LL | () => (recursive_ident!(VariantB)); LL | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` | | @@ -64,22 +67,24 @@ LL | recursive_ident!(); | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:51 | -LL | () => (nested2_tt!(VariantB)); - | -------- not allowed on this type +LL | () => (nested2_tt!(VariantB)); + | -------- not allowed on this type ... -LL | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); - | ^^^ ^^^ type argument not allowed +LL | / macro_rules! nested2_tt { +LL | | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); + | | ^^^ ^^^ type argument not allowed +... | +LL | | } + | |_- this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` ... -LL | nested1_tt!(); - | ------------- in this macro invocation +LL | nested1_tt!(); + | ------------- in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -89,32 +94,38 @@ LL + ($variant:tt) => (if let EnumUnit::::$variant {} = 5 { true } error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:30 | -LL | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` - | | - | expected integer, found `Enum<(), ()>` +LL | / macro_rules! nested2_tt { +LL | | ($variant:tt) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` + | | | + | | expected integer, found `Enum<(), ()>` +... | +LL | | } + | |_- this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` ... -LL | nested1_tt!(); - | ------------- in this macro invocation +LL | nested1_tt!(); + | ------------- in this macro invocation | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:54 | -LL | () => (nested2_ident!(VariantB)); - | -------- not allowed on this type +LL | () => (nested2_ident!(VariantB)); + | -------- not allowed on this type ... -LL | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); - | ^^^ ^^^ type argument not allowed +LL | / macro_rules! nested2_ident { +LL | | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); + | | ^^^ ^^^ type argument not allowed +... | +LL | | } + | |_- this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` ... -LL | nested1_ident!(); - | ---------------- in this macro invocation +LL | nested1_ident!(); + | ---------------- in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); @@ -124,21 +135,25 @@ LL + ($variant:ident) => (if let EnumUnit::::$variant {} = 5 { tru error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:33 | -LL | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` - | | - | expected integer, found `Enum<(), ()>` +LL | / macro_rules! nested2_ident { +LL | | ($variant:ident) => (if let EnumUnit::$variant:: {} = 5 { true } else { false }); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}` + | | | + | | expected integer, found `Enum<(), ()>` +... | +LL | | } + | |_- this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` ... -LL | nested1_ident!(); - | ---------------- in this macro invocation +LL | nested1_ident!(); + | ---------------- in this macro invocation | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:60:44 | +LL | macro_rules! nested1_tt_args_in_first_macro { LL | () => (nested2_tt_args_in_first_macro!(i32, u32)); | ^^^ ^^^ type argument not allowed ... @@ -149,7 +164,6 @@ LL | nested1_tt_args_in_first_macro!(); | --------------------------------- in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} @@ -159,32 +173,37 @@ LL + ($arg1:tt, $arg2:tt) => (if let EnumUnit::<$arg1, $arg2>::VariantB {} error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:65:37 | -LL | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>` -LL | -LL | = 5 { true } else { false }); - | - this expression has type `{integer}` +LL | / macro_rules! nested2_tt_args_in_first_macro { +LL | | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>` +LL | | +LL | | = 5 { true } else { false }); + | | - this expression has type `{integer}` +LL | | } + | |_- this error originates in the macro `nested2_tt_args_in_first_macro` which comes from the expansion of the macro `nested1_tt_args_in_first_macro` ... -LL | nested1_tt_args_in_first_macro!(); - | --------------------------------- in this macro invocation +LL | nested1_tt_args_in_first_macro!(); + | --------------------------------- in this macro invocation | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `nested2_tt_args_in_first_macro` which comes from the expansion of the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:64 | -LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} - | -------- ^^^^^ ^^^^^ type argument not allowed - | | - | not allowed on this type +LL | / macro_rules! nested2_ident_args_in_first_macro { +LL | | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} + | | -------- ^^^^^ ^^^^^ type argument not allowed + | | | + | | not allowed on this type +... | +LL | | } + | |_- this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` ... -LL | nested1_ident_args_in_first_macro!(); - | ------------------------------------ in this macro invocation +LL | nested1_ident_args_in_first_macro!(); + | ------------------------------------ in this macro invocation | = note: enum variants can't have type parameters - = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might have meant to specify type parameters on enum `Enum` | LL - ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} @@ -194,18 +213,20 @@ LL + ($arg1:ident, $arg2:ident) => (if let EnumUnit::<$arg1, $arg2>::Variant error[E0308]: mismatched types --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:43 | -LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>` -... -LL | = 5 { true } else { false }); - | - this expression has type `{integer}` +LL | / macro_rules! nested2_ident_args_in_first_macro { +LL | | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {} + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>` +... | +LL | | = 5 { true } else { false }); + | | - this expression has type `{integer}` +LL | | } + | |_- this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` ... -LL | nested1_ident_args_in_first_macro!(); - | ------------------------------------ in this macro invocation +LL | nested1_ident_args_in_first_macro!(); + | ------------------------------------ in this macro invocation | = note: expected type `{integer}` found enum `Enum<(), ()>` - = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0109]: type arguments are not allowed on this type --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:93:33 diff --git a/tests/ui/typeck/issue-81943.stderr b/tests/ui/typeck/issue-81943.stderr index 041ff10752cf0..7b34e3f043813 100644 --- a/tests/ui/typeck/issue-81943.stderr +++ b/tests/ui/typeck/issue-81943.stderr @@ -27,6 +27,7 @@ LL | f(|x| match x { tmp => { g(tmp) } };); error[E0308]: mismatched types --> $DIR/issue-81943.rs:10:38 | +LL | macro_rules! d { LL | ($e:expr) => { match $e { x => { g(x) } } } | ------------------^^^^---- | | | @@ -36,7 +37,6 @@ LL | } LL | f(|x| d!(x)); | ----- in this macro invocation | - = note: this error originates in the macro `d` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a semicolon here | LL | ($e:expr) => { match $e { x => { g(x); } } } diff --git a/tests/ui/typeck/sugg-swap-equality-in-macro-issue-139050.stderr b/tests/ui/typeck/sugg-swap-equality-in-macro-issue-139050.stderr index c217672b0050d..856aecf9264e4 100644 --- a/tests/ui/typeck/sugg-swap-equality-in-macro-issue-139050.stderr +++ b/tests/ui/typeck/sugg-swap-equality-in-macro-issue-139050.stderr @@ -22,6 +22,8 @@ LL | ext::eq!(assert iter.next(), Some(value)); error[E0308]: mismatched types --> $DIR/sugg-swap-equality-in-macro-issue-139050.rs:15:35 | +LL | macro_rules! eq_local { +... LL | if !(*left_val == *right_val) { | ^^^^^^^^^^ expected `Option<::Item>`, found `Option<&::Item>` ... @@ -31,7 +33,6 @@ LL | eq_local!(assert iter.next(), Some(value)); = note: expected enum `Option<_>` found enum `Option<&_>` = note: `Option<&::Item>` implements `PartialEq::Item>>` - = note: this error originates in the macro `eq_local` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider swapping the equality | LL - if !(*left_val == *right_val) { diff --git a/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr index 12537754d8029..399056112ce9f 100644 --- a/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr +++ b/tests/ui/typeck/suggestions/macro-shorthand-issue-140659.stderr @@ -1,15 +1,23 @@ error[E0308]: mismatched types --> $DIR/macro-shorthand-issue-140659.rs:42:44 | -LL | Instruction::Suspend { tag_index } - | ^^^^^^^^^ expected `u32`, found `Result::Error>` -... -LL | for_each_operator!(translate) - | ----------------------------- in this macro invocation +LL | / macro_rules! translate { +LL | | (Suspend { tag_index: $ty:ty } => $visit:ident) => { +LL | | match op { +LL | | Operator::Suspend { tag_index } => { +... | +LL | | Instruction::Suspend { tag_index } + | | ^^^^^^^^^ expected `u32`, found `Result::Error>` +... | +LL | | }; +LL | | } + | |_____- this error originates in the macro `translate` which comes from the expansion of the macro `for_each_operator` +LL | +LL | for_each_operator!(translate) + | ----------------------------- in this macro invocation | = note: expected type `u32` found enum `Result::Error>` - = note: this error originates in the macro `translate` which comes from the expansion of the macro `for_each_operator` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr index 3308a0807db6f..b64ca25280faa 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr @@ -88,7 +88,6 @@ note: an unsafe function restricts its caller, but its body is safe by default LL | pub unsafe fn unsafe_in_macro() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: for more information, see - = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block --> $DIR/wrapping-unsafe-block-sugg.rs:48:36 @@ -101,7 +100,6 @@ LL | unsafe_macro!(); | = note: consult the function's documentation for information on how to avoid undefined behavior = note: for more information, see - = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/tests/ui/use/use-path-segment-kw.e2015.stderr b/tests/ui/use/use-path-segment-kw.e2015.stderr index a63cce80896ab..cb7a4bb387634 100644 --- a/tests/ui/use/use-path-segment-kw.e2015.stderr +++ b/tests/ui/use/use-path-segment-kw.e2015.stderr @@ -358,13 +358,14 @@ LL | use self::{self as name}; error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:11:13 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate as name; @@ -373,365 +374,366 @@ LL | use $crate as name; error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:15:15 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:16:15 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::$crate as _dollar_crate2; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:17:16 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:18:16 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::{$crate as _nested_dollar_crate2}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:21:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:22:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::$crate as _dollar_crate3; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:23:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:24:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::{$crate as _nested_dollar_crate3}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:27:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:28:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::$crate as _dollar_crate4; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:29:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:30:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::{$crate as _nested_dollar_crate4}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:33:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:34:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::$crate as _dollar_crate5; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:35:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:36:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::{$crate as _nested_dollar_crate5}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:39:19 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:40:19 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::$crate as _dollar_crate6; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:41:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:42:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::{$crate as _nested_dollar_crate6}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:45:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:46:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::$crate as _dollar_crate7; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:47:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:48:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{$crate as _nested_dollar_crate7}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:51:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::crate; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:52:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::crate as _m_crate8; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:53:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{crate}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:54:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{crate as _m_nested_crate8}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:57:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::super; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:58:21 | -LL | ... use $crate::super as _m_super8; - | ^^^^^ +LL | macro_rules! macro_dollar_crate { ... -LL | ... macro_dollar_crate!(); - | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | use $crate::super as _m_super8; + | ^^^^^ +... +LL | macro_dollar_crate!(); + | --------------------- in this macro invocation error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:59:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{super}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:60:22 | -LL | ... use $crate::{super as _m_nested_super8}; - | ^^^^^ +LL | macro_rules! macro_dollar_crate { ... -LL | ... macro_dollar_crate!(); - | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | use $crate::{super as _m_nested_super8}; + | ^^^^^ +... +LL | macro_dollar_crate!(); + | --------------------- in this macro invocation error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:63:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::self; | ^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate::self as name; @@ -740,13 +742,14 @@ LL | use $crate::self as name; error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:65:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{self}; | ^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate::{self as name}; @@ -799,24 +802,24 @@ LL | pub use self::foobar::{self as _nested_self3}; error[E0573]: expected type, found module `$crate` --> $DIR/use-path-segment-kw.rs:10:19 | +LL | macro_rules! macro_dollar_crate { +... LL | type A1 = $crate; | ^^^^^^ not a type ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0573]: expected type, found module `$crate::self` --> $DIR/use-path-segment-kw.rs:62:20 | +LL | macro_rules! macro_dollar_crate { +... LL | type A10 = $crate::self; | ^^^^^^^^^^^^ not a type ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0573]: expected type, found module `crate` --> $DIR/use-path-segment-kw.rs:95:19 @@ -887,90 +890,90 @@ LL | type D7 = crate::foo::bar::self; error[E0433]: global paths cannot start with `$crate` --> $DIR/use-path-segment-kw.rs:14:21 | +LL | macro_rules! macro_dollar_crate { +... LL | type A2 = ::$crate; | ^^^^^^ cannot start with this ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:20:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A3 = foobar::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:26:26 | +LL | macro_rules! macro_dollar_crate { +... LL | type A4 = crate::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:32:26 | +LL | macro_rules! macro_dollar_crate { +... LL | type A5 = super::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:38:25 | +LL | macro_rules! macro_dollar_crate { +... LL | type A6 = self::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:44:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A7 = $crate::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:50:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A8 = $crate::crate; | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `super` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:56:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A9 = $crate::super; | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: global paths cannot start with `crate` --> $DIR/use-path-segment-kw.rs:99:21 diff --git a/tests/ui/use/use-path-segment-kw.e2018.stderr b/tests/ui/use/use-path-segment-kw.e2018.stderr index 3f1b01a27de54..bc03f1c7f25a2 100644 --- a/tests/ui/use/use-path-segment-kw.e2018.stderr +++ b/tests/ui/use/use-path-segment-kw.e2018.stderr @@ -360,13 +360,14 @@ LL | use self::{self as name}; error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:11:13 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate as name; @@ -375,365 +376,366 @@ LL | use $crate as name; error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:15:15 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:16:15 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::$crate as _dollar_crate2; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:17:16 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:18:16 | +LL | macro_rules! macro_dollar_crate { +... LL | use ::{$crate as _nested_dollar_crate2}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:21:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:22:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::$crate as _dollar_crate3; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:23:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:24:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use foobar::{$crate as _nested_dollar_crate3}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:27:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:28:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::$crate as _dollar_crate4; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:29:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:30:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use crate::{$crate as _nested_dollar_crate4}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:33:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:34:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::$crate as _dollar_crate5; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:35:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:36:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use super::{$crate as _nested_dollar_crate5}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:39:19 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:40:19 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::$crate as _dollar_crate6; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:41:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:42:20 | +LL | macro_rules! macro_dollar_crate { +... LL | use self::{$crate as _nested_dollar_crate6}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:45:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::$crate; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:46:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::$crate as _dollar_crate7; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:47:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{$crate}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:48:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{$crate as _nested_dollar_crate7}; | ^^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:51:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::crate; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:52:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::crate as _m_crate8; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:53:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{crate}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:54:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{crate as _m_nested_crate8}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:57:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::super; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:58:21 | -LL | ... use $crate::super as _m_super8; - | ^^^^^ +LL | macro_rules! macro_dollar_crate { ... -LL | ... macro_dollar_crate!(); - | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | use $crate::super as _m_super8; + | ^^^^^ +... +LL | macro_dollar_crate!(); + | --------------------- in this macro invocation error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:59:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{super}; | ^^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: `super` in paths can only be used in start position, after `self`, or after another `super` --> $DIR/use-path-segment-kw.rs:60:22 | -LL | ... use $crate::{super as _m_nested_super8}; - | ^^^^^ +LL | macro_rules! macro_dollar_crate { ... -LL | ... macro_dollar_crate!(); - | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | use $crate::{super as _m_nested_super8}; + | ^^^^^ +... +LL | macro_dollar_crate!(); + | --------------------- in this macro invocation error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:63:21 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::self; | ^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate::self as name; @@ -742,13 +744,14 @@ LL | use $crate::self as name; error: imports need to be explicitly named --> $DIR/use-path-segment-kw.rs:65:22 | +LL | macro_rules! macro_dollar_crate { +... LL | use $crate::{self}; | ^^^^ ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: try renaming it with a name | LL | use $crate::{self as name}; @@ -763,24 +766,24 @@ LL | foo::bar::_nested_self2::outer(); error[E0573]: expected type, found module `$crate` --> $DIR/use-path-segment-kw.rs:10:19 | +LL | macro_rules! macro_dollar_crate { +... LL | type A1 = $crate; | ^^^^^^ not a type ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0573]: expected type, found module `$crate::self` --> $DIR/use-path-segment-kw.rs:62:20 | +LL | macro_rules! macro_dollar_crate { +... LL | type A10 = $crate::self; | ^^^^^^^^^^^^ not a type ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0573]: expected type, found module `crate` --> $DIR/use-path-segment-kw.rs:95:19 @@ -851,90 +854,90 @@ LL | type D7 = crate::foo::bar::self; error[E0433]: global paths cannot start with `$crate` --> $DIR/use-path-segment-kw.rs:14:21 | +LL | macro_rules! macro_dollar_crate { +... LL | type A2 = ::$crate; | ^^^^^^ cannot start with this ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:20:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A3 = foobar::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:26:26 | +LL | macro_rules! macro_dollar_crate { +... LL | type A4 = crate::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:32:26 | +LL | macro_rules! macro_dollar_crate { +... LL | type A5 = super::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:38:25 | +LL | macro_rules! macro_dollar_crate { +... LL | type A6 = self::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:44:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A7 = $crate::$crate; | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:50:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A8 = $crate::crate; | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: `super` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:56:27 | +LL | macro_rules! macro_dollar_crate { +... LL | type A9 = $crate::super; | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation - | - = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: global paths cannot start with `crate` --> $DIR/use-path-segment-kw.rs:99:21 diff --git a/tests/ui/use/use-self-at-end-2.e2015.stderr b/tests/ui/use/use-self-at-end-2.e2015.stderr new file mode 100644 index 0000000000000..9901b6b93ed55 --- /dev/null +++ b/tests/ui/use/use-self-at-end-2.e2015.stderr @@ -0,0 +1,29 @@ +error[E0223]: ambiguous associated type + --> $DIR/use-self-at-end-2.rs:14:18 + | +LL | type H = super::Struct::self; + | ^^^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path + | +LL - type H = super::Struct::self; +LL + type H = ::self; + | + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/use-self-at-end-2.rs:15:18 + | +LL | type J = super::Trait::self; + | ^^^^^^^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default +help: if this is a dyn-compatible trait, use `dyn` + | +LL | type J = dyn super::Trait::self; + | +++ + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/use/use-self-at-end-2.e2018.stderr b/tests/ui/use/use-self-at-end-2.e2018.stderr new file mode 100644 index 0000000000000..2cc518438b7eb --- /dev/null +++ b/tests/ui/use/use-self-at-end-2.e2018.stderr @@ -0,0 +1,29 @@ +error[E0223]: ambiguous associated type + --> $DIR/use-self-at-end-2.rs:14:18 + | +LL | type H = super::Struct::self; + | ^^^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path + | +LL - type H = super::Struct::self; +LL + type H = ::self; + | + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/use-self-at-end-2.rs:15:18 + | +LL | type J = super::Trait::self; + | ^^^^^^^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default +help: if this is a dyn-compatible trait, use `dyn` + | +LL | type J = dyn super::Trait::self; + | +++ + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/use/use-self-at-end-2.e2021.stderr b/tests/ui/use/use-self-at-end-2.e2021.stderr new file mode 100644 index 0000000000000..a2f77ab0795c9 --- /dev/null +++ b/tests/ui/use/use-self-at-end-2.e2021.stderr @@ -0,0 +1,27 @@ +error[E0223]: ambiguous associated type + --> $DIR/use-self-at-end-2.rs:14:18 + | +LL | type H = super::Struct::self; + | ^^^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path + | +LL - type H = super::Struct::self; +LL + type H = ::self; + | + +error[E0782]: expected a type, found a trait + --> $DIR/use-self-at-end-2.rs:15:18 + | +LL | type J = super::Trait::self; + | ^^^^^^^^^^^^^^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | type J = dyn super::Trait::self; + | +++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0223, E0782. +For more information about an error, try `rustc --explain E0223`. diff --git a/tests/ui/use/use-self-at-end-2.rs b/tests/ui/use/use-self-at-end-2.rs new file mode 100644 index 0000000000000..bb794d39e36f4 --- /dev/null +++ b/tests/ui/use/use-self-at-end-2.rs @@ -0,0 +1,26 @@ +//@ revisions: e2015 e2018 e2021 +//@ [e2015] edition: 2015 +//@ [e2018] edition: 2018 +//@ [e2021] edition: 2021.. + +pub mod x { + pub struct Struct; + pub enum Enum {} + pub trait Trait {} + + pub mod y { + pub mod z {} + + type H = super::Struct::self; //~ ERROR: ambiguous associated type + type J = super::Trait::self; + //[e2015]~^ WARN: trait objects without an explicit `dyn` are deprecated + //[e2015]~^^ WARN: this is accepted in the current edition + //[e2018]~^^^ WARN: trait objects without an explicit `dyn` are deprecated + //[e2018]~^^^^ WARN: this is accepted in the current edition + //[e2021]~^^^^^ ERROR: expected a type, found a trait + } +} + +pub mod z {} + +fn main() {} diff --git a/tests/ui/use/use-self-at-end.e2015.stderr b/tests/ui/use/use-self-at-end.e2015.stderr index d77045b45941b..5baca45f3ed9e 100644 --- a/tests/ui/use/use-self-at-end.e2015.stderr +++ b/tests/ui/use/use-self-at-end.e2015.stderr @@ -161,7 +161,7 @@ LL | pub use super::Enum::{self}; = note: `Enum` must be defined only once in the type namespace of this module error[E0252]: the name `Trait` is defined multiple times - --> $DIR/use-self-at-end.rs:88:32 + --> $DIR/use-self-at-end.rs:83:32 | LL | pub use super::Trait::self; | ------------------ previous import of the trait `Trait` here @@ -193,25 +193,25 @@ LL | pub use super::Struct::{self}; | ^^^^^^ `Struct` is a struct, not a module error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:92:24 + --> $DIR/use-self-at-end.rs:87:24 | LL | pub use super::self::y::z; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:93:24 + --> $DIR/use-self-at-end.rs:88:24 | LL | pub use super::self::y::z as z3; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:94:24 + --> $DIR/use-self-at-end.rs:89:24 | LL | pub use super::self::y::{z}; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:95:24 + --> $DIR/use-self-at-end.rs:90:24 | LL | pub use super::self::y::{z as z4}; | ^^^^ can only be used in path start position or last position @@ -229,7 +229,7 @@ LL | type G = z::self::self; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:91:25 + --> $DIR/use-self-at-end.rs:86:25 | LL | type K = super::self::y::z; | ^^^^ can only be used in path start position or last position @@ -270,33 +270,7 @@ error[E0573]: expected type, found module `::self` LL | type F = ::self; | ^^^^^^ not a type -error[E0223]: ambiguous associated type - --> $DIR/use-self-at-end.rs:68:18 - | -LL | type H = super::Struct::self; - | ^^^^^^^^^^^^^^^^^^^ - | -help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path - | -LL - type H = super::Struct::self; -LL + type H = ::self; - | - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/use-self-at-end.rs:80:18 - | -LL | type J = super::Trait::self; - | ^^^^^^^^^^^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see - = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default -help: if this is a dyn-compatible trait, use `dyn` - | -LL | type J = dyn super::Trait::self; - | +++ - -error: aborting due to 34 previous errors; 1 warning emitted +error: aborting due to 33 previous errors -Some errors have detailed explanations: E0223, E0252, E0432, E0433, E0573. -For more information about an error, try `rustc --explain E0223`. +Some errors have detailed explanations: E0252, E0432, E0433, E0573. +For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use-self-at-end.e2018.stderr b/tests/ui/use/use-self-at-end.e2018.stderr index 65cba69dd4cdc..0cb0b9a9d2e1a 100644 --- a/tests/ui/use/use-self-at-end.e2018.stderr +++ b/tests/ui/use/use-self-at-end.e2018.stderr @@ -163,7 +163,7 @@ LL | pub use super::Enum::{self}; = note: `Enum` must be defined only once in the type namespace of this module error[E0252]: the name `Trait` is defined multiple times - --> $DIR/use-self-at-end.rs:88:32 + --> $DIR/use-self-at-end.rs:83:32 | LL | pub use super::Trait::self; | ------------------ previous import of the trait `Trait` here @@ -195,25 +195,25 @@ LL | pub use super::Struct::{self}; | ^^^^^^ `Struct` is a struct, not a module error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:92:24 + --> $DIR/use-self-at-end.rs:87:24 | LL | pub use super::self::y::z; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:93:24 + --> $DIR/use-self-at-end.rs:88:24 | LL | pub use super::self::y::z as z3; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:94:24 + --> $DIR/use-self-at-end.rs:89:24 | LL | pub use super::self::y::{z}; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:95:24 + --> $DIR/use-self-at-end.rs:90:24 | LL | pub use super::self::y::{z as z4}; | ^^^^ can only be used in path start position or last position @@ -231,7 +231,7 @@ LL | type G = z::self::self; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:91:25 + --> $DIR/use-self-at-end.rs:86:25 | LL | type K = super::self::y::z; | ^^^^ can only be used in path start position or last position @@ -272,33 +272,7 @@ error[E0425]: cannot find crate `self` in the list of imported crates LL | type F = ::self; | ^^^^ not found in the list of imported crates -error[E0223]: ambiguous associated type - --> $DIR/use-self-at-end.rs:68:18 - | -LL | type H = super::Struct::self; - | ^^^^^^^^^^^^^^^^^^^ - | -help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path - | -LL - type H = super::Struct::self; -LL + type H = ::self; - | - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/use-self-at-end.rs:80:18 - | -LL | type J = super::Trait::self; - | ^^^^^^^^^^^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see - = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default -help: if this is a dyn-compatible trait, use `dyn` - | -LL | type J = dyn super::Trait::self; - | +++ - -error: aborting due to 36 previous errors; 1 warning emitted +error: aborting due to 35 previous errors -Some errors have detailed explanations: E0223, E0252, E0425, E0432, E0433, E0573. -For more information about an error, try `rustc --explain E0223`. +Some errors have detailed explanations: E0252, E0425, E0432, E0433, E0573. +For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use-self-at-end.e2021.stderr b/tests/ui/use/use-self-at-end.e2021.stderr index 9809179144b7c..0cb0b9a9d2e1a 100644 --- a/tests/ui/use/use-self-at-end.e2021.stderr +++ b/tests/ui/use/use-self-at-end.e2021.stderr @@ -163,7 +163,7 @@ LL | pub use super::Enum::{self}; = note: `Enum` must be defined only once in the type namespace of this module error[E0252]: the name `Trait` is defined multiple times - --> $DIR/use-self-at-end.rs:88:32 + --> $DIR/use-self-at-end.rs:83:32 | LL | pub use super::Trait::self; | ------------------ previous import of the trait `Trait` here @@ -195,25 +195,25 @@ LL | pub use super::Struct::{self}; | ^^^^^^ `Struct` is a struct, not a module error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:92:24 + --> $DIR/use-self-at-end.rs:87:24 | LL | pub use super::self::y::z; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:93:24 + --> $DIR/use-self-at-end.rs:88:24 | LL | pub use super::self::y::z as z3; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:94:24 + --> $DIR/use-self-at-end.rs:89:24 | LL | pub use super::self::y::{z}; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:95:24 + --> $DIR/use-self-at-end.rs:90:24 | LL | pub use super::self::y::{z as z4}; | ^^^^ can only be used in path start position or last position @@ -231,7 +231,7 @@ LL | type G = z::self::self; | ^^^^ can only be used in path start position or last position error[E0433]: `self` in paths can only be used in start position or last position - --> $DIR/use-self-at-end.rs:91:25 + --> $DIR/use-self-at-end.rs:86:25 | LL | type K = super::self::y::z; | ^^^^ can only be used in path start position or last position @@ -272,30 +272,7 @@ error[E0425]: cannot find crate `self` in the list of imported crates LL | type F = ::self; | ^^^^ not found in the list of imported crates -error[E0223]: ambiguous associated type - --> $DIR/use-self-at-end.rs:68:18 - | -LL | type H = super::Struct::self; - | ^^^^^^^^^^^^^^^^^^^ - | -help: if there were a trait named `Example` with associated type `self` implemented for `x::Struct`, you could use the fully-qualified path - | -LL - type H = super::Struct::self; -LL + type H = ::self; - | - -error[E0782]: expected a type, found a trait - --> $DIR/use-self-at-end.rs:80:18 - | -LL | type J = super::Trait::self; - | ^^^^^^^^^^^^^^^^^^ - | -help: you can add the `dyn` keyword if you want a trait object - | -LL | type J = dyn super::Trait::self; - | +++ - -error: aborting due to 37 previous errors +error: aborting due to 35 previous errors -Some errors have detailed explanations: E0223, E0252, E0425, E0432, E0433, E0573, E0782. -For more information about an error, try `rustc --explain E0223`. +Some errors have detailed explanations: E0252, E0425, E0432, E0433, E0573. +For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use-self-at-end.rs b/tests/ui/use/use-self-at-end.rs index 29097bc3dffb8..4d8ffc057d643 100644 --- a/tests/ui/use/use-self-at-end.rs +++ b/tests/ui/use/use-self-at-end.rs @@ -65,7 +65,7 @@ pub mod x { pub use z::{self::{self}}; //~ ERROR `self` in paths can only be used in start position or last position pub use z::{self::{self as z2}}; //~ ERROR `self` in paths can only be used in start position - type H = super::Struct::self; //~ ERROR ambiguous associated type + type H = super::Struct::self; // silenced due to duplicate imports pub use super::Struct::self; //~ ERROR unresolved import `super::Struct` pub use super::Struct::self as Struct1; //~ ERROR unresolved import `super::Struct` pub use super::Struct::{self}; //~ ERROR unresolved import `super::Struct` @@ -77,12 +77,7 @@ pub mod x { pub use super::Enum::{self}; //~ ERROR the name `Enum` is defined multiple times pub use super::Enum::{self as Enum2}; - type J = super::Trait::self; - //[e2015]~^ WARN trait objects without an explicit `dyn` are deprecated - //[e2015]~^^ WARN this is accepted in the current edition - //[e2018]~^^^ WARN trait objects without an explicit `dyn` are deprecated - //[e2018]~^^^^ WARN this is accepted in the current edition - //[e2021]~^^^^^ ERROR expected a type, found a trait + type J = super::Trait::self; // silenced due to duplicate imports pub use super::Trait::self; pub use super::Trait::self as Trait1; pub use super::Trait::{self}; //~ ERROR the name `Trait` is defined multiple times