Skip to content

Commit

Permalink
Update exhaustive match in autotrait coherence check
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 22, 2023
1 parent 888ca93 commit fa84c6f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions compiler/rustc_hir_analysis/src/coherence/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,13 @@ fn do_orphan_check_impl<'tcx>(
NonlocalImpl::DisallowOther,
),

// Some of these should perhaps be a delay_span_bug.
// type Opaque = impl Trait;
// impl AutoTrait for Opaque {}
ty::Alias(AliasKind::Opaque, _) => (
LocalImpl::Disallow { problematic_kind: "opaque type" },
NonlocalImpl::DisallowOther,
),

ty::Bool
| ty::Char
| ty::Int(..)
Expand All @@ -220,16 +226,17 @@ fn do_orphan_check_impl<'tcx>(
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(..)
| ty::Closure(..)
| ty::Never
| ty::Tuple(..) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),

ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(..)
| ty::Alias(AliasKind::Opaque, ..)
| ty::Bound(..)
| ty::Placeholder(..)
| ty::Infer(..)
| ty::Error(..) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
| ty::Infer(..) => span_bug!(sp, "weird self type for autotrait impl"),

ty::Error(..) => (LocalImpl::Allow, NonlocalImpl::Allow),
};

if trait_def_id.is_local() {
Expand Down

0 comments on commit fa84c6f

Please sign in to comment.