Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix SCCs containing mixture of universes
And add a test showing a universe violation getting caught.
- Loading branch information
1 parent
f0e3a09
commit fced2b1
Showing
3 changed files
with
61 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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,17 @@ | ||
// Test that the NLL `relate_tys` code correctly deduces that a | ||
// function returning either argument CANNOT be upcast to one | ||
// that returns always its first argument. | ||
// | ||
// compile-flags:-Zno-leak-check | ||
|
||
#![feature(nll)] | ||
|
||
fn make_it() -> fn(&'static u32) -> &'static u32 { | ||
panic!() | ||
} | ||
|
||
fn main() { | ||
let a: fn(_) -> _ = make_it(); | ||
let b: fn(&u32) -> &u32 = a; | ||
drop(a); | ||
} |
This file contains 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,14 @@ | ||
error: higher-ranked subtype error | ||
--> $DIR/universe-violation.rs:14:9 | ||
| | ||
LL | let a: fn(_) -> _ = make_it(); | ||
| ^ | ||
|
||
error: higher-ranked subtype error | ||
--> $DIR/universe-violation.rs:15:9 | ||
| | ||
LL | let b: fn(&u32) -> &u32 = a; | ||
| ^ | ||
|
||
error: aborting due to 2 previous errors | ||
|