Skip to content

Commit a31dd0a

Browse files
committed
Directly check if input_ty is a type parameter and therefore a
uncoverd type
1 parent 854ac40 commit a31dd0a

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

src/librustc/traits/coherence.rs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
387387
if ty_is_local(tcx, input_ty, in_crate) {
388388
debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
389389
return Ok(());
390-
} else if is_uncovered_ty(input_ty) {
390+
} else if let ty::Param(_) = input_ty.sty {
391391
debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty);
392392
return Err(OrphanCheckErr::UncoveredTy(input_ty))
393393
}
@@ -435,46 +435,6 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
435435
}
436436
}
437437

438-
fn is_uncovered_ty(ty: Ty<'_>) -> bool {
439-
match ty.sty {
440-
ty::Bool |
441-
ty::Char |
442-
ty::Int(..) |
443-
ty::Uint(..) |
444-
ty::Float(..) |
445-
ty::Str |
446-
ty::FnDef(..) |
447-
ty::FnPtr(_) |
448-
ty::Array(..) |
449-
ty::Slice(..) |
450-
ty::RawPtr(..) |
451-
ty::Ref(..) |
452-
ty::Never |
453-
ty::Tuple(..) |
454-
ty::Bound(..) |
455-
ty::Infer(..) |
456-
ty::Adt(..) |
457-
ty::Foreign(..) |
458-
ty::Dynamic(..) |
459-
ty::Error |
460-
ty::Projection(..) => {
461-
false
462-
}
463-
464-
ty::Param(..) => {
465-
true
466-
}
467-
468-
ty::UnnormalizedProjection(..) |
469-
ty::Closure(..) |
470-
ty::Generator(..) |
471-
ty::GeneratorWitness(..) |
472-
ty::Opaque(..) => {
473-
bug!("is_uncovered_ty invoked on unexpected type: {:?}", ty)
474-
}
475-
}
476-
}
477-
478438
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
479439
-> Vec<Ty<'tcx>> {
480440
if ty_is_local_constructor(ty, in_crate) {

0 commit comments

Comments
 (0)