diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index c7c77bf56b7b0..fb59770d48a2b 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1434,19 +1434,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let (bounds, lifetime_bound) = self.with_dyn_type_scope(true, |this| { let bounds = this.arena.alloc_from_iter(bounds.iter().filter_map(|bound| match bound { - GenericBound::Trait( - ty, - TraitBoundModifiers { - polarity: BoundPolarity::Positive | BoundPolarity::Negative(_), - constness, - }, - ) => Some(this.lower_poly_trait_ref(ty, itctx, *constness)), - // We can safely ignore constness here, since AST validation - // will take care of invalid modifier combinations. - GenericBound::Trait( - _, - TraitBoundModifiers { polarity: BoundPolarity::Maybe(_), .. }, - ) => None, + // We can safely ignore constness here since AST validation + // takes care of rejecting invalid modifier combinations and + // const trait bounds in trait object types. + GenericBound::Trait(ty, modifiers) => match modifiers.polarity { + BoundPolarity::Positive | BoundPolarity::Negative(_) => { + Some(this.lower_poly_trait_ref( + ty, + itctx, + // Still, don't pass along the constness here; we don't want to + // synthesize any host effect args, it'd only cause problems. + ast::BoundConstness::Never, + )) + } + BoundPolarity::Maybe(_) => None, + }, GenericBound::Outlives(lifetime) => { if lifetime_bound.is_none() { lifetime_bound = Some(this.lower_lifetime(lifetime)); diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index 43221d70e21cf..0c5e18b0f4d14 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -56,9 +56,6 @@ mod parallel; pub use parallel::scope; pub use parallel::{join, par_for_each_in, par_map, parallel_guard, try_par_for_each_in}; -pub use std::sync::atomic::Ordering; -pub use std::sync::atomic::Ordering::SeqCst; - pub use vec::{AppendOnlyIndexVec, AppendOnlyVec}; mod vec; @@ -67,8 +64,7 @@ mod freeze; pub use freeze::{FreezeLock, FreezeReadGuard, FreezeWriteGuard}; mod mode { - use super::Ordering; - use std::sync::atomic::AtomicU8; + use std::sync::atomic::{AtomicU8, Ordering}; const UNINITIALIZED: u8 = 0; const DYN_NOT_THREAD_SAFE: u8 = 1; diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index ca6b0afc76a9b..40ba8d580d417 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -12,6 +12,7 @@ #![feature(lazy_cell)] #![feature(let_chains)] #![feature(panic_update_hook)] +#![feature(result_flattening)] #![recursion_limit = "256"] #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] @@ -24,7 +25,6 @@ use rustc_codegen_ssa::{traits::CodegenBackend, CodegenErrors, CodegenResults}; use rustc_data_structures::profiling::{ get_resident_set_size, print_time_passes_entry, TimePassesFormat, }; -use rustc_data_structures::sync::SeqCst; use rustc_errors::registry::{InvalidErrorCode, Registry}; use rustc_errors::{markdown, ColorConfig}; use rustc_errors::{DiagCtxt, ErrorGuaranteed, PResult}; @@ -475,7 +475,7 @@ fn run_compiler( eprintln!( "Fuel used by {}: {}", sess.opts.unstable_opts.print_fuel.as_ref().unwrap(), - sess.print_fuel.load(SeqCst) + sess.print_fuel.load(Ordering::SeqCst) ); } @@ -1249,8 +1249,7 @@ pub fn catch_fatal_errors R, R>(f: F) -> Result interface::Result<()>) -> i32 { - let result = catch_fatal_errors(f).and_then(|result| result); - match result { + match catch_fatal_errors(f).flatten() { Ok(()) => EXIT_SUCCESS, Err(_) => EXIT_FAILURE, } diff --git a/compiler/rustc_hir_typeck/src/check.rs b/compiler/rustc_hir_typeck/src/check.rs index 2a408ac255c44..a852c3d2be375 100644 --- a/compiler/rustc_hir_typeck/src/check.rs +++ b/compiler/rustc_hir_typeck/src/check.rs @@ -28,10 +28,10 @@ use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode}; pub(super) fn check_fn<'a, 'tcx>( fcx: &mut FnCtxt<'a, 'tcx>, fn_sig: ty::FnSig<'tcx>, + coroutine_types: Option>, decl: &'tcx hir::FnDecl<'tcx>, fn_def_id: LocalDefId, body: &'tcx hir::Body<'tcx>, - closure_kind: Option, params_can_be_unsized: bool, ) -> Option> { let fn_id = fcx.tcx.local_def_id_to_hir_id(fn_def_id); @@ -49,54 +49,13 @@ pub(super) fn check_fn<'a, 'tcx>( fcx.param_env, )); + fcx.coroutine_types = coroutine_types; fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(ret_ty))); let span = body.value.span; forbid_intrinsic_abi(tcx, span, fn_sig.abi); - if let Some(hir::ClosureKind::Coroutine(kind)) = closure_kind { - let yield_ty = match kind { - hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _) - | hir::CoroutineKind::Coroutine(_) => { - let yield_ty = fcx.next_ty_var(TypeVariableOrigin { - kind: TypeVariableOriginKind::TypeInference, - span, - }); - fcx.require_type_is_sized(yield_ty, span, traits::SizedYieldType); - yield_ty - } - // HACK(-Ztrait-solver=next): In the *old* trait solver, we must eagerly - // guide inference on the yield type so that we can handle `AsyncIterator` - // in this block in projection correctly. In the new trait solver, it is - // not a problem. - hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _) => { - let yield_ty = fcx.next_ty_var(TypeVariableOrigin { - kind: TypeVariableOriginKind::TypeInference, - span, - }); - fcx.require_type_is_sized(yield_ty, span, traits::SizedYieldType); - - Ty::new_adt( - tcx, - tcx.adt_def(tcx.require_lang_item(hir::LangItem::Poll, Some(span))), - tcx.mk_args(&[Ty::new_adt( - tcx, - tcx.adt_def(tcx.require_lang_item(hir::LangItem::Option, Some(span))), - tcx.mk_args(&[yield_ty.into()]), - ) - .into()]), - ) - } - hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _) => Ty::new_unit(tcx), - }; - - // Resume type defaults to `()` if the coroutine has no argument. - let resume_ty = fn_sig.inputs().get(0).copied().unwrap_or_else(|| Ty::new_unit(tcx)); - - fcx.resume_yield_tys = Some((resume_ty, yield_ty)); - } - GatherLocalsVisitor::new(fcx).visit_body(body); // C-variadic fns also have a `VaList` input that's not listed in `fn_sig` @@ -147,25 +106,6 @@ pub(super) fn check_fn<'a, 'tcx>( fcx.require_type_is_sized(declared_ret_ty, return_or_body_span, traits::SizedReturnType); fcx.check_return_expr(body.value, false); - // We insert the deferred_coroutine_interiors entry after visiting the body. - // This ensures that all nested coroutines appear before the entry of this coroutine. - // resolve_coroutine_interiors relies on this property. - let coroutine_ty = if let Some(hir::ClosureKind::Coroutine(coroutine_kind)) = closure_kind { - let interior = fcx - .next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::MiscVariable, span }); - fcx.deferred_coroutine_interiors.borrow_mut().push(( - fn_def_id, - body.id(), - interior, - coroutine_kind, - )); - - let (resume_ty, yield_ty) = fcx.resume_yield_tys.unwrap(); - Some(CoroutineTypes { resume_ty, yield_ty, interior }) - } else { - None - }; - // Finalize the return check by taking the LUB of the return types // we saw and assigning it to the expected return type. This isn't // really expected to fail, since the coercions would have failed @@ -201,7 +141,7 @@ pub(super) fn check_fn<'a, 'tcx>( check_lang_start_fn(tcx, fn_sig, fn_def_id); } - coroutine_ty + fcx.coroutine_types } fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>) { diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index bf6fda20df83e..7edb5912dd530 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -72,7 +72,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { opt_kind: Option, expected_sig: Option>, ) -> Ty<'tcx> { - let body = self.tcx.hir().body(closure.body); + let tcx = self.tcx; + let body = tcx.hir().body(closure.body); trace!("decl = {:#?}", closure.fn_decl); let expr_def_id = closure.def_id; @@ -83,81 +84,151 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { debug!(?bound_sig, ?liberated_sig); + // FIXME: We could probably actually just unify this further -- + // instead of having a `FnSig` and a `Option`, + // we can have a `ClosureSignature { Coroutine { .. }, Closure { .. } }`, + // similar to how `ty::GenSig` is a distinct data structure. + let coroutine_types = match closure.kind { + hir::ClosureKind::Closure => None, + hir::ClosureKind::Coroutine(kind) => { + let yield_ty = match kind { + hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _) + | hir::CoroutineKind::Coroutine(_) => { + let yield_ty = self.next_ty_var(TypeVariableOrigin { + kind: TypeVariableOriginKind::TypeInference, + span: expr_span, + }); + self.require_type_is_sized(yield_ty, expr_span, traits::SizedYieldType); + yield_ty + } + // HACK(-Ztrait-solver=next): In the *old* trait solver, we must eagerly + // guide inference on the yield type so that we can handle `AsyncIterator` + // in this block in projection correctly. In the new trait solver, it is + // not a problem. + hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _) => { + let yield_ty = self.next_ty_var(TypeVariableOrigin { + kind: TypeVariableOriginKind::TypeInference, + span: expr_span, + }); + self.require_type_is_sized(yield_ty, expr_span, traits::SizedYieldType); + + Ty::new_adt( + tcx, + tcx.adt_def( + tcx.require_lang_item(hir::LangItem::Poll, Some(expr_span)), + ), + tcx.mk_args(&[Ty::new_adt( + tcx, + tcx.adt_def( + tcx.require_lang_item(hir::LangItem::Option, Some(expr_span)), + ), + tcx.mk_args(&[yield_ty.into()]), + ) + .into()]), + ) + } + hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, _) => { + tcx.types.unit + } + }; + + // Resume type defaults to `()` if the coroutine has no argument. + let resume_ty = liberated_sig.inputs().get(0).copied().unwrap_or(tcx.types.unit); + + Some(CoroutineTypes { resume_ty, yield_ty }) + } + }; + let mut fcx = FnCtxt::new(self, self.param_env, closure.def_id); - let coroutine_types = check_fn( + check_fn( &mut fcx, liberated_sig, + coroutine_types, closure.fn_decl, expr_def_id, body, - Some(closure.kind), // Closure "rust-call" ABI doesn't support unsized params false, ); - let parent_args = GenericArgs::identity_for_item( - self.tcx, - self.tcx.typeck_root_def_id(expr_def_id.to_def_id()), - ); + let parent_args = + GenericArgs::identity_for_item(tcx, tcx.typeck_root_def_id(expr_def_id.to_def_id())); let tupled_upvars_ty = self.next_root_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::ClosureSynthetic, - span: self.tcx.def_span(expr_def_id), - }); - - if let Some(CoroutineTypes { resume_ty, yield_ty, interior }) = coroutine_types { - let coroutine_args = ty::CoroutineArgs::new( - self.tcx, - ty::CoroutineArgsParts { - parent_args, - resume_ty, - yield_ty, - return_ty: liberated_sig.output(), - witness: interior, - tupled_upvars_ty, - }, - ); - - return Ty::new_coroutine(self.tcx, expr_def_id.to_def_id(), coroutine_args.args); - } - - // Tuple up the arguments and insert the resulting function type into - // the `closures` table. - let sig = bound_sig.map_bound(|sig| { - self.tcx.mk_fn_sig( - [Ty::new_tup(self.tcx, sig.inputs())], - sig.output(), - sig.c_variadic, - sig.unsafety, - sig.abi, - ) + span: expr_span, }); - debug!(?sig, ?opt_kind); - - let closure_kind_ty = match opt_kind { - Some(kind) => Ty::from_closure_kind(self.tcx, kind), + match closure.kind { + hir::ClosureKind::Closure => { + assert_eq!(coroutine_types, None); + // Tuple up the arguments and insert the resulting function type into + // the `closures` table. + let sig = bound_sig.map_bound(|sig| { + tcx.mk_fn_sig( + [Ty::new_tup(tcx, sig.inputs())], + sig.output(), + sig.c_variadic, + sig.unsafety, + sig.abi, + ) + }); - // Create a type variable (for now) to represent the closure kind. - // It will be unified during the upvar inference phase (`upvar.rs`) - None => self.next_root_ty_var(TypeVariableOrigin { - // FIXME(eddyb) distinguish closure kind inference variables from the rest. - kind: TypeVariableOriginKind::ClosureSynthetic, - span: expr_span, - }), - }; + debug!(?sig, ?opt_kind); + + let closure_kind_ty = match opt_kind { + Some(kind) => Ty::from_closure_kind(tcx, kind), + + // Create a type variable (for now) to represent the closure kind. + // It will be unified during the upvar inference phase (`upvar.rs`) + None => self.next_root_ty_var(TypeVariableOrigin { + // FIXME(eddyb) distinguish closure kind inference variables from the rest. + kind: TypeVariableOriginKind::ClosureSynthetic, + span: expr_span, + }), + }; + + let closure_args = ty::ClosureArgs::new( + tcx, + ty::ClosureArgsParts { + parent_args, + closure_kind_ty, + closure_sig_as_fn_ptr_ty: Ty::new_fn_ptr(tcx, sig), + tupled_upvars_ty, + }, + ); - let closure_args = ty::ClosureArgs::new( - self.tcx, - ty::ClosureArgsParts { - parent_args, - closure_kind_ty, - closure_sig_as_fn_ptr_ty: Ty::new_fn_ptr(self.tcx, sig), - tupled_upvars_ty, - }, - ); + Ty::new_closure(tcx, expr_def_id.to_def_id(), closure_args.args) + } + hir::ClosureKind::Coroutine(_) => { + let Some(CoroutineTypes { resume_ty, yield_ty }) = coroutine_types else { + bug!("expected coroutine to have yield/resume types"); + }; + let interior = fcx.next_ty_var(TypeVariableOrigin { + kind: TypeVariableOriginKind::MiscVariable, + span: body.value.span, + }); + fcx.deferred_coroutine_interiors.borrow_mut().push(( + expr_def_id, + body.id(), + interior, + )); + + let coroutine_args = ty::CoroutineArgs::new( + tcx, + ty::CoroutineArgsParts { + parent_args, + resume_ty, + yield_ty, + return_ty: liberated_sig.output(), + witness: interior, + tupled_upvars_ty, + }, + ); - Ty::new_closure(self.tcx, expr_def_id.to_def_id(), closure_args.args) + Ty::new_coroutine(tcx, expr_def_id.to_def_id(), coroutine_args.args) + } + } } /// Given the expected type, figures out what it can about this closure we diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 7425d6f89012a..44d9f1ed81846 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -15,6 +15,7 @@ use crate::errors::{ use crate::fatally_break_rust; use crate::method::SelfSource; use crate::type_error_struct; +use crate::CoroutineTypes; use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectation}; use crate::{ report_unexpected_variant_res, BreakableCtxt, Diverges, FnCtxt, Needs, @@ -3163,8 +3164,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { value: &'tcx hir::Expr<'tcx>, expr: &'tcx hir::Expr<'tcx>, ) -> Ty<'tcx> { - match self.resume_yield_tys { - Some((resume_ty, yield_ty)) => { + match self.coroutine_types { + Some(CoroutineTypes { resume_ty, yield_ty }) => { self.check_expr_coercible_to_type(value, yield_ty, None); resume_ty diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 994f11b57d195..cb109a2e02428 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -534,7 +534,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let coroutines = std::mem::take(&mut *self.deferred_coroutine_interiors.borrow_mut()); debug!(?coroutines); - for &(expr_def_id, body_id, interior, _) in coroutines.iter() { + for &(expr_def_id, body_id, interior) in coroutines.iter() { debug!(?expr_def_id); // Create the `CoroutineWitness` type that we will unify with `interior`. diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 635284c5f7323..fde3d41faecf0 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -5,7 +5,7 @@ mod checks; mod suggestions; use crate::coercion::DynamicCoerceMany; -use crate::{Diverges, EnclosingBreakables, Inherited}; +use crate::{CoroutineTypes, Diverges, EnclosingBreakables, Inherited}; use rustc_errors::{DiagCtxt, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -68,7 +68,7 @@ pub struct FnCtxt<'a, 'tcx> { /// First span of a return site that we find. Used in error messages. pub(super) ret_coercion_span: Cell>, - pub(super) resume_yield_tys: Option<(Ty<'tcx>, Ty<'tcx>)>, + pub(super) coroutine_types: Option>, /// Whether the last checked node generates a divergence (e.g., /// `return` will set this to `Always`). In general, when entering @@ -122,7 +122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err_count_on_creation: inh.tcx.dcx().err_count(), ret_coercion: None, ret_coercion_span: Cell::new(None), - resume_yield_tys: None, + coroutine_types: None, diverges: Cell::new(Diverges::Maybe), enclosing_breakables: RefCell::new(EnclosingBreakables { stack: Vec::new(), diff --git a/compiler/rustc_hir_typeck/src/inherited.rs b/compiler/rustc_hir_typeck/src/inherited.rs index 7a6a2b2a01029..4ad46845f0ba8 100644 --- a/compiler/rustc_hir_typeck/src/inherited.rs +++ b/compiler/rustc_hir_typeck/src/inherited.rs @@ -55,8 +55,7 @@ pub struct Inherited<'tcx> { pub(super) deferred_asm_checks: RefCell, hir::HirId)>>, - pub(super) deferred_coroutine_interiors: - RefCell, hir::CoroutineKind)>>, + pub(super) deferred_coroutine_interiors: RefCell)>>, /// Whenever we introduce an adjustment from `!` into a type variable, /// we record that type variable here. This is later used to inform diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index da9a2bde783b8..6044b1fdd40af 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -193,7 +193,7 @@ fn typeck_with_fallback<'tcx>( let fn_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), fn_sig); let fn_sig = fcx.normalize(body.value.span, fn_sig); - check_fn(&mut fcx, fn_sig, decl, def_id, body, None, tcx.features().unsized_fn_params); + check_fn(&mut fcx, fn_sig, None, decl, def_id, body, tcx.features().unsized_fn_params); } else { let expected_type = if let Some(&hir::Ty { kind: hir::TyKind::Infer, span, .. }) = body_ty { Some(fcx.next_ty_var(TypeVariableOrigin { @@ -295,15 +295,13 @@ fn typeck_with_fallback<'tcx>( /// When `check_fn` is invoked on a coroutine (i.e., a body that /// includes yield), it returns back some information about the yield /// points. +#[derive(Debug, PartialEq, Copy, Clone)] struct CoroutineTypes<'tcx> { /// Type of coroutine argument / values returned by `yield`. resume_ty: Ty<'tcx>, /// Type of value that is yielded. yield_ty: Ty<'tcx>, - - /// Types that are captured (see `CoroutineInterior` for more). - interior: Ty<'tcx>, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index 4ce7f831c8711..e3dea2212df0d 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -61,7 +61,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { @call(mir_drop, args) => { Ok(TerminatorKind::Drop { place: self.parse_place(args[0])?, - target: self.parse_block(args[1])?, + target: self.parse_return_to(args[1])?, unwind: self.parse_unwind_action(args[2])?, replace: false, }) @@ -104,6 +104,14 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { ) } + fn parse_return_to(&self, expr_id: ExprId) -> PResult { + parse_by_kind!(self, expr_id, _, "return block", + @call(mir_return_to, args) => { + self.parse_block(args[0]) + }, + ) + } + fn parse_match(&self, arms: &[ArmId], span: Span) -> PResult { let Some((otherwise, rest)) = arms.split_last() else { return Err(ParseError { @@ -146,7 +154,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { ExprKind::Assign { lhs, rhs } => (*lhs, *rhs), ); let destination = self.parse_place(destination)?; - let target = self.parse_block(args[1])?; + let target = self.parse_return_to(args[1])?; let unwind = self.parse_unwind_action(args[2])?; parse_by_kind!(self, call, _, "function call", diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index c6bddbfacd6ec..aa8c8538b5408 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -767,6 +767,9 @@ parse_unexpected_if_with_if = unexpected `if` in the condition expression parse_unexpected_lifetime_in_pattern = unexpected lifetime `{$symbol}` in pattern .suggestion = remove the lifetime +parse_unexpected_paren_in_range_pat = range pattern bounds cannot have parentheses +parse_unexpected_paren_in_range_pat_sugg = remove these parentheses + parse_unexpected_parentheses_in_for_head = unexpected parentheses surrounding `for` loop head .suggestion = remove parentheses in `for` loop diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index e276b34ca37af..d67ae14934429 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -2378,6 +2378,27 @@ pub(crate) struct ExpectedCommaAfterPatternField { pub span: Span, } +#[derive(Diagnostic)] +#[diag(parse_unexpected_paren_in_range_pat)] +pub(crate) struct UnexpectedParenInRangePat { + #[primary_span] + pub span: Vec, + #[subdiagnostic] + pub sugg: UnexpectedParenInRangePatSugg, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion( + parse_unexpected_paren_in_range_pat_sugg, + applicability = "machine-applicable" +)] +pub(crate) struct UnexpectedParenInRangePatSugg { + #[suggestion_part(code = "")] + pub start_span: Span, + #[suggestion_part(code = "")] + pub end_span: Span, +} + #[derive(Diagnostic)] #[diag(parse_return_types_use_thin_arrow)] pub(crate) struct ReturnTypesUseThinArrow { diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index afbc253757816..7d17b1d4c4d67 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -6,7 +6,8 @@ use crate::errors::{ InclusiveRangeExtraEquals, InclusiveRangeMatchArrow, InclusiveRangeNoEnd, InvalidMutInPattern, PatternOnWrongSideOfAt, RefMutOrderIncorrect, RemoveLet, RepeatedMutInPattern, SwitchRefBoxOrder, TopLevelOrPatternNotAllowed, TopLevelOrPatternNotAllowedSugg, - TrailingVertNotAllowed, UnexpectedLifetimeInPattern, UnexpectedVertVertBeforeFunctionParam, + TrailingVertNotAllowed, UnexpectedLifetimeInPattern, UnexpectedParenInRangePat, + UnexpectedParenInRangePatSugg, UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, }; use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; @@ -579,6 +580,8 @@ impl<'a> Parser<'a> { /// Parse a tuple or parenthesis pattern. fn parse_pat_tuple_or_parens(&mut self) -> PResult<'a, PatKind> { + let open_paren = self.token.span; + let (fields, trailing_comma) = self.parse_paren_comma_seq(|p| { p.parse_pat_allow_top_alt( None, @@ -591,7 +594,29 @@ impl<'a> Parser<'a> { // Here, `(pat,)` is a tuple pattern. // For backward compatibility, `(..)` is a tuple pattern as well. Ok(if fields.len() == 1 && !(trailing_comma || fields[0].is_rest()) { - PatKind::Paren(fields.into_iter().next().unwrap()) + let pat = fields.into_iter().next().unwrap(); + let close_paren = self.prev_token.span; + + match &pat.kind { + // recover ranges with parentheses around the `(start)..` + PatKind::Lit(begin) + if self.may_recover() + && let Some(form) = self.parse_range_end() => + { + self.dcx().emit_err(UnexpectedParenInRangePat { + span: vec![open_paren, close_paren], + sugg: UnexpectedParenInRangePatSugg { + start_span: open_paren, + end_span: close_paren, + }, + }); + + self.parse_pat_range_begin_with(begin.clone(), form)? + } + + // (pat) with optional parentheses + _ => PatKind::Paren(pat), + } } else { PatKind::Tuple(fields) }) @@ -794,11 +819,21 @@ impl<'a> Parser<'a> { || t.can_begin_literal_maybe_minus() // e.g. `42`. || t.is_whole_expr() || t.is_lifetime() // recover `'a` instead of `'a'` + || (self.may_recover() // recover leading `(` + && t.kind == token::OpenDelim(Delimiter::Parenthesis) + && self.look_ahead(dist + 1, |t| t.kind != token::OpenDelim(Delimiter::Parenthesis)) + && self.is_pat_range_end_start(dist + 1)) }) } + /// Parse a range pattern end bound fn parse_pat_range_end(&mut self) -> PResult<'a, P> { - if self.check_inline_const(0) { + // recover leading `(` + let open_paren = (self.may_recover() + && self.eat_noexpect(&token::OpenDelim(Delimiter::Parenthesis))) + .then_some(self.prev_token.span); + + let bound = if self.check_inline_const(0) { self.parse_const_block(self.token.span, true) } else if self.check_path() { let lo = self.token.span; @@ -814,7 +849,22 @@ impl<'a> Parser<'a> { Ok(self.mk_expr(lo.to(hi), ExprKind::Path(qself, path))) } else { self.parse_literal_maybe_minus() + }?; + + // recover trailing `)` + if let Some(open_paren) = open_paren { + self.expect(&token::CloseDelim(Delimiter::Parenthesis))?; + + self.dcx().emit_err(UnexpectedParenInRangePat { + span: vec![open_paren, self.prev_token.span], + sugg: UnexpectedParenInRangePatSugg { + start_span: open_paren, + end_span: self.prev_token.span, + }, + }); } + + Ok(bound) } /// Is this the start of a pattern beginning with a path? diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index f131a0f759320..fd7f1669ba456 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -69,7 +69,7 @@ impl QueryContext for QueryCtxt<'_> { fn next_job_id(self) -> QueryJobId { QueryJobId( NonZeroU64::new( - self.query_system.jobs.fetch_add(1, rustc_data_structures::sync::Ordering::Relaxed), + self.query_system.jobs.fetch_add(1, std::sync::atomic::Ordering::Relaxed), ) .unwrap(), ) diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 9b06823dfbafb..1f09de0ed70c7 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -4,7 +4,7 @@ use rustc_data_structures::profiling::{EventId, QueryInvocationId, SelfProfilerR use rustc_data_structures::sharded::{self, Sharded}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::steal::Steal; -use rustc_data_structures::sync::{AtomicU32, AtomicU64, Lock, Lrc, Ordering}; +use rustc_data_structures::sync::{AtomicU32, AtomicU64, Lock, Lrc}; use rustc_data_structures::unord::UnordMap; use rustc_index::IndexVec; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; @@ -13,7 +13,7 @@ use std::collections::hash_map::Entry; use std::fmt::Debug; use std::hash::Hash; use std::marker::PhantomData; -use std::sync::atomic::Ordering::Relaxed; +use std::sync::atomic::Ordering; use super::query::DepGraphQuery; use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex}; @@ -476,7 +476,7 @@ impl DepGraph { let task_deps = &mut *task_deps; if cfg!(debug_assertions) { - data.current.total_read_count.fetch_add(1, Relaxed); + data.current.total_read_count.fetch_add(1, Ordering::Relaxed); } // As long as we only have a low number of reads we can avoid doing a hash @@ -506,7 +506,7 @@ impl DepGraph { } } } else if cfg!(debug_assertions) { - data.current.total_duplicate_read_count.fetch_add(1, Relaxed); + data.current.total_duplicate_read_count.fetch_add(1, Ordering::Relaxed); } }) } @@ -976,8 +976,8 @@ impl DepGraph { pub fn print_incremental_info(&self) { if let Some(data) = &self.data { data.current.encoder.borrow().print_incremental_info( - data.current.total_read_count.load(Relaxed), - data.current.total_duplicate_read_count.load(Relaxed), + data.current.total_read_count.load(Ordering::Relaxed), + data.current.total_duplicate_read_count.load(Ordering::Relaxed), ) } } @@ -992,7 +992,7 @@ impl DepGraph { pub(crate) fn next_virtual_depnode_index(&self) -> DepNodeIndex { debug_assert!(self.data.is_none()); - let index = self.virtual_dep_node_index.fetch_add(1, Relaxed); + let index = self.virtual_dep_node_index.fetch_add(1, Ordering::Relaxed); DepNodeIndex::from_u32(index) } } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 9ee7625e5bfeb..b0d07c1c768a4 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -14,9 +14,7 @@ use rustc_data_structures::flock; use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_data_structures::jobserver::{self, Client}; use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef}; -use rustc_data_structures::sync::{ - AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread, Ordering::SeqCst, -}; +use rustc_data_structures::sync::{AtomicU64, DynSend, DynSync, Lock, Lrc, OneThread}; use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter; use rustc_errors::emitter::{DynEmitter, EmitterWriter, HumanReadableErrorType}; use rustc_errors::json::JsonEmitter; @@ -44,7 +42,7 @@ use std::fmt; use std::ops::{Div, Mul}; use std::path::{Path, PathBuf}; use std::str::FromStr; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{atomic::AtomicBool, atomic::Ordering::SeqCst, Arc}; struct OptimizationFuel { /// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 0b44071496ea8..9af81e0630318 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1041,6 +1041,7 @@ symbols! { mir_offset, mir_retag, mir_return, + mir_return_to, mir_set_discriminant, mir_static, mir_static_mut, diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index 34a61e76fcf66..c6401ec1e3333 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -104,21 +104,22 @@ //! } //! //! #[custom_mir(dialect = "runtime", phase = "optimized")] +#![cfg_attr(bootstrap, doc = "#[cfg(any())]")] // disable the following function in doctests when `bootstrap` is set //! fn push_and_pop(v: &mut Vec, value: T) { //! mir!( //! let _unused; //! let popped; //! //! { -//! Call(_unused = Vec::push(v, value), pop, UnwindContinue()) +//! Call(_unused = Vec::push(v, value), ReturnTo(pop), UnwindContinue()) //! } //! //! pop = { -//! Call(popped = Vec::pop(v), drop, UnwindContinue()) +//! Call(popped = Vec::pop(v), ReturnTo(drop), UnwindContinue()) //! } //! //! drop = { -//! Drop(popped, ret, UnwindContinue()) +//! Drop(popped, ReturnTo(ret), UnwindContinue()) //! } //! //! ret = { @@ -242,9 +243,8 @@ //! - `match some_int_operand` becomes a `SwitchInt`. Each arm should be `literal => basic_block` //! - The exception is the last arm, which must be `_ => basic_block` and corresponds to the //! otherwise branch. -//! - [`Call`] has an associated function as well. The third argument of this function is a normal -//! function call expression, for example `my_other_function(a, 5)`. -//! +//! - [`Call`] has an associated function as well, with special syntax: +//! `Call(ret_val = function(arg1, arg2, ...), ReturnTo(next_block), UnwindContinue())`. #![unstable( feature = "custom_mir", @@ -287,35 +287,68 @@ macro_rules! define { } // Unwind actions +pub struct UnwindActionArg; define!( "mir_unwind_continue", /// An unwind action that continues unwinding. - fn UnwindContinue() + fn UnwindContinue() -> UnwindActionArg ); define!( "mir_unwind_unreachable", /// An unwind action that triggers undefined behaviour. - fn UnwindUnreachable() -> BasicBlock + fn UnwindUnreachable() -> UnwindActionArg ); define!( "mir_unwind_terminate", /// An unwind action that terminates the execution. /// /// `UnwindTerminate` can also be used as a terminator. - fn UnwindTerminate(reason: UnwindTerminateReason) + fn UnwindTerminate(reason: UnwindTerminateReason) -> UnwindActionArg ); define!( "mir_unwind_cleanup", /// An unwind action that continues execution in a given basic blok. - fn UnwindCleanup(goto: BasicBlock) + fn UnwindCleanup(goto: BasicBlock) -> UnwindActionArg ); +// Return destination for `Call` +pub struct ReturnToArg; +define!("mir_return_to", fn ReturnTo(goto: BasicBlock) -> ReturnToArg); + // Terminators define!("mir_return", fn Return() -> BasicBlock); define!("mir_goto", fn Goto(destination: BasicBlock) -> BasicBlock); define!("mir_unreachable", fn Unreachable() -> BasicBlock); -define!("mir_drop", fn Drop(place: T, goto: BasicBlock, unwind_action: U)); -define!("mir_call", fn Call(call: (), goto: BasicBlock, unwind_action: U)); +define!("mir_drop", + /// Drop the contents of a place. + /// + /// The first argument must be a place. + /// + /// The second argument must be of the form `ReturnTo(bb)`, where `bb` is the basic block that + /// will be jumped to after the destructor returns. + /// + /// The third argument describes what happens on unwind. It can be one of: + /// - [`UnwindContinue`] + /// - [`UnwindUnreachable`] + /// - [`UnwindTerminate`] + /// - [`UnwindCleanup`] + fn Drop(place: T, goto: ReturnToArg, unwind_action: UnwindActionArg) +); +define!("mir_call", + /// Call a function. + /// + /// The first argument must be of the form `ret_val = fun(arg1, arg2, ...)`. + /// + /// The second argument must be of the form `ReturnTo(bb)`, where `bb` is the basic block that + /// will be jumped to after the function returns. + /// + /// The third argument describes what happens on unwind. It can be one of: + /// - [`UnwindContinue`] + /// - [`UnwindUnreachable`] + /// - [`UnwindTerminate`] + /// - [`UnwindCleanup`] + fn Call(call: (), goto: ReturnToArg, unwind_action: UnwindActionArg) +); define!("mir_unwind_resume", /// A terminator that resumes the unwinding. fn UnwindResume() diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index dbb64583d561c..8e1f3b03d7863 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -905,34 +905,6 @@ impl Step for Rustc { )); } - // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary - // and may just be a time sink. - if compiler.stage != 0 { - match builder.config.rust_lto { - RustcLto::Thin | RustcLto::Fat => { - // Since using LTO for optimizing dylibs is currently experimental, - // we need to pass -Zdylib-lto. - cargo.rustflag("-Zdylib-lto"); - // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when - // compiling dylibs (and their dependencies), even when LTO is enabled for the - // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here. - let lto_type = match builder.config.rust_lto { - RustcLto::Thin => "thin", - RustcLto::Fat => "fat", - _ => unreachable!(), - }; - cargo.rustflag(&format!("-Clto={lto_type}")); - cargo.rustflag("-Cembed-bitcode=yes"); - } - RustcLto::ThinLocal => { /* Do nothing, this is the default */ } - RustcLto::Off => { - cargo.rustflag("-Clto=off"); - } - } - } else if builder.config.rust_lto == RustcLto::Off { - cargo.rustflag("-Clto=off"); - } - for krate in &*self.crates { cargo.arg("-p").arg(krate); } @@ -989,6 +961,34 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)"); + // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary + // and may just be a time sink. + if stage != 0 { + match builder.config.rust_lto { + RustcLto::Thin | RustcLto::Fat => { + // Since using LTO for optimizing dylibs is currently experimental, + // we need to pass -Zdylib-lto. + cargo.rustflag("-Zdylib-lto"); + // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when + // compiling dylibs (and their dependencies), even when LTO is enabled for the + // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here. + let lto_type = match builder.config.rust_lto { + RustcLto::Thin => "thin", + RustcLto::Fat => "fat", + _ => unreachable!(), + }; + cargo.rustflag(&format!("-Clto={lto_type}")); + cargo.rustflag("-Cembed-bitcode=yes"); + } + RustcLto::ThinLocal => { /* Do nothing, this is the default */ } + RustcLto::Off => { + cargo.rustflag("-Clto=off"); + } + } + } else if builder.config.rust_lto == RustcLto::Off { + cargo.rustflag("-Clto=off"); + } + rustc_cargo_env(builder, cargo, target, stage); } diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index c33e66e02ac41..e0ec76aa027b7 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -11,7 +11,7 @@ use once_cell::sync::Lazy; use regex::Regex; use tracing::*; -#[derive(Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq)] pub enum ErrorKind { Help, Error, diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ca80328f3ac03..1f5f77839de41 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3977,23 +3977,29 @@ impl<'test> TestCx<'test> { proc_res.status, self.props.error_patterns ); - if !explicit && self.config.compare_mode.is_none() { - let check_patterns = should_run == WillExecute::No - && (!self.props.error_patterns.is_empty() - || !self.props.regex_error_patterns.is_empty()); + let check_patterns = should_run == WillExecute::No + && (!self.props.error_patterns.is_empty() + || !self.props.regex_error_patterns.is_empty()); + if !explicit && self.config.compare_mode.is_none() { let check_annotations = !check_patterns || !expected_errors.is_empty(); - if check_patterns { - // "// error-pattern" comments - let output_to_check = self.get_output(&proc_res); - self.check_all_error_patterns(&output_to_check, &proc_res, pm); - } - if check_annotations { // "//~ERROR comments" self.check_expected_errors(expected_errors, &proc_res); } + } else if explicit && !expected_errors.is_empty() { + let msg = format!( + "line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead", + expected_errors[0].line_num, + expected_errors[0].kind.unwrap_or(ErrorKind::Error), + ); + self.fatal(&msg); + } + if check_patterns { + // "// error-pattern" comments + let output_to_check = self.get_output(&proc_res); + self.check_all_error_patterns(&output_to_check, &proc_res, pm); } if self.props.run_rustfix && self.config.compare_mode.is_none() { diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs index e79bd70e915e5..8a5c10913b48a 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs @@ -14,7 +14,7 @@ fn main() { let ptr = std::ptr::addr_of_mut!(non_copy); // Inside `callee`, the first argument and `*ptr` are basically // aliasing places! - Call(_unit = callee(Move(*ptr), ptr), after_call, UnwindContinue()) + Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { Return() diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr index 1756123c84ebc..422dc24343612 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr @@ -27,8 +27,8 @@ LL | unsafe { ptr.write(S(0)) }; note: inside `main` --> $DIR/arg_inplace_mutate.rs:LL:CC | -LL | Call(_unit = callee(Move(*ptr), ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr index 76f7ee189e3d4..4fe9b7b4728da 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr @@ -35,8 +35,8 @@ LL | unsafe { ptr.write(S(0)) }; note: inside `main` --> $DIR/arg_inplace_mutate.rs:LL:CC | -LL | Call(_unit = callee(Move(*ptr), ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs index e4c00fdd84561..18daf9497a15b 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs @@ -11,7 +11,7 @@ fn main() { { let non_copy = S(42); // This could change `non_copy` in-place - Call(_unit = change_arg(Move(non_copy)), after_call, UnwindContinue()) + Call(_unit = change_arg(Move(non_copy)), ReturnTo(after_call), UnwindContinue()) } after_call = { // So now we must not be allowed to observe non-copy again. diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr index 723ca75daef89..1c73577f5cd5d 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr @@ -11,8 +11,8 @@ LL | unsafe { ptr.read() }; note: inside `main` --> $DIR/arg_inplace_observe_during.rs:LL:CC | -LL | Call(_unit = change_arg(Move(*ptr), ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_unit = change_arg(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs index 517abd733a9ce..2201bf17bfc78 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs @@ -14,7 +14,7 @@ fn main() { let non_copy = S(42); let ptr = std::ptr::addr_of_mut!(non_copy); // This could change `non_copy` in-place - Call(_unit = change_arg(Move(*ptr), ptr), after_call, UnwindContinue()) + Call(_unit = change_arg(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { Return() diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr index 401e8c6d5a8a6..09c9a777eca46 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr @@ -27,8 +27,8 @@ LL | x.0 = 0; note: inside `main` --> $DIR/arg_inplace_observe_during.rs:LL:CC | -LL | Call(_unit = change_arg(Move(*ptr), ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_unit = change_arg(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr index 3529ddd3c53cb..67906f24bbd03 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr @@ -35,8 +35,8 @@ LL | x.0 = 0; note: inside `main` --> $DIR/arg_inplace_observe_during.rs:LL:CC | -LL | Call(_unit = change_arg(Move(*ptr), ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_unit = change_arg(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr index 48db898a250fc..eb215a2d2e805 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr @@ -11,8 +11,8 @@ LL | unsafe { ptr.read() }; note: inside `main` --> $DIR/return_pointer_aliasing.rs:LL:CC | -LL | Call(*ptr = myfun(ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(*ptr = myfun(ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs index 23b1e38b99f72..c8e0782eff2ff 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs @@ -15,7 +15,7 @@ pub fn main() { let ptr = &raw mut x; // We arrange for `myfun` to have a pointer that aliases // its return place. Even just reading from that pointer is UB. - Call(*ptr = myfun(ptr), after_call, UnwindContinue()) + Call(*ptr = myfun(ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr index 85dcd29ba5513..01357f430fc71 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr @@ -27,8 +27,8 @@ LL | unsafe { ptr.read() }; note: inside `main` --> $DIR/return_pointer_aliasing.rs:LL:CC | -LL | Call(*ptr = myfun(ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(*ptr = myfun(ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr index ea1867b1a7153..6b3f5fbedee9c 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr @@ -35,8 +35,8 @@ LL | unsafe { ptr.read() }; note: inside `main` --> $DIR/return_pointer_aliasing.rs:LL:CC | -LL | Call(*ptr = myfun(ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(*ptr = myfun(ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.rs b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.rs index 56706cdb63bad..7db641538ce55 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.rs +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.rs @@ -15,7 +15,7 @@ pub fn main() { let ptr = &raw mut _x; // We arrange for `myfun` to have a pointer that aliases // its return place. Even just reading from that pointer is UB. - Call(_x = myfun(ptr), after_call, UnwindContinue()) + Call(_x = myfun(ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.stack.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.stack.stderr index 12a99fbf2931f..04040827b0f97 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.stack.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.stack.stderr @@ -30,8 +30,8 @@ LL | unsafe { ptr.write(0) }; note: inside `main` --> $DIR/return_pointer_aliasing2.rs:LL:CC | -LL | Call(_x = myfun(ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_x = myfun(ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr index 926303bb48948..37c98eabbec83 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr @@ -35,8 +35,8 @@ LL | unsafe { ptr.write(0) }; note: inside `main` --> $DIR/return_pointer_aliasing2.rs:LL:CC | -LL | Call(_x = myfun(ptr), after_call, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Call(_x = myfun(ptr), ReturnTo(after_call), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.rs b/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.rs index 923c59e74299a..244acd8f2be5e 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.rs +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.rs @@ -14,7 +14,7 @@ struct S(i32, [u8; 128]); fn docall(out: &mut S) { mir! { { - Call(*out = callee(), after_call, UnwindContinue()) + Call(*out = callee(), ReturnTo(after_call), UnwindContinue()) } after_call = { @@ -37,7 +37,7 @@ fn callee() -> S { // become visible to the outside. In codegen we can see them // but Miri should detect this as UB! RET.0 = 42; - Call(_unit = startpanic(), after_call, UnwindContinue()) + Call(_unit = startpanic(), ReturnTo(after_call), UnwindContinue()) } after_call = { diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.rs b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.rs index 9357b37250508..3a87bb786776e 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.rs +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.rs @@ -20,7 +20,7 @@ fn call(f: fn(NonZeroU32)) { let tmp = ptr::addr_of!(c); let ptr = tmp as *const NonZeroU32; // The call site now is a NonZeroU32-to-u32 transmute. - Call(_res = f(*ptr), retblock, UnwindContinue()) //~ERROR: expected something greater or equal to 1 + Call(_res = f(*ptr), ReturnTo(retblock), UnwindContinue()) //~ERROR: expected something greater or equal to 1 } retblock = { Return() diff --git a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr index 9e9ea710f0e47..b1a2bd2c79a40 100644 --- a/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr +++ b/src/tools/miri/tests/fail/validity/cast_fn_ptr_invalid_caller_arg.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: constructing invalid value: encountered 0, but expected something greater or equal to 1 --> $DIR/cast_fn_ptr_invalid_caller_arg.rs:LL:CC | -LL | Call(_res = f(*ptr), retblock, UnwindContinue()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 +LL | Call(_res = f(*ptr), ReturnTo(retblock), UnwindContinue()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs b/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs index 89ee689fabe1f..a5cbe2a0d1d9e 100644 --- a/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs +++ b/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs @@ -11,7 +11,7 @@ pub fn main() { { let x = 0; let ptr = &raw mut x; - Call(*ptr = myfun(), after_call, UnwindContinue()) + Call(*ptr = myfun(), ReturnTo(after_call), UnwindContinue()) } after_call = { diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs index a83a6c07461f4..01c132cf3e77a 100644 --- a/tests/mir-opt/building/custom/terminators.rs +++ b/tests/mir-opt/building/custom/terminators.rs @@ -13,7 +13,7 @@ fn ident(t: T) -> T { fn direct_call(x: i32) -> i32 { mir!( { - Call(RET = ident(x), retblock, UnwindContinue()) + Call(RET = ident(x), ReturnTo(retblock), UnwindContinue()) } retblock = { @@ -27,7 +27,7 @@ fn direct_call(x: i32) -> i32 { fn indirect_call(x: i32, f: fn(i32) -> i32) -> i32 { mir!( { - Call(RET = f(x), retblock, UnwindContinue()) + Call(RET = f(x), ReturnTo(retblock), UnwindContinue()) } retblock = { @@ -49,7 +49,7 @@ impl<'a> Drop for WriteOnDrop<'a> { fn drop_first<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) { mir!( { - Drop(a, retblock, UnwindContinue()) + Drop(a, ReturnTo(retblock), UnwindContinue()) } retblock = { @@ -64,7 +64,7 @@ fn drop_first<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) { fn drop_second<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) { mir!( { - Drop(b, retblock, UnwindContinue()) + Drop(b, ReturnTo(retblock), UnwindContinue()) } retblock = { diff --git a/tests/mir-opt/building/custom/unwind_action.rs b/tests/mir-opt/building/custom/unwind_action.rs index e3c4ffac358ad..0dfbf780f676a 100644 --- a/tests/mir-opt/building/custom/unwind_action.rs +++ b/tests/mir-opt/building/custom/unwind_action.rs @@ -11,7 +11,7 @@ use core::intrinsics::mir::*; pub fn a() { mir!( { - Call(RET = a(), bb1, UnwindUnreachable()) + Call(RET = a(), ReturnTo(bb1), UnwindUnreachable()) } bb1 = { Return() @@ -26,7 +26,7 @@ pub fn a() { pub fn b() { mir!( { - Call(RET = b(), bb1, UnwindContinue()) + Call(RET = b(), ReturnTo(bb1), UnwindContinue()) } bb1 = { Return() @@ -41,7 +41,7 @@ pub fn b() { pub fn c() { mir!( { - Call(RET = c(), bb1, UnwindTerminate(ReasonAbi)) + Call(RET = c(), ReturnTo(bb1), UnwindTerminate(ReasonAbi)) } bb1 = { Return() @@ -56,7 +56,7 @@ pub fn c() { pub fn d() { mir!( { - Call(RET = d(), bb1, UnwindCleanup(bb2)) + Call(RET = d(), ReturnTo(bb1), UnwindCleanup(bb2)) } bb1 = { Return() diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index a44e65164af01..af40f5bce8b23 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -22,11 +22,11 @@ fn f() -> bool { let b = a; // We cannot propagate the place `a`. let r2 = &b; - Call(RET = cmp_ref(r1, r2), next, UnwindContinue()) + Call(RET = cmp_ref(r1, r2), ReturnTo(next), UnwindContinue()) } next = { // But we can propagate the value `a`. - Call(RET = opaque(b), ret, UnwindContinue()) + Call(RET = opaque(b), ReturnTo(ret), UnwindContinue()) } ret = { Return() diff --git a/tests/mir-opt/copy-prop/calls.rs b/tests/mir-opt/copy-prop/calls.rs index bc6760707ccca..a6b5d511805c4 100644 --- a/tests/mir-opt/copy-prop/calls.rs +++ b/tests/mir-opt/copy-prop/calls.rs @@ -26,7 +26,7 @@ fn multiple_edges(t: bool) -> u8 { match t { true => bbt, _ => ret } } bbt = { - Call(x = dummy(13), ret, UnwindContinue()) + Call(x = dummy(13), ReturnTo(ret), UnwindContinue()) } ret = { // `x` is not assigned on the `bb0 -> ret` edge, diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs index 8593d9fa9aba2..45913626a8fe5 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.rs +++ b/tests/mir-opt/copy-prop/custom_move_arg.rs @@ -14,11 +14,11 @@ struct NotCopy(bool); fn f(_1: NotCopy) { mir!({ let _2 = _1; - Call(RET = opaque(Move(_1)), bb1, UnwindContinue()) + Call(RET = opaque(Move(_1)), ReturnTo(bb1), UnwindContinue()) } bb1 = { let _3 = Move(_2); - Call(RET = opaque(_3), bb2, UnwindContinue()) + Call(RET = opaque(_3), ReturnTo(bb2), UnwindContinue()) } bb2 = { Return() diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs index 438a90dddd0cb..f02867814ac0a 100644 --- a/tests/mir-opt/copy-prop/move_projection.rs +++ b/tests/mir-opt/copy-prop/move_projection.rs @@ -18,10 +18,10 @@ fn f(a: Foo) -> bool { let b = a; // This is a move out of a copy, so must become a copy of `a.0`. let c = Move(b.0); - Call(RET = opaque(Move(a)), bb1, UnwindContinue()) + Call(RET = opaque(Move(a)), ReturnTo(bb1), UnwindContinue()) } bb1 = { - Call(RET = opaque(Move(c)), ret, UnwindContinue()) + Call(RET = opaque(Move(c)), ReturnTo(ret), UnwindContinue()) } ret = { Return() diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs index b2eb64756f9ac..490a4aa502c38 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -28,7 +28,7 @@ struct Packed { fn move_packed(packed: Packed) { mir!( { - Call(RET = use_both(0, packed.y), ret, UnwindContinue()) + Call(RET = use_both(0, packed.y), ReturnTo(ret), UnwindContinue()) } ret = { Return() diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs index c9ad06a9da266..13e5411275da8 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.rs +++ b/tests/mir-opt/dead-store-elimination/cycle.rs @@ -20,7 +20,7 @@ fn cycle(mut x: i32, mut y: i32, mut z: i32) { mir!( let condition: bool; { - Call(condition = cond(), bb1, UnwindContinue()) + Call(condition = cond(), ReturnTo(bb1), UnwindContinue()) } bb1 = { match condition { true => bb2, _ => ret } @@ -30,7 +30,7 @@ fn cycle(mut x: i32, mut y: i32, mut z: i32) { z = y; y = x; x = temp; - Call(condition = cond(), bb1, UnwindContinue()) + Call(condition = cond(), ReturnTo(bb1), UnwindContinue()) } ret = { Return() diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index db131f7f97d8b..23e33a0fa49ea 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -529,31 +529,31 @@ fn duplicate_slice() -> (bool, bool) { // CHECK: [[a:_.*]] = (const "a",); // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute); let a = ("a",); - Call(au = transmute::<_, u128>(a.0), bb1, UnwindContinue()) + Call(au = transmute::<_, u128>(a.0), ReturnTo(bb1), UnwindContinue()) } bb1 = { // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str)) - Call(c = identity(a.0), bb2, UnwindContinue()) + Call(c = identity(a.0), ReturnTo(bb2), UnwindContinue()) } bb2 = { // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute); - Call(cu = transmute::<_, u128>(c), bb3, UnwindContinue()) + Call(cu = transmute::<_, u128>(c), ReturnTo(bb3), UnwindContinue()) } bb3 = { // This slice is different from `a.0`. Hence `bu` is not `au`. // CHECK: [[b:_.*]] = const "a"; // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute); let b = "a"; - Call(bu = transmute::<_, u128>(b), bb4, UnwindContinue()) + Call(bu = transmute::<_, u128>(b), ReturnTo(bb4), UnwindContinue()) } bb4 = { // This returns a copy of `b`, which is not `a`. // CHECK: [[d:_.*]] = identity::<&str>([[b]]) - Call(d = identity(b), bb5, UnwindContinue()) + Call(d = identity(b), ReturnTo(bb5), UnwindContinue()) } bb5 = { // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute); - Call(du = transmute::<_, u128>(d), bb6, UnwindContinue()) + Call(du = transmute::<_, u128>(d), ReturnTo(bb6), UnwindContinue()) } bb6 = { // `direct` must not fold to `true`, as `indirect` will not. diff --git a/tests/mir-opt/inline/indirect_destination.rs b/tests/mir-opt/inline/indirect_destination.rs index 2842e23366e00..82143d85c258a 100644 --- a/tests/mir-opt/inline/indirect_destination.rs +++ b/tests/mir-opt/inline/indirect_destination.rs @@ -25,7 +25,7 @@ pub fn f(a: *mut u8) { Goto(bb1) } bb1 = { - Call(*a = g(), bb1, UnwindUnreachable()) + Call(*a = g(), ReturnTo(bb1), UnwindUnreachable()) } } } diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 8adfbb4535b9a..b71ad90abb19d 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -696,7 +696,7 @@ fn multiple_storage() { // As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s // pointer address is the address of `x`, so do nothing. let y = *z; - Call(RET = opaque(y), retblock, UnwindContinue()) + Call(RET = opaque(y), ReturnTo(retblock), UnwindContinue()) } retblock = { @@ -724,7 +724,7 @@ fn dominate_storage() { } bb1 = { let c = *r; - Call(RET = opaque(c), bb2, UnwindContinue()) + Call(RET = opaque(c), ReturnTo(bb2), UnwindContinue()) } bb2 = { StorageDead(x); @@ -760,18 +760,18 @@ fn maybe_dead(m: bool) { bb1 = { StorageDead(x); StorageDead(y); - Call(RET = opaque(u), bb2, UnwindContinue()) + Call(RET = opaque(u), ReturnTo(bb2), UnwindContinue()) } bb2 = { // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing. let z = *a; - Call(RET = opaque(z), bb3, UnwindContinue()) + Call(RET = opaque(z), ReturnTo(bb3), UnwindContinue()) } bb3 = { // As `y` may be `StorageDead`, `b` may be dangling, so we do nothing. // This implies that we also do not substitute `b` in `bb0`. let t = *b; - Call(RET = opaque(t), retblock, UnwindContinue()) + Call(RET = opaque(t), ReturnTo(retblock), UnwindContinue()) } retblock = { Return() diff --git a/tests/rustdoc-ui/issues/issue-81662-shortness.rs b/tests/rustdoc-ui/issues/issue-81662-shortness.rs index 0240d217bee52..79fb65dec48a0 100644 --- a/tests/rustdoc-ui/issues/issue-81662-shortness.rs +++ b/tests/rustdoc-ui/issues/issue-81662-shortness.rs @@ -1,4 +1,6 @@ // compile-flags:--test --error-format=short +// check-stdout +// error-pattern:cannot find function `foo` in this scope // normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 @@ -6,7 +8,6 @@ /// ```rust /// foo(); /// ``` -//~^^ ERROR cannot find function `foo` in this scope fn foo() { println!("Hello, world!"); } diff --git a/tests/rustdoc-ui/issues/issue-81662-shortness.stdout b/tests/rustdoc-ui/issues/issue-81662-shortness.stdout index 6313dde32c57d..f32f51e12f2c3 100644 --- a/tests/rustdoc-ui/issues/issue-81662-shortness.stdout +++ b/tests/rustdoc-ui/issues/issue-81662-shortness.stdout @@ -1,16 +1,16 @@ running 1 test -test $DIR/issue-81662-shortness.rs - foo (line 6) ... FAILED +test $DIR/issue-81662-shortness.rs - foo (line 8) ... FAILED failures: ----- $DIR/issue-81662-shortness.rs - foo (line 6) stdout ---- -$DIR/issue-81662-shortness.rs:7:1: error[E0425]: cannot find function `foo` in this scope +---- $DIR/issue-81662-shortness.rs - foo (line 8) stdout ---- +$DIR/issue-81662-shortness.rs:9:1: error[E0425]: cannot find function `foo` in this scope error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/issue-81662-shortness.rs - foo (line 6) + $DIR/issue-81662-shortness.rs - foo (line 8) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/ui/annotate-snippet/missing-type.rs b/tests/ui/annotate-snippet/missing-type.rs index b0d8b5fbaf224..f5facc16b3180 100644 --- a/tests/ui/annotate-snippet/missing-type.rs +++ b/tests/ui/annotate-snippet/missing-type.rs @@ -1,5 +1,6 @@ // compile-flags: --error-format human-annotate-rs -Z unstable-options +// error-pattern:cannot find type `Iter` in this scope pub fn main() { - let x: Iter; //~ ERROR cannot find type `Iter` in this scope + let x: Iter; } diff --git a/tests/ui/annotate-snippet/missing-type.stderr b/tests/ui/annotate-snippet/missing-type.stderr index c16f022a77fa3..89ce19c182f52 100644 --- a/tests/ui/annotate-snippet/missing-type.stderr +++ b/tests/ui/annotate-snippet/missing-type.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Iter` in this scope - --> $DIR/missing-type.rs:4:12 + --> $DIR/missing-type.rs:5:12 | LL | let x: Iter; | ^^^^ not found in this scope diff --git a/tests/ui/annotate-snippet/multispan.rs b/tests/ui/annotate-snippet/multispan.rs index 69d7e1a9d116a..d7241b8036492 100644 --- a/tests/ui/annotate-snippet/multispan.rs +++ b/tests/ui/annotate-snippet/multispan.rs @@ -1,4 +1,5 @@ // aux-build:multispan.rs +// error-pattern:hello to you, too! // compile-flags: --error-format human-annotate-rs -Z unstable-options #![feature(proc_macro_hygiene)] @@ -12,17 +13,17 @@ fn main() { hello!(); // Exactly one 'hi'. - hello!(hi); //~ ERROR hello to you, too! + hello!(hi); // Now two, back to back. - hello!(hi hi); //~ ERROR hello to you, too! + hello!(hi hi); // Now three, back to back. - hello!(hi hi hi); //~ ERROR hello to you, too! + hello!(hi hi hi); // Now several, with spacing. - hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! - hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! - hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! - hello!(hi good hi and good bye); //~ ERROR hello to you, too! + hello!(hi hey hi yo hi beep beep hi hi); + hello!(hi there, hi how are you? hi... hi.); + hello!(whoah. hi di hi di ho); + hello!(hi good hi and good bye); } diff --git a/tests/ui/annotate-snippet/multispan.stderr b/tests/ui/annotate-snippet/multispan.stderr index baed54c59a4e9..833b67730325e 100644 --- a/tests/ui/annotate-snippet/multispan.stderr +++ b/tests/ui/annotate-snippet/multispan.stderr @@ -1,41 +1,41 @@ error: hello to you, too! - --> $DIR/multispan.rs:15:5 + --> $DIR/multispan.rs:16:5 | LL | hello!(hi); | ^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:18:5 + --> $DIR/multispan.rs:19:5 | LL | hello!(hi hi); | ^^^^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:21:5 + --> $DIR/multispan.rs:22:5 | LL | hello!(hi hi hi); | ^^^^^^^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:24:5 + --> $DIR/multispan.rs:25:5 | LL | hello!(hi hey hi yo hi beep beep hi hi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:25:5 + --> $DIR/multispan.rs:26:5 | LL | hello!(hi there, hi how are you? hi... hi.); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:26:5 + --> $DIR/multispan.rs:27:5 | LL | hello!(whoah. hi di hi di ho); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | error: hello to you, too! - --> $DIR/multispan.rs:27:5 + --> $DIR/multispan.rs:28:5 | LL | hello!(hi good hi and good bye); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/coroutine/gen_block.e2024.stderr b/tests/ui/coroutine/gen_block.e2024.stderr index f250e2f79c77d..e32f80dafa0c1 100644 --- a/tests/ui/coroutine/gen_block.e2024.stderr +++ b/tests/ui/coroutine/gen_block.e2024.stderr @@ -8,10 +8,10 @@ LL | let _ = || yield true; = help: add `#![feature(coroutines)]` to the crate attributes to enable error[E0282]: type annotations needed - --> $DIR/gen_block.rs:6:17 + --> $DIR/gen_block.rs:6:13 | LL | let x = gen {}; - | ^^ cannot infer type + | ^^^^^^ cannot infer type error: aborting due to 2 previous errors diff --git a/tests/ui/coroutine/sized-yield.stderr b/tests/ui/coroutine/sized-yield.stderr index 40663ac12de46..bbecaffa95a12 100644 --- a/tests/ui/coroutine/sized-yield.stderr +++ b/tests/ui/coroutine/sized-yield.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/sized-yield.rs:8:27 + --> $DIR/sized-yield.rs:8:19 | LL | let mut gen = move || { - | ___________________________^ + | ___________________^ LL | | LL | | yield s[..]; LL | | }; diff --git a/tests/ui/diagnostic-width/flag-json.rs b/tests/ui/diagnostic-width/flag-json.rs index 51a1fb447c7d2..820f1a049e1f7 100644 --- a/tests/ui/diagnostic-width/flag-json.rs +++ b/tests/ui/diagnostic-width/flag-json.rs @@ -1,9 +1,9 @@ // compile-flags: --diagnostic-width=20 --error-format=json +// error-pattern:expected `()`, found integer // This test checks that `-Z output-width` effects the JSON error output by restricting it to an // arbitrarily low value so that the effect is visible. fn main() { let _: () = 42; - //~^ ERROR arguments to this function are incorrect } diff --git a/tests/ui/diagnostic-width/flag-json.stderr b/tests/ui/diagnostic-width/flag-json.stderr index f3bf4f97942c8..0a4b54ebc8565 100644 --- a/tests/ui/diagnostic-width/flag-json.stderr +++ b/tests/ui/diagnostic-width/flag-json.stderr @@ -24,8 +24,8 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":243,"byte_end":245,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":238,"byte_end":240,"line_start":7,"line_end":7,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types - --> $DIR/flag-json.rs:7:17 +"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":289,"byte_end":291,"line_start":8,"line_end":8,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":284,"byte_end":286,"line_start":8,"line_end":8,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types + --> $DIR/flag-json.rs:8:17 | LL | ..._: () = 42; | -- ^^ expected `()`, found integer diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr index c582ca7ba3d58..526354f6cfbdf 100644 --- a/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr +++ b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr @@ -35,16 +35,16 @@ LL | async gen {}; = help: add `#![feature(gen_blocks)]` to the crate attributes to enable error[E0282]: type annotations needed - --> $DIR/feature-gate-gen_blocks.rs:5:9 + --> $DIR/feature-gate-gen_blocks.rs:5:5 | LL | gen {}; - | ^^ cannot infer type + | ^^^^^^ cannot infer type error[E0282]: type annotations needed - --> $DIR/feature-gate-gen_blocks.rs:12:15 + --> $DIR/feature-gate-gen_blocks.rs:12:5 | LL | async gen {}; - | ^^ cannot infer type + | ^^^^^^^^^^^^ cannot infer type error: aborting due to 6 previous errors diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions2.rs b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs index 4615ebd688a9c..0e96cfe785857 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions2.rs +++ b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs @@ -8,8 +8,7 @@ fn main() { for x in -9 + 1..=(9 - 2) { match x as i32 { 0..=(5+1) => errors_only.push(x), - //~^ error: inclusive range with no end - //~| error: expected one of `=>`, `if`, or `|`, found `(` + //~^ error: expected `)`, found `+` 1 | -3..0 => first_or.push(x), y @ (0..5 | 6) => or_two.push(y), y @ 0..const { 5 + 1 } => assert_eq!(y, 5), diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr b/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr index 13a5542a4741f..a54f29a3b3263 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr +++ b/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr @@ -1,17 +1,8 @@ -error[E0586]: inclusive range with no end - --> $DIR/range_pat_interactions2.rs:10:14 +error: expected `)`, found `+` + --> $DIR/range_pat_interactions2.rs:10:19 | LL | 0..=(5+1) => errors_only.push(x), - | ^^^ help: use `..` instead - | - = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) - -error: expected one of `=>`, `if`, or `|`, found `(` - --> $DIR/range_pat_interactions2.rs:10:17 - | -LL | 0..=(5+1) => errors_only.push(x), - | ^ expected one of `=>`, `if`, or `|` + | ^ expected `)` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0586`. diff --git a/tests/ui/lint/unused_parens_json_suggestion.fixed b/tests/ui/lint/unused_parens_json_suggestion.fixed index c400454046748..b73197ef1bd0b 100644 --- a/tests/ui/lint/unused_parens_json_suggestion.fixed +++ b/tests/ui/lint/unused_parens_json_suggestion.fixed @@ -1,4 +1,5 @@ // compile-flags: --error-format json +// error-pattern:unnecessary parentheses // run-rustfix // The output for humans should just highlight the whole span without showing @@ -13,7 +14,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = 1 / (2 + 3); //~ERROR unnecessary parentheses + let _a = 1 / (2 + 3); f(); } diff --git a/tests/ui/lint/unused_parens_json_suggestion.rs b/tests/ui/lint/unused_parens_json_suggestion.rs index 962c8bdd7d789..4339655cf9d51 100644 --- a/tests/ui/lint/unused_parens_json_suggestion.rs +++ b/tests/ui/lint/unused_parens_json_suggestion.rs @@ -1,4 +1,5 @@ // compile-flags: --error-format json +// error-pattern:unnecessary parentheses // run-rustfix // The output for humans should just highlight the whole span without showing @@ -13,7 +14,7 @@ fn main() { // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not // the malformed `1 / (2 + 3` - let _a = (1 / (2 + 3)); //~ERROR unnecessary parentheses + let _a = (1 / (2 + 3)); f(); } diff --git a/tests/ui/lint/unused_parens_json_suggestion.stderr b/tests/ui/lint/unused_parens_json_suggestion.stderr index 4bdfee9159b2d..88f6be4236b2b 100644 --- a/tests/ui/lint/unused_parens_json_suggestion.stderr +++ b/tests/ui/lint/unused_parens_json_suggestion.stderr @@ -1,11 +1,11 @@ -{"$message_type":"diagnostic","message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":577,"byte_end":578,"line_start":16,"line_end":16,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3)); - --> $DIR/unused_parens_json_suggestion.rs:16:14 +{"$message_type":"diagnostic","message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":618,"byte_end":619,"line_start":17,"line_end":17,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":630,"byte_end":631,"line_start":17,"line_end":17,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":436,"byte_end":449,"line_start":11,"line_end":11,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":618,"byte_end":619,"line_start":17,"line_end":17,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":630,"byte_end":631,"line_start":17,"line_end":17,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around assigned value + --> $DIR/unused_parens_json_suggestion.rs:17:14 | LL | let _a = (1 / (2 + 3)); | ^ ^ | note: the lint level is defined here - --> $DIR/unused_parens_json_suggestion.rs:10:9 + --> $DIR/unused_parens_json_suggestion.rs:11:9 | LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused_parens_remove_json_suggestion.fixed b/tests/ui/lint/unused_parens_remove_json_suggestion.fixed index 8a57cd57385f3..39d7a1127b642 100644 --- a/tests/ui/lint/unused_parens_remove_json_suggestion.fixed +++ b/tests/ui/lint/unused_parens_remove_json_suggestion.fixed @@ -1,4 +1,5 @@ // compile-flags: --error-format json +// error-pattern:unnecessary parentheses // run-rustfix // The output for humans should just highlight the whole span without showing @@ -14,7 +15,7 @@ fn main() { let _b = false; - if _b { //~ ERROR unnecessary parentheses + if _b { println!("hello"); } @@ -25,29 +26,29 @@ fn main() { fn f() -> bool { let c = false; - if c { //~ ERROR unnecessary parentheses + if c { println!("next"); } - if c { //~ ERROR unnecessary parentheses + if c { println!("prev"); } while false && true { - if c { //~ ERROR unnecessary parentheses + if c { println!("norm"); } } - while true && false { //~ ERROR unnecessary parentheses - for _ in 0 .. 3 { //~ ERROR unnecessary parentheses + while true && false { + for _ in 0 .. 3 { println!("e~") } } - for _ in 0 .. 3 { //~ ERROR unnecessary parentheses - while true && false { //~ ERROR unnecessary parentheses + for _ in 0 .. 3 { + while true && false { println!("e~") } } diff --git a/tests/ui/lint/unused_parens_remove_json_suggestion.rs b/tests/ui/lint/unused_parens_remove_json_suggestion.rs index 952332d54e9c1..2748bd3f73df6 100644 --- a/tests/ui/lint/unused_parens_remove_json_suggestion.rs +++ b/tests/ui/lint/unused_parens_remove_json_suggestion.rs @@ -1,4 +1,5 @@ // compile-flags: --error-format json +// error-pattern:unnecessary parentheses // run-rustfix // The output for humans should just highlight the whole span without showing @@ -14,7 +15,7 @@ fn main() { let _b = false; - if (_b) { //~ ERROR unnecessary parentheses + if (_b) { println!("hello"); } @@ -25,29 +26,29 @@ fn main() { fn f() -> bool { let c = false; - if(c) { //~ ERROR unnecessary parentheses + if(c) { println!("next"); } - if (c){ //~ ERROR unnecessary parentheses + if (c){ println!("prev"); } while (false && true){ - if (c) { //~ ERROR unnecessary parentheses + if (c) { println!("norm"); } } - while(true && false) { //~ ERROR unnecessary parentheses - for _ in (0 .. 3){ //~ ERROR unnecessary parentheses + while(true && false) { + for _ in (0 .. 3){ println!("e~") } } - for _ in (0 .. 3) { //~ ERROR unnecessary parentheses - while (true && false) { //~ ERROR unnecessary parentheses + for _ in (0 .. 3) { + while (true && false) { println!("e~") } } diff --git a/tests/ui/lint/unused_parens_remove_json_suggestion.stderr b/tests/ui/lint/unused_parens_remove_json_suggestion.stderr index 7521d41cc939d..80371c1594f71 100644 --- a/tests/ui/lint/unused_parens_remove_json_suggestion.stderr +++ b/tests/ui/lint/unused_parens_remove_json_suggestion.stderr @@ -1,11 +1,11 @@ -{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":481,"byte_end":482,"line_start":17,"line_end":17,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) { - --> $DIR/unused_parens_remove_json_suggestion.rs:17:8 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":522,"byte_end":523,"line_start":18,"line_end":18,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":525,"byte_end":526,"line_start":18,"line_end":18,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":436,"byte_end":449,"line_start":11,"line_end":11,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":522,"byte_end":523,"line_start":18,"line_end":18,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":525,"byte_end":526,"line_start":18,"line_end":18,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:18:8 | LL | if (_b) { | ^ ^ | note: the lint level is defined here - --> $DIR/unused_parens_remove_json_suggestion.rs:10:9 + --> $DIR/unused_parens_remove_json_suggestion.rs:11:9 | LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ @@ -16,8 +16,8 @@ LL + if _b { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":612,"byte_end":613,"line_start":28,"line_end":28,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) { - --> $DIR/unused_parens_remove_json_suggestion.rs:28:7 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":619,"byte_end":620,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":621,"byte_end":622,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":619,"byte_end":620,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":621,"byte_end":622,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:29:7 | LL | if(c) { | ^ ^ @@ -29,8 +29,8 @@ LL + if c { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":692,"byte_end":693,"line_start":32,"line_end":32,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){ - --> $DIR/unused_parens_remove_json_suggestion.rs:32:8 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":665,"byte_end":666,"line_start":33,"line_end":33,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":667,"byte_end":668,"line_start":33,"line_end":33,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":665,"byte_end":666,"line_start":33,"line_end":33,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":667,"byte_end":668,"line_start":33,"line_end":33,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:33:8 | LL | if (c){ | ^ ^ @@ -42,8 +42,8 @@ LL + if c { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":774,"byte_end":775,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":788,"byte_end":789,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition - --> $DIR/unused_parens_remove_json_suggestion.rs:36:11 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":713,"byte_end":714,"line_start":37,"line_end":37,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":727,"byte_end":728,"line_start":37,"line_end":37,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":713,"byte_end":714,"line_start":37,"line_end":37,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":727,"byte_end":728,"line_start":37,"line_end":37,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:37:11 | LL | while (false && true){ | ^ ^ @@ -55,8 +55,8 @@ LL + while false && true { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":802,"byte_end":803,"line_start":37,"line_end":37,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) { - --> $DIR/unused_parens_remove_json_suggestion.rs:37:12 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":741,"byte_end":742,"line_start":38,"line_end":38,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":743,"byte_end":744,"line_start":38,"line_end":38,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":741,"byte_end":742,"line_start":38,"line_end":38,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":743,"byte_end":744,"line_start":38,"line_end":38,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:38:12 | LL | if (c) { | ^ ^ @@ -68,8 +68,8 @@ LL + if c { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":899,"byte_end":900,"line_start":43,"line_end":43,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) { - --> $DIR/unused_parens_remove_json_suggestion.rs:43:10 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":804,"byte_end":805,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":818,"byte_end":819,"line_start":44,"line_end":44,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":804,"byte_end":805,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":818,"byte_end":819,"line_start":44,"line_end":44,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:44:10 | LL | while(true && false) { | ^ ^ @@ -81,8 +81,8 @@ LL + while true && false { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":968,"byte_end":969,"line_start":44,"line_end":44,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){ - --> $DIR/unused_parens_remove_json_suggestion.rs:44:18 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":839,"byte_end":840,"line_start":45,"line_end":45,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":846,"byte_end":847,"line_start":45,"line_end":45,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":839,"byte_end":840,"line_start":45,"line_end":45,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":846,"byte_end":847,"line_start":45,"line_end":45,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression + --> $DIR/unused_parens_remove_json_suggestion.rs:45:18 | LL | for _ in (0 .. 3){ | ^ ^ @@ -94,8 +94,8 @@ LL + for _ in 0 .. 3 { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1069,"byte_end":1070,"line_start":49,"line_end":49,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) { - --> $DIR/unused_parens_remove_json_suggestion.rs:49:14 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":906,"byte_end":907,"line_start":50,"line_end":50,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":913,"byte_end":914,"line_start":50,"line_end":50,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":906,"byte_end":907,"line_start":50,"line_end":50,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":913,"byte_end":914,"line_start":50,"line_end":50,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression + --> $DIR/unused_parens_remove_json_suggestion.rs:50:14 | LL | for _ in (0 .. 3) { | ^ ^ @@ -107,8 +107,8 @@ LL + for _ in 0 .. 3 { | "} -{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1128,"byte_end":1129,"line_start":50,"line_end":50,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) { - --> $DIR/unused_parens_remove_json_suggestion.rs:50:15 +{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":931,"byte_end":932,"line_start":51,"line_end":51,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":945,"byte_end":946,"line_start":51,"line_end":51,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":931,"byte_end":932,"line_start":51,"line_end":51,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":945,"byte_end":946,"line_start":51,"line_end":51,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition + --> $DIR/unused_parens_remove_json_suggestion.rs:51:15 | LL | while (true && false) { | ^ ^ diff --git a/tests/ui/mir/ssa_call_ret.rs b/tests/ui/mir/ssa_call_ret.rs index 6132a6691dea3..f8a83249225c2 100644 --- a/tests/ui/mir/ssa_call_ret.rs +++ b/tests/ui/mir/ssa_call_ret.rs @@ -13,7 +13,7 @@ pub fn f() -> u32 { mir!( let a: u32; { - Call(a = g(), bb1, UnwindCleanup(bb2)) + Call(a = g(), ReturnTo(bb1), UnwindCleanup(bb2)) } bb1 = { RET = a; diff --git a/tests/ui/mir/validate/critical-edge.rs b/tests/ui/mir/validate/critical-edge.rs index 9ef655cd1bb4a..3bb732ad3f776 100644 --- a/tests/ui/mir/validate/critical-edge.rs +++ b/tests/ui/mir/validate/critical-edge.rs @@ -20,7 +20,7 @@ pub fn f(a: u32) -> u32 { } } bb1 = { - Call(RET = f(1), bb2, UnwindTerminate(ReasonAbi)) + Call(RET = f(1), ReturnTo(bb2), UnwindTerminate(ReasonAbi)) } bb2 = { diff --git a/tests/ui/mir/validate/noncleanup-cleanup.rs b/tests/ui/mir/validate/noncleanup-cleanup.rs index 0a1c4528aa6d9..a14ab44257fa1 100644 --- a/tests/ui/mir/validate/noncleanup-cleanup.rs +++ b/tests/ui/mir/validate/noncleanup-cleanup.rs @@ -11,7 +11,7 @@ use core::intrinsics::mir::*; pub fn main() { mir!( { - Call(RET = main(), block, UnwindCleanup(block)) + Call(RET = main(), ReturnTo(block), UnwindCleanup(block)) } block = { Return() diff --git a/tests/ui/parser/pat-recover-ranges.rs b/tests/ui/parser/pat-recover-ranges.rs new file mode 100644 index 0000000000000..65a6fc6fe21f3 --- /dev/null +++ b/tests/ui/parser/pat-recover-ranges.rs @@ -0,0 +1,19 @@ +fn main() { + match -1 { + 0..=1 => (), + 0..=(1) => (), + //~^ error: range pattern bounds cannot have parentheses + (-12)..=4 => (), + //~^ error: range pattern bounds cannot have parentheses + (0)..=(-4) => (), + //~^ error: range pattern bounds cannot have parentheses + //~| error: range pattern bounds cannot have parentheses + }; +} + +macro_rules! m { + ($pat:pat) => {}; + (($s:literal)..($e:literal)) => {}; +} + +m!((7)..(7)); diff --git a/tests/ui/parser/pat-recover-ranges.stderr b/tests/ui/parser/pat-recover-ranges.stderr new file mode 100644 index 0000000000000..0d722b5aa95c8 --- /dev/null +++ b/tests/ui/parser/pat-recover-ranges.stderr @@ -0,0 +1,50 @@ +error: range pattern bounds cannot have parentheses + --> $DIR/pat-recover-ranges.rs:4:13 + | +LL | 0..=(1) => (), + | ^ ^ + | +help: remove these parentheses + | +LL - 0..=(1) => (), +LL + 0..=1 => (), + | + +error: range pattern bounds cannot have parentheses + --> $DIR/pat-recover-ranges.rs:6:9 + | +LL | (-12)..=4 => (), + | ^ ^ + | +help: remove these parentheses + | +LL - (-12)..=4 => (), +LL + -12..=4 => (), + | + +error: range pattern bounds cannot have parentheses + --> $DIR/pat-recover-ranges.rs:8:9 + | +LL | (0)..=(-4) => (), + | ^ ^ + | +help: remove these parentheses + | +LL - (0)..=(-4) => (), +LL + 0..=(-4) => (), + | + +error: range pattern bounds cannot have parentheses + --> $DIR/pat-recover-ranges.rs:8:15 + | +LL | (0)..=(-4) => (), + | ^ ^ + | +help: remove these parentheses + | +LL - (0)..=(-4) => (), +LL + (0)..=-4 => (), + | + +error: aborting due to 4 previous errors + diff --git a/tests/ui/proc-macro/inner-attrs.rs b/tests/ui/proc-macro/inner-attrs.rs index 1000c9c755ffc..c448294e0f64e 100644 --- a/tests/ui/proc-macro/inner-attrs.rs +++ b/tests/ui/proc-macro/inner-attrs.rs @@ -1,5 +1,6 @@ // gate-test-custom_inner_attributes // compile-flags: -Z span-debug --error-format human +// error-pattern:expected non-macro inner attribute // aux-build:test-macros.rs // edition:2018 @@ -61,19 +62,19 @@ fn bar() { ); for _ in &[true] { - #![print_attr] //~ ERROR expected non-macro inner attribute + #![print_attr] } let _ = { - #![print_attr] //~ ERROR expected non-macro inner attribute + #![print_attr] }; let _ = async { - #![print_attr] //~ ERROR expected non-macro inner attribute + #![print_attr] }; { - #![print_attr] //~ ERROR expected non-macro inner attribute + #![print_attr] }; } diff --git a/tests/ui/proc-macro/inner-attrs.stderr b/tests/ui/proc-macro/inner-attrs.stderr index a332e143a79f1..ee8732c650dc9 100644 --- a/tests/ui/proc-macro/inner-attrs.stderr +++ b/tests/ui/proc-macro/inner-attrs.stderr @@ -1,23 +1,23 @@ error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:64:12 + --> $DIR/inner-attrs.rs:65:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:68:12 + --> $DIR/inner-attrs.rs:69:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:72:12 + --> $DIR/inner-attrs.rs:73:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:76:12 + --> $DIR/inner-attrs.rs:77:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute diff --git a/tests/ui/proc-macro/inner-attrs.stdout b/tests/ui/proc-macro/inner-attrs.stdout index 037ec044e426e..39ec6834f0658 100644 --- a/tests/ui/proc-macro/inner-attrs.stdout +++ b/tests/ui/proc-macro/inner-attrs.stdout @@ -2,7 +2,7 @@ PRINT-ATTR_ARGS INPUT (DISPLAY): first PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "first", - span: $DIR/inner-attrs.rs:17:25: 17:30 (#0), + span: $DIR/inner-attrs.rs:18:25: 18:30 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo() @@ -13,40 +13,40 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attrs.rs:18:1: 18:2 (#0), + span: $DIR/inner-attrs.rs:19:1: 19:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:18:3: 18:24 (#0), + span: $DIR/inner-attrs.rs:19:3: 19:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "second", - span: $DIR/inner-attrs.rs:18:25: 18:31 (#0), + span: $DIR/inner-attrs.rs:19:25: 19:31 (#0), }, ], - span: $DIR/inner-attrs.rs:18:24: 18:32 (#0), + span: $DIR/inner-attrs.rs:19:24: 19:32 (#0), }, ], - span: $DIR/inner-attrs.rs:18:2: 18:33 (#0), + span: $DIR/inner-attrs.rs:19:2: 19:33 (#0), }, Ident { ident: "fn", - span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), + span: $DIR/inner-attrs.rs:20:1: 20:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:4: 20:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:9 (#0), }, Group { delimiter: Brace, @@ -54,72 +54,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), + span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), + span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), + span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:35 (#0), }, ], - span: $DIR/inner-attrs.rs:20:29: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:29: 21:36 (#0), }, ], - span: $DIR/inner-attrs.rs:20:7: 20:37 (#0), + span: $DIR/inner-attrs.rs:21:7: 21:37 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), + span: $DIR/inner-attrs.rs:22:5: 22:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), + span: $DIR/inner-attrs.rs:22:6: 22:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), + span: $DIR/inner-attrs.rs:22:8: 22:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), + span: $DIR/inner-attrs.rs:22:30: 22:36 (#0), }, ], - span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), + span: $DIR/inner-attrs.rs:22:29: 22:37 (#0), }, ], - span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), + span: $DIR/inner-attrs.rs:22:7: 22:38 (#0), }, ], - span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), + span: $DIR/inner-attrs.rs:20:10: 23:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): second PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "second", - span: $DIR/inner-attrs.rs:18:25: 18:31 (#0), + span: $DIR/inner-attrs.rs:19:25: 19:31 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() @@ -129,16 +129,16 @@ PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): fn foo() PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), + span: $DIR/inner-attrs.rs:20:1: 20:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:4: 20:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:9 (#0), }, Group { delimiter: Brace, @@ -146,72 +146,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), + span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), + span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), + span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:35 (#0), }, ], - span: $DIR/inner-attrs.rs:20:29: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:29: 21:36 (#0), }, ], - span: $DIR/inner-attrs.rs:20:7: 20:37 (#0), + span: $DIR/inner-attrs.rs:21:7: 21:37 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), + span: $DIR/inner-attrs.rs:22:5: 22:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), + span: $DIR/inner-attrs.rs:22:6: 22:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), + span: $DIR/inner-attrs.rs:22:8: 22:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), + span: $DIR/inner-attrs.rs:22:30: 22:36 (#0), }, ], - span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), + span: $DIR/inner-attrs.rs:22:29: 22:37 (#0), }, ], - span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), + span: $DIR/inner-attrs.rs:22:7: 22:38 (#0), }, ], - span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), + span: $DIR/inner-attrs.rs:20:10: 23:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): third PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:35 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() { #![print_target_and_args(fourth)] } @@ -219,16 +219,16 @@ PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): fn foo() { #! [print_target_and_args(fou PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), + span: $DIR/inner-attrs.rs:20:1: 20:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:4: 20:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:9 (#0), }, Group { delimiter: Brace, @@ -236,70 +236,70 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), + span: $DIR/inner-attrs.rs:22:5: 22:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), + span: $DIR/inner-attrs.rs:22:6: 22:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), + span: $DIR/inner-attrs.rs:22:8: 22:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), + span: $DIR/inner-attrs.rs:22:30: 22:36 (#0), }, ], - span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), + span: $DIR/inner-attrs.rs:22:29: 22:37 (#0), }, ], - span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), + span: $DIR/inner-attrs.rs:22:7: 22:38 (#0), }, ], - span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), + span: $DIR/inner-attrs.rs:20:10: 23:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): fourth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), + span: $DIR/inner-attrs.rs:22:30: 22:36 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), + span: $DIR/inner-attrs.rs:20:1: 20:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:4: 20:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:9 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), + span: $DIR/inner-attrs.rs:20:10: 23:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_first PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_first", - span: $DIR/inner-attrs.rs:24:25: 24:34 (#0), + span: $DIR/inner-attrs.rs:25:25: 25:34 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(mod_second)] mod inline_mod @@ -313,35 +313,35 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attrs.rs:25:1: 25:2 (#0), + span: $DIR/inner-attrs.rs:26:1: 26:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:25:3: 25:24 (#0), + span: $DIR/inner-attrs.rs:26:3: 26:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_second", - span: $DIR/inner-attrs.rs:25:25: 25:35 (#0), + span: $DIR/inner-attrs.rs:26:25: 26:35 (#0), }, ], - span: $DIR/inner-attrs.rs:25:24: 25:36 (#0), + span: $DIR/inner-attrs.rs:26:24: 26:36 (#0), }, ], - span: $DIR/inner-attrs.rs:25:2: 25:37 (#0), + span: $DIR/inner-attrs.rs:26:2: 26:37 (#0), }, Ident { ident: "mod", - span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), + span: $DIR/inner-attrs.rs:27:1: 27:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:15 (#0), }, Group { delimiter: Brace, @@ -349,72 +349,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), + span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), + span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), + span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:39 (#0), }, ], - span: $DIR/inner-attrs.rs:27:29: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:29: 28:40 (#0), }, ], - span: $DIR/inner-attrs.rs:27:7: 27:41 (#0), + span: $DIR/inner-attrs.rs:28:7: 28:41 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), + span: $DIR/inner-attrs.rs:29:5: 29:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), + span: $DIR/inner-attrs.rs:29:6: 29:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), + span: $DIR/inner-attrs.rs:29:8: 29:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), + span: $DIR/inner-attrs.rs:29:30: 29:40 (#0), }, ], - span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), + span: $DIR/inner-attrs.rs:29:29: 29:41 (#0), }, ], - span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), + span: $DIR/inner-attrs.rs:29:7: 29:42 (#0), }, ], - span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), + span: $DIR/inner-attrs.rs:27:16: 30:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_second PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_second", - span: $DIR/inner-attrs.rs:25:25: 25:35 (#0), + span: $DIR/inner-attrs.rs:26:25: 26:35 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod @@ -427,11 +427,11 @@ PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): mod inline_mod PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), + span: $DIR/inner-attrs.rs:27:1: 27:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:15 (#0), }, Group { delimiter: Brace, @@ -439,72 +439,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), + span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), + span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), + span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:39 (#0), }, ], - span: $DIR/inner-attrs.rs:27:29: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:29: 28:40 (#0), }, ], - span: $DIR/inner-attrs.rs:27:7: 27:41 (#0), + span: $DIR/inner-attrs.rs:28:7: 28:41 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), + span: $DIR/inner-attrs.rs:29:5: 29:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), + span: $DIR/inner-attrs.rs:29:6: 29:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), + span: $DIR/inner-attrs.rs:29:8: 29:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), + span: $DIR/inner-attrs.rs:29:30: 29:40 (#0), }, ], - span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), + span: $DIR/inner-attrs.rs:29:29: 29:41 (#0), }, ], - span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), + span: $DIR/inner-attrs.rs:29:7: 29:42 (#0), }, ], - span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), + span: $DIR/inner-attrs.rs:27:16: 30:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_third PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:39 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod { #![print_target_and_args(mod_fourth)] } @@ -512,11 +512,11 @@ PRINT-ATTR DEEP-RE-COLLECTED (DISPLAY): mod inline_mod { #! [print_target_and_ar PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), + span: $DIR/inner-attrs.rs:27:1: 27:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:15 (#0), }, Group { delimiter: Brace, @@ -524,58 +524,58 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), + span: $DIR/inner-attrs.rs:29:5: 29:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), + span: $DIR/inner-attrs.rs:29:6: 29:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), + span: $DIR/inner-attrs.rs:29:8: 29:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), + span: $DIR/inner-attrs.rs:29:30: 29:40 (#0), }, ], - span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), + span: $DIR/inner-attrs.rs:29:29: 29:41 (#0), }, ], - span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), + span: $DIR/inner-attrs.rs:29:7: 29:42 (#0), }, ], - span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), + span: $DIR/inner-attrs.rs:27:16: 30:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_fourth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), + span: $DIR/inner-attrs.rs:29:30: 29:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), + span: $DIR/inner-attrs.rs:27:1: 27:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:15 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), + span: $DIR/inner-attrs.rs:27:16: 30:2 (#0), }, ] PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint @@ -588,63 +588,63 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): struct MyDerivePrint PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: $DIR/inner-attrs.rs:36:1: 36:7 (#0), + span: $DIR/inner-attrs.rs:37:1: 37:7 (#0), }, Ident { ident: "MyDerivePrint", - span: $DIR/inner-attrs.rs:36:8: 36:21 (#0), + span: $DIR/inner-attrs.rs:37:8: 37:21 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "field", - span: $DIR/inner-attrs.rs:37:5: 37:10 (#0), + span: $DIR/inner-attrs.rs:38:5: 38:10 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/inner-attrs.rs:37:10: 37:11 (#0), + span: $DIR/inner-attrs.rs:38:10: 38:11 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "u8", - span: $DIR/inner-attrs.rs:37:13: 37:15 (#0), + span: $DIR/inner-attrs.rs:38:13: 38:15 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:37:15: 37:16 (#0), + span: $DIR/inner-attrs.rs:38:15: 38:16 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "match", - span: $DIR/inner-attrs.rs:38:9: 38:14 (#0), + span: $DIR/inner-attrs.rs:39:9: 39:14 (#0), }, Ident { ident: "true", - span: $DIR/inner-attrs.rs:38:15: 38:19 (#0), + span: $DIR/inner-attrs.rs:39:15: 39:19 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "_", - span: $DIR/inner-attrs.rs:39:13: 39:14 (#0), + span: $DIR/inner-attrs.rs:40:13: 40:14 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/inner-attrs.rs:39:15: 39:16 (#0), + span: $DIR/inner-attrs.rs:40:15: 40:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/inner-attrs.rs:39:16: 39:17 (#0), + span: $DIR/inner-attrs.rs:40:16: 40:17 (#0), }, Group { delimiter: Brace, @@ -652,69 +652,69 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:40:17: 40:18 (#0), + span: $DIR/inner-attrs.rs:41:17: 41:18 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:40:18: 40:19 (#0), + span: $DIR/inner-attrs.rs:41:18: 41:19 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:40:41: 40:52 (#0), + span: $DIR/inner-attrs.rs:41:41: 41:52 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:40:53: 40:58 (#0), + span: $DIR/inner-attrs.rs:41:53: 41:58 (#0), }, ], - span: $DIR/inner-attrs.rs:40:52: 40:59 (#0), + span: $DIR/inner-attrs.rs:41:52: 41:59 (#0), }, ], - span: $DIR/inner-attrs.rs:40:17: 40:18 (#0), + span: $DIR/inner-attrs.rs:41:17: 41:18 (#0), }, Ident { ident: "true", - span: $DIR/inner-attrs.rs:41:17: 41:21 (#0), + span: $DIR/inner-attrs.rs:42:17: 42:21 (#0), }, ], - span: $DIR/inner-attrs.rs:39:18: 42:14 (#0), + span: $DIR/inner-attrs.rs:40:18: 43:14 (#0), }, ], - span: $DIR/inner-attrs.rs:38:20: 43:10 (#0), + span: $DIR/inner-attrs.rs:39:20: 44:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:43:10: 43:11 (#0), + span: $DIR/inner-attrs.rs:44:10: 44:11 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/inner-attrs.rs:44:9: 44:10 (#0), + span: $DIR/inner-attrs.rs:45:9: 45:10 (#0), }, ], - span: $DIR/inner-attrs.rs:37:17: 45:6 (#0), + span: $DIR/inner-attrs.rs:38:17: 46:6 (#0), }, ], - span: $DIR/inner-attrs.rs:37:12: 45:7 (#0), + span: $DIR/inner-attrs.rs:38:12: 46:7 (#0), }, ], - span: $DIR/inner-attrs.rs:36:22: 46:2 (#0), + span: $DIR/inner-attrs.rs:37:22: 47:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tuple_attrs", - span: $DIR/inner-attrs.rs:49:29: 49:40 (#0), + span: $DIR/inner-attrs.rs:50:29: 50:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): (3, 4, { #![cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }); @@ -728,23 +728,23 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ kind: Integer, symbol: "3", suffix: None, - span: $DIR/inner-attrs.rs:50:9: 50:10 (#0), + span: $DIR/inner-attrs.rs:51:9: 51:10 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:50:10: 50:11 (#0), + span: $DIR/inner-attrs.rs:51:10: 51:11 (#0), }, Literal { kind: Integer, symbol: "4", suffix: None, - span: $DIR/inner-attrs.rs:50:12: 50:13 (#0), + span: $DIR/inner-attrs.rs:51:12: 51:13 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:50:13: 50:14 (#0), + span: $DIR/inner-attrs.rs:51:13: 51:14 (#0), }, Group { delimiter: Brace, @@ -752,85 +752,85 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:51:13: 51:14 (#0), + span: $DIR/inner-attrs.rs:52:13: 52:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:51:14: 51:15 (#0), + span: $DIR/inner-attrs.rs:52:14: 52:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:51:16: 51:24 (#0), + span: $DIR/inner-attrs.rs:52:16: 52:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/inner-attrs.rs:51:25: 51:28 (#0), + span: $DIR/inner-attrs.rs:52:25: 52:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:51:29: 51:34 (#0), + span: $DIR/inner-attrs.rs:52:29: 52:34 (#0), }, ], - span: $DIR/inner-attrs.rs:51:28: 51:35 (#0), + span: $DIR/inner-attrs.rs:52:28: 52:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:51:35: 51:36 (#0), + span: $DIR/inner-attrs.rs:52:35: 52:36 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:51:37: 51:48 (#0), + span: $DIR/inner-attrs.rs:52:37: 52:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "innermost", - span: $DIR/inner-attrs.rs:51:49: 51:58 (#0), + span: $DIR/inner-attrs.rs:52:49: 52:58 (#0), }, ], - span: $DIR/inner-attrs.rs:51:48: 51:59 (#0), + span: $DIR/inner-attrs.rs:52:48: 52:59 (#0), }, ], - span: $DIR/inner-attrs.rs:51:24: 51:60 (#0), + span: $DIR/inner-attrs.rs:52:24: 52:60 (#0), }, ], - span: $DIR/inner-attrs.rs:51:15: 51:61 (#0), + span: $DIR/inner-attrs.rs:52:15: 52:61 (#0), }, Literal { kind: Integer, symbol: "5", suffix: None, - span: $DIR/inner-attrs.rs:52:13: 52:14 (#0), + span: $DIR/inner-attrs.rs:53:13: 53:14 (#0), }, ], - span: $DIR/inner-attrs.rs:50:15: 53:10 (#0), + span: $DIR/inner-attrs.rs:51:15: 54:10 (#0), }, ], - span: $DIR/inner-attrs.rs:49:43: 54:6 (#0), + span: $DIR/inner-attrs.rs:50:43: 55:6 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:54:6: 54:7 (#0), + span: $DIR/inner-attrs.rs:55:6: 55:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tuple_attrs", - span: $DIR/inner-attrs.rs:56:29: 56:40 (#0), + span: $DIR/inner-attrs.rs:57:29: 57:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): (3, 4, { #![cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }); @@ -844,23 +844,23 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ kind: Integer, symbol: "3", suffix: None, - span: $DIR/inner-attrs.rs:57:9: 57:10 (#0), + span: $DIR/inner-attrs.rs:58:9: 58:10 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:57:10: 57:11 (#0), + span: $DIR/inner-attrs.rs:58:10: 58:11 (#0), }, Literal { kind: Integer, symbol: "4", suffix: None, - span: $DIR/inner-attrs.rs:57:12: 57:13 (#0), + span: $DIR/inner-attrs.rs:58:12: 58:13 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:57:13: 57:14 (#0), + span: $DIR/inner-attrs.rs:58:13: 58:14 (#0), }, Group { delimiter: Brace, @@ -868,105 +868,105 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:58:13: 58:14 (#0), + span: $DIR/inner-attrs.rs:59:13: 59:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:58:14: 58:15 (#0), + span: $DIR/inner-attrs.rs:59:14: 59:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:58:16: 58:24 (#0), + span: $DIR/inner-attrs.rs:59:16: 59:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/inner-attrs.rs:58:25: 58:28 (#0), + span: $DIR/inner-attrs.rs:59:25: 59:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:58:29: 58:34 (#0), + span: $DIR/inner-attrs.rs:59:29: 59:34 (#0), }, ], - span: $DIR/inner-attrs.rs:58:28: 58:35 (#0), + span: $DIR/inner-attrs.rs:59:28: 59:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:58:35: 58:36 (#0), + span: $DIR/inner-attrs.rs:59:35: 59:36 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:58:37: 58:48 (#0), + span: $DIR/inner-attrs.rs:59:37: 59:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "innermost", - span: $DIR/inner-attrs.rs:58:49: 58:58 (#0), + span: $DIR/inner-attrs.rs:59:49: 59:58 (#0), }, ], - span: $DIR/inner-attrs.rs:58:48: 58:59 (#0), + span: $DIR/inner-attrs.rs:59:48: 59:59 (#0), }, ], - span: $DIR/inner-attrs.rs:58:24: 58:60 (#0), + span: $DIR/inner-attrs.rs:59:24: 59:60 (#0), }, ], - span: $DIR/inner-attrs.rs:58:15: 58:61 (#0), + span: $DIR/inner-attrs.rs:59:15: 59:61 (#0), }, Literal { kind: Integer, symbol: "5", suffix: None, - span: $DIR/inner-attrs.rs:59:13: 59:14 (#0), + span: $DIR/inner-attrs.rs:60:13: 60:14 (#0), }, ], - span: $DIR/inner-attrs.rs:57:15: 60:10 (#0), + span: $DIR/inner-attrs.rs:58:15: 61:10 (#0), }, ], - span: $DIR/inner-attrs.rs:56:43: 61:6 (#0), + span: $DIR/inner-attrs.rs:57:43: 62:6 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:61:6: 61:7 (#0), + span: $DIR/inner-attrs.rs:62:6: 62:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tenth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tenth", - span: $DIR/inner-attrs.rs:83:42: 83:47 (#0), + span: $DIR/inner-attrs.rs:84:42: 84:47 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn weird_extern() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:82:5: 82:7 (#0), + span: $DIR/inner-attrs.rs:83:5: 83:7 (#0), }, Ident { ident: "weird_extern", - span: $DIR/inner-attrs.rs:82:8: 82:20 (#0), + span: $DIR/inner-attrs.rs:83:8: 83:20 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:82:20: 82:22 (#0), + span: $DIR/inner-attrs.rs:83:20: 83:22 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:82:23: 84:6 (#0), + span: $DIR/inner-attrs.rs:83:23: 85:6 (#0), }, ] diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.rs b/tests/ui/proc-macro/issue-75930-derive-cfg.rs index e0213527c5005..1e37b40c9540f 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.rs +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.rs @@ -1,13 +1,10 @@ // check-pass -// compile-flags: -Z span-debug --error-format human +// compile-flags: -Z span-debug // aux-build:test-macros.rs // Regression test for issue #75930 // Tests that we cfg-strip all targets before invoking // a derive macro -// We need '--error-format human' to stop compiletest from -// trying to interpret proc-macro output as JSON messages -// (a pretty-printed struct may cause a line to start with '{' ) // FIXME: We currently lose spans here (see issue #43081) #![no_std] // Don't load unnecessary hygiene information from std @@ -47,6 +44,8 @@ extern crate test_macros; // that kind of correction caused the problem seen in #76399, so maybe not. #[print_helper(a)] //~ WARN derive helper attribute is used before it is introduced + //~| WARN derive helper attribute is used before it is introduced + //~| WARN this was previously accepted //~| WARN this was previously accepted #[cfg_attr(not(FALSE), allow(dead_code))] #[print_attr] diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr index 1017745de6f2b..df1e36d739080 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr @@ -1,5 +1,5 @@ warning: derive helper attribute is used before it is introduced - --> $DIR/issue-75930-derive-cfg.rs:49:3 + --> $DIR/issue-75930-derive-cfg.rs:46:3 | LL | #[print_helper(a)] | ^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #[derive(Print)] = note: `#[warn(legacy_derive_helpers)]` on by default warning: derive helper attribute is used before it is introduced - --> $DIR/issue-75930-derive-cfg.rs:49:3 + --> $DIR/issue-75930-derive-cfg.rs:46:3 | LL | #[print_helper(a)] | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout index 47f26451d1c53..093e37f8a8d0e 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout @@ -74,158 +74,158 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:1: 46:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:3: 46:15 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "a", - span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:16: 46:17 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:15: 46:18 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:2: 46:19 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "allow", - span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:24: 50:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "dead_code", - span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:30: 50:39 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:53:1: 53:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:52:1: 52:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "derive", - span: $DIR/issue-75930-derive-cfg.rs:53:3: 53:9 (#0), + span: $DIR/issue-75930-derive-cfg.rs:52:3: 52:9 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "Print", - span: $DIR/issue-75930-derive-cfg.rs:53:10: 53:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:52:10: 52:15 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:53:9: 53:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:52:9: 52:16 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:53:2: 53:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:52:2: 52:17 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:1: 53:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:3: 53:15 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "b", - span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:16: 53:17 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:15: 53:18 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:2: 53:19 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:7 (#0), }, Ident { ident: "Foo", - span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:8: 54:11 (#0), }, Punct { ch: '<', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:11: 54:12 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:55:12: 55:13 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:12: 54:13 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:55:14: 55:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:14: 54:17 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:55:18: 55:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:18: 54:23 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:55:17: 55:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:17: 54:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:55:13: 55:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:13: 54:25 (#0), }, Ident { ident: "A", - span: $DIR/issue-75930-derive-cfg.rs:55:26: 55:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:26: 54:27 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:55:27: 55:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:27: 54:28 (#0), }, Ident { ident: "B", - span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:29: 54:30 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:30: 54:31 (#0), }, Group { delimiter: Brace, @@ -233,128 +233,128 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:56:5: 56:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:5: 55:6 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:56:7: 56:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:7: 55:10 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:56:11: 56:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:16 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:56:10: 56:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:10: 55:17 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:56:6: 56:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:6: 55:18 (#0), }, Ident { ident: "first", - span: $DIR/issue-75930-derive-cfg.rs:56:19: 56:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:19: 55:24 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:56:24: 56:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:24: 55:25 (#0), }, Ident { ident: "String", - span: $DIR/issue-75930-derive-cfg.rs:56:26: 56:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:26: 55:32 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:56:32: 56:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:55:32: 55:33 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:5: 57:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:5: 56:6 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/issue-75930-derive-cfg.rs:57:7: 57:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:7: 56:15 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:21 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:16: 56:21 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:21: 57:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:21: 56:22 (#0), }, Ident { ident: "deny", - span: $DIR/issue-75930-derive-cfg.rs:57:23: 57:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:23: 56:27 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "warnings", - span: $DIR/issue-75930-derive-cfg.rs:57:28: 57:36 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:28: 56:36 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:57:27: 57:37 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:27: 56:37 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:38 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:15: 56:38 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:57:6: 57:39 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:6: 56:39 (#0), }, Ident { ident: "second", - span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:40: 56:46 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:46: 56:47 (#0), }, Ident { ident: "bool", - span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:48: 56:52 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:52: 56:53 (#0), }, Ident { ident: "third", - span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:5: 57:10 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:10: 57:11 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:13: 57:15 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:16 (#0), }, Group { delimiter: Brace, @@ -362,145 +362,145 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:59:9: 59:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:9: 58:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:59:11: 59:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:11: 58:14 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:20 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:20 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:21 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:14: 58:21 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:22 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:23: 58:29 (#0), }, Ident { ident: "Bar", - span: $DIR/issue-75930-derive-cfg.rs:59:30: 59:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:30: 58:33 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:59:33: 59:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:58:33: 58:34 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:9: 59:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:11: 59:14 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:26 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:27 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:28: 59:34 (#0), }, Ident { ident: "Inner", - span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:40 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:40: 59:41 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:61:11: 61:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:61:15: 61:20 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:20 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:61:14: 61:21 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:21 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:61:10: 61:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:22 (#0), }, Ident { ident: "let", - span: $DIR/issue-75930-derive-cfg.rs:61:23: 61:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:23: 60:26 (#0), }, Ident { ident: "a", - span: $DIR/issue-75930-derive-cfg.rs:61:27: 61:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:27: 60:28 (#0), }, Punct { ch: '=', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:61:29: 61:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:29: 60:30 (#0), }, Literal { kind: Integer, symbol: "25", suffix: None, - span: $DIR/issue-75930-derive-cfg.rs:61:31: 61:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:31: 60:33 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:61:33: 61:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:60:33: 60:34 (#0), }, Ident { ident: "match", - span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:14 (#0), }, Ident { ident: "true", - span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:15: 61:19 (#0), }, Group { delimiter: Brace, @@ -508,194 +508,194 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:13: 62:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:63:15: 63:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:63:19: 63:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:19: 62:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:63:18: 63:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:18: 62:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:14: 62:26 (#0), }, Ident { ident: "true", - span: $DIR/issue-75930-derive-cfg.rs:63:27: 63:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:27: 62:31 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:63:32: 63:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:32: 62:33 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:63:33: 63:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:33: 62:34 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:63:35: 63:37 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:35: 62:37 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:63:37: 63:38 (#0), + span: $DIR/issue-75930-derive-cfg.rs:62:37: 62:38 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/issue-75930-derive-cfg.rs:64:15: 64:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:15: 63:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:64:24: 64:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:24: 63:27 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:28: 63:33 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:27: 64:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:27: 63:34 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:34: 64:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:34: 63:35 (#0), }, Ident { ident: "allow", - span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:36: 63:41 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "warnings", - span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:42: 63:50 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:41: 63:51 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:23: 64:52 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:23: 63:52 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:14: 64:53 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:53 (#0), }, Ident { ident: "false", - span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:54: 63:59 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:60: 63:61 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:61: 63:62 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:63: 63:65 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:65: 63:66 (#0), }, Ident { ident: "_", - span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:15: 64:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:16: 64:17 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:18: 64:20 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:20: 65:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:65:10: 65:11 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:67:9: 67:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:68:11: 68:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:67:11: 67:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "should_be_removed", - span: $DIR/issue-75930-derive-cfg.rs:68:24: 68:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:67:24: 67:41 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:68:23: 68:42 (#0), + span: $DIR/issue-75930-derive-cfg.rs:67:23: 67:42 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:68:10: 68:43 (#0), + span: $DIR/issue-75930-derive-cfg.rs:67:10: 67:43 (#0), }, Ident { ident: "fn", - span: $DIR/issue-75930-derive-cfg.rs:69:9: 69:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:11 (#0), }, Ident { ident: "removed_fn", - span: $DIR/issue-75930-derive-cfg.rs:69:12: 69:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:68:12: 68:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:69:22: 69:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:68:22: 68:24 (#0), }, Group { delimiter: Brace, @@ -703,108 +703,108 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:70:13: 70:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:13: 69:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:70:14: 70:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:14: 69:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:70:16: 70:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:16: 69:19 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:20: 69:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:19: 69:26 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:70:15: 70:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:69:15: 69:27 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:69:25: 71:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:68:25: 70:10 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:9: 72:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:11: 72:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "c", - span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:24: 72:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:23: 72:26 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:10: 72:27 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:28: 72:29 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:30: 72:33 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:34: 72:37 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:38: 72:43 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:37: 72:44 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:33: 72:45 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:29: 72:46 (#0), }, Ident { ident: "fn", - span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:47: 72:49 (#0), }, Ident { ident: "kept_fn", - span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:50: 72:57 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:57: 72:59 (#0), }, Group { delimiter: Brace, @@ -812,82 +812,82 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:13: 73:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:14: 73:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:16: 73:19 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:20: 73:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:30 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:19: 73:31 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:15: 73:32 (#0), }, Ident { ident: "let", - span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:16 (#0), }, Ident { ident: "my_val", - span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:17: 74:23 (#0), }, Punct { ch: '=', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:25 (#0), }, Ident { ident: "true", - span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:26: 74:30 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:30: 74:31 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:60: 75:10 (#0), }, Ident { ident: "enum", - span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:9: 77:13 (#0), }, Ident { ident: "TupleEnum", - span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:14: 77:23 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "Foo", - span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:78:13: 78:16 (#0), }, Group { delimiter: Parenthesis, @@ -895,166 +895,166 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:80:17: 80:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:17: 79:18 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:80:19: 80:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:19: 79:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:23: 79:28 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:80:22: 80:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:22: 79:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:80:18: 80:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:18: 79:30 (#0), }, Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:80:31: 80:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:31: 79:33 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:80:33: 80:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:79:33: 79:34 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:81:17: 81:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:17: 80:18 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:81:19: 81:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:19: 80:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:81:23: 81:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:81:22: 81:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:22: 80:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:81:18: 81:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:18: 80:30 (#0), }, Ident { ident: "bool", - span: $DIR/issue-75930-derive-cfg.rs:81:31: 81:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:31: 80:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:81:35: 81:36 (#0), + span: $DIR/issue-75930-derive-cfg.rs:80:35: 80:36 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:17: 81:18 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:19: 81:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:23: 81:26 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:27: 81:32 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:26: 81:33 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:22: 81:34 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:18: 81:35 (#0), }, Ident { ident: "i32", - span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:36: 81:39 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:39: 81:40 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:83:17: 83:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:83:19: 83:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:83:23: 83:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:28 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:83:22: 83:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:83:18: 83:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:30 (#0), }, Ident { ident: "String", - span: $DIR/issue-75930-derive-cfg.rs:83:31: 83:37 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:31: 82:37 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:83:37: 83:38 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:37: 82:38 (#0), }, Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:41 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:78:16: 83:14 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:24: 84:10 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:9: 86:15 (#0), }, Ident { ident: "TupleStruct", - span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:16: 86:27 (#0), }, Group { delimiter: Parenthesis, @@ -1062,139 +1062,139 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:88:13: 88:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:13: 87:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:88:15: 88:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:15: 87:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:88:19: 88:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:19: 87:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:88:18: 88:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:18: 87:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:88:14: 88:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:14: 87:26 (#0), }, Ident { ident: "String", - span: $DIR/issue-75930-derive-cfg.rs:88:27: 88:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:27: 87:33 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:88:33: 88:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:87:33: 87:34 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:13: 88:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:15: 88:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:19: 88:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:23: 88:28 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:22: 88:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:18: 88:30 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:14: 88:31 (#0), }, Ident { ident: "i32", - span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:32: 88:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:35: 88:36 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:90:13: 90:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:90:15: 90:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:90:19: 90:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:90:18: 90:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:90:14: 90:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:26 (#0), }, Ident { ident: "bool", - span: $DIR/issue-75930-derive-cfg.rs:90:27: 90:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:27: 89:31 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:90:31: 90:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:89:31: 89:32 (#0), }, Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:90:13: 90:15 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:27: 91:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:91:10: 91:11 (#0), }, Ident { ident: "fn", - span: $DIR/issue-75930-derive-cfg.rs:94:9: 94:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:93:9: 93:11 (#0), }, Ident { ident: "plain_removed_fn", - span: $DIR/issue-75930-derive-cfg.rs:94:12: 94:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:93:12: 93:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:94:28: 94:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:93:28: 93:30 (#0), }, Group { delimiter: Brace, @@ -1202,122 +1202,122 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:95:13: 95:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:13: 94:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:95:14: 95:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:14: 94:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/issue-75930-derive-cfg.rs:95:16: 95:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:16: 94:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:95:25: 95:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:25: 94:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:95:29: 95:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:29: 94:34 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:95:28: 95:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:28: 94:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:95:35: 95:36 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:35: 94:36 (#0), }, Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:95:37: 95:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:37: 94:40 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:95:41: 95:46 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:41: 94:46 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:95:40: 95:47 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:40: 94:47 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:95:24: 95:48 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:24: 94:48 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:95:15: 95:49 (#0), + span: $DIR/issue-75930-derive-cfg.rs:94:15: 94:49 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:94:31: 96:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:93:31: 95:10 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:97:9: 97:10 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:17: 98:6 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:12: 98:7 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0), + span: $DIR/issue-75930-derive-cfg.rs:98:7: 98:8 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:5: 99:6 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:19 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "d", - span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:20: 99:21 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:19: 99:22 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:6: 99:23 (#0), }, Ident { ident: "fourth", - span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:11 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:11: 100:12 (#0), }, Ident { ident: "B", - span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:13: 100:14 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:32: 101:2 (#0), }, ] PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_helper(b)] struct Foo @@ -1350,141 +1350,141 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:1: 46:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:3: 46:15 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "a", - span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:16: 46:17 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:15: 46:18 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:46:2: 46:19 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "allow", - span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:24: 50:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "dead_code", - span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:30: 50:39 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:1: 53:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:3: 53:15 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "b", - span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:16: 53:17 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:15: 53:18 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:53:2: 53:19 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:7 (#0), }, Ident { ident: "Foo", - span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:8: 54:11 (#0), }, Punct { ch: '<', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:11: 54:12 (#0), }, Ident { ident: "B", - span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:29: 54:30 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:30: 54:31 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "second", - span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:40: 56:46 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:46: 56:47 (#0), }, Ident { ident: "bool", - span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:48: 56:52 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0), + span: $DIR/issue-75930-derive-cfg.rs:56:52: 56:53 (#0), }, Ident { ident: "third", - span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:5: 57:10 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:10: 57:11 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:13: 57:15 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:16 (#0), }, Group { delimiter: Brace, @@ -1492,58 +1492,58 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:9: 59:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:11: 59:14 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:24 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:26 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:27 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:28: 59:34 (#0), }, Ident { ident: "Inner", - span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:40 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:59:40: 59:41 (#0), }, Ident { ident: "match", - span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:14 (#0), }, Ident { ident: "true", - span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:15: 61:19 (#0), }, Group { delimiter: Brace, @@ -1551,151 +1551,151 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "allow", - span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:36: 63:41 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "warnings", - span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:42: 63:50 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:41: 63:51 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), }, Ident { ident: "false", - span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:54: 63:59 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:60: 63:61 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:61: 63:62 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:63: 63:65 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:65: 63:66 (#0), }, Ident { ident: "_", - span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:15: 64:16 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:16: 64:17 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0), + span: $DIR/issue-75930-derive-cfg.rs:64:18: 64:20 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:61:20: 65:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:65:10: 65:11 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:9: 72:10 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:11: 72:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "c", - span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:24: 72:25 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:23: 72:26 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:10: 72:27 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:28: 72:29 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:30: 72:33 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:34: 72:37 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:38: 72:43 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:37: 72:44 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:33: 72:45 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:29: 72:46 (#0), }, Ident { ident: "fn", - span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:47: 72:49 (#0), }, Ident { ident: "kept_fn", - span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:50: 72:57 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:57: 72:59 (#0), }, Group { delimiter: Brace, @@ -1703,82 +1703,82 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:13: 73:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:14: 73:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:16: 73:19 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:20: 73:23 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:30 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:19: 73:31 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:73:15: 73:32 (#0), }, Ident { ident: "let", - span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:16 (#0), }, Ident { ident: "my_val", - span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:17: 74:23 (#0), }, Punct { ch: '=', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:25 (#0), }, Ident { ident: "true", - span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:26: 74:30 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:74:30: 74:31 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:72:60: 75:10 (#0), }, Ident { ident: "enum", - span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:9: 77:13 (#0), }, Ident { ident: "TupleEnum", - span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:14: 77:23 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "Foo", - span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0), + span: $DIR/issue-75930-derive-cfg.rs:78:13: 78:16 (#0), }, Group { delimiter: Parenthesis, @@ -1786,64 +1786,64 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:17: 81:18 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:19: 81:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:23: 81:26 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:27: 81:32 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:26: 81:33 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:22: 81:34 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:18: 81:35 (#0), }, Ident { ident: "i32", - span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:36: 81:39 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0), + span: $DIR/issue-75930-derive-cfg.rs:81:39: 81:40 (#0), }, Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0), + span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:41 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:78:16: 83:14 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:77:24: 84:10 (#0), }, Ident { ident: "struct", - span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:9: 86:15 (#0), }, Ident { ident: "TupleStruct", - span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:16: 86:27 (#0), }, Group { delimiter: Parenthesis, @@ -1851,115 +1851,115 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:13: 88:14 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg", - span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:15: 88:18 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:19: 88:22 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:23: 88:28 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:22: 88:29 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:18: 88:30 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:14: 88:31 (#0), }, Ident { ident: "i32", - span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:32: 88:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0), + span: $DIR/issue-75930-derive-cfg.rs:88:35: 88:36 (#0), }, Ident { ident: "u8", - span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0), + span: $DIR/issue-75930-derive-cfg.rs:90:13: 90:15 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:86:27: 91:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:91:10: 91:11 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0), + span: $DIR/issue-75930-derive-cfg.rs:97:9: 97:10 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:17: 98:6 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0), + span: $DIR/issue-75930-derive-cfg.rs:57:12: 98:7 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0), + span: $DIR/issue-75930-derive-cfg.rs:98:7: 98:8 (#0), }, Punct { ch: '#', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:5: 99:6 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_helper", - span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:19 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "d", - span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:20: 99:21 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:19: 99:22 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0), + span: $DIR/issue-75930-derive-cfg.rs:99:6: 99:23 (#0), }, Ident { ident: "fourth", - span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:11 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:11: 100:12 (#0), }, Ident { ident: "B", - span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:100:13: 100:14 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:54:32: 101:2 (#0), }, ] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs index 8670667131695..a00a6d481050d 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl)] +#![feature(const_trait_impl, effects)] // edition: 2021 #[const_trait] @@ -6,4 +6,12 @@ trait Trait {} fn main() { let _: &dyn const Trait; //~ ERROR const trait bounds are not allowed in trait object types + let _: &dyn ~const Trait; //~ ERROR `~const` is not allowed here } + +// Regression test for issue #119525. +trait NonConst {} +const fn handle(_: &dyn const NonConst) {} +//~^ ERROR const trait bounds are not allowed in trait object types +const fn take(_: &dyn ~const NonConst) {} +//~^ ERROR `~const` is not allowed here diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr index 8b9ba94d099d5..04c2dc2e2e0fd 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.stderr @@ -4,5 +4,27 @@ error: const trait bounds are not allowed in trait object types LL | let _: &dyn const Trait; | ^^^^^^^^^^^ -error: aborting due to 1 previous error +error: `~const` is not allowed here + --> $DIR/const-trait-bounds-trait-objects.rs:9:17 + | +LL | let _: &dyn ~const Trait; + | ^^^^^^ + | + = note: trait objects cannot have `~const` trait bounds + +error: const trait bounds are not allowed in trait object types + --> $DIR/const-trait-bounds-trait-objects.rs:14:25 + | +LL | const fn handle(_: &dyn const NonConst) {} + | ^^^^^^^^^^^^^^ + +error: `~const` is not allowed here + --> $DIR/const-trait-bounds-trait-objects.rs:16:23 + | +LL | const fn take(_: &dyn ~const NonConst) {} + | ^^^^^^ + | + = note: trait objects cannot have `~const` trait bounds + +error: aborting due to 4 previous errors