Fix ICE when negative impl is collected during eager mono
This commit is contained in:
parent
215e3cd218
commit
1013ee8df5
2 changed files with 16 additions and 0 deletions
|
@ -1336,6 +1336,10 @@ fn create_mono_items_for_default_impls<'tcx>(
|
||||||
) {
|
) {
|
||||||
match item.kind {
|
match item.kind {
|
||||||
hir::ItemKind::Impl(ref impl_) => {
|
hir::ItemKind::Impl(ref impl_) => {
|
||||||
|
if matches!(impl_.polarity, hir::ImplPolarity::Negative(_)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for param in impl_.generics.params {
|
for param in impl_.generics.params {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
hir::GenericParamKind::Lifetime { .. } => {}
|
hir::GenericParamKind::Lifetime { .. } => {}
|
||||||
|
|
12
src/test/ui/traits/negative-impls/eager-mono.rs
Normal file
12
src/test/ui/traits/negative-impls/eager-mono.rs
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue