Improve an error message.
This commit is contained in:
parent
d7c3386414
commit
567de4a202
3 changed files with 12 additions and 8 deletions
|
@ -503,14 +503,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
let unit_obligation =
|
let unit_obligation =
|
||||||
obligation.with(predicate.without_const().to_predicate(tcx));
|
obligation.with(predicate.without_const().to_predicate(tcx));
|
||||||
if self.predicate_may_hold(&unit_obligation) {
|
if self.predicate_may_hold(&unit_obligation) {
|
||||||
|
err.note("this trait is implemented for `()`.");
|
||||||
err.note(
|
err.note(
|
||||||
"the trait is implemented for `()`. \
|
"this error might have been caused by changes to \
|
||||||
Possibly this error has been caused by changes to \
|
Rust's type-inference algorithm (see issue #48950 \
|
||||||
Rust's type-inference algorithm (see issue #48950 \
|
<https://github.com/rust-lang/rust/issues/48950> \
|
||||||
<https://github.com/rust-lang/rust/issues/48950> \
|
for more information).",
|
||||||
for more information). Consider whether you meant to use \
|
|
||||||
the type `()` here instead.",
|
|
||||||
);
|
);
|
||||||
|
err.help("did you intend to use the type `()` here instead?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@ fn smeg() {
|
||||||
foo(_x);
|
foo(_x);
|
||||||
//~^ ERROR the trait bound
|
//~^ ERROR the trait bound
|
||||||
//~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented
|
//~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented
|
||||||
//~| NOTE the trait is implemented for `()`
|
//~| NOTE this trait is implemented for `()`
|
||||||
|
//~| NOTE this error might have been caused
|
||||||
|
//~| HELP did you intend
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -7,7 +7,9 @@ LL | fn foo<T: ImplementedForUnitButNotNever>(_t: T) {}
|
||||||
LL | foo(_x);
|
LL | foo(_x);
|
||||||
| ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!`
|
| ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!`
|
||||||
|
|
|
|
||||||
= note: the trait is implemented for `()`. Possibly this error has been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information). Consider whether you meant to use the type `()` here instead.
|
= note: this trait is implemented for `()`.
|
||||||
|
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information).
|
||||||
|
= help: did you intend to use the type `()` here instead?
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue