Use same_type_modulo_infer in more places
This commit is contained in:
parent
5bc98076f3
commit
3ba27e7dfa
@ -1879,7 +1879,7 @@ fn suggest_accessing_field_where_appropriate(
|
||||
.iter()
|
||||
.filter(|field| field.vis.is_accessible_from(field.did, self.tcx))
|
||||
.map(|field| (field.ident.name, field.ty(self.tcx, expected_substs)))
|
||||
.find(|(_, ty)| ty::TyS::same_type(ty, exp_found.found))
|
||||
.find(|(_, ty)| same_type_modulo_infer(ty, exp_found.found))
|
||||
{
|
||||
if let ObligationCauseCode::Pattern { span: Some(span), .. } = cause.code {
|
||||
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
|
||||
@ -1944,7 +1944,7 @@ fn suggest_as_ref_where_appropriate(
|
||||
| (_, ty::Infer(_))
|
||||
| (ty::Param(_), _)
|
||||
| (ty::Infer(_), _) => {}
|
||||
_ if ty::TyS::same_type(exp_ty, found_ty) => {}
|
||||
_ if same_type_modulo_infer(exp_ty, found_ty) => {}
|
||||
_ => show_suggestion = false,
|
||||
};
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ LL | [_, 99.., _] => {},
|
||||
|
|
||||
= note: expected struct `std::ops::Range<{integer}>`
|
||||
found type `{integer}`
|
||||
help: you might have meant to use field `start` whose type is `{integer}`
|
||||
|
|
||||
LL | match [5..4, 99..105, 43..44].start {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,6 +14,10 @@ LL | [_, 99..] => {},
|
||||
|
|
||||
= note: expected struct `std::ops::Range<{integer}>`
|
||||
found type `{integer}`
|
||||
help: you might have meant to use field `start` whose type is `{integer}`
|
||||
|
|
||||
LL | match [5..4, 99..105, 43..44].start {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -8,6 +8,10 @@ LL | [..9, 99..100, _] => {},
|
||||
|
|
||||
= note: expected struct `std::ops::Range<{integer}>`
|
||||
found type `{integer}`
|
||||
help: you might have meant to use field `start` whose type is `{integer}`
|
||||
|
|
||||
LL | match [5..4, 99..105, 43..44].start {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:15
|
||||
@ -21,6 +25,10 @@ LL | [..9, 99..100, _] => {},
|
||||
|
|
||||
= note: expected struct `std::ops::Range<{integer}>`
|
||||
found type `{integer}`
|
||||
help: you might have meant to use field `start` whose type is `{integer}`
|
||||
|
|
||||
LL | match [5..4, 99..105, 43..44].start {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:19
|
||||
@ -34,6 +42,10 @@ LL | [..9, 99..100, _] => {},
|
||||
|
|
||||
= note: expected struct `std::ops::Range<{integer}>`
|
||||
found type `{integer}`
|
||||
help: you might have meant to use field `start` whose type is `{integer}`
|
||||
|
|
||||
LL | match [5..4, 99..105, 43..44].start {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -8,6 +8,10 @@ LL | Either::Right(_) => {}
|
||||
|
|
||||
= note: expected struct `S`
|
||||
found enum `Either<_, _>`
|
||||
help: you might have meant to use field `0` whose type is `Either<usize, usize>`
|
||||
|
|
||||
LL | match S(Either::Left(5)).0 {
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user