diff options
| author | Ralf Jung <post@ralfj.de> | 2023-09-12 23:28:25 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-09-13 07:29:34 +0200 |
| commit | 6e4779ab1775d0901408c08d64dc12c735069701 (patch) | |
| tree | c9b26f901b489aa15840a10b12556ea3a7b87b7a /compiler/rustc_transmute/src/lib.rs | |
| parent | e5fedceabf4e0564231db592b6d1f35e1ca27908 (diff) | |
| download | rust-6e4779ab1775d0901408c08d64dc12c735069701.tar.gz rust-6e4779ab1775d0901408c08d64dc12c735069701.zip | |
make the eval() functions on our const types return the resulting value
Diffstat (limited to 'compiler/rustc_transmute/src/lib.rs')
| -rw-r--r-- | compiler/rustc_transmute/src/lib.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index af2ad547480..6c49e94dc31 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -129,19 +129,16 @@ mod rustc { c: Const<'tcx>, ) -> Option<Self> { use rustc_middle::ty::ScalarInt; - use rustc_middle::ty::TypeVisitableExt; use rustc_span::symbol::sym; - let c = c.eval(tcx, param_env); - - if let Err(err) = c.error_reported() { + let Ok(cv) = c.eval(tcx, param_env, None) else { return Some(Self { alignment: true, lifetimes: true, safety: true, validity: true, }); - } + }; let adt_def = c.ty().ty_adt_def()?; @@ -153,8 +150,8 @@ mod rustc { ); let variant = adt_def.non_enum_variant(); - let fields = match c.try_to_valtree() { - Some(ValTree::Branch(branch)) => branch, + let fields = match cv { + ValTree::Branch(branch) => branch, _ => { return Some(Self { alignment: true, |
