Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
emit errors during AbstractConst building
There changes are currently still untested, so I don't expect this to pass CI 😆
It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.
r? @oli-obk
This commit is contained in:
commit
98e5ee7df0
10 changed files with 160 additions and 92 deletions
|
@ -11,6 +11,7 @@ use rustc_data_structures::fingerprint::{Fingerprint, FingerprintDecoder};
|
|||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{AtomicCell, Lock, LockGuard, Lrc, OnceCell};
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive};
|
||||
use rustc_hir as hir;
|
||||
|
@ -1201,13 +1202,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
&self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
id: DefIndex,
|
||||
) -> Option<&'tcx [mir::abstract_const::Node<'tcx>]> {
|
||||
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
|
||||
self.root
|
||||
.tables
|
||||
.mir_abstract_consts
|
||||
.get(self, id)
|
||||
.filter(|_| !self.is_proc_macro(id))
|
||||
.map_or(None, |v| Some(v.decode((self, tcx))))
|
||||
.map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx)))))
|
||||
}
|
||||
|
||||
fn get_unused_generic_params(&self, id: DefIndex) -> FiniteBitSet<u32> {
|
||||
|
|
|
@ -1117,7 +1117,7 @@ impl EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
let abstract_const = self.tcx.mir_abstract_const(def_id);
|
||||
if let Some(abstract_const) = abstract_const {
|
||||
if let Ok(Some(abstract_const)) = abstract_const {
|
||||
record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue