diff options
| author | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-12 13:00:16 +0000 |
|---|---|---|
| committer | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-12 13:00:16 +0000 |
| commit | c51749af6e8b42540f0493c7be47df332686d64a (patch) | |
| tree | 95420b9e92fdd49b10f246a77e7b37dde85d3e82 /compiler/rustc_mir/src/const_eval | |
| parent | 6ca1d871948cc8fb9831f7f4d2e898bbef557e93 (diff) | |
We won't support trait object constants in type level constants for the forseeable future
Diffstat (limited to 'compiler/rustc_mir/src/const_eval')
| -rw-r--r-- | compiler/rustc_mir/src/const_eval/mod.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_mir/src/const_eval/mod.rs b/compiler/rustc_mir/src/const_eval/mod.rs index 5e77cc9daf3..ca165f2c8cb 100644 --- a/compiler/rustc_mir/src/const_eval/mod.rs +++ b/compiler/rustc_mir/src/const_eval/mod.rs @@ -87,9 +87,11 @@ fn const_to_valtree_inner<'tcx>( ty::FnPtr(_) | ty::RawPtr(_) => None, ty::Ref(..) => unimplemented!("need to use deref_const"), - ty::Dynamic(..) => unimplemented!( - "for trait objects we must look at the vtable and figure out the real type" - ), + // Trait objects are not allowed in type level constants, as we have no concept for + // resolving their backing type, even if we can do that at const eval time. We may want to consider + // adding a `ValTree::DownCast(Ty<'tcx>, Box<ValTree>)` in the future, but I don't even know the + // questions such a concept would open up, so an RFC would probably be good for this. + ty::Dynamic(..) => None, ty::Slice(_) | ty::Str => { unimplemented!("need to find the backing data of the slice/str and recurse on that") |
