-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make type equality != bidirectional subtyping
- Loading branch information
1 parent
f74f700
commit 3679fde
Showing
63 changed files
with
373 additions
and
387 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
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 |
---|---|---|
@@ -1,22 +1,15 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-109789.rs:18:11 | ||
error[E0220]: associated type `Assoc` not found for `Foo<for<'a> fn(&'a ())>` in the current scope | ||
--> $DIR/issue-109789.rs:18:36 | ||
| | ||
LL | struct Foo<T>(T); | ||
| ------------- associated item `Assoc` not found for this struct | ||
... | ||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| ^^^^^ associated item not found in `Foo<for<'a> fn(&'a ())>` | ||
| | ||
= note: expected struct `Foo<fn(&'static ())>` | ||
found struct `Foo<for<'a> fn(&'a ())>` | ||
= note: the associated type was found for | ||
- `Foo<fn(&'static ())>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109789.rs:18:11 | ||
| | ||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected struct `Foo<fn(&'static ())>` | ||
found struct `Foo<for<'a> fn(&'a ())>` | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. | ||
For more information about this error, try `rustc --explain E0220`. |
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 |
---|---|---|
@@ -1,8 +1,33 @@ | ||
error[E0220]: associated type `Assoc` not found for `Foo<for<'b> fn(&'b ())>` in the current scope | ||
--> $DIR/issue-111404-1.rs:10:55 | ||
| | ||
LL | struct Foo<T>(T); | ||
| ------------- associated item `Assoc` not found for this struct | ||
... | ||
LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} | ||
<<<<<<< HEAD | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
||||||| parent of 9bb25a65025 (Make type equality != bidirectional subtyping) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: higher-ranked subtype error | ||
--> $DIR/issue-111404-1.rs:10:1 | ||
| | ||
LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 2 previous errors | ||
======= | ||
| ^^^^^ associated item not found in `Foo<for<'b> fn(&'b ())>` | ||
| | ||
= note: the associated type was found for | ||
- `Foo<fn(&'a ())>` | ||
|
||
error: aborting due to previous error | ||
>>>>>>> 9bb25a65025 (Make type equality != bidirectional subtyping) | ||
|
||
For more information about this error, try `rustc --explain E0220`. |
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
97 changes: 59 additions & 38 deletions
97
tests/ui/closure-expected-type/expect-fn-supply-fn.stderr
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 |
---|---|---|
@@ -1,51 +1,72 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/expect-fn-supply-fn.rs:16:49 | ||
| | ||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { | ||
| -- lifetime `'x` defined here | ||
... | ||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ||
| ^ | ||
| | | ||
| has type `fn(&'1 u32)` | ||
| requires that `'1` must outlive `'x` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/expect-fn-supply-fn.rs:16:49 | ||
| | ||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { | ||
| -- lifetime `'x` defined here | ||
... | ||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ||
| ^ requires that `'x` must outlive `'static` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/expect-fn-supply-fn.rs:32:49 | ||
error[E0631]: type mismatch in closure arguments | ||
--> $DIR/expect-fn-supply-fn.rs:30:5 | ||
| | ||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); | ||
| ^ one type is more general than the other | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature defined here | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected closure signature `for<'a, 'b> fn(for<'a> fn(&'a u32), &'b i32) -> _` | ||
found closure signature `fn(for<'a> fn(&'a u32), _) -> _` | ||
note: required by a bound in `with_closure_expecting_fn_with_free_region` | ||
--> $DIR/expect-fn-supply-fn.rs:3:8 | ||
| | ||
LL | fn with_closure_expecting_fn_with_free_region<F>(_: F) | ||
| ------------------------------------------ required by a bound in this function | ||
LL | where | ||
LL | F: for<'a> FnOnce(fn(&'a u32), &i32), | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_free_region` | ||
help: consider adjusting the signature so it borrows its argument | ||
| | ||
= note: expected fn pointer `fn(&u32)` | ||
found fn pointer `for<'a> fn(&'a u32)` | ||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), &y| {}); | ||
| + | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/expect-fn-supply-fn.rs:39:50 | ||
error[E0631]: type mismatch in closure arguments | ||
--> $DIR/expect-fn-supply-fn.rs:37:5 | ||
| | ||
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); | ||
| ^ one type is more general than the other | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature defined here | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected fn pointer `for<'a> fn(&'a u32)` | ||
found fn pointer `fn(&u32)` | ||
= note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` | ||
found closure signature `fn(fn(&'x u32), _) -> _` | ||
note: required by a bound in `with_closure_expecting_fn_with_bound_region` | ||
--> $DIR/expect-fn-supply-fn.rs:9:8 | ||
| | ||
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F) | ||
| ------------------------------------------- required by a bound in this function | ||
LL | where | ||
LL | F: FnOnce(fn(&u32), &i32), | ||
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` | ||
help: consider adjusting the signature so it borrows its argument | ||
| | ||
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), &y| {}); | ||
| + | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/expect-fn-supply-fn.rs:48:50 | ||
error[E0631]: type mismatch in closure arguments | ||
--> $DIR/expect-fn-supply-fn.rs:46:5 | ||
| | ||
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { | ||
| ^ one type is more general than the other | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- found signature defined here | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected closure signature `for<'a> fn(for<'a> fn(&'a u32), &'a i32) -> _` | ||
found closure signature `for<'a> fn(for<'a> fn(&'a u32), _) -> _` | ||
note: required by a bound in `with_closure_expecting_fn_with_bound_region` | ||
--> $DIR/expect-fn-supply-fn.rs:9:8 | ||
| | ||
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F) | ||
| ------------------------------------------- required by a bound in this function | ||
LL | where | ||
LL | F: FnOnce(fn(&u32), &i32), | ||
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `with_closure_expecting_fn_with_bound_region` | ||
help: consider adjusting the signature so it borrows its argument | ||
| | ||
= note: expected fn pointer `for<'a> fn(&'a u32)` | ||
found fn pointer `fn(&u32)` | ||
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, &y| { | ||
| + | ||
|
||
error: aborting due to 5 previous errors | ||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. | ||
For more information about this error, try `rustc --explain E0631`. |
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
13 changes: 0 additions & 13 deletions
13
tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.