Fix ICE when negative impl is collected during eager mono

This commit is contained in:
Gary Guo 2022-11-04 03:08:28 +00:00
parent 215e3cd218
commit 1013ee8df5
2 changed files with 16 additions and 0 deletions

View File

@ -1336,6 +1336,10 @@ fn create_mono_items_for_default_impls<'tcx>(
) {
match item.kind {
hir::ItemKind::Impl(ref impl_) => {
if matches!(impl_.polarity, hir::ImplPolarity::Negative(_)) {
return;
}
for param in impl_.generics.params {
match param.kind {
hir::GenericParamKind::Lifetime { .. } => {}

View File

@ -0,0 +1,12 @@
// build-pass
// compile-flags:-C link-dead-code=y
#![feature(negative_impls)]
trait Foo {
fn foo() {}
}
impl !Foo for () {}
fn main() {}