diff options
| -rw-r--r-- | compiler/rustc_ast_lowering/src/index.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 2 |
3 files changed, 6 insertions, 10 deletions
diff --git a/compiler/rustc_ast_lowering/src/index.rs b/compiler/rustc_ast_lowering/src/index.rs index a3031d71340..f0bc1e22622 100644 --- a/compiler/rustc_ast_lowering/src/index.rs +++ b/compiler/rustc_ast_lowering/src/index.rs @@ -61,7 +61,7 @@ pub(super) fn index_hir<'hir>( if let Node::Err(span) = node.node { let hir_id = HirId { owner: item.def_id(), local_id }; let msg = format!("ID {hir_id} not encountered when visiting item HIR"); - tcx.dcx().span_delayed_bug(*span, msg); + tcx.dcx().span_delayed_bug(span, msg); } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 62d7e287e62..766a2374f6c 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -3442,15 +3442,13 @@ impl<'hir> OwnerNode<'hir> { } } - // Span by reference to pass to `Node::Err`. - #[allow(rustc::pass_by_value)] - pub fn span(&self) -> &'hir Span { + pub fn span(&self) -> Span { match self { OwnerNode::Item(Item { span, .. }) | OwnerNode::ForeignItem(ForeignItem { span, .. }) | OwnerNode::ImplItem(ImplItem { span, .. }) - | OwnerNode::TraitItem(TraitItem { span, .. }) => span, - OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => inner_span, + | OwnerNode::TraitItem(TraitItem { span, .. }) => *span, + OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => *inner_span, OwnerNode::Synthetic => unreachable!(), } } @@ -3595,9 +3593,7 @@ pub enum Node<'hir> { PreciseCapturingNonLifetimeArg(&'hir PreciseCapturingNonLifetimeArg), // Created by query feeding Synthetic, - // Span by reference to minimize `Node`'s size - #[allow(rustc::pass_by_value)] - Err(&'hir Span), + Err(Span), } impl<'hir> Node<'hir> { diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index c0c773c6285..c8be8b45046 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -912,7 +912,7 @@ impl<'hir> Map<'hir> { Node::ArrayLenInfer(inf) => inf.span, Node::PreciseCapturingNonLifetimeArg(param) => param.ident.span, Node::Synthetic => unreachable!(), - Node::Err(span) => *span, + Node::Err(span) => span, } } |
