Rollup merge of #102137 - b-naber:lazy-const-val-conversion, r=lcnr
Don't convert valtree to constvalue during normalization r? ``@lcnr``
This commit is contained in:
commit
3a8bad98d7
3 changed files with 7 additions and 54 deletions
|
@ -351,25 +351,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
constant: mir::ConstantKind<'tcx>,
|
constant: mir::ConstantKind<'tcx>,
|
||||||
) -> Result<mir::ConstantKind<'tcx>, Self::Error> {
|
) -> Result<mir::ConstantKind<'tcx>, Self::Error> {
|
||||||
Ok(match constant {
|
constant.try_super_fold_with(self)
|
||||||
mir::ConstantKind::Ty(c) => {
|
|
||||||
let const_folded = c.try_super_fold_with(self)?;
|
|
||||||
match const_folded.kind() {
|
|
||||||
ty::ConstKind::Value(valtree) => {
|
|
||||||
let tcx = self.infcx.tcx;
|
|
||||||
let ty = const_folded.ty();
|
|
||||||
let const_val = tcx.valtree_to_const_val((ty, valtree));
|
|
||||||
debug!(?ty, ?valtree, ?const_val);
|
|
||||||
|
|
||||||
mir::ConstantKind::Val(const_val, ty)
|
|
||||||
}
|
|
||||||
_ => mir::ConstantKind::Ty(const_folded),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mir::ConstantKind::Val(_, _) | mir::ConstantKind::Unevaluated(..) => {
|
|
||||||
constant.try_super_fold_with(self)?
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -24,10 +24,6 @@ mod assert {
|
||||||
Src,
|
Src,
|
||||||
Context,
|
Context,
|
||||||
{ from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
{ from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
||||||
//~^ ERROR E0080
|
|
||||||
//~| ERROR E0080
|
|
||||||
//~| ERROR E0080
|
|
||||||
//~| ERROR E0080
|
|
||||||
>,
|
>,
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -1,52 +1,27 @@
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/wrong-type-assume.rs:53:51
|
--> $DIR/wrong-type-assume.rs:49:51
|
||||||
|
|
|
|
||||||
LL | assert::is_transmutable::<Src, Dst, Context, {0u8}, false, false, false>();
|
LL | assert::is_transmutable::<Src, Dst, Context, {0u8}, false, false, false>();
|
||||||
| ^^^ expected `bool`, found `u8`
|
| ^^^ expected `bool`, found `u8`
|
||||||
|
|
||||||
error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, {0u8}, false, false, false>::{constant#0}` failed
|
|
||||||
--> $DIR/wrong-type-assume.rs:26:15
|
|
||||||
|
|
|
||||||
LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/wrong-type-assume.rs:54:58
|
--> $DIR/wrong-type-assume.rs:50:58
|
||||||
|
|
|
|
||||||
LL | assert::is_transmutable::<Src, Dst, Context, false, {0u8}, false, false>();
|
LL | assert::is_transmutable::<Src, Dst, Context, false, {0u8}, false, false>();
|
||||||
| ^^^ expected `bool`, found `u8`
|
| ^^^ expected `bool`, found `u8`
|
||||||
|
|
||||||
error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, {0u8}, false, false>::{constant#0}` failed
|
|
||||||
--> $DIR/wrong-type-assume.rs:26:15
|
|
||||||
|
|
|
||||||
LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/wrong-type-assume.rs:55:65
|
--> $DIR/wrong-type-assume.rs:51:65
|
||||||
|
|
|
|
||||||
LL | assert::is_transmutable::<Src, Dst, Context, false, false, {0u8}, false>();
|
LL | assert::is_transmutable::<Src, Dst, Context, false, false, {0u8}, false>();
|
||||||
| ^^^ expected `bool`, found `u8`
|
| ^^^ expected `bool`, found `u8`
|
||||||
|
|
||||||
error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, false, {0u8}, false>::{constant#0}` failed
|
|
||||||
--> $DIR/wrong-type-assume.rs:26:15
|
|
||||||
|
|
|
||||||
LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/wrong-type-assume.rs:56:72
|
--> $DIR/wrong-type-assume.rs:52:72
|
||||||
|
|
|
|
||||||
LL | assert::is_transmutable::<Src, Dst, Context, false, false, false, {0u8}>();
|
LL | assert::is_transmutable::<Src, Dst, Context, false, false, false, {0u8}>();
|
||||||
| ^^^ expected `bool`, found `u8`
|
| ^^^ expected `bool`, found `u8`
|
||||||
|
|
||||||
error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, false, false, {0u8}>::{constant#0}` failed
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/wrong-type-assume.rs:26:15
|
|
||||||
|
|
|
||||||
LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
For more information about this error, try `rustc --explain E0308`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0080, E0308.
|
|
||||||
For more information about an error, try `rustc --explain E0080`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue