diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-04-26 13:09:04 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-04-26 13:09:04 +0000 |
| commit | e4f8b93454ace7a9c652a51c394d022bb4fc2b9e (patch) | |
| tree | d5a4f0b6f7c3d8974499d0fecaaddff20f7e1648 | |
| parent | 4a19711b25f13a8cb1e2b7e5d35a395e162765d6 (diff) | |
| download | rust-e4f8b93454ace7a9c652a51c394d022bb4fc2b9e.tar.gz rust-e4f8b93454ace7a9c652a51c394d022bb4fc2b9e.zip | |
`Span`s are already 64 bit, just like references, so stop putting them behind indirections
| -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, } } |
