fix bugs with effects fallback
This commit is contained in:
parent
04eec37dc2
commit
7b1b17574b
@ -815,12 +815,6 @@ fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Loc
|
|||||||
mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck,
|
mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck,
|
||||||
_ => LangItem::Panic,
|
_ => LangItem::Panic,
|
||||||
};
|
};
|
||||||
let def_id = tcx.require_lang_item(lang_item, Some(source));
|
|
||||||
let instance = if has_host_effect {
|
|
||||||
Instance::new(def_id, tcx.mk_args(&[tcx.consts.true_.into()]))
|
|
||||||
} else {
|
|
||||||
Instance::mono(tcx, def_id)
|
|
||||||
};
|
|
||||||
push_mono_lang_item(self, lang_item);
|
push_mono_lang_item(self, lang_item);
|
||||||
}
|
}
|
||||||
mir::TerminatorKind::UnwindTerminate(reason) => {
|
mir::TerminatorKind::UnwindTerminate(reason) => {
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
use rustc_hir::{LangItem, LanguageItems, Target};
|
use rustc_hir::{LangItem, LanguageItems, Target};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::cstore::ExternCrate;
|
use rustc_session::cstore::ExternCrate;
|
||||||
use rustc_span::{symbol::kw::Empty, Span};
|
use rustc_span::symbol::kw::Empty;
|
||||||
|
use rustc_span::{sym, Span};
|
||||||
|
|
||||||
use rustc_middle::query::Providers;
|
use rustc_middle::query::Providers;
|
||||||
|
|
||||||
@ -157,7 +158,14 @@ fn collect_item_extended(&mut self, lang_item: LangItem, item_def_id: LocalDefId
|
|||||||
self.tcx.hir().get_by_def_id(item_def_id)
|
self.tcx.hir().get_by_def_id(item_def_id)
|
||||||
{
|
{
|
||||||
let (actual_num, generics_span) = match kind.generics() {
|
let (actual_num, generics_span) = match kind.generics() {
|
||||||
Some(generics) => (generics.params.len(), generics.span),
|
Some(generics) => (
|
||||||
|
generics
|
||||||
|
.params
|
||||||
|
.iter()
|
||||||
|
.filter(|p| !self.tcx.has_attr(p.def_id, sym::rustc_host))
|
||||||
|
.count(),
|
||||||
|
generics.span,
|
||||||
|
),
|
||||||
None => (0, *item_span),
|
None => (0, *item_span),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user