summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-03-08 15:39:52 +0100
committerlcnr <rust@lcnr.de>2022-03-08 15:39:52 +0100
commitb8135fd5c8e51a0578cff82096cbbf7e5d57fdeb (patch)
tree424db470532660fc53ca3239561ad29f137e5fd9 /compiler/rustc_span/src
parent67b3e8183830c7af4e06a9aa91de4d1be3c860f7 (diff)
downloadrust-b8135fd5c8e51a0578cff82096cbbf7e5d57fdeb.tar.gz
rust-b8135fd5c8e51a0578cff82096cbbf7e5d57fdeb.zip
add `#[rustc_pass_by_value]` to more types
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/def_id.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 56da7c43728..6d1b36796d8 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -27,8 +27,8 @@ impl CrateNum {
     }
 
     #[inline]
-    pub fn as_def_id(&self) -> DefId {
-        DefId { krate: *self, index: CRATE_DEF_INDEX }
+    pub fn as_def_id(self) -> DefId {
+        DefId { krate: self, index: CRATE_DEF_INDEX }
     }
 }
 
@@ -222,6 +222,7 @@ impl<D: Decoder> Decodable<D> for DefIndex {
 // On below-64 bit systems we can simply use the derived `Hash` impl
 #[cfg_attr(not(target_pointer_width = "64"), derive(Hash))]
 #[repr(C)]
+#[rustc_pass_by_value]
 // We guarantee field order. Note that the order is essential here, see below why.
 pub struct DefId {
     // cfg-ing the order of fields so that the `DefIndex` which is high entropy always ends up in