Make is_intrinsic
query return the intrinsic name
This commit is contained in:
parent
036d00bff6
commit
d55fdb25ce
@ -335,7 +335,7 @@ fn check_terminator<'tcx>(
|
|||||||
// within const fns. `transmute` is allowed in all other const contexts.
|
// 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
|
// 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.
|
// transmutes in const fn before we add more hacks to this.
|
||||||
if tcx.is_intrinsic(fn_def_id) && tcx.item_name(fn_def_id) == sym::transmute {
|
if matches!(tcx.intrinsic(fn_def_id), Some(sym::transmute)) {
|
||||||
return Err((
|
return Err((
|
||||||
span,
|
span,
|
||||||
"can only call `transmute` from const items, not `const fn`".into(),
|
"can only call `transmute` from const items, not `const fn`".into(),
|
||||||
|
Loading…
Reference in New Issue
Block a user