1
Fork 0

Add a test

This commit is contained in:
Ben Kimock 2024-03-18 18:47:41 -04:00
parent 82717ab877
commit 2f6fb234de
7 changed files with 189 additions and 21 deletions

View file

@ -10,6 +10,7 @@ use rustc_hir::lang_items::LangItem;
use rustc_index::bit_set::FiniteBitSet;
use rustc_macros::HashStable;
use rustc_middle::ty::normalize_erasing_regions::NormalizationError;
use rustc_span::def_id::LOCAL_CRATE;
use rustc_span::Symbol;
use std::assert_matches::assert_matches;
@ -168,6 +169,11 @@ impl<'tcx> Instance<'tcx> {
// If this a non-generic instance, it cannot be a shared monomorphization.
self.args.non_erasable_generics(tcx, self.def_id()).next()?;
// compiler_builtins cannot use upstream monomorphizations.
if tcx.is_compiler_builtins(LOCAL_CRATE) {
return None;
}
match self.def {
InstanceDef::Item(def) => tcx
.upstream_monomorphizations_for(def)