about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-29 06:16:56 +0000
committerbors <bors@rust-lang.org>2024-03-29 06:16:56 +0000
commiteae940fcef7f95d31b566f92f511f91f24f2f703 (patch)
treea5635c4d1821e9114fe7cc27d00353f98cac5402 /compiler/rustc_span/src
parent58a771ebfa2e59f48cb50229049487c6550b2f7b (diff)
parented29546a27db9fa024c6f99a7dd001e86d75e14f (diff)
downloadrust-eae940fcef7f95d31b566f92f511f91f24f2f703.tar.gz
rust-eae940fcef7f95d31b566f92f511f91f24f2f703.zip
Auto merge of #3427 - rust-lang:rustup-2024-03-29, r=saethlin
Automatic Rustup
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/def_id.rs24
-rw-r--r--compiler/rustc_span/src/lib.rs11
-rw-r--r--compiler/rustc_span/src/symbol.rs20
3 files changed, 37 insertions, 18 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 0c811d7dff1..8f721bac951 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -218,8 +218,6 @@ rustc_index::newtype_index! {
 ///
 /// You can create a `DefId` from a `LocalDefId` using `local_def_id.to_def_id()`.
 #[derive(Clone, PartialEq, Eq, Copy)]
-// Don't derive order on 64-bit big-endian, so we can be consistent regardless of field order.
-#[cfg_attr(not(all(target_pointer_width = "64", target_endian = "big")), derive(PartialOrd, Ord))]
 // On below-64 bit systems we can simply use the derived `Hash` impl
 #[cfg_attr(not(target_pointer_width = "64"), derive(Hash))]
 #[repr(C)]
@@ -236,6 +234,12 @@ pub struct DefId {
     pub index: DefIndex,
 }
 
+// To ensure correctness of incremental compilation,
+// `DefId` must not implement `Ord` or `PartialOrd`.
+// See https://github.com/rust-lang/rust/issues/90317.
+impl !Ord for DefId {}
+impl !PartialOrd for DefId {}
+
 // On 64-bit systems, we can hash the whole `DefId` as one `u64` instead of two `u32`s. This
 // improves performance without impairing `FxHash` quality. So the below code gets compiled to a
 // noop on little endian systems because the memory layout of `DefId` is as follows:
@@ -261,22 +265,6 @@ impl Hash for DefId {
     }
 }
 
-// Implement the same comparison as derived with the other field order.
-#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
-impl Ord for DefId {
-    #[inline]
-    fn cmp(&self, other: &DefId) -> std::cmp::Ordering {
-        Ord::cmp(&(self.index, self.krate), &(other.index, other.krate))
-    }
-}
-#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
-impl PartialOrd for DefId {
-    #[inline]
-    fn partial_cmp(&self, other: &DefId) -> Option<std::cmp::Ordering> {
-        Some(self.cmp(other))
-    }
-}
-
 impl DefId {
     /// Makes a local `DefId` from the given `DefIndex`.
     #[inline]
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 616a7ccc7c6..0c974ef4ca3 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -427,6 +427,17 @@ impl FileName {
         src.hash(&mut hasher);
         FileName::InlineAsm(hasher.finish())
     }
+
+    /// Returns the path suitable for reading from the file system on the local host,
+    /// if this information exists.
+    /// Avoid embedding this in build artifacts; see `remapped_path_if_available()` for that.
+    pub fn into_local_path(self) -> Option<PathBuf> {
+        match self {
+            FileName::Real(path) => path.into_local_path(),
+            FileName::DocTest(path, _) => Some(path),
+            _ => None,
+        }
+    }
 }
 
 /// Represents a span.
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 73fcd2a76df..1da0b80a610 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -674,6 +674,7 @@ symbols! {
         deref_mut,
         deref_mut_method,
         deref_patterns,
+        deref_pure,
         deref_target,
         derive,
         derive_const,
@@ -1296,6 +1297,24 @@ symbols! {
         panic_abort,
         panic_bounds_check,
         panic_cannot_unwind,
+        panic_const_add_overflow,
+        panic_const_async_fn_resumed,
+        panic_const_async_fn_resumed_panic,
+        panic_const_async_gen_fn_resumed,
+        panic_const_async_gen_fn_resumed_panic,
+        panic_const_coroutine_resumed,
+        panic_const_coroutine_resumed_panic,
+        panic_const_div_by_zero,
+        panic_const_div_overflow,
+        panic_const_gen_fn_none,
+        panic_const_gen_fn_none_panic,
+        panic_const_mul_overflow,
+        panic_const_neg_overflow,
+        panic_const_rem_by_zero,
+        panic_const_rem_overflow,
+        panic_const_shl_overflow,
+        panic_const_shr_overflow,
+        panic_const_sub_overflow,
         panic_fmt,
         panic_handler,
         panic_impl,
@@ -1571,6 +1590,7 @@ symbols! {
         rustc_peek_maybe_init,
         rustc_peek_maybe_uninit,
         rustc_polymorphize_error,
+        rustc_preserve_ub_checks,
         rustc_private,
         rustc_proc_macro_decls,
         rustc_promotable,