diff --git a/.mailmap b/.mailmap index f47692683215..d3e400e5f906 100644 --- a/.mailmap +++ b/.mailmap @@ -148,6 +148,7 @@ Jorge Aparicio Joseph Martin Joseph T. Lyons Joseph T. Lyons +Joshua Nelson jumbatm <30644300+jumbatm@users.noreply.github.com> Junyoung Cho Jyun-Yan You diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index 2fd625c2a6c2..364a3a1eeb5e 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -67,7 +67,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) { } } -#[derive(Clone, PartialEq, Encodable, Decodable)] +#[derive(Copy, Clone, PartialEq, Encodable, Decodable)] pub enum InlineAttr { None, Hint, diff --git a/compiler/rustc_builtin_macros/src/cfg_accessible.rs b/compiler/rustc_builtin_macros/src/cfg_accessible.rs index 75f4b077640d..09ed1af34567 100644 --- a/compiler/rustc_builtin_macros/src/cfg_accessible.rs +++ b/compiler/rustc_builtin_macros/src/cfg_accessible.rs @@ -1,7 +1,7 @@ //! Implementation of the `#[cfg_accessible(path)]` attribute macro. use rustc_ast as ast; -use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier}; +use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier}; use rustc_feature::AttributeTemplate; use rustc_parse::validate_attr; use rustc_span::symbol::sym; @@ -31,7 +31,7 @@ impl MultiItemModifier for Expander { fn expand( &self, ecx: &mut ExtCtxt<'_>, - _span: Span, + span: Span, meta_item: &ast::MetaItem, item: Annotatable, ) -> ExpandResult, Annotatable> { @@ -49,11 +49,14 @@ impl MultiItemModifier for Expander { None => return ExpandResult::Ready(Vec::new()), }; - let failure_msg = "cannot determine whether the path is accessible or not"; match ecx.resolver.cfg_accessible(ecx.current_expansion.id, path) { Ok(true) => ExpandResult::Ready(vec![item]), Ok(false) => ExpandResult::Ready(Vec::new()), - Err(_) => ExpandResult::Retry(item, failure_msg.into()), + Err(Indeterminate) if ecx.force_mode => { + ecx.span_err(span, "cannot determine whether the path is accessible or not"); + ExpandResult::Ready(vec![item]) + } + Err(Indeterminate) => ExpandResult::Retry(item), } } } diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 0642edff6b67..a767de53dae1 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -407,13 +407,7 @@ impl<'a> TraitDef<'a> { _ => false, }) } - _ => { - // Non-ADT derive is an error, but it should have been - // set earlier; see - // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() - // librustc_expand/base.rs:Annotatable::derive_allowed() - return; - } + _ => unreachable!(), }; let container_id = cx.current_expansion.id.expn_data().parent; let always_copy = has_no_type_params && cx.resolver.has_derive_copy(container_id); @@ -475,12 +469,7 @@ impl<'a> TraitDef<'a> { ); push(Annotatable::Item(P(ast::Item { attrs, ..(*newitem).clone() }))) } - _ => { - // Non-Item derive is an error, but it should have been - // set earlier; see - // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() - // librustc_expand/base.rs:Annotatable::derive_allowed() - } + _ => unreachable!(), } } diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs index bf9509349288..72d94af4694a 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -98,13 +98,7 @@ fn inject_impl_of_structural_trait( ) { let item = match *item { Annotatable::Item(ref item) => item, - _ => { - // Non-Item derive is an error, but it should have been - // set earlier; see - // librustc_expand/expand.rs:MacroExpander::fully_expand_fragment() - // librustc_expand/base.rs:Annotatable::derive_allowed() - return; - } + _ => unreachable!(), }; let generics = match item.kind { diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 9a2fbf359ea1..62a7986c194f 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -25,7 +25,7 @@ use crate::value::Value; /// Mark LLVM function to use provided inline heuristic. #[inline] -fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr, requires_inline: bool) { +fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) { use self::InlineAttr::*; match inline { Hint => Attribute::InlineHint.apply_llfn(Function, val), @@ -35,7 +35,6 @@ fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr, requires Attribute::NoInline.apply_llfn(Function, val); } } - None if requires_inline => Attribute::InlineHint.apply_llfn(Function, val), None => {} }; } @@ -226,7 +225,14 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: } } - inline(cx, llfn, codegen_fn_attrs.inline.clone(), instance.def.requires_inline(cx.tcx)); + let inline_attr = if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) { + InlineAttr::Never + } else if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) { + InlineAttr::Hint + } else { + codegen_fn_attrs.inline + }; + inline(cx, llfn, inline_attr); // The `uwtable` attribute according to LLVM is: // diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index b435def87ac8..1c76c31e1a7f 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -251,8 +251,7 @@ pub enum ExpandResult { /// Expansion produced a result (possibly dummy). Ready(T), /// Expansion could not produce a result and needs to be retried. - /// The string is an explanation that will be printed if we are stuck in an infinite retry loop. - Retry(U, String), + Retry(U), } // `meta_item` is the attribute, and `item` is the item being modified. @@ -889,8 +888,10 @@ pub trait ResolverExpand { /// Some parent node that is close enough to the given macro call. fn lint_node_id(&mut self, expn_id: ExpnId) -> NodeId; + // Resolver interfaces for specific built-in macros. + /// Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Copy` inside it? fn has_derive_copy(&self, expn_id: ExpnId) -> bool; - fn add_derive_copy(&mut self, expn_id: ExpnId); + /// Path resolution logic for `#[cfg_accessible(path)]`. fn cfg_accessible(&mut self, expn_id: ExpnId, path: &ast::Path) -> Result; } @@ -919,6 +920,9 @@ pub struct ExtCtxt<'a> { pub root_path: PathBuf, pub resolver: &'a mut dyn ResolverExpand, pub current_expansion: ExpansionData, + /// Error recovery mode entered when expansion is stuck + /// (or during eager expansion, but that's a hack). + pub force_mode: bool, pub expansions: FxHashMap>, /// Called directly after having parsed an external `mod foo;` in expansion. pub(super) extern_mod_loaded: Option<&'a dyn Fn(&ast::Crate)>, @@ -945,6 +949,7 @@ impl<'a> ExtCtxt<'a> { directory_ownership: DirectoryOwnership::Owned { relative: None }, prior_type_ascription: None, }, + force_mode: false, expansions: FxHashMap::default(), } } diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index cccbdf778edc..563783c5b795 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -1,5 +1,7 @@ //! Conditional compilation stripping. +use crate::base::Annotatable; + use rustc_ast::attr::HasAttrs; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; @@ -496,6 +498,49 @@ impl<'a> StripUnconfigured<'a> { pub fn configure_fn_decl(&mut self, fn_decl: &mut ast::FnDecl) { fn_decl.inputs.flat_map_in_place(|arg| self.configure(arg)); } + + pub fn fully_configure(&mut self, item: Annotatable) -> Annotatable { + // Since the item itself has already been configured by the InvocationCollector, + // we know that fold result vector will contain exactly one element + match item { + Annotatable::Item(item) => Annotatable::Item(self.flat_map_item(item).pop().unwrap()), + Annotatable::TraitItem(item) => { + Annotatable::TraitItem(self.flat_map_trait_item(item).pop().unwrap()) + } + Annotatable::ImplItem(item) => { + Annotatable::ImplItem(self.flat_map_impl_item(item).pop().unwrap()) + } + Annotatable::ForeignItem(item) => { + Annotatable::ForeignItem(self.flat_map_foreign_item(item).pop().unwrap()) + } + Annotatable::Stmt(stmt) => { + Annotatable::Stmt(stmt.map(|stmt| self.flat_map_stmt(stmt).pop().unwrap())) + } + Annotatable::Expr(mut expr) => Annotatable::Expr({ + self.visit_expr(&mut expr); + expr + }), + Annotatable::Arm(arm) => Annotatable::Arm(self.flat_map_arm(arm).pop().unwrap()), + Annotatable::Field(field) => { + Annotatable::Field(self.flat_map_field(field).pop().unwrap()) + } + Annotatable::FieldPat(fp) => { + Annotatable::FieldPat(self.flat_map_field_pattern(fp).pop().unwrap()) + } + Annotatable::GenericParam(param) => { + Annotatable::GenericParam(self.flat_map_generic_param(param).pop().unwrap()) + } + Annotatable::Param(param) => { + Annotatable::Param(self.flat_map_param(param).pop().unwrap()) + } + Annotatable::StructField(sf) => { + Annotatable::StructField(self.flat_map_struct_field(sf).pop().unwrap()) + } + Annotatable::Variant(v) => { + Annotatable::Variant(self.flat_map_variant(v).pop().unwrap()) + } + } + } } impl<'a> MutVisitor for StripUnconfigured<'a> { diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 1b31bd6a3051..5be2fee8b38f 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -209,6 +209,28 @@ impl AstFragmentKind { self.make_from(DummyResult::any(span)).expect("couldn't create a dummy AST fragment") } + /// Fragment supports macro expansion and not just inert attributes, `cfg` and `cfg_attr`. + pub fn supports_macro_expansion(self) -> bool { + match self { + AstFragmentKind::OptExpr + | AstFragmentKind::Expr + | AstFragmentKind::Pat + | AstFragmentKind::Ty + | AstFragmentKind::Stmts + | AstFragmentKind::Items + | AstFragmentKind::TraitItems + | AstFragmentKind::ImplItems + | AstFragmentKind::ForeignItems => true, + AstFragmentKind::Arms + | AstFragmentKind::Fields + | AstFragmentKind::FieldPats + | AstFragmentKind::GenericParams + | AstFragmentKind::Params + | AstFragmentKind::StructFields + | AstFragmentKind::Variants => false, + } + } + fn expect_from_annotatables>( self, items: I, @@ -404,6 +426,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { // Recursively expand all macro invocations in this AST fragment. pub fn fully_expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment { let orig_expansion_data = self.cx.current_expansion.clone(); + let orig_force_mode = self.cx.force_mode; self.cx.current_expansion.depth = 0; // Collect all macro invocations and replace them with placeholders. @@ -432,6 +455,12 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } invocations = mem::take(&mut undetermined_invocations); force = !mem::replace(&mut progress, false); + if force && self.monotonic { + self.cx.sess.delay_span_bug( + invocations.last().unwrap().0.span(), + "expansion entered force mode without producing any errors", + ); + } continue; }; @@ -460,18 +489,19 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data; self.cx.current_expansion = invoc.expansion_data.clone(); + self.cx.force_mode = force; // FIXME(jseyfried): Refactor out the following logic + let fragment_kind = invoc.fragment_kind; let (expanded_fragment, new_invocations) = match res { InvocationRes::Single(ext) => match self.expand_invoc(invoc, &ext.kind) { ExpandResult::Ready(fragment) => self.collect_invocations(fragment, &[]), - ExpandResult::Retry(invoc, explanation) => { + ExpandResult::Retry(invoc) => { if force { - // We are stuck, stop retrying and produce a dummy fragment. - let span = invoc.span(); - self.cx.span_err(span, &explanation); - let fragment = invoc.fragment_kind.dummy(span); - self.collect_invocations(fragment, &[]) + self.cx.span_bug( + invoc.span(), + "expansion entered force mode but is still stuck", + ); } else { // Cannot expand, will retry this invocation later. undetermined_invocations @@ -483,36 +513,45 @@ impl<'a, 'b> MacroExpander<'a, 'b> { InvocationRes::DeriveContainer(_exts) => { // FIXME: Consider using the derive resolutions (`_exts`) immediately, // instead of enqueuing the derives to be resolved again later. - let (derives, item) = match invoc.kind { + let (derives, mut item) = match invoc.kind { InvocationKind::DeriveContainer { derives, item } => (derives, item), _ => unreachable!(), }; - if !item.derive_allowed() { + let (item, derive_placeholders) = if !item.derive_allowed() { self.error_derive_forbidden_on_non_adt(&derives, &item); - } + item.visit_attrs(|attrs| attrs.retain(|a| !a.has_name(sym::derive))); + (item, Vec::new()) + } else { + let mut item = StripUnconfigured { + sess: self.cx.sess, + features: self.cx.ecfg.features, + } + .fully_configure(item); + item.visit_attrs(|attrs| attrs.retain(|a| !a.has_name(sym::derive))); + + invocations.reserve(derives.len()); + let derive_placeholders = derives + .into_iter() + .map(|path| { + let expn_id = ExpnId::fresh(None); + invocations.push(( + Invocation { + kind: InvocationKind::Derive { path, item: item.clone() }, + fragment_kind, + expansion_data: ExpansionData { + id: expn_id, + ..self.cx.current_expansion.clone() + }, + }, + None, + )); + NodeId::placeholder_from_expn_id(expn_id) + }) + .collect::>(); + (item, derive_placeholders) + }; - let mut item = self.fully_configure(item); - item.visit_attrs(|attrs| attrs.retain(|a| !a.has_name(sym::derive))); - - let mut derive_placeholders = Vec::with_capacity(derives.len()); - invocations.reserve(derives.len()); - for path in derives { - let expn_id = ExpnId::fresh(None); - derive_placeholders.push(NodeId::placeholder_from_expn_id(expn_id)); - invocations.push(( - Invocation { - kind: InvocationKind::Derive { path, item: item.clone() }, - fragment_kind: invoc.fragment_kind, - expansion_data: ExpansionData { - id: expn_id, - ..invoc.expansion_data.clone() - }, - }, - None, - )); - } - let fragment = - invoc.fragment_kind.expect_from_annotatables(::std::iter::once(item)); + let fragment = fragment_kind.expect_from_annotatables(::std::iter::once(item)); self.collect_invocations(fragment, &derive_placeholders) } }; @@ -526,6 +565,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } self.cx.current_expansion = orig_expansion_data; + self.cx.force_mode = orig_force_mode; // Finally incorporate all the expanded macros into the input AST fragment. let mut placeholder_expander = PlaceholderExpander::new(self.cx, self.monotonic); @@ -601,48 +641,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { (fragment, invocations) } - fn fully_configure(&mut self, item: Annotatable) -> Annotatable { - let mut cfg = StripUnconfigured { sess: &self.cx.sess, features: self.cx.ecfg.features }; - // Since the item itself has already been configured by the InvocationCollector, - // we know that fold result vector will contain exactly one element - match item { - Annotatable::Item(item) => Annotatable::Item(cfg.flat_map_item(item).pop().unwrap()), - Annotatable::TraitItem(item) => { - Annotatable::TraitItem(cfg.flat_map_trait_item(item).pop().unwrap()) - } - Annotatable::ImplItem(item) => { - Annotatable::ImplItem(cfg.flat_map_impl_item(item).pop().unwrap()) - } - Annotatable::ForeignItem(item) => { - Annotatable::ForeignItem(cfg.flat_map_foreign_item(item).pop().unwrap()) - } - Annotatable::Stmt(stmt) => { - Annotatable::Stmt(stmt.map(|stmt| cfg.flat_map_stmt(stmt).pop().unwrap())) - } - Annotatable::Expr(mut expr) => Annotatable::Expr({ - cfg.visit_expr(&mut expr); - expr - }), - Annotatable::Arm(arm) => Annotatable::Arm(cfg.flat_map_arm(arm).pop().unwrap()), - Annotatable::Field(field) => { - Annotatable::Field(cfg.flat_map_field(field).pop().unwrap()) - } - Annotatable::FieldPat(fp) => { - Annotatable::FieldPat(cfg.flat_map_field_pattern(fp).pop().unwrap()) - } - Annotatable::GenericParam(param) => { - Annotatable::GenericParam(cfg.flat_map_generic_param(param).pop().unwrap()) - } - Annotatable::Param(param) => { - Annotatable::Param(cfg.flat_map_param(param).pop().unwrap()) - } - Annotatable::StructField(sf) => { - Annotatable::StructField(cfg.flat_map_struct_field(sf).pop().unwrap()) - } - Annotatable::Variant(v) => Annotatable::Variant(cfg.flat_map_variant(v).pop().unwrap()), - } - } - fn error_recursion_limit_reached(&mut self) { let expn_data = self.cx.current_expansion.id.expn_data(); let suggested_limit = self.cx.ecfg.recursion_limit * 2; @@ -735,20 +733,17 @@ impl<'a, 'b> MacroExpander<'a, 'b> { Ok(meta) => { let items = match expander.expand(self.cx, span, &meta, item) { ExpandResult::Ready(items) => items, - ExpandResult::Retry(item, explanation) => { + ExpandResult::Retry(item) => { // Reassemble the original invocation for retrying. - return ExpandResult::Retry( - Invocation { - kind: InvocationKind::Attr { - attr, - item, - derives, - after_derive, - }, - ..invoc + return ExpandResult::Retry(Invocation { + kind: InvocationKind::Attr { + attr, + item, + derives, + after_derive, }, - explanation, - ); + ..invoc + }); } }; fragment_kind.expect_from_annotatables(items) @@ -772,24 +767,18 @@ impl<'a, 'b> MacroExpander<'a, 'b> { InvocationKind::Derive { path, item } => match ext { SyntaxExtensionKind::Derive(expander) | SyntaxExtensionKind::LegacyDerive(expander) => { - if !item.derive_allowed() { - return ExpandResult::Ready(fragment_kind.dummy(span)); - } if let SyntaxExtensionKind::Derive(..) = ext { self.gate_proc_macro_input(&item); } let meta = ast::MetaItem { kind: ast::MetaItemKind::Word, span, path }; let items = match expander.expand(self.cx, span, &meta, item) { ExpandResult::Ready(items) => items, - ExpandResult::Retry(item, explanation) => { + ExpandResult::Retry(item) => { // Reassemble the original invocation for retrying. - return ExpandResult::Retry( - Invocation { - kind: InvocationKind::Derive { path: meta.path, item }, - ..invoc - }, - explanation, - ); + return ExpandResult::Retry(Invocation { + kind: InvocationKind::Derive { path: meta.path, item }, + ..invoc + }); } }; fragment_kind.expect_from_annotatables(items) @@ -1034,11 +1023,9 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { fn collect_attr( &mut self, - attr: Option, - derives: Vec, + (attr, derives, after_derive): (Option, Vec, bool), item: Annotatable, kind: AstFragmentKind, - after_derive: bool, ) -> AstFragment { self.collect( kind, @@ -1054,7 +1041,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { attrs: &mut Vec, after_derive: &mut bool, ) -> Option { - let attr = attrs + attrs .iter() .position(|a| { if a.has_name(sym::derive) { @@ -1062,29 +1049,14 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { } !self.cx.sess.is_attr_known(a) && !is_builtin_attr(a) }) - .map(|i| attrs.remove(i)); - if let Some(attr) = &attr { - if !self.cx.ecfg.custom_inner_attributes() - && attr.style == ast::AttrStyle::Inner - && !attr.has_name(sym::test) - { - feature_err( - &self.cx.sess.parse_sess, - sym::custom_inner_attributes, - attr.span, - "non-builtin inner attributes are unstable", - ) - .emit(); - } - } - attr + .map(|i| attrs.remove(i)) } /// If `item` is an attr invocation, remove and return the macro attribute and derive traits. - fn classify_item( + fn take_first_attr( &mut self, item: &mut impl HasAttrs, - ) -> (Option, Vec, /* after_derive */ bool) { + ) -> Option<(Option, Vec, /* after_derive */ bool)> { let (mut attr, mut traits, mut after_derive) = (None, Vec::new(), false); item.visit_attrs(|mut attrs| { @@ -1092,23 +1064,23 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { traits = collect_derives(&mut self.cx, &mut attrs); }); - (attr, traits, after_derive) + if attr.is_some() || !traits.is_empty() { Some((attr, traits, after_derive)) } else { None } } - /// Alternative to `classify_item()` that ignores `#[derive]` so invocations fallthrough + /// Alternative to `take_first_attr()` that ignores `#[derive]` so invocations fallthrough /// to the unused-attributes lint (making it an error on statements and expressions /// is a breaking change) - fn classify_nonitem( + fn take_first_attr_no_derive( &mut self, nonitem: &mut impl HasAttrs, - ) -> (Option, /* after_derive */ bool) { + ) -> Option<(Option, Vec, /* after_derive */ bool)> { let (mut attr, mut after_derive) = (None, false); nonitem.visit_attrs(|mut attrs| { attr = self.find_attr_invoc(&mut attrs, &mut after_derive); }); - (attr, after_derive) + attr.map(|attr| (Some(attr), Vec::new(), after_derive)) } fn configure(&mut self, node: T) -> Option { @@ -1152,23 +1124,14 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { visit_clobber(expr.deref_mut(), |mut expr| { self.cfg.configure_expr_kind(&mut expr.kind); - // ignore derives so they remain unused - let (attr, after_derive) = self.classify_nonitem(&mut expr); - - if let Some(ref attr_value) = attr { + if let Some(attr) = self.take_first_attr_no_derive(&mut expr) { // Collect the invoc regardless of whether or not attributes are permitted here // expansion will eat the attribute so it won't error later. - self.cfg.maybe_emit_expr_attr_err(attr_value); + attr.0.as_ref().map(|attr| self.cfg.maybe_emit_expr_attr_err(attr)); // AstFragmentKind::Expr requires the macro to emit an expression. return self - .collect_attr( - attr, - vec![], - Annotatable::Expr(P(expr)), - AstFragmentKind::Expr, - after_derive, - ) + .collect_attr(attr, Annotatable::Expr(P(expr)), AstFragmentKind::Expr) .make_expr() .into_inner(); } @@ -1186,16 +1149,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_arm(&mut self, arm: ast::Arm) -> SmallVec<[ast::Arm; 1]> { let mut arm = configure!(self, arm); - let (attr, traits, after_derive) = self.classify_item(&mut arm); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut arm) { return self - .collect_attr( - attr, - traits, - Annotatable::Arm(arm), - AstFragmentKind::Arms, - after_derive, - ) + .collect_attr(attr, Annotatable::Arm(arm), AstFragmentKind::Arms) .make_arms(); } @@ -1205,16 +1161,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_field(&mut self, field: ast::Field) -> SmallVec<[ast::Field; 1]> { let mut field = configure!(self, field); - let (attr, traits, after_derive) = self.classify_item(&mut field); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut field) { return self - .collect_attr( - attr, - traits, - Annotatable::Field(field), - AstFragmentKind::Fields, - after_derive, - ) + .collect_attr(attr, Annotatable::Field(field), AstFragmentKind::Fields) .make_fields(); } @@ -1224,16 +1173,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_field_pattern(&mut self, fp: ast::FieldPat) -> SmallVec<[ast::FieldPat; 1]> { let mut fp = configure!(self, fp); - let (attr, traits, after_derive) = self.classify_item(&mut fp); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut fp) { return self - .collect_attr( - attr, - traits, - Annotatable::FieldPat(fp), - AstFragmentKind::FieldPats, - after_derive, - ) + .collect_attr(attr, Annotatable::FieldPat(fp), AstFragmentKind::FieldPats) .make_field_patterns(); } @@ -1243,16 +1185,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_param(&mut self, p: ast::Param) -> SmallVec<[ast::Param; 1]> { let mut p = configure!(self, p); - let (attr, traits, after_derive) = self.classify_item(&mut p); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut p) { return self - .collect_attr( - attr, - traits, - Annotatable::Param(p), - AstFragmentKind::Params, - after_derive, - ) + .collect_attr(attr, Annotatable::Param(p), AstFragmentKind::Params) .make_params(); } @@ -1262,16 +1197,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_struct_field(&mut self, sf: ast::StructField) -> SmallVec<[ast::StructField; 1]> { let mut sf = configure!(self, sf); - let (attr, traits, after_derive) = self.classify_item(&mut sf); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut sf) { return self - .collect_attr( - attr, - traits, - Annotatable::StructField(sf), - AstFragmentKind::StructFields, - after_derive, - ) + .collect_attr(attr, Annotatable::StructField(sf), AstFragmentKind::StructFields) .make_struct_fields(); } @@ -1281,16 +1209,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_variant(&mut self, variant: ast::Variant) -> SmallVec<[ast::Variant; 1]> { let mut variant = configure!(self, variant); - let (attr, traits, after_derive) = self.classify_item(&mut variant); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut variant) { return self - .collect_attr( - attr, - traits, - Annotatable::Variant(variant), - AstFragmentKind::Variants, - after_derive, - ) + .collect_attr(attr, Annotatable::Variant(variant), AstFragmentKind::Variants) .make_variants(); } @@ -1302,20 +1223,11 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { expr.filter_map(|mut expr| { self.cfg.configure_expr_kind(&mut expr.kind); - // Ignore derives so they remain unused. - let (attr, after_derive) = self.classify_nonitem(&mut expr); - - if let Some(ref attr_value) = attr { - self.cfg.maybe_emit_expr_attr_err(attr_value); + if let Some(attr) = self.take_first_attr_no_derive(&mut expr) { + attr.0.as_ref().map(|attr| self.cfg.maybe_emit_expr_attr_err(attr)); return self - .collect_attr( - attr, - vec![], - Annotatable::Expr(P(expr)), - AstFragmentKind::OptExpr, - after_derive, - ) + .collect_attr(attr, Annotatable::Expr(P(expr)), AstFragmentKind::OptExpr) .make_opt_expr() .map(|expr| expr.into_inner()); } @@ -1354,25 +1266,13 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { // we'll expand attributes on expressions separately if !stmt.is_expr() { - let (attr, derives, after_derive) = if stmt.is_item() { - // FIXME: Handle custom attributes on statements (#15701) - (None, vec![], false) - } else { - // ignore derives on non-item statements so it falls through - // to the unused-attributes lint - let (attr, after_derive) = self.classify_nonitem(&mut stmt); - (attr, vec![], after_derive) - }; + // FIXME: Handle custom attributes on statements (#15701). + let attr = + if stmt.is_item() { None } else { self.take_first_attr_no_derive(&mut stmt) }; - if attr.is_some() || !derives.is_empty() { + if let Some(attr) = attr { return self - .collect_attr( - attr, - derives, - Annotatable::Stmt(P(stmt)), - AstFragmentKind::Stmts, - after_derive, - ) + .collect_attr(attr, Annotatable::Stmt(P(stmt)), AstFragmentKind::Stmts) .make_stmts(); } } @@ -1412,16 +1312,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_item(&mut self, item: P) -> SmallVec<[P; 1]> { let mut item = configure!(self, item); - let (attr, traits, after_derive) = self.classify_item(&mut item); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut item) { return self - .collect_attr( - attr, - traits, - Annotatable::Item(item), - AstFragmentKind::Items, - after_derive, - ) + .collect_attr(attr, Annotatable::Item(item), AstFragmentKind::Items) .make_items(); } @@ -1515,16 +1408,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_trait_item(&mut self, item: P) -> SmallVec<[P; 1]> { let mut item = configure!(self, item); - let (attr, traits, after_derive) = self.classify_item(&mut item); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut item) { return self - .collect_attr( - attr, - traits, - Annotatable::TraitItem(item), - AstFragmentKind::TraitItems, - after_derive, - ) + .collect_attr(attr, Annotatable::TraitItem(item), AstFragmentKind::TraitItems) .make_trait_items(); } @@ -1545,16 +1431,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { fn flat_map_impl_item(&mut self, item: P) -> SmallVec<[P; 1]> { let mut item = configure!(self, item); - let (attr, traits, after_derive) = self.classify_item(&mut item); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut item) { return self - .collect_attr( - attr, - traits, - Annotatable::ImplItem(item), - AstFragmentKind::ImplItems, - after_derive, - ) + .collect_attr(attr, Annotatable::ImplItem(item), AstFragmentKind::ImplItems) .make_impl_items(); } @@ -1595,16 +1474,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { &mut self, mut foreign_item: P, ) -> SmallVec<[P; 1]> { - let (attr, traits, after_derive) = self.classify_item(&mut foreign_item); - - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut foreign_item) { return self .collect_attr( attr, - traits, Annotatable::ForeignItem(foreign_item), AstFragmentKind::ForeignItems, - after_derive, ) .make_foreign_items(); } @@ -1639,15 +1514,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { ) -> SmallVec<[ast::GenericParam; 1]> { let mut param = configure!(self, param); - let (attr, traits, after_derive) = self.classify_item(&mut param); - if attr.is_some() || !traits.is_empty() { + if let Some(attr) = self.take_first_attr(&mut param) { return self .collect_attr( attr, - traits, Annotatable::GenericParam(param), AstFragmentKind::GenericParams, - after_derive, ) .make_generic_params(); } @@ -1830,7 +1702,4 @@ impl<'feat> ExpansionConfig<'feat> { fn proc_macro_hygiene(&self) -> bool { self.features.map_or(false, |features| features.proc_macro_hygiene) } - fn custom_inner_attributes(&self) -> bool { - self.features.map_or(false, |features| features.custom_inner_attributes) - } } diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs index 4c95f19b96dc..dea167740edc 100644 --- a/compiler/rustc_expand/src/proc_macro.rs +++ b/compiler/rustc_expand/src/proc_macro.rs @@ -75,38 +75,9 @@ impl MultiItemModifier for ProcMacroDerive { item: Annotatable, ) -> ExpandResult, Annotatable> { let item = match item { - Annotatable::Arm(..) - | Annotatable::Field(..) - | Annotatable::FieldPat(..) - | Annotatable::GenericParam(..) - | Annotatable::Param(..) - | Annotatable::StructField(..) - | Annotatable::Variant(..) => panic!("unexpected annotatable"), - Annotatable::Item(item) => item, - Annotatable::ImplItem(_) - | Annotatable::TraitItem(_) - | Annotatable::ForeignItem(_) - | Annotatable::Stmt(_) - | Annotatable::Expr(_) => { - ecx.span_err( - span, - "proc-macro derives may only be applied to a struct, enum, or union", - ); - return ExpandResult::Ready(Vec::new()); - } + Annotatable::Item(item) => token::NtItem(item), + _ => unreachable!(), }; - match item.kind { - ItemKind::Struct(..) | ItemKind::Enum(..) | ItemKind::Union(..) => {} - _ => { - ecx.span_err( - span, - "proc-macro derives may only be applied to a struct, enum, or union", - ); - return ExpandResult::Ready(Vec::new()); - } - } - - let item = token::NtItem(item); let input = if item.pretty_printing_compatibility_hack() { TokenTree::token(token::Interpolated(Lrc::new(item)), DUMMY_SP).into() } else { diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 298cfcc254c8..4ede9d67b741 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -39,6 +39,9 @@ pub enum NonMacroAttrKind { Tool, /// Single-segment custom attribute registered by a derive macro (`#[serde(default)]`). DeriveHelper, + /// Single-segment custom attribute registered by a derive macro + /// but used before that derive macro was expanded (deprecated). + DeriveHelperCompat, /// Single-segment custom attribute registered with `#[register_attr]`. Registered, } @@ -370,7 +373,9 @@ impl NonMacroAttrKind { match self { NonMacroAttrKind::Builtin => "built-in attribute", NonMacroAttrKind::Tool => "tool attribute", - NonMacroAttrKind::DeriveHelper => "derive helper attribute", + NonMacroAttrKind::DeriveHelper | NonMacroAttrKind::DeriveHelperCompat => { + "derive helper attribute" + } NonMacroAttrKind::Registered => "explicitly registered attribute", } } @@ -385,7 +390,9 @@ impl NonMacroAttrKind { /// Users of some attributes cannot mark them as used, so they are considered always used. pub fn is_used(self) -> bool { match self { - NonMacroAttrKind::Tool | NonMacroAttrKind::DeriveHelper => true, + NonMacroAttrKind::Tool + | NonMacroAttrKind::DeriveHelper + | NonMacroAttrKind::DeriveHelperCompat => true, NonMacroAttrKind::Builtin | NonMacroAttrKind::Registered => false, } } diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs index 094c15131186..4eeb8969bb11 100644 --- a/compiler/rustc_mir/src/transform/inline.rs +++ b/compiler/rustc_mir/src/transform/inline.rs @@ -254,6 +254,11 @@ impl Inliner<'tcx> { self.tcx.sess.opts.debugging_opts.inline_mir_threshold }; + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) { + debug!("#[naked] present - not inlining"); + return false; + } + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) { debug!("#[cold] present - not inlining"); return false; diff --git a/compiler/rustc_mir/src/transform/validate.rs b/compiler/rustc_mir/src/transform/validate.rs index 75399e9c32cc..919e4a90a171 100644 --- a/compiler/rustc_mir/src/transform/validate.rs +++ b/compiler/rustc_mir/src/transform/validate.rs @@ -38,9 +38,7 @@ pub struct Validator { impl<'tcx> MirPass<'tcx> for Validator { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let def_id = body.source.def_id(); - // We need to param_env_reveal_all_normalized, as some optimizations - // change types in ways that require unfolding opaque types. - let param_env = tcx.param_env_reveal_all_normalized(def_id); + let param_env = tcx.param_env(def_id); let mir_phase = self.mir_phase; let always_live_locals = AlwaysLiveLocals::new(body); @@ -81,6 +79,7 @@ pub fn equal_up_to_regions( } // Normalize lifetimes away on both sides, then compare. + let param_env = param_env.with_reveal_all_normalized(tcx); let normalize = |ty: Ty<'tcx>| { tcx.normalize_erasing_regions( param_env, @@ -168,14 +167,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { return true; } // Normalize projections and things like that. - let src = self.tcx.normalize_erasing_regions(self.param_env, src); - let dest = self.tcx.normalize_erasing_regions(self.param_env, dest); + // FIXME: We need to reveal_all, as some optimizations change types in ways + // that require unfolding opaque types. + let param_env = self.param_env.with_reveal_all_normalized(self.tcx); + let src = self.tcx.normalize_erasing_regions(param_env, src); + let dest = self.tcx.normalize_erasing_regions(param_env, dest); // Type-changing assignments can happen when subtyping is used. While // all normal lifetimes are erased, higher-ranked types with their // late-bound lifetimes are still around and can lead to type // differences. So we compare ignoring lifetimes. - equal_up_to_regions(self.tcx, self.param_env, src, dest) + equal_up_to_regions(self.tcx, param_env, src, dest) } } @@ -363,7 +365,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { } TerminatorKind::Call { func, args, destination, cleanup, .. } => { let func_ty = func.ty(&self.body.local_decls, self.tcx); - let func_ty = self.tcx.normalize_erasing_regions(self.param_env, func_ty); match func_ty.kind() { ty::FnPtr(..) | ty::FnDef(..) => {} _ => self.fail( diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 3738fbaeac84..41985757b57a 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -312,14 +312,13 @@ impl<'a> Parser<'a> { } pub fn maybe_needs_tokens(attrs: &[ast::Attribute]) -> bool { + // One of the attributes may either itself be a macro, or apply derive macros (`derive`), + // or expand to macro attributes (`cfg_attr`). attrs.iter().any(|attr| { - if let Some(ident) = attr.ident() { + attr.ident().map_or(true, |ident| { ident.name == sym::derive - // This might apply a custom attribute/derive - || ident.name == sym::cfg_attr - || !rustc_feature::is_builtin_attr_name(ident.name) - } else { - true - } + || ident.name == sym::cfg_attr + || !rustc_feature::is_builtin_attr_name(ident.name) + }) }) } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index acd88af1806c..2cca1a6ee597 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -609,7 +609,7 @@ impl<'a> Resolver<'a> { } } Scope::DeriveHelpersCompat => { - let res = Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper); + let res = Res::NonMacroAttr(NonMacroAttrKind::DeriveHelperCompat); if filter_fn(res) { for derive in parent_scope.derives { let parent_scope = &ParentScope { derives: &[], ..*parent_scope }; diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 21e43be20456..1ee96f81e4fa 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -12,24 +12,24 @@ use rustc_ast_pretty::pprust; use rustc_attr::StabilityLevel; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::ptr_key::PtrKey; +use rustc_data_structures::sync::Lrc; use rustc_errors::struct_span_err; use rustc_expand::base::{Indeterminate, InvocationRes, ResolverExpand, SyntaxExtension}; use rustc_expand::compile_declarative_macro; -use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; +use rustc_expand::expand::{AstFragment, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; use rustc_hir::def::{self, DefKind, NonMacroAttrKind}; use rustc_hir::def_id; use rustc_middle::middle::stability; use rustc_middle::ty; use rustc_session::lint::builtin::UNUSED_MACROS; +use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::edition::Edition; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; +use rustc_span::hygiene::{AstPass, MacroKind}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{Span, DUMMY_SP}; - -use rustc_data_structures::sync::Lrc; -use rustc_span::hygiene::{AstPass, MacroKind}; use std::cell::Cell; use std::{mem, ptr}; @@ -241,15 +241,20 @@ impl<'a> ResolverExpand for Resolver<'a> { } }; - let (path, kind, derives, after_derive) = match invoc.kind { + let (path, kind, inner_attr, derives, after_derive) = match invoc.kind { InvocationKind::Attr { ref attr, ref derives, after_derive, .. } => ( &attr.get_normal_item().path, MacroKind::Attr, + attr.style == ast::AttrStyle::Inner, self.arenas.alloc_ast_paths(derives), after_derive, ), - InvocationKind::Bang { ref mac, .. } => (&mac.path, MacroKind::Bang, &[][..], false), - InvocationKind::Derive { ref path, .. } => (path, MacroKind::Derive, &[][..], false), + InvocationKind::Bang { ref mac, .. } => { + (&mac.path, MacroKind::Bang, false, &[][..], false) + } + InvocationKind::Derive { ref path, .. } => { + (path, MacroKind::Derive, false, &[][..], false) + } InvocationKind::DeriveContainer { ref derives, .. } => { // Block expansion of the container until we resolve all derives in it. // This is required for two reasons: @@ -281,7 +286,7 @@ impl<'a> ResolverExpand for Resolver<'a> { ext.helper_attrs.iter().map(|name| Ident::new(*name, span)), ); if ext.is_derive_copy { - self.add_derive_copy(invoc_id); + self.containers_deriving_copy.insert(invoc_id); } ext } @@ -299,8 +304,17 @@ impl<'a> ResolverExpand for Resolver<'a> { // Derives are not included when `invocations` are collected, so we have to add them here. let parent_scope = &ParentScope { derives, ..parent_scope }; + let require_inert = !invoc.fragment_kind.supports_macro_expansion(); let node_id = self.lint_node_id(eager_expansion_root); - let (ext, res) = self.smart_resolve_macro_path(path, kind, parent_scope, node_id, force)?; + let (ext, res) = self.smart_resolve_macro_path( + path, + kind, + require_inert, + inner_attr, + parent_scope, + node_id, + force, + )?; let span = invoc.span(); invoc_id.set_expn_data(ext.expn_data( @@ -318,29 +332,6 @@ impl<'a> ResolverExpand for Resolver<'a> { self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id); } - match invoc.fragment_kind { - AstFragmentKind::Arms - | AstFragmentKind::Fields - | AstFragmentKind::FieldPats - | AstFragmentKind::GenericParams - | AstFragmentKind::Params - | AstFragmentKind::StructFields - | AstFragmentKind::Variants => { - if let Res::Def(..) = res { - self.session.span_err( - span, - &format!( - "expected an inert attribute, found {} {}", - res.article(), - res.descr() - ), - ); - return Ok(InvocationRes::Single(self.dummy_ext(kind))); - } - } - _ => {} - } - Ok(InvocationRes::Single(ext)) } @@ -360,10 +351,6 @@ impl<'a> ResolverExpand for Resolver<'a> { self.containers_deriving_copy.contains(&expn_id) } - fn add_derive_copy(&mut self, expn_id: ExpnId) { - self.containers_deriving_copy.insert(expn_id); - } - // The function that implements the resolution logic of `#[cfg_accessible(path)]`. // Returns true if the path can certainly be resolved in one of three namespaces, // returns false if the path certainly cannot be resolved in any of the three namespaces. @@ -403,10 +390,14 @@ impl<'a> ResolverExpand for Resolver<'a> { impl<'a> Resolver<'a> { /// Resolve macro path with error reporting and recovery. + /// Uses dummy syntax extensions for unresolved macros or macros with unexpected resolutions + /// for better error recovery. fn smart_resolve_macro_path( &mut self, path: &ast::Path, kind: MacroKind, + require_inert: bool, + inner_attr: bool, parent_scope: &ParentScope<'a>, node_id: NodeId, force: bool, @@ -414,7 +405,6 @@ impl<'a> Resolver<'a> { let (ext, res) = match self.resolve_macro_path(path, Some(kind), parent_scope, true, force) { Ok((Some(ext), res)) => (ext, res), - // Use dummy syntax extensions for unresolved macros for better recovery. Ok((None, res)) => (self.dummy_ext(kind), res), Err(Determinacy::Determined) => (self.dummy_ext(kind), Res::Err), Err(Determinacy::Undetermined) => return Err(Indeterminate), @@ -451,19 +441,43 @@ impl<'a> Resolver<'a> { self.check_stability_and_deprecation(&ext, path, node_id); - Ok(if ext.macro_kind() != kind { - let expected = kind.descr_expected(); + let unexpected_res = if ext.macro_kind() != kind { + Some((kind.article(), kind.descr_expected())) + } else if require_inert && matches!(res, Res::Def(..)) { + Some(("a", "non-macro attribute")) + } else { + None + }; + if let Some((article, expected)) = unexpected_res { let path_str = pprust::path_to_string(path); let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path_str); self.session .struct_span_err(path.span, &msg) - .span_label(path.span, format!("not {} {}", kind.article(), expected)) + .span_label(path.span, format!("not {} {}", article, expected)) .emit(); - // Use dummy syntax extensions for unexpected macro kinds for better recovery. - (self.dummy_ext(kind), Res::Err) - } else { - (ext, res) - }) + return Ok((self.dummy_ext(kind), Res::Err)); + } + + // We are trying to avoid reporting this error if other related errors were reported. + if inner_attr + && !self.session.features_untracked().custom_inner_attributes + && path != &sym::test + && res != Res::Err + { + feature_err( + &self.session.parse_sess, + sym::custom_inner_attributes, + path.span, + match res { + Res::Def(..) => "inner macro attributes are unstable", + Res::NonMacroAttr(..) => "custom inner attributes are unstable", + _ => unreachable!(), + }, + ) + .emit(); + } + + Ok((ext, res)) } pub fn resolve_macro_path( @@ -568,10 +582,9 @@ impl<'a> Resolver<'a> { struct Flags: u8 { const MACRO_RULES = 1 << 0; const MODULE = 1 << 1; - const DERIVE_HELPER_COMPAT = 1 << 2; - const MISC_SUGGEST_CRATE = 1 << 3; - const MISC_SUGGEST_SELF = 1 << 4; - const MISC_FROM_PRELUDE = 1 << 5; + const MISC_SUGGEST_CRATE = 1 << 2; + const MISC_SUGGEST_SELF = 1 << 3; + const MISC_FROM_PRELUDE = 1 << 4; } } @@ -646,14 +659,11 @@ impl<'a> Resolver<'a> { ) { Ok((Some(ext), _)) => { if ext.helper_attrs.contains(&ident.name) { - let binding = ( - Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper), - ty::Visibility::Public, + result = ok( + Res::NonMacroAttr(NonMacroAttrKind::DeriveHelperCompat), derive.span, - ExpnId::root(), - ) - .to_name_binding(this.arenas); - result = Ok((binding, Flags::DERIVE_HELPER_COMPAT)); + this.arenas, + ); break; } } @@ -799,17 +809,15 @@ impl<'a> Resolver<'a> { let (res, innermost_res) = (binding.res(), innermost_binding.res()); if res != innermost_res { let builtin = Res::NonMacroAttr(NonMacroAttrKind::Builtin); - let is_derive_helper_compat = |res, flags: Flags| { - res == Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper) - && flags.contains(Flags::DERIVE_HELPER_COMPAT) - }; + let derive_helper_compat = + Res::NonMacroAttr(NonMacroAttrKind::DeriveHelperCompat); let ambiguity_error_kind = if is_import { Some(AmbiguityKind::Import) } else if innermost_res == builtin || res == builtin { Some(AmbiguityKind::BuiltinAttr) - } else if is_derive_helper_compat(innermost_res, innermost_flags) - || is_derive_helper_compat(res, flags) + } else if innermost_res == derive_helper_compat + || res == derive_helper_compat { Some(AmbiguityKind::DeriveHelper) } else if innermost_flags.contains(Flags::MACRO_RULES) diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs index cafb002c01a1..706f865b4d14 100644 --- a/library/core/src/array/iter.rs +++ b/library/core/src/array/iter.rs @@ -69,7 +69,8 @@ impl IntoIter { /// Returns an immutable slice of all elements that have not been yielded /// yet. - fn as_slice(&self) -> &[T] { + #[unstable(feature = "array_value_iter_slice", issue = "65798")] + pub fn as_slice(&self) -> &[T] { // SAFETY: We know that all elements within `alive` are properly initialized. unsafe { let slice = self.data.get_unchecked(self.alive.clone()); @@ -78,7 +79,8 @@ impl IntoIter { } /// Returns a mutable slice of all elements that have not been yielded yet. - fn as_mut_slice(&mut self) -> &mut [T] { + #[unstable(feature = "array_value_iter_slice", issue = "65798")] + pub fn as_mut_slice(&mut self) -> &mut [T] { // SAFETY: We know that all elements within `alive` are properly initialized. unsafe { let slice = self.data.get_unchecked_mut(self.alive.clone()); diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index fe3eff04b4ae..c229decc5220 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -44,7 +44,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - panic!(r#"assertion failed: `(left == right)` + $crate::panic!(r#"assertion failed: `(left == right)` left: `{:?}`, right: `{:?}`"#, &*left_val, &*right_val) } @@ -58,7 +58,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - panic!(r#"assertion failed: `(left == right)` + $crate::panic!(r#"assertion failed: `(left == right)` left: `{:?}`, right: `{:?}`: {}"#, &*left_val, &*right_val, $crate::format_args!($($arg)+)) @@ -95,7 +95,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - panic!(r#"assertion failed: `(left != right)` + $crate::panic!(r#"assertion failed: `(left != right)` left: `{:?}`, right: `{:?}`"#, &*left_val, &*right_val) } @@ -109,7 +109,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - panic!(r#"assertion failed: `(left != right)` + $crate::panic!(r#"assertion failed: `(left != right)` left: `{:?}`, right: `{:?}`: {}"#, &*left_val, &*right_val, $crate::format_args!($($arg)+)) @@ -466,7 +466,7 @@ macro_rules! writeln { /// /// # Panics /// -/// This will always [`panic!`] +/// This will always [`panic!`]. /// /// # Examples /// @@ -500,13 +500,13 @@ macro_rules! writeln { #[stable(feature = "rust1", since = "1.0.0")] macro_rules! unreachable { () => ({ - panic!("internal error: entered unreachable code") + $crate::panic!("internal error: entered unreachable code") }); ($msg:expr $(,)?) => ({ $crate::unreachable!("{}", $msg) }); ($fmt:expr, $($arg:tt)*) => ({ - panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*) + $crate::panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*) }); } @@ -515,15 +515,15 @@ macro_rules! unreachable { /// This allows your code to type-check, which is useful if you are prototyping or /// implementing a trait that requires multiple methods which you don't plan of using all of. /// -/// The difference between `unimplemented!` and [`todo!`](macro.todo.html) is that while `todo!` +/// The difference between `unimplemented!` and [`todo!`] is that while `todo!` /// conveys an intent of implementing the functionality later and the message is "not yet /// implemented", `unimplemented!` makes no such claims. Its message is "not implemented". /// Also some IDEs will mark `todo!`s. /// /// # Panics /// -/// This will always [panic!](macro.panic.html) because `unimplemented!` is just a -/// shorthand for `panic!` with a fixed, specific message. +/// This will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a +/// fixed, specific message. /// /// Like `panic!`, this macro has a second form for displaying custom values. /// @@ -584,8 +584,8 @@ macro_rules! unreachable { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! unimplemented { - () => (panic!("not implemented")); - ($($arg:tt)+) => (panic!("not implemented: {}", $crate::format_args!($($arg)+))); + () => ($crate::panic!("not implemented")); + ($($arg:tt)+) => ($crate::panic!("not implemented: {}", $crate::format_args!($($arg)+))); } /// Indicates unfinished code. @@ -600,7 +600,7 @@ macro_rules! unimplemented { /// /// # Panics /// -/// This will always [panic!](macro.panic.html) +/// This will always [`panic!`]. /// /// # Examples /// @@ -645,8 +645,8 @@ macro_rules! unimplemented { #[macro_export] #[stable(feature = "todo_macro", since = "1.40.0")] macro_rules! todo { - () => (panic!("not yet implemented")); - ($($arg:tt)+) => (panic!("not yet implemented: {}", $crate::format_args!($($arg)+))); + () => ($crate::panic!("not yet implemented")); + ($($arg:tt)+) => ($crate::panic!("not yet implemented: {}", $crate::format_args!($($arg)+))); } /// Definitions of built-in macros. diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index d48c02bf59c6..9d2045990570 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -47,9 +47,16 @@ //! //! * PowerPC and MIPS platforms with 32-bit pointers do not have `AtomicU64` or //! `AtomicI64` types. -//! * ARM platforms like `armv5te` that aren't for Linux do not have any atomics -//! at all. -//! * ARM targets with `thumbv6m` do not have atomic operations at all. +//! * ARM platforms like `armv5te` that aren't for Linux only provide `load` +//! and `store` operations, and do not support Compare and Swap (CAS) +//! operations, such as `swap`, `fetch_add`, etc. Additionally on Linux, +//! these CAS operations are implemented via [operating system support], which +//! may come with a performance penalty. +//! * ARM targets with `thumbv6m` only provide `load` and `store` operations, +//! and do not support Compare and Swap (CAS) operations, such as `swap`, +//! `fetch_add`, etc. +//! +//! [operating system support]: https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt //! //! Note that future platforms may be added that also do not have support for //! some atomic operations. Maximally portable code will want to be careful diff --git a/library/core/tests/num/i128.rs b/library/core/tests/num/i128.rs new file mode 100644 index 000000000000..72c0b225991f --- /dev/null +++ b/library/core/tests/num/i128.rs @@ -0,0 +1 @@ +int_module!(i128, i128); diff --git a/library/core/tests/num/int_macros.rs b/library/core/tests/num/int_macros.rs index fcb0d6031be6..90c476567844 100644 --- a/library/core/tests/num/int_macros.rs +++ b/library/core/tests/num/int_macros.rs @@ -131,9 +131,9 @@ macro_rules! int_module { assert_eq!(B.rotate_left(0), B); assert_eq!(C.rotate_left(0), C); // Rotating by a multiple of word size should also have no effect - assert_eq!(A.rotate_left(64), A); - assert_eq!(B.rotate_left(64), B); - assert_eq!(C.rotate_left(64), C); + assert_eq!(A.rotate_left(128), A); + assert_eq!(B.rotate_left(128), B); + assert_eq!(C.rotate_left(128), C); } #[test] diff --git a/library/core/tests/num/mod.rs b/library/core/tests/num/mod.rs index 49e5cc0eaa54..012ab4ea5c57 100644 --- a/library/core/tests/num/mod.rs +++ b/library/core/tests/num/mod.rs @@ -11,6 +11,7 @@ use core::str::FromStr; #[macro_use] mod int_macros; +mod i128; mod i16; mod i32; mod i64; @@ -19,6 +20,7 @@ mod i8; #[macro_use] mod uint_macros; +mod u128; mod u16; mod u32; mod u64; diff --git a/library/core/tests/num/u128.rs b/library/core/tests/num/u128.rs new file mode 100644 index 000000000000..716d1836f2c0 --- /dev/null +++ b/library/core/tests/num/u128.rs @@ -0,0 +1 @@ +uint_module!(u128, u128); diff --git a/library/core/tests/num/uint_macros.rs b/library/core/tests/num/uint_macros.rs index 952ec188dc13..445f8fb350ee 100644 --- a/library/core/tests/num/uint_macros.rs +++ b/library/core/tests/num/uint_macros.rs @@ -96,9 +96,9 @@ macro_rules! uint_module { assert_eq!(B.rotate_left(0), B); assert_eq!(C.rotate_left(0), C); // Rotating by a multiple of word size should also have no effect - assert_eq!(A.rotate_left(64), A); - assert_eq!(B.rotate_left(64), B); - assert_eq!(C.rotate_left(64), C); + assert_eq!(A.rotate_left(128), A); + assert_eq!(B.rotate_left(128), B); + assert_eq!(C.rotate_left(128), C); } #[test] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 60808dcba614..e087e2b8ff15 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -484,10 +484,13 @@ impl Step for CompiletestTest { let host = self.host; let compiler = builder.compiler(0, host); + // We need `ToolStd` for the locally-built sysroot because + // compiletest uses unstable features of the `test` crate. + builder.ensure(compile::Std { compiler, target: host }); let cargo = tool::prepare_tool_cargo( builder, compiler, - Mode::ToolBootstrap, + Mode::ToolStd, host, "test", "src/tools/compiletest", diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 28f7a4d31624..147a8d33765a 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1194,6 +1194,16 @@ fn write_minify( } } +fn write_srclink(cx: &Context, item: &clean::Item, buf: &mut Buffer, cache: &Cache) { + if let Some(l) = cx.src_href(item, cache) { + write!( + buf, + "[src]", + l, "goto source code" + ) + } +} + #[derive(Debug, Eq, PartialEq, Hash)] struct ItemEntry { url: String, @@ -1706,13 +1716,7 @@ fn print_item(cx: &Context, item: &clean::Item, buf: &mut Buffer, cache: &Cache) // this page, and this link will be auto-clicked. The `id` attribute is // used to find the link to auto-click. if cx.shared.include_sources && !item.is_primitive() { - if let Some(l) = cx.src_href(item, cache) { - write!( - buf, - "[src]", - l, "goto source code" - ); - } + write_srclink(cx, item, buf, cache); } write!(buf, ""); // out-of-band @@ -2624,7 +2628,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, write!(w, "{}Loading content...", extra_content) } - fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) { + fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item, cache: &Cache) { let name = m.name.as_ref().unwrap(); info!("Documenting {} on {}", name, t.name.as_deref().unwrap_or_default()); let item_type = m.type_(); @@ -2633,6 +2637,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl); write!(w, ""); render_stability_since(w, m, t); + write_srclink(cx, m, w, cache); write!(w, ""); document(w, cx, m, Some(t)); } @@ -2644,8 +2649,8 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, "Associated Types", "
", ); - for t in &types { - trait_item(w, cx, *t, it); + for t in types { + trait_item(w, cx, t, it, cache); } write_loading_content(w, "
"); } @@ -2657,8 +2662,8 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, "Associated Constants", "
", ); - for t in &consts { - trait_item(w, cx, *t, it); + for t in consts { + trait_item(w, cx, t, it, cache); } write_loading_content(w, "
"); } @@ -2671,8 +2676,8 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, "Required methods", "
", ); - for m in &required { - trait_item(w, cx, *m, it); + for m in required { + trait_item(w, cx, m, it, cache); } write_loading_content(w, "
"); } @@ -2683,8 +2688,8 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait, "Provided methods", "
", ); - for m in &provided { - trait_item(w, cx, *m, it); + for m in provided { + trait_item(w, cx, m, it, cache); } write_loading_content(w, "
"); } @@ -3693,13 +3698,7 @@ fn render_impl( StabilityLevel::Unstable { .. } => None, }); render_stability_since_raw(w, since.as_deref(), outer_version); - if let Some(l) = cx.src_href(&i.impl_item, cache) { - write!( - w, - "[src]", - l, "goto source code" - ); - } + write_srclink(cx, &i.impl_item, w, cache); write!(w, ""); if trait_.is_some() { @@ -3765,13 +3764,7 @@ fn render_impl( render_assoc_item(w, item, link.anchor(&id), ItemType::Impl); write!(w, ""); render_stability_since_raw(w, item.stable_since().as_deref(), outer_version); - if let Some(l) = cx.src_href(item, cache) { - write!( - w, - "[src]", - l, "goto source code" - ); - } + write_srclink(cx, item, w, cache); write!(w, ""); } } @@ -3787,13 +3780,7 @@ fn render_impl( assoc_const(w, item, ty, default.as_ref(), link.anchor(&id), ""); write!(w, ""); render_stability_since_raw(w, item.stable_since().as_deref(), outer_version); - if let Some(l) = cx.src_href(item, cache) { - write!( - w, - "[src]", - l, "goto source code" - ); - } + write_srclink(cx, item, w, cache); write!(w, ""); } clean::AssocTypeItem(ref bounds, ref default) => { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 7eccb09b0736..7d22913b99de 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -659,7 +659,7 @@ a { text-decoration: underline; } -.invisible > .srclink, h4 > code + .srclink { +.invisible > .srclink, h4 > code + .srclink, h3 > code + .srclink { position: absolute; top: 0; right: 0; @@ -857,25 +857,25 @@ body.blur > :not(#help) { top: 0; } -.impl-items .since, .impl .since { +.impl-items .since, .impl .since, .methods .since { flex-grow: 0; padding-left: 12px; padding-right: 2px; position: initial; } -.impl-items .srclink, .impl .srclink { +.impl-items .srclink, .impl .srclink, .methods .srclink { flex-grow: 0; /* Override header settings otherwise it's too bold */ font-size: 17px; font-weight: normal; } -.impl-items code, .impl code { +.impl-items code, .impl code, .methods code { flex-grow: 1; } -.impl-items h4, h4.impl, h3.impl { +.impl-items h4, h4.impl, h3.impl, .methods h3 { display: flex; flex-basis: 100%; font-size: 16px; diff --git a/src/test/codegen/naked-inline.rs b/src/test/codegen/naked-inline.rs new file mode 100644 index 000000000000..e4fe0c2a1f3f --- /dev/null +++ b/src/test/codegen/naked-inline.rs @@ -0,0 +1,29 @@ +// Checks that naked functions are never inlined. +// compile-flags: -O -Zmir-opt-level=2 +#![crate_type = "lib"] +#![feature(asm)] +#![feature(naked_functions)] + +#[inline(always)] +#[naked] +#[no_mangle] +pub unsafe fn f() { +// Check that f has naked and noinline attributes. +// +// CHECK: define void @f() unnamed_addr [[ATTR:#[0-9]+]] +// CHECK-NEXT: start: +// CHECK-NEXT: call void asm + asm!("", options(noreturn)); +} + +#[no_mangle] +pub unsafe fn g() { +// Check that call to f is not inlined. +// +// CHECK-LABEL: define void @g() +// CHECK-NEXT: start: +// CHECK-NEXT: call void @f() + f(); +} + +// CHECK: attributes [[ATTR]] = { naked noinline{{.*}} } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index f9f30ccb20e2..4db83c5c683d 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -11,17 +11,16 @@ let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _14: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _15: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _16: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _22: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _12: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _14: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _15: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _16: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _18: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -33,33 +32,32 @@ debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _28; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _25; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _24; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _24: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _25: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _27; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _24; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _23; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: &&i32; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 7 { } } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _28; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _27; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _26: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _28: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _26; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: &&i32; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 9 { } } } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug pieces => _29; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - debug args => _31; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _29: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _30: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug pieces => (_12.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug args => _29; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _28: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -114,83 +112,80 @@ } bb2: { - StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _14 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _29 = move _14 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_12.0: &[&str]) = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_16.0: &&i32) = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_17.0: &&i32) = &_18; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _20 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_17.1: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _25 = (_17.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _28 = (_17.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _19 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = &_19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_16.1: &&i32) = move _18; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (_16.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = (_16.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_23); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _23 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _24) -> bb3; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb3: { - (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb4; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + (_20.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb4: { - (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _23; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _22; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_26); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _26 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - (_22.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _28) -> bb6; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _27) -> bb6; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - (_22.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _26; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_26); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _16 = [move _21, move _22]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _15 = &_16; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _31 = move _15 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_30); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - discriminant(_30) = 0; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.0: &[&str]) = move _29; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _30; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.2: &[std::fmt::ArgumentV1]) = move _31; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_30); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _25; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = [move _20, move _21]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _14 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_28) = 0; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_12.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _28; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_12.2: &[std::fmt::ArgumentV1]) = move _29; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_28); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic_fmt(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } } } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index f9f30ccb20e2..4db83c5c683d 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -11,17 +11,16 @@ let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _14: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _15: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _16: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _22: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _12: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _14: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _15: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _16: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _18: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -33,33 +32,32 @@ debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _28; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _25; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _24; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _24: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _25: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _27; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _24; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _23; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: &&i32; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 7 { } } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _28; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _27; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _26: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _28: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _26; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: &&i32; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 9 { } } } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug pieces => _29; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - debug args => _31; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _29: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _30: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug pieces => (_12.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug args => _29; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _28: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -114,83 +112,80 @@ } bb2: { - StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _14 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _29 = move _14 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_12.0: &[&str]) = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_16.0: &&i32) = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_17.0: &&i32) = &_18; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _20 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_17.1: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _25 = (_17.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _28 = (_17.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _19 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = &_19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_16.1: &&i32) = move _18; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (_16.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = (_16.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_23); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _23 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _24) -> bb3; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb3: { - (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb4; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + (_20.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb4: { - (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _23; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _22; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_26); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _26 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - (_22.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _28) -> bb6; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _27) -> bb6; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - (_22.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _26; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_26); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _16 = [move _21, move _22]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _15 = &_16; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _31 = move _15 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_30); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - discriminant(_30) = 0; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.0: &[&str]) = move _29; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _30; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_13.2: &[std::fmt::ArgumentV1]) = move _31; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_30); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _25; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = [move _20, move _21]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _14 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_28) = 0; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_12.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _28; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_12.2: &[std::fmt::ArgumentV1]) = move _29; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_28); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic_fmt(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } } } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index a9425224ce47..4e362f3556b2 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -18,29 +18,27 @@ let mut _16: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: !; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _21: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _22: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _24: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _25: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _26: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _27: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _28: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _29: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _30: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _23: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _24: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _28: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _30: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _31: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _32: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _33: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _34: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _35: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _38: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _39: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _40: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _41: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _36: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _37: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _38: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _39: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _40: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _41: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -48,43 +46,43 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _43: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _36: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _37: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _44: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _34: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _35: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _42: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _36; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _37; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _39; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _40; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _46: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _47: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _48: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _49: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug arg0 => _34; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _35; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _37; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _38; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _44: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _45: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _46: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _47: &&i32; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 7 { } } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _42; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _43; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _50: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _51: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _52: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _53: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _40; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _41; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _48: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _49: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _50: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _51: &&i32; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 9 { } } } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug pieces => _23; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - debug args => _27; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _54: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _55: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _56: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug pieces => _21; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug args => _25; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _52: &[&str]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _53: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _54: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -126,14 +124,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _45 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _43 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - _11 = _45; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = _43; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -170,146 +168,142 @@ } bb4: { - StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _44 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _42 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _25 = _44; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _25; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = move _24 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_28); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_29); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_30); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_31); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _23 = _42; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = _23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = move _22 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &_31; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_33); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _32 = &_33; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_29.0: &&i32) = move _30; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_29.1: &&i32) = move _32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = (_29.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _35 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = &_35; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_31.0: &&i32) = move _32; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_31.1: &&i32) = move _34; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_34); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_32); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_36); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _36 = (_31.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _37 = (_31.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_38); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _39 = _36; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _40 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _35 = (_29.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_36); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _37 = _34; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _38 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_46); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_47); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _47 = _40; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _46 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb5; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _45 = _38; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - StorageDead(_47); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_48); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_49); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _49 = _39; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb6; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_46); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_47); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _47 = _37; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _46 = transmute::<&&i32, &core::fmt::Opaque>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - StorageDead(_49); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - (_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - (_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_48); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_41); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_42); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _42 = _37; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_43); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _43 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_47); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_36.0: &core::fmt::Opaque) = move _46; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_36.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _44; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_46); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _40 = _35; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _41 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_50); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _51 = _43; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _50 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb7; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _49 = _41; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb7: { - StorageDead(_51); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_52); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_53); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _53 = _42; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb8; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_50); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_51); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _51 = _40; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _50 = transmute::<&&i32, &core::fmt::Opaque>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb8: { - StorageDead(_53); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - (_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - (_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_52); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_50); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_43); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_42); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _30 = [move _38, move _41]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_41); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_38); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_37); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_36); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _29 = &_30; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _28 = _29; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = move _28 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_28); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_54); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _54 = _23; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_55); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - discriminant(_55) = 0; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_56); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _56 = _27; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.0: &[&str]) = move _54; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _55; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.2: &[std::fmt::ArgumentV1]) = move _56; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_56); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_55); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_54); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_27); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_23); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _21 = &_22; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _20 = _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_51); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_39.0: &core::fmt::Opaque) = move _50; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_39.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _48; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_50); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = [move _36, move _39]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_36); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = &_28; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _27; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = move _26 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_52); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _52 = _21; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_53); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_53) = 0; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_54); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _54 = _25; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.0: &[&str]) = move _52; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _53; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.2: &[std::fmt::ArgumentV1]) = move _54; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_54); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_53); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_52); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic_fmt(move _20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } } } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index a9425224ce47..4e362f3556b2 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -18,29 +18,27 @@ let mut _16: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: !; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _21: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _22: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _24: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _25: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _26: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _27: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _28: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _29: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _30: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _23: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _24: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _28: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _30: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _31: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _32: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _33: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _34: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _35: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _38: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _39: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _40: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _41: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _36: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _37: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _38: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _39: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _40: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _41: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -48,43 +46,43 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _43: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _36: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _37: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _44: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _34: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _35: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _42: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _36; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _37; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _39; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _40; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _46: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _47: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _48: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _49: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug arg0 => _34; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _35; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _37; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _38; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _44: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _45: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _46: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _47: &&i32; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 7 { } } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug x => _42; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - debug f => _43; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _50: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _51: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _52: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _53: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug x => _40; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug f => _41; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _48: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _49: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _50: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _51: &&i32; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 9 { } } } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/std/src/macros.rs:LL:COL - debug pieces => _23; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - debug args => _27; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _54: &[&str]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _55: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _56: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug pieces => _21; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug args => _25; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _52: &[&str]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _53: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _54: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -126,14 +124,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _45 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _43 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - _11 = _45; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = _43; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -170,146 +168,142 @@ } bb4: { - StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _44 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _42 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _25 = _44; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _25; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = move _24 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_28); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_29); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_30); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_31); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _23 = _42; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = _23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = move _22 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &_31; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_33); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _32 = &_33; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_29.0: &&i32) = move _30; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_29.1: &&i32) = move _32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = (_29.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _35 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = &_35; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_31.0: &&i32) = move _32; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_31.1: &&i32) = move _34; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_34); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_32); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_36); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _36 = (_31.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _37 = (_31.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_38); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _39 = _36; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _40 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _35 = (_29.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_36); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _37 = _34; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _38 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_46); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_47); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _47 = _40; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _46 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb5; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _45 = _38; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - StorageDead(_47); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_48); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_49); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _49 = _39; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - _48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb6; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_46); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_47); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _47 = _37; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _46 = transmute::<&&i32, &core::fmt::Opaque>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - StorageDead(_49); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - (_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - (_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_48); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_41); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_42); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _42 = _37; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_43); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _43 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_47); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_36.0: &core::fmt::Opaque) = move _46; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_36.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _44; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_46); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _40 = _35; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _41 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_50); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _51 = _43; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _50 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb7; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _49 = _41; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb7: { - StorageDead(_51); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_52); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_53); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _53 = _42; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - _52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb8; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_50); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_51); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _51 = _40; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _50 = transmute::<&&i32, &core::fmt::Opaque>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb8: { - StorageDead(_53); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - (_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - (_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_52); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_50); // scope 9 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_43); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_42); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _30 = [move _38, move _41]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_41); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_38); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_37); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_36); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _29 = &_30; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _28 = _29; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = move _28 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_28); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_54); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _54 = _23; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_55); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - discriminant(_55) = 0; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_56); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - _56 = _27; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.0: &[&str]) = move _54; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _55; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - (_22.2: &[std::fmt::ArgumentV1]) = move _56; // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_56); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_55); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_54); // scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_27); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_23); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _21 = &_22; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _20 = _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_51); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_39.0: &core::fmt::Opaque) = move _50; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_39.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _48; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_50); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = [move _36, move _39]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_39); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_36); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = &_28; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _27; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = move _26 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_52); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _52 = _21; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_53); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_53) = 0; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_54); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _54 = _25; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.0: &[&str]) = move _52; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _53; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_20.2: &[std::fmt::ArgumentV1]) = move _54; // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_54); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_53); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_52); // scope 10 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic_fmt(move _20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } } } diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index 499134b69919..6450a2a22c6c 100644 --- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -21,7 +21,7 @@ let mut _19: *const T; // in scope 0 at $DIR/issue_76432.rs:9:54: 9:68 let mut _20: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 let mut _21: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 - let mut _22: !; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _22: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug v => _2; // in scope 1 at $DIR/issue_76432.rs:7:9: 7:10 let _13: &T; // in scope 1 at $DIR/issue_76432.rs:9:10: 9:16 @@ -64,11 +64,11 @@ } bb1: { - StorageLive(_22); // scope 1 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic::<&str>(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_22); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } // ty::Const // + ty: &str // + val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, size: Size { raw: 40 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) diff --git a/src/test/rustdoc/trait-src-link.rs b/src/test/rustdoc/trait-src-link.rs new file mode 100644 index 000000000000..77116695690f --- /dev/null +++ b/src/test/rustdoc/trait-src-link.rs @@ -0,0 +1,26 @@ +#![crate_name = "quix"] +pub trait Foo { + // @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#4"]' '[src]' + fn required(); + + // @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]' + fn provided() {} +} + +pub struct Bar; + +impl Foo for Bar { + // @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#14"]' '[src]' + fn required() {} + // @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]' +} + +pub struct Baz; + +impl Foo for Baz { + // @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#22"]' '[src]' + fn required() {} + + // @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#25"]' '[src]' + fn provided() {} +} diff --git a/src/test/ui/attrs-resolution-errors.rs b/src/test/ui/attrs-resolution-errors.rs index a38b3cfa6665..8770fb1ded8e 100644 --- a/src/test/ui/attrs-resolution-errors.rs +++ b/src/test/ui/attrs-resolution-errors.rs @@ -1,12 +1,12 @@ enum FooEnum { #[test] - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro Bar(i32), } struct FooStruct { #[test] - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro bar: i32, } @@ -21,20 +21,20 @@ fn main() { match foo_struct { FooStruct { #[test] bar - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro } => {} } match 1 { 0 => {} #[test] - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro _ => {} } let _another_foo_strunct = FooStruct { #[test] - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro bar: 1, }; } diff --git a/src/test/ui/attrs-resolution-errors.stderr b/src/test/ui/attrs-resolution-errors.stderr index 31f2a74edb33..883f96e5c193 100644 --- a/src/test/ui/attrs-resolution-errors.stderr +++ b/src/test/ui/attrs-resolution-errors.stderr @@ -1,32 +1,32 @@ -error: expected an inert attribute, found an attribute macro - --> $DIR/attrs-resolution-errors.rs:2:5 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/attrs-resolution-errors.rs:2:7 | LL | #[test] - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/attrs-resolution-errors.rs:8:5 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/attrs-resolution-errors.rs:8:7 | LL | #[test] - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/attrs-resolution-errors.rs:23:13 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/attrs-resolution-errors.rs:23:15 | LL | #[test] bar - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/attrs-resolution-errors.rs:30:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/attrs-resolution-errors.rs:30:11 | LL | #[test] - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/attrs-resolution-errors.rs:36:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/attrs-resolution-errors.rs:36:11 | LL | #[test] - | ^^^^^^^ + | ^^^^ not a non-macro attribute error: aborting due to 5 previous errors diff --git a/src/test/ui/conditional-compilation/cfg_accessible-stuck.rs b/src/test/ui/conditional-compilation/cfg_accessible-stuck.rs index 8bc93fa32437..50504a44c951 100644 --- a/src/test/ui/conditional-compilation/cfg_accessible-stuck.rs +++ b/src/test/ui/conditional-compilation/cfg_accessible-stuck.rs @@ -1,6 +1,6 @@ #![feature(cfg_accessible)] -#[cfg_accessible(Z)] //~ ERROR cannot determine whether the path is accessible or not +#[cfg_accessible(Z)] // OK, recovered after the other `cfg_accessible` produces an error. struct S; #[cfg_accessible(S)] //~ ERROR cannot determine whether the path is accessible or not diff --git a/src/test/ui/conditional-compilation/cfg_accessible-stuck.stderr b/src/test/ui/conditional-compilation/cfg_accessible-stuck.stderr index 9641441a819b..33af7d62548e 100644 --- a/src/test/ui/conditional-compilation/cfg_accessible-stuck.stderr +++ b/src/test/ui/conditional-compilation/cfg_accessible-stuck.stderr @@ -4,11 +4,5 @@ error: cannot determine whether the path is accessible or not LL | #[cfg_accessible(S)] | ^^^^^^^^^^^^^^^^^^^^ -error: cannot determine whether the path is accessible or not - --> $DIR/cfg_accessible-stuck.rs:3:1 - | -LL | #[cfg_accessible(Z)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/destructuring-assignment/drop-order.rs b/src/test/ui/destructuring-assignment/drop-order.rs new file mode 100644 index 000000000000..d06b31c7f270 --- /dev/null +++ b/src/test/ui/destructuring-assignment/drop-order.rs @@ -0,0 +1,44 @@ +// run-pass + +//! Test that let bindings and destructuring assignments have consistent drop orders + +#![feature(destructuring_assignment)] +#![allow(unused_variables, unused_assignments)] + +use std::cell::RefCell; + +thread_local! { + static DROP_ORDER: RefCell> = RefCell::new(Vec::new()); +} + +struct DropRecorder(usize); +impl Drop for DropRecorder { + fn drop(&mut self) { + DROP_ORDER.with(|d| d.borrow_mut().push(self.0)); + } +} + +fn main() { + let expected_drop_order = vec![1, 4, 5, 3, 2]; + // Check the drop order for let bindings: + { + let _ = DropRecorder(1); + let _val = DropRecorder(2); + let (x, _) = (DropRecorder(3), DropRecorder(4)); + drop(DropRecorder(5)); + } + DROP_ORDER.with(|d| { + assert_eq!(&*d.borrow(), &expected_drop_order); + d.borrow_mut().clear(); + }); + // Check that the drop order for destructuring assignment is the same: + { + let _val; + let x; + _ = DropRecorder(1); + _val = DropRecorder(2); + (x, _) = (DropRecorder(3), DropRecorder(4)); + drop(DropRecorder(5)); + } + DROP_ORDER.with(|d| assert_eq!(&*d.borrow(), &expected_drop_order)); +} diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index 204e7b248797..a6b9e22cc652 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -1,7 +1,7 @@ #![feature(decl_macro)] mod foo { - pub macro m() { Vec::new(); ().clone() } + pub macro m() { Vec::::new(); ().clone() } fn f() { ::bar::m!(); } } @@ -13,7 +13,7 @@ mod bar { } fn f() { ::foo::m!(); - assert_eq!(0, 0); //~ ERROR cannot find macro `panic` in this scope + assert!(true); //~ ERROR cannot find macro `panic` in this scope } } diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 843dee2478b3..b35304a76b9c 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -1,8 +1,8 @@ error: cannot find macro `panic` in this scope --> $DIR/no_implicit_prelude.rs:16:9 | -LL | assert_eq!(0, 0); - | ^^^^^^^^^^^^^^^^^ +LL | assert!(true); + | ^^^^^^^^^^^^^^ | = note: consider importing one of these items: core::panic diff --git a/src/test/ui/issues/issue-36617.rs b/src/test/ui/issues/issue-36617.rs index 58f44f42524b..1102f3c4640a 100644 --- a/src/test/ui/issues/issue-36617.rs +++ b/src/test/ui/issues/issue-36617.rs @@ -1,5 +1,4 @@ #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions //~| ERROR cannot determine resolution for the derive macro `Copy` - //~| ERROR cannot determine resolution for the derive macro `Copy` fn main() {} diff --git a/src/test/ui/issues/issue-36617.stderr b/src/test/ui/issues/issue-36617.stderr index 586dcf2cea67..dc6ef1692591 100644 --- a/src/test/ui/issues/issue-36617.stderr +++ b/src/test/ui/issues/issue-36617.stderr @@ -12,14 +12,6 @@ LL | #![derive(Copy)] | = note: import resolution is stuck, try simplifying macro imports -error: cannot determine resolution for the derive macro `Copy` - --> $DIR/issue-36617.rs:1:11 - | -LL | #![derive(Copy)] - | ^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0774`. diff --git a/src/test/ui/issues/issue-49934-errors.rs b/src/test/ui/issues/issue-49934-errors.rs index 6fa5f01ffd92..bf95f8fa7e1e 100644 --- a/src/test/ui/issues/issue-49934-errors.rs +++ b/src/test/ui/issues/issue-49934-errors.rs @@ -1,10 +1,8 @@ fn foo<#[derive(Debug)] T>() { //~^ ERROR `derive` may only be applied to structs, enums and unions -//~| ERROR expected an inert attribute, found a derive macro match 0 { #[derive(Debug)] //~^ ERROR `derive` may only be applied to structs, enums and unions - //~| ERROR expected an inert attribute, found a derive macro _ => (), } } diff --git a/src/test/ui/issues/issue-49934-errors.stderr b/src/test/ui/issues/issue-49934-errors.stderr index 3befb38a2088..71cd2d303424 100644 --- a/src/test/ui/issues/issue-49934-errors.stderr +++ b/src/test/ui/issues/issue-49934-errors.stderr @@ -4,24 +4,12 @@ error[E0774]: `derive` may only be applied to structs, enums and unions LL | fn foo<#[derive(Debug)] T>() { | ^^^^^^^^^^^^^^^^ -error: expected an inert attribute, found a derive macro - --> $DIR/issue-49934-errors.rs:1:17 - | -LL | fn foo<#[derive(Debug)] T>() { - | ^^^^^ - error[E0774]: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-49934-errors.rs:5:9 + --> $DIR/issue-49934-errors.rs:4:9 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ -error: expected an inert attribute, found a derive macro - --> $DIR/issue-49934-errors.rs:5:18 - | -LL | #[derive(Debug)] - | ^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0774`. diff --git a/src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs b/src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs index f3a51b415fac..fb4bf2b8b44e 100644 --- a/src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs +++ b/src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs @@ -1,3 +1,7 @@ +// revisions: default miropt +//[miropt]compile-flags: -Z mir-opt-level=2 +// ~^ This flag is for #77668, it used to be ICE. + #![crate_type = "lib"] pub fn bar

( // Error won't happen if "bar" is not generic diff --git a/src/test/ui/iterators/iter-count-overflow-ndebug.rs b/src/test/ui/iterators/iter-count-overflow-ndebug.rs index b755bb554f44..c38755db87eb 100644 --- a/src/test/ui/iterators/iter-count-overflow-ndebug.rs +++ b/src/test/ui/iterators/iter-count-overflow-ndebug.rs @@ -2,7 +2,6 @@ // only-32bit too impatient for 2⁶⁴ items // compile-flags: -C debug_assertions=no -C opt-level=3 -use std::panic; use std::usize::MAX; fn main() { diff --git a/src/test/ui/iterators/iter-position-overflow-ndebug.rs b/src/test/ui/iterators/iter-position-overflow-ndebug.rs index 368f9c0c02b0..3b0c245a5c2a 100644 --- a/src/test/ui/iterators/iter-position-overflow-ndebug.rs +++ b/src/test/ui/iterators/iter-position-overflow-ndebug.rs @@ -2,7 +2,6 @@ // only-32bit too impatient for 2⁶⁴ items // compile-flags: -C debug_assertions=no -C opt-level=3 -use std::panic; use std::usize::MAX; fn main() { diff --git a/src/test/ui/macros/issue-78333.rs b/src/test/ui/macros/issue-78333.rs new file mode 100644 index 000000000000..c376f2067045 --- /dev/null +++ b/src/test/ui/macros/issue-78333.rs @@ -0,0 +1,13 @@ +// build-pass + +#![no_implicit_prelude] + +fn main() { + ::std::panic!(); + ::std::todo!(); + ::std::unimplemented!(); + ::std::assert_eq!(0, 0); + ::std::assert_ne!(0, 1); + ::std::dbg!(123); + ::std::unreachable!(); +} diff --git a/src/test/ui/malformed/issue-69341-malformed-derive-inert.rs b/src/test/ui/malformed/issue-69341-malformed-derive-inert.rs index 24692f7cf52e..1fd7cddc7c93 100644 --- a/src/test/ui/malformed/issue-69341-malformed-derive-inert.rs +++ b/src/test/ui/malformed/issue-69341-malformed-derive-inert.rs @@ -4,7 +4,6 @@ struct CLI { #[derive(parse())] //~^ ERROR traits in `#[derive(...)]` don't accept arguments //~| ERROR cannot find derive macro `parse` in this scope - //~| ERROR cannot find derive macro `parse` in this scope path: (), //~^ ERROR `derive` may only be applied to structs, enums and unions } diff --git a/src/test/ui/malformed/issue-69341-malformed-derive-inert.stderr b/src/test/ui/malformed/issue-69341-malformed-derive-inert.stderr index c4532a375a75..db40ce075304 100644 --- a/src/test/ui/malformed/issue-69341-malformed-derive-inert.stderr +++ b/src/test/ui/malformed/issue-69341-malformed-derive-inert.stderr @@ -5,7 +5,7 @@ LL | #[derive(parse())] | ^^ help: remove the arguments error[E0774]: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-69341-malformed-derive-inert.rs:8:5 + --> $DIR/issue-69341-malformed-derive-inert.rs:7:5 | LL | path: (), | ^^^^^^^^ @@ -16,12 +16,6 @@ error: cannot find derive macro `parse` in this scope LL | #[derive(parse())] | ^^^^^ -error: cannot find derive macro `parse` in this scope - --> $DIR/issue-69341-malformed-derive-inert.rs:4:14 - | -LL | #[derive(parse())] - | ^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0774`. diff --git a/src/test/ui/mir/mir-inlining/ice-issue-77306-1.rs b/src/test/ui/mir/mir-inlining/ice-issue-77306-1.rs index ccb279f7fa21..4d083bf23215 100644 --- a/src/test/ui/mir/mir-inlining/ice-issue-77306-1.rs +++ b/src/test/ui/mir/mir-inlining/ice-issue-77306-1.rs @@ -1,27 +1,17 @@ -// Regression test for various issues related to normalization & inlining. -// * #68347, #77306, #77668 - missed normalization during inlining. -// * #78442 - missed normalization in validator after inlining. -// -// build-pass +// run-pass // compile-flags:-Zmir-opt-level=2 +// Previously ICEd because we did not normalize during inlining, +// see https://github.com/rust-lang/rust/pull/77306 for more discussion. + pub fn write() { create()() } -pub fn write_generic(_t: T) { - hide()(); -} - pub fn create() -> impl FnOnce() { || () } -pub fn hide() -> impl Fn() { - write -} - fn main() { write(); - write_generic(()); } diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs index b3b677fa7ffe..4c72ecbfc03a 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.rs +++ b/src/test/ui/proc-macro/proc-macro-gates.rs @@ -7,11 +7,11 @@ extern crate test_macros; fn _test_inner() { - #![empty_attr] //~ ERROR: non-builtin inner attributes are unstable + #![empty_attr] //~ ERROR: inner macro attributes are unstable } mod _test2_inner { - #![empty_attr] //~ ERROR: non-builtin inner attributes are unstable + #![empty_attr] //~ ERROR: inner macro attributes are unstable } #[empty_attr = "y"] //~ ERROR: key-value macro attributes are not supported diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr index c03434955317..33a808037eea 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -1,17 +1,17 @@ -error[E0658]: non-builtin inner attributes are unstable - --> $DIR/proc-macro-gates.rs:10:5 +error[E0658]: inner macro attributes are unstable + --> $DIR/proc-macro-gates.rs:10:8 | LL | #![empty_attr] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^ | = note: see issue #54726 for more information = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable -error[E0658]: non-builtin inner attributes are unstable - --> $DIR/proc-macro-gates.rs:14:5 +error[E0658]: inner macro attributes are unstable + --> $DIR/proc-macro-gates.rs:14:8 | LL | #![empty_attr] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^ | = note: see issue #54726 for more information = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable diff --git a/src/test/ui/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs index 2fd5efd71f04..38fbd4733d5c 100644 --- a/src/test/ui/proc-macro/proc-macro-gates2.rs +++ b/src/test/ui/proc-macro/proc-macro-gates2.rs @@ -10,11 +10,11 @@ extern crate test_macros; // should either require a feature gate or not be allowed on stable. fn _test6<#[empty_attr] T>() {} -//~^ ERROR: expected an inert attribute, found an attribute macro +//~^ ERROR: expected non-macro attribute, found attribute macro fn _test7() { match 1 { - #[empty_attr] //~ ERROR: expected an inert attribute, found an attribute macro + #[empty_attr] //~ ERROR: expected non-macro attribute, found attribute macro 0 => {} _ => {} } diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr index fd271da61553..64df34e7ce39 100644 --- a/src/test/ui/proc-macro/proc-macro-gates2.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr @@ -1,14 +1,14 @@ -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-gates2.rs:12:11 +error: expected non-macro attribute, found attribute macro `empty_attr` + --> $DIR/proc-macro-gates2.rs:12:13 | LL | fn _test6<#[empty_attr] T>() {} - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-gates2.rs:17:9 +error: expected non-macro attribute, found attribute macro `empty_attr` + --> $DIR/proc-macro-gates2.rs:17:11 | LL | #[empty_attr] - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^ not a non-macro attribute error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs b/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs index bf09171c9a12..6403b3f55c40 100644 --- a/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs +++ b/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs @@ -3,7 +3,7 @@ extern "C" { /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -19,7 +19,7 @@ type FnType = fn( /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: u32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -34,7 +34,7 @@ pub fn foo( /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: u32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -54,7 +54,7 @@ impl SelfStruct { /// Bar //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -69,7 +69,7 @@ impl SelfStruct { /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -90,7 +90,7 @@ impl RefStruct { /// Bar //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -109,7 +109,7 @@ trait RefTrait { /// Bar //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -124,7 +124,7 @@ trait RefTrait { /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -144,7 +144,7 @@ impl RefTrait for RefStruct { /// Bar //~^ ERROR documentation comments cannot be applied to function #[test] a: i32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Baz //~^ ERROR documentation comments cannot be applied to function #[must_use] @@ -161,7 +161,7 @@ fn main() { /// Foo //~^ ERROR documentation comments cannot be applied to function #[test] a: u32, - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro /// Bar //~^ ERROR documentation comments cannot be applied to function #[must_use] diff --git a/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr b/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr index 4d0349e8765f..edca8cea68d7 100644 --- a/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr +++ b/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.stderr @@ -1,62 +1,62 @@ -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:5:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:5:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:21:5 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:21:7 | LL | #[test] a: u32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:36:5 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:36:7 | LL | #[test] a: u32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:56:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:56:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:71:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:71:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:92:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:92:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:111:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:111:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:126:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:126:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:146:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:146:11 | LL | #[test] a: i32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/param-attrs-builtin-attrs.rs:163:9 +error: expected non-macro attribute, found attribute macro `test` + --> $DIR/param-attrs-builtin-attrs.rs:163:11 | LL | #[test] a: u32, - | ^^^^^^^ + | ^^^^ not a non-macro attribute error: documentation comments cannot be applied to function parameters --> $DIR/param-attrs-builtin-attrs.rs:3:9 diff --git a/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs b/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs index be9085d5878c..fcfa610ec855 100644 --- a/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs +++ b/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.rs @@ -8,58 +8,58 @@ use ident_mac::id; struct W(u8); extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); } -//~^ ERROR expected an inert attribute, found an attribute macro -//~| ERROR expected an inert attribute, found an attribute macro +//~^ ERROR expected non-macro attribute, found attribute macro +//~| ERROR expected non-macro attribute, found attribute macro unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {} -//~^ ERROR expected an inert attribute, found an attribute macro +//~^ ERROR expected non-macro attribute, found attribute macro type Alias = extern "C" fn(#[id] u8, #[id] ...); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn free(#[id] arg1: u8) { - //~^ ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro let lam = |#[id] W(x), #[id] y: usize| (); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro } impl W { fn inherent1(#[id] self, #[id] arg1: u8) {} - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn inherent2(#[id] &self, #[id] arg1: u8) {} - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {} - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn inherent4<'a>(#[id] self: Box, #[id] arg1: u8) {} - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {} - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro } trait A { fn trait1(#[id] self, #[id] arg1: u8); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn trait2(#[id] &self, #[id] arg1: u8); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn trait4<'a>(#[id] self: Box, #[id] arg1: u8, #[id] Vec); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8); - //~^ ERROR expected an inert attribute, found an attribute macro - //~| ERROR expected an inert attribute, found an attribute macro + //~^ ERROR expected non-macro attribute, found attribute macro + //~| ERROR expected non-macro attribute, found attribute macro } fn main() {} diff --git a/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr b/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr index 1cc3c3d82281..38c5050f3428 100644 --- a/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr +++ b/src/test/ui/rfc-2565-param-attrs/proc-macro-cannot-be-used.stderr @@ -1,176 +1,176 @@ -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:10:21 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:10:23 | LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); } - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:10:38 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:10:40 | LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); } - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:14:38 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:14:40 | LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:17:28 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:17:30 | LL | type Alias = extern "C" fn(#[id] u8, #[id] ...); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:17:38 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:17:40 | LL | type Alias = extern "C" fn(#[id] u8, #[id] ...); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:21:9 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:21:11 | LL | fn free(#[id] arg1: u8) { - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:23:16 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:23:18 | LL | let lam = |#[id] W(x), #[id] y: usize| (); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:23:28 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:23:30 | LL | let lam = |#[id] W(x), #[id] y: usize| (); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:29:18 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:29:20 | LL | fn inherent1(#[id] self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:29:30 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:29:32 | LL | fn inherent1(#[id] self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:32:18 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:32:20 | LL | fn inherent2(#[id] &self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:32:31 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:32:33 | LL | fn inherent2(#[id] &self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:35:22 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:35:24 | LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:35:42 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:35:44 | LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:38:22 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:38:24 | LL | fn inherent4<'a>(#[id] self: Box, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:38:45 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:38:47 | LL | fn inherent4<'a>(#[id] self: Box, #[id] arg1: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:41:38 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:41:40 | LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:41:54 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:41:56 | LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8) {} - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:47:15 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:47:17 | LL | fn trait1(#[id] self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:47:27 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:47:29 | LL | fn trait1(#[id] self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:50:15 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:50:17 | LL | fn trait2(#[id] &self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:50:28 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:50:30 | LL | fn trait2(#[id] &self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:53:19 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:53:21 | LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:53:39 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:53:41 | LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:56:19 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:56:21 | LL | fn trait4<'a>(#[id] self: Box, #[id] arg1: u8, #[id] Vec); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:56:42 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:56:44 | LL | fn trait4<'a>(#[id] self: Box, #[id] arg1: u8, #[id] Vec); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:56:58 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:56:60 | LL | fn trait4<'a>(#[id] self: Box, #[id] arg1: u8, #[id] Vec); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:60:38 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:60:40 | LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8); - | ^^^^^ + | ^^ not a non-macro attribute -error: expected an inert attribute, found an attribute macro - --> $DIR/proc-macro-cannot-be-used.rs:60:54 +error: expected non-macro attribute, found attribute macro `id` + --> $DIR/proc-macro-cannot-be-used.rs:60:56 | LL | fn issue_64682_associated_fn<'a>(#[id] arg1: u8, #[id] arg2: u8); - | ^^^^^ + | ^^ not a non-macro attribute error: aborting due to 29 previous errors diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs index 4776740d8de9..70e04bf7ee6e 100644 --- a/src/test/ui/span/issue-36530.rs +++ b/src/test/ui/span/issue-36530.rs @@ -6,7 +6,7 @@ #[foo] mod foo { - #![foo] //~ ERROR non-builtin inner attributes are unstable + #![foo] //~ ERROR custom inner attributes are unstable } fn main() {} diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index 79b12590fc53..a998d7217a13 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,8 +1,8 @@ -error[E0658]: non-builtin inner attributes are unstable - --> $DIR/issue-36530.rs:9:5 +error[E0658]: custom inner attributes are unstable + --> $DIR/issue-36530.rs:9:8 | LL | #![foo] - | ^^^^^^^ + | ^^^ | = note: see issue #54726 for more information = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.rs b/src/test/ui/span/issue-43927-non-ADT-derive.rs index 89b8eba1e95e..8f1599a5abcb 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.rs +++ b/src/test/ui/span/issue-43927-non-ADT-derive.rs @@ -5,9 +5,6 @@ //~| ERROR cannot determine resolution for the derive macro `Debug` //~| ERROR cannot determine resolution for the derive macro `PartialEq` //~| ERROR cannot determine resolution for the derive macro `Eq` -//~| ERROR cannot determine resolution for the derive macro `Debug` -//~| ERROR cannot determine resolution for the derive macro `PartialEq` -//~| ERROR cannot determine resolution for the derive macro `Eq` struct DerivedOn; fn main() {} diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.stderr b/src/test/ui/span/issue-43927-non-ADT-derive.stderr index b160a4e5877d..85beac535c96 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.stderr +++ b/src/test/ui/span/issue-43927-non-ADT-derive.stderr @@ -28,30 +28,6 @@ LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! | = note: import resolution is stuck, try simplifying macro imports -error: cannot determine resolution for the derive macro `Eq` - --> $DIR/issue-43927-non-ADT-derive.rs:3:29 - | -LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: cannot determine resolution for the derive macro `PartialEq` - --> $DIR/issue-43927-non-ADT-derive.rs:3:18 - | -LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: cannot determine resolution for the derive macro `Debug` - --> $DIR/issue-43927-non-ADT-derive.rs:3:11 - | -LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: aborting due to 7 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0774`.