Use same_type_modulo_infer in more places
This commit is contained in:
parent
5bc98076f3
commit
3ba27e7dfa
5 changed files with 26 additions and 2 deletions
|
@ -1879,7 +1879,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|field| field.vis.is_accessible_from(field.did, self.tcx))
|
.filter(|field| field.vis.is_accessible_from(field.did, self.tcx))
|
||||||
.map(|field| (field.ident.name, field.ty(self.tcx, expected_substs)))
|
.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 ObligationCauseCode::Pattern { span: Some(span), .. } = cause.code {
|
||||||
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
|
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
|
||||||
|
@ -1944,7 +1944,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
| (_, ty::Infer(_))
|
| (_, ty::Infer(_))
|
||||||
| (ty::Param(_), _)
|
| (ty::Param(_), _)
|
||||||
| (ty::Infer(_), _) => {}
|
| (ty::Infer(_), _) => {}
|
||||||
_ if ty::TyS::same_type(exp_ty, found_ty) => {}
|
_ if same_type_modulo_infer(exp_ty, found_ty) => {}
|
||||||
_ => show_suggestion = false,
|
_ => show_suggestion = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | [_, 99.., _] => {},
|
||||||
|
|
|
|
||||||
= note: expected struct `std::ops::Range<{integer}>`
|
= note: expected struct `std::ops::Range<{integer}>`
|
||||||
found type `{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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@ LL | [_, 99..] => {},
|
||||||
|
|
|
|
||||||
= note: expected struct `std::ops::Range<{integer}>`
|
= note: expected struct `std::ops::Range<{integer}>`
|
||||||
found type `{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
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | [..9, 99..100, _] => {},
|
||||||
|
|
|
|
||||||
= note: expected struct `std::ops::Range<{integer}>`
|
= note: expected struct `std::ops::Range<{integer}>`
|
||||||
found type `{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
|
error[E0308]: mismatched types
|
||||||
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:15
|
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:15
|
||||||
|
@ -21,6 +25,10 @@ LL | [..9, 99..100, _] => {},
|
||||||
|
|
|
|
||||||
= note: expected struct `std::ops::Range<{integer}>`
|
= note: expected struct `std::ops::Range<{integer}>`
|
||||||
found type `{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
|
error[E0308]: mismatched types
|
||||||
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:19
|
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:6:19
|
||||||
|
@ -34,6 +42,10 @@ LL | [..9, 99..100, _] => {},
|
||||||
|
|
|
|
||||||
= note: expected struct `std::ops::Range<{integer}>`
|
= note: expected struct `std::ops::Range<{integer}>`
|
||||||
found type `{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
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ LL | Either::Right(_) => {}
|
||||||
|
|
|
|
||||||
= note: expected struct `S`
|
= note: expected struct `S`
|
||||||
found enum `Either<_, _>`
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue