Skip to content

Commit 07f144e

Browse files
committed
Improve the ICE message for invalid nullary intrinsic calls
1 parent 79966ae commit 07f144e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-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
}

0 commit comments

Comments
 (0)