Skip to content

Commit

Permalink
Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelix
Browse files Browse the repository at this point in the history
Add a scheme for moving away from `extern "rust-intrinsic"` entirely

All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic.

This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic.

cc rust-lang/rust#63585

follow-up to #120500

MCP at rust-lang/compiler-team#720
  • Loading branch information
bors committed Mar 5, 2024
2 parents b74b4b0 + ea92548 commit 415b1f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_utils/src/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ fn check_terminator<'tcx>(
// within const fns. `transmute` is allowed in all other const contexts.
// This won't really scale to more intrinsics or functions. Let's allow const
// transmutes in const fn before we add more hacks to this.
if matches!(tcx.intrinsic(fn_def_id), Some(sym::transmute)) {
if tcx.is_intrinsic(fn_def_id, sym::transmute) {
return Err((
span,
"can only call `transmute` from const items, not `const fn`".into(),
Expand Down

0 comments on commit 415b1f1

Please sign in to comment.