mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 21:24:12 +00:00
Fix typo in E0308 if/else label
This commit is contained in:
parent
7b0085a613
commit
1c82987782
@ -1650,7 +1650,7 @@ impl<'tcx> ObligationCause<'tcx> {
|
||||
hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types",
|
||||
_ => "match arms have compatible types",
|
||||
},
|
||||
IfExpression { .. } => "if and else have compatible types",
|
||||
IfExpression { .. } => "if and else have incompatible types",
|
||||
IfExpressionWithNoElse => "if missing an else returns ()",
|
||||
MainFunctionType => "`main` function has the correct type",
|
||||
StartFunctionType => "`start` function has the correct type",
|
||||
|
@ -247,13 +247,15 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn note_and_explain_type_err(self,
|
||||
db: &mut DiagnosticBuilder<'_>,
|
||||
err: &TypeError<'tcx>,
|
||||
sp: Span) {
|
||||
pub fn note_and_explain_type_err(
|
||||
self,
|
||||
db: &mut DiagnosticBuilder<'_>,
|
||||
err: &TypeError<'tcx>,
|
||||
sp: Span,
|
||||
) {
|
||||
use self::TypeError::*;
|
||||
|
||||
match err.clone() {
|
||||
match err {
|
||||
Sorts(values) => {
|
||||
let expected_str = values.expected.sort_string(self);
|
||||
let found_str = values.found.sort_string(self);
|
||||
@ -261,6 +263,15 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
db.note("no two closures, even if identical, have the same type");
|
||||
db.help("consider boxing your closure and/or using it as a trait object");
|
||||
}
|
||||
if expected_str == found_str && expected_str == "opaque type" { // Issue #63167
|
||||
db.note("distinct uses of `impl Trait` result in different opaque types");
|
||||
let e_str = values.expected.to_string();
|
||||
let f_str = values.found.to_string();
|
||||
if &e_str == &f_str && &e_str == "impl std::future::Future" {
|
||||
db.help("if both futures resolve to the same type, consider `await`ing \
|
||||
on both of them");
|
||||
}
|
||||
}
|
||||
if let (ty::Infer(ty::IntVar(_)), ty::Float(_)) =
|
||||
(&values.found.sty, &values.expected.sty) // Issue #53280
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user