Skip to content

Commit cbb2cf8

Browse files
committed
Handle matches added by rebase
1 parent 57493e5 commit cbb2cf8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
618618

619619
/// Computes cost for the given source.
620620
///
621-
/// Sources with a small cost are prefer and should result
621+
/// Sources with a small cost are preferred and should result
622622
/// in a clearer and idiomatic suggestion.
623623
fn source_cost(&self, source: &InferSource<'tcx>) -> usize {
624624
#[derive(Clone, Copy)]
@@ -631,6 +631,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
631631
GenericArgKind::Lifetime(_) => 0, // erased
632632
GenericArgKind::Type(ty) => self.ty_cost(ty),
633633
GenericArgKind::Const(_) => 3, // some non-zero value
634+
GenericArgKind::Constness(_) => 1,
634635
}
635636
}
636637
fn ty_cost(self, ty: Ty<'tcx>) -> usize {
@@ -748,6 +749,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
748749
}
749750
match inner.unpack() {
750751
GenericArgKind::Lifetime(_) => {}
752+
GenericArgKind::Constness(_) => {}
751753
GenericArgKind::Type(ty) => {
752754
if matches!(ty.kind(), ty::Opaque(..) | ty::Closure(..) | ty::Generator(..)) {
753755
// Opaque types can't be named by the user right now.

compiler/rustc_middle/src/ty/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl GenericParamDef {
7878
match self.kind {
7979
GenericParamDefKind::Type { has_default, .. }
8080
| GenericParamDefKind::Const { has_default } => has_default,
81-
GenericParamDefKind::Lifetime => false,
81+
GenericParamDefKind::Lifetime | GenericParamDefKind::Constness => false,
8282
}
8383
}
8484

0 commit comments

Comments
 (0)