Skip to content

Commit 58b4453

Browse files
committed
Auto merge of rust-lang#148136 - Zalathar:rollup-73hkwv8, r=Zalathar
Rollup of 2 pull requests Successful merges: - rust-lang#148118 (Improve the ICE message for invalid nullary intrinsic calls) - rust-lang#148134 (Add myself as a windows-msvc maintainer) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a8664a1 + cdacfb8 commit 58b4453

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
120120
| sym::atomic_singlethreadfence
121121
| sym::caller_location => {}
122122
_ => {
123-
span_bug!(span, "nullary intrinsic {name} must either be in a const block or explicitly opted out because it is inherently a runtime intrinsic
124-
");
123+
span_bug!(
124+
span,
125+
"Nullary intrinsic {name} must be called in a const block. \
126+
If you are seeing this message from code outside the standard library, the \
127+
unstable implementation details of the relevant intrinsic may have changed. \
128+
Consider using stable APIs instead. \
129+
If you are adding a new nullary intrinsic that is inherently a runtime \
130+
intrinsic, update this check."
131+
);
125132
}
126133
}
127134
}

library/core/src/intrinsics/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,6 +2728,11 @@ pub unsafe fn vtable_align(ptr: *const ()) -> usize;
27282728
/// More specifically, this is the offset in bytes between successive
27292729
/// items of the same type, including alignment padding.
27302730
///
2731+
/// Note that, unlike most intrinsics, this can only be called at compile-time
2732+
/// as backends do not have an implementation for it. The only caller (its
2733+
/// stable counterpart) wraps this intrinsic call in a `const` block so that
2734+
/// backends only see an evaluated constant.
2735+
///
27312736
/// The stabilized version of this intrinsic is [`core::mem::size_of`].
27322737
#[rustc_nounwind]
27332738
#[unstable(feature = "core_intrinsics", issue = "none")]
@@ -2742,6 +2747,11 @@ pub const fn size_of<T>() -> usize;
27422747
/// Therefore, implementations must not require the user to uphold
27432748
/// any safety invariants.
27442749
///
2750+
/// Note that, unlike most intrinsics, this can only be called at compile-time
2751+
/// as backends do not have an implementation for it. The only caller (its
2752+
/// stable counterpart) wraps this intrinsic call in a `const` block so that
2753+
/// backends only see an evaluated constant.
2754+
///
27452755
/// The stabilized version of this intrinsic is [`core::mem::align_of`].
27462756
#[rustc_nounwind]
27472757
#[unstable(feature = "core_intrinsics", issue = "none")]

src/doc/rustc/src/platform-support/windows-msvc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Windows MSVC targets.
1212

1313
[@ChrisDenton](https://github.com/ChrisDenton)
1414
[@dpaoliello](https://github.com/dpaoliello)
15+
[@Fulgen301](https://github.com/Fulgen301)
1516
[@lambdageek](https://github.com/lambdageek)
1617
[@sivadeilra](https://github.com/sivadeilra)
1718
[@wesleywiser](https://github.com/wesleywiser)

0 commit comments

Comments
 (0)