-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Diverging tyvars #85558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+477
−173
Closed
Diverging tyvars #85558
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fn main() { | ||
(return)[0]; //~ ERROR cannot index into a value of type `!` | ||
(return)[0]; //~ ERROR cannot index into a value of type `()` | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fn main() { | ||
return.is_failure //~ ERROR no field `is_failure` on type `!` | ||
return.is_failure //~ ERROR no field `is_failure` on type `()` | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
fn main() { | ||
loop { | ||
break.push(1) //~ ERROR no method named `push` found for type `!` | ||
break.push(1) //~ ERROR no method named `push` found for unit type `()` | ||
; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
fn main() { | ||
return | ||
{ return () } | ||
//~^ ERROR type annotations needed [E0282] | ||
//~^ ERROR expected function, found `_` | ||
() | ||
; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
error[E0282]: type annotations needed | ||
error[E0618]: expected function, found `_` | ||
--> $DIR/issue-15965.rs:3:9 | ||
| | ||
LL | / { return () } | ||
LL | { return () } | ||
| _________-^^^^^^^^^^^^ | ||
LL | | | ||
LL | | () | ||
| |______^ cannot infer type | ||
| | ||
= note: type must be known at this point | ||
| |______- call expression requires function | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. | ||
For more information about this error, try `rustc --explain E0618`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
fn main() { | ||
*return //~ ERROR type `!` cannot be dereferenced | ||
*return //~ ERROR type `()` cannot be dereferenced | ||
; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![feature(never_type)] | ||
#![feature(never_type_fallback)] | ||
#![allow(dead_code)] | ||
|
||
fn foo() { | ||
{ if true { return } else { return } }.test(); | ||
//~^ ERROR no method named `test` found for type `!` | ||
} | ||
|
||
fn bar() { | ||
{ if true { Default::default() } else { return } }.test(); | ||
//~^ ERROR type annotations needed | ||
} | ||
|
||
fn baz() { | ||
let a = return; | ||
{ if true { return } else { a } }.test(); | ||
//~^ ERROR type annotations needed | ||
} | ||
|
||
fn qux() { | ||
let a: ! = return; | ||
{ if true { return } else { a } }.test(); | ||
//~^ ERROR no method named `test` found for type `!` | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error[E0599]: no method named `test` found for type `!` in the current scope | ||
--> $DIR/early-fallback.rs:6:44 | ||
| | ||
LL | { if true { return } else { return } }.test(); | ||
| ^^^^ method not found in `!` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/early-fallback.rs:11:5 | ||
| | ||
LL | { if true { Default::default() } else { return } }.test(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ||
| | ||
= note: type must be known at this point | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/early-fallback.rs:17:5 | ||
| | ||
LL | let a = return; | ||
| - consider giving `a` a type | ||
LL | { if true { return } else { a } }.test(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ||
| | ||
= note: type must be known at this point | ||
|
||
error[E0599]: no method named `test` found for type `!` in the current scope | ||
--> $DIR/early-fallback.rs:23:39 | ||
| | ||
LL | { if true { return } else { a } }.test(); | ||
| ^^^^ method not found in `!` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0282, E0599. | ||
For more information about an error, try `rustc --explain E0282`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[allow(dead_code)] | ||
|
||
fn foo() { | ||
let mut a = (return, ); | ||
a.0 = 1; | ||
a.0 = 1.1; //~ ERROR mismatched types | ||
} | ||
|
||
fn bar() { | ||
let mut a = (return, ); | ||
a.0.test(); //~ ERROR type annotations needed for `(_,)` | ||
} | ||
|
||
fn baz() { | ||
let mut a = (return, ); | ||
a + 1; //~ ERROR cannot add `{integer}` to `(_,)` | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/tuple.rs:6:11 | ||
| | ||
LL | a.0 = 1.1; | ||
| ^^^ expected integer, found floating-point number | ||
|
||
error[E0282]: type annotations needed for `(_,)` | ||
--> $DIR/tuple.rs:11:5 | ||
| | ||
LL | let mut a = (return, ); | ||
| ----- consider giving `a` the explicit type `(_,)`, with the type parameters specified | ||
LL | a.0.test(); | ||
| ^^^ cannot infer type | ||
| | ||
= note: type must be known at this point | ||
|
||
error[E0369]: cannot add `{integer}` to `(_,)` | ||
--> $DIR/tuple.rs:16:7 | ||
| | ||
LL | a + 1; | ||
| - ^ - {integer} | ||
| | | ||
| (_,) | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0282, E0308, E0369. | ||
For more information about an error, try `rustc --explain E0282`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked much at the implementation here, but this change alone signals something is probably not correct with this PR; the type of
return
should be!
, not()