entirely get rid of NeedsRfc CTFE errors
This commit is contained in:
parent
a9f9145b09
commit
f29c3c421b
3 changed files with 8 additions and 15 deletions
|
@ -15,7 +15,6 @@ use crate::interpret::{
|
||||||
/// The CTFE machine has some custom error kinds.
|
/// The CTFE machine has some custom error kinds.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum ConstEvalErrKind {
|
pub enum ConstEvalErrKind {
|
||||||
NeedsRfc(String),
|
|
||||||
ConstAccessesStatic,
|
ConstAccessesStatic,
|
||||||
ModifiedGlobal,
|
ModifiedGlobal,
|
||||||
AssertFailure(AssertKind<ConstInt>),
|
AssertFailure(AssertKind<ConstInt>),
|
||||||
|
@ -42,9 +41,6 @@ impl fmt::Display for ConstEvalErrKind {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
use self::ConstEvalErrKind::*;
|
use self::ConstEvalErrKind::*;
|
||||||
match *self {
|
match *self {
|
||||||
NeedsRfc(ref msg) => {
|
|
||||||
write!(f, "\"{}\" needs an rfc before being allowed inside constants", msg)
|
|
||||||
}
|
|
||||||
ConstAccessesStatic => write!(f, "constant accesses static"),
|
ConstAccessesStatic => write!(f, "constant accesses static"),
|
||||||
ModifiedGlobal => {
|
ModifiedGlobal => {
|
||||||
write!(f, "modifying a static's initial value from another static's initializer")
|
write!(f, "modifying a static's initial value from another static's initializer")
|
||||||
|
|
|
@ -340,11 +340,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||||
|
|
||||||
// CTFE-specific intrinsics.
|
// CTFE-specific intrinsics.
|
||||||
let Some(ret) = target else {
|
let Some(ret) = target else {
|
||||||
return Err(ConstEvalErrKind::NeedsRfc(format!(
|
throw_unsup_format!("intrinsic `{intrinsic_name}` is not supported at compile-time");
|
||||||
"calling intrinsic `{}`",
|
|
||||||
intrinsic_name
|
|
||||||
))
|
|
||||||
.into());
|
|
||||||
};
|
};
|
||||||
match intrinsic_name {
|
match intrinsic_name {
|
||||||
sym::ptr_guaranteed_eq | sym::ptr_guaranteed_ne => {
|
sym::ptr_guaranteed_eq | sym::ptr_guaranteed_ne => {
|
||||||
|
@ -401,11 +397,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(ConstEvalErrKind::NeedsRfc(format!(
|
throw_unsup_format!(
|
||||||
"calling intrinsic `{}`",
|
"intrinsic `{intrinsic_name}` is not supported at compile-time"
|
||||||
intrinsic_name
|
);
|
||||||
))
|
|
||||||
.into());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +442,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||||
_left: &ImmTy<'tcx>,
|
_left: &ImmTy<'tcx>,
|
||||||
_right: &ImmTy<'tcx>,
|
_right: &ImmTy<'tcx>,
|
||||||
) -> InterpResult<'tcx, (Scalar, bool, Ty<'tcx>)> {
|
) -> InterpResult<'tcx, (Scalar, bool, Ty<'tcx>)> {
|
||||||
Err(ConstEvalErrKind::NeedsRfc("pointer arithmetic or comparison".to_string()).into())
|
throw_unsup_format!("pointer arithmetic or comparison is not supported at compile-time");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_terminator(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
fn before_terminator(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||||
|
|
|
@ -19,4 +19,7 @@ static PTR_INT_TRANSMUTE: () = unsafe {
|
||||||
//~| unable to turn pointer into raw bytes
|
//~| unable to turn pointer into raw bytes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// I'd love to test pointer comparison, but that is not possible since
|
||||||
|
// their `PartialEq` impl is non-`const`.
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue