fix bugs with effects fallback

This commit is contained in:
Deadbeef 2023-09-12 01:07:04 +00:00
parent 04eec37dc2
commit 7b1b17574b
2 changed files with 10 additions and 8 deletions

View File

@ -815,12 +815,6 @@ fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Loc
mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck,
_ => 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);
}
mir::TerminatorKind::UnwindTerminate(reason) => {

View File

@ -20,7 +20,8 @@
use rustc_hir::{LangItem, LanguageItems, Target};
use rustc_middle::ty::TyCtxt;
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;
@ -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)
{
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),
};