diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-09-12 03:44:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-12 03:44:56 -0700 |
| commit | f5ac5cadd3d426cbf9a67dfe1c21a7d404cd2423 (patch) | |
| tree | 6309929aa2d74a733e154b06a113e0336801f450 /compiler/rustc_metadata/src/rmeta/decoder.rs | |
| parent | a8e3afe3720cc4772aa49e1f7f494c60b81f07a1 (diff) | |
| parent | 8295e4a6cfb12ce74c480172c2854f76d1428b8b (diff) | |
| download | rust-f5ac5cadd3d426cbf9a67dfe1c21a7d404cd2423.tar.gz rust-f5ac5cadd3d426cbf9a67dfe1c21a7d404cd2423.zip | |
Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr
generic_const_exprs: use thir for abstract consts instead of mir Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test) r? `@lcnr`
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta/decoder.rs')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index cc4b7d08f45..2a0332a1124 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -26,6 +26,7 @@ use rustc_middle::middle::cstore::{ForeignModule, LinkagePreference, NativeLib}; use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel}; use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState}; use rustc_middle::mir::{self, Body, Promoted}; +use rustc_middle::thir; use rustc_middle::ty::codec::TyDecoder; use rustc_middle::ty::{self, Ty, TyCtxt, Visibility}; use rustc_serialize::{opaque, Decodable, Decoder}; @@ -541,7 +542,7 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span { } } -impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] { +impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] { fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String> { ty::codec::RefDecodable::decode(d) } @@ -1196,14 +1197,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { .decode((self, tcx)) } - fn get_mir_abstract_const( + fn get_thir_abstract_const( &self, tcx: TyCtxt<'tcx>, id: DefIndex, - ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> { + ) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> { self.root .tables - .mir_abstract_consts + .thir_abstract_consts .get(self, id) .map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx))))) } |
