diff options
| author | bors <bors@rust-lang.org> | 2024-09-21 16:20:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-21 16:20:10 +0000 |
| commit | 1d68e6dd1deef26c5aeb91aee554edbee8b6d5e2 (patch) | |
| tree | fabeeb3de79ab606a550c87f37a20ccc44d6adb8 /compiler | |
| parent | 28364822410af31bba5c8adac19cbbfcb9b48717 (diff) | |
| parent | cf78f26d5ed5ce32f49fb38cca969d3609599e27 (diff) | |
Auto merge of #127546 - workingjubilee:5-level-paging-exists, r=saethlin
Correct outdated object size limit The comment here about 48 bit addresses being enough was written in 2016 but was made incorrect in 2019 by 5-level paging, and then persisted for another 5 years before being noticed and corrected. The bolding of the "exclusive" part is merely to call attention to something I missed when reading it and doublechecking the math. try-job: i686-msvc try-job: test-various
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/messages.ftl | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir_typeck/src/intrinsicck.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/messages.ftl | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/layout.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs | 4 |
6 files changed, 10 insertions, 12 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 7bd2507d1ad..904c5933a18 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -337,23 +337,21 @@ impl TargetDataLayout { Ok(dl) } - /// Returns exclusive upper bound on object size. + /// Returns **exclusive** upper bound on object size in bytes. /// /// The theoretical maximum object size is defined as the maximum positive `isize` value. /// This ensures that the `offset` semantics remain well-defined by allowing it to correctly /// index every address within an object along with one byte past the end, along with allowing /// `isize` to store the difference between any two pointers into an object. /// - /// The upper bound on 64-bit currently needs to be lower because LLVM uses a 64-bit integer - /// to represent object size in bits. It would need to be 1 << 61 to account for this, but is - /// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable - /// address space on 64-bit ARMv8 and x86_64. + /// LLVM uses a 64-bit integer to represent object size in *bits*, but we care only for bytes, + /// so we adopt such a more-constrained size bound due to its technical limitations. #[inline] pub fn obj_size_bound(&self) -> u64 { match self.pointer_size.bits() { 16 => 1 << 15, 32 => 1 << 31, - 64 => 1 << 47, + 64 => 1 << 61, bits => panic!("obj_size_bound: unknown pointer bit size {bits}"), } } diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 633ccacedfc..0fe1e348498 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -478,7 +478,7 @@ hir_analysis_tait_forward_compat2 = item does not constrain `{$opaque_type}`, bu hir_analysis_target_feature_on_main = `main` function is not allowed to have `#[target_feature]` -hir_analysis_too_large_static = extern static is too large for the current architecture +hir_analysis_too_large_static = extern static is too large for the target architecture hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]` .suggestion = remove this annotation diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index f39d83a2a6f..81d940a3f9b 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -95,7 +95,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { format!("{v} bits") } else { // `u128` should definitely be able to hold the size of different architectures - // larger sizes should be reported as error `are too big for the current architecture` + // larger sizes should be reported as error `are too big for the target architecture` // otherwise we have a bug somewhere bug!("{:?} overflow for u128", size) } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 2b9d9a07a98..39485a324f2 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -103,5 +103,5 @@ middle_unknown_layout = the type `{$ty}` has an unknown layout middle_values_too_big = - values of the type `{$ty}` are too big for the current architecture + values of the type `{$ty}` are too big for the target architecture middle_written_to_path = the full type name has been written to '{$path}' diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 877c54c5649..9ed5dc87be4 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -264,7 +264,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { match *self { LayoutError::Unknown(ty) => write!(f, "the type `{ty}` has an unknown layout"), LayoutError::SizeOverflow(ty) => { - write!(f, "values of the type `{ty}` are too big for the current architecture") + write!(f, "values of the type `{ty}` are too big for the target architecture") } LayoutError::NormalizationFailure(t, e) => write!( f, diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 2de6ee9cf91..1f11ee3f939 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -2269,12 +2269,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } rustc_transmute::Reason::SrcSizeOverflow => { format!( - "values of the type `{src}` are too big for the current architecture" + "values of the type `{src}` are too big for the target architecture" ) } rustc_transmute::Reason::DstSizeOverflow => { format!( - "values of the type `{dst}` are too big for the current architecture" + "values of the type `{dst}` are too big for the target architecture" ) } rustc_transmute::Reason::DstHasStricterAlignment { |
