-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Type mismatch in function arguments E0631, E0271 are falsely recognized as E0308 mismatched types #74400
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@jonas-schievink would you be so kind to label this issue? It's sliding down the list while being hard to search. |
It would be great to find the culprit PR. |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @camelid @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke |
searched nightlies: from nightly-2020-06-23 to nightly-2020-06-24 bisected with cargo-bisect-rustc v0.5.1Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2020-06-23 --end=2020-06-24 --prompt -- check If we rule out document changes then we have |
Bisection seems to confirm this, cc @nikomatsakis |
With a little more git bisect it seems 6873a76 is the first bad commit And I guess the change to the test case also shows that diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr
index 3cb8abcdcfd..cd637056c94 100644
--- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr
+++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr
@@ -1,11 +1,12 @@
-error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-57611-trait-alias.rs:21:9: 21:14] as std::ops::FnOnce<(&'r X,)>>::Output == &'r X`
+error[E0308]: mismatched types
--> $DIR/issue-57611-trait-alias.rs:17:16
|
LL | type Bar = impl Baz<Self, Self>;
- | ^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter, found concrete lifetime
+ | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
- = note: the return type of a function must have a statically known size
+ = note: expected type `std::ops::FnOnce<(&X,)>`
+ found type `std::ops::FnOnce<(&X,)>`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0271`.
+For more information about this error, try `rustc --explain E0308`. |
Assigning |
Well, I can certainly imagine how this could come about as a result of the leak-check moving, since the same error can now be detected at a different point during type-checking. What's happening in that confusing error, I imagine, is that we are now winding up with a "universe error" that comes out from region checking. The identity function was inferred to take an argument Well, in short, I imagine that the solution here is to improve the error reporting for the new point where the error occurs, but it'll take a bit more digging to give good mentoring instructions into how to go about doing that. |
This is now a stable regression. |
Discussed in T-compiler meeting. Seems related to (or potential duplicate of) #75791 ? |
On today's nightly, the error is now:
That seems correct, and with the extra lifetime, the snippet compiles:
|
Rollup of 9 pull requests Successful merges: - rust-lang#86263 (Rustdoc: Report Layout of enum variants) - rust-lang#88541 (Add regression test for rust-lang#74400) - rust-lang#88553 (Improve diagnostics for unary plus operators (rust-lang#88276)) - rust-lang#88594 (More symbolic doc aliases) - rust-lang#88648 (Correct “copies” to “moves” in `<Option<T> as From<T>>::from` doc, and other copyediting) - rust-lang#88691 (Add a regression test for rust-lang#88649) - rust-lang#88694 (Drop 1.56 stabilizations from 1.55 release notes) - rust-lang#88712 (Fix docs for `uX::checked_next_multiple_of`) - rust-lang#88726 (Fix typo in `const_generics` replaced with `adt_const_params` note) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Regression from
1.45.0-beta.4 (2020-07-13 e99e6422a2f799fc86a3)
to1.46.0-nightly (2020-07-15 7e11379f3b4c376fbb9a)
.The following code yields an incorrect error:
On beta, this gives:
On nightly, this:
The text was updated successfully, but these errors were encountered: