Fix ICE
This commit is contained in:
parent
f7964aebe5
commit
3fa3fe01b6
8 changed files with 54 additions and 2 deletions
|
|
@ -570,6 +570,8 @@ define_dep_nodes!( <'tcx>
|
|||
[] MissingExternCrateItem(CrateNum),
|
||||
[] UsedCrateSource(CrateNum),
|
||||
[] PostorderCnums,
|
||||
[] HasCloneClosures(CrateNum),
|
||||
[] HasCopyClosures(CrateNum),
|
||||
|
||||
[] Freevars(DefId),
|
||||
[] MaybeUnusedTraitImport(DefId),
|
||||
|
|
|
|||
|
|
@ -2087,10 +2087,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
let trait_id = obligation.predicate.def_id();
|
||||
let copy_closures =
|
||||
Some(trait_id) == self.tcx().lang_items().copy_trait() &&
|
||||
self.tcx().sess.features.borrow().copy_closures;
|
||||
self.tcx().has_copy_closures(def_id.krate);
|
||||
let clone_closures =
|
||||
Some(trait_id) == self.tcx().lang_items().clone_trait() &&
|
||||
self.tcx().sess.features.borrow().clone_closures;
|
||||
self.tcx().has_clone_closures(def_id.krate);
|
||||
|
||||
if copy_closures || clone_closures {
|
||||
Where(ty::Binder(substs.upvar_tys(def_id, self.tcx()).collect()))
|
||||
|
|
|
|||
|
|
@ -2247,4 +2247,12 @@ pub fn provide(providers: &mut ty::maps::Providers) {
|
|||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.output_filenames.clone()
|
||||
};
|
||||
providers.has_copy_closures = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.sess.features.borrow().copy_closures
|
||||
};
|
||||
providers.has_clone_closures = |tcx, cnum| {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
tcx.sess.features.borrow().clone_closures
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,3 +490,15 @@ impl<'tcx> QueryDescription for queries::output_filenames<'tcx> {
|
|||
format!("output_filenames")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> QueryDescription for queries::has_clone_closures<'tcx> {
|
||||
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
|
||||
format!("seeing if the crate has enabled `Clone` closures")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> QueryDescription for queries::has_copy_closures<'tcx> {
|
||||
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
|
||||
format!("seeing if the crate has enabled `Copy` closures")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,6 +326,9 @@ define_maps! { <'tcx>
|
|||
[] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
|
||||
[] fn output_filenames: output_filenames_node(CrateNum)
|
||||
-> Arc<OutputFilenames>,
|
||||
|
||||
[] fn has_copy_closures: HasCopyClosures(CrateNum) -> bool,
|
||||
[] fn has_clone_closures: HasCloneClosures(CrateNum) -> bool,
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue