Skip to content

Commit 6912b2d

Browse files
committed
Directly check if input_ty is a type parameter and therefore a
uncoverd type
1 parent eee09d5 commit 6912b2d

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
@@ -360,7 +360,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
360360
if ty_is_local(tcx, input_ty, in_crate) {
361361
debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
362362
return Ok(());
363-
} else if is_uncovered_ty(input_ty) {
363+
} else if let ty::Param(_) = input_ty.sty {
364364
debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty);
365365
return Err(OrphanCheckErr::UncoveredTy(input_ty))
366366
}
@@ -408,46 +408,6 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
408408
}
409409
}
410410

411-
fn is_uncovered_ty(ty: Ty<'_>) -> bool {
412-
match ty.sty {
413-
ty::Bool |
414-
ty::Char |
415-
ty::Int(..) |
416-
ty::Uint(..) |
417-
ty::Float(..) |
418-
ty::Str |
419-
ty::FnDef(..) |
420-
ty::FnPtr(_) |
421-
ty::Array(..) |
422-
ty::Slice(..) |
423-
ty::RawPtr(..) |
424-
ty::Ref(..) |
425-
ty::Never |
426-
ty::Tuple(..) |
427-
ty::Bound(..) |
428-
ty::Infer(..) |
429-
ty::Adt(..) |
430-
ty::Foreign(..) |
431-
ty::Dynamic(..) |
432-
ty::Error |
433-
ty::Projection(..) => {
434-
false
435-
}
436-
437-
ty::Param(..) => {
438-
true
439-
}
440-
441-
ty::UnnormalizedProjection(..) |
442-
ty::Closure(..) |
443-
ty::Generator(..) |
444-
ty::GeneratorWitness(..) |
445-
ty::Opaque(..) => {
446-
bug!("is_uncovered_ty invoked on unexpected type: {:?}", ty)
447-
}
448-
}
449-
}
450-
451411
fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
452412
-> Vec<Ty<'tcx>> {
453413
if ty_is_local_constructor(ty, in_crate) {

0 commit comments

Comments
 (0)