-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
select.rs: unsizing coercion should use a subtype
When we coerce `dyn Foo` to `dyn Bar`, that is OK as long as `Foo` is usable in all contexts where `Bar` is usable (hence using the source must be a subtype of the target). This is needed for the universe-based code to handle `old-lub-glb-object`; that test used to work sort of by accident before with the old code.
- Loading branch information
1 parent
4170829
commit 904a0bd
Showing
3 changed files
with
11 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
error[E0308]: match arms have incompatible types | ||
--> $DIR/old-lub-glb-object.rs:10:13 | ||
| | ||
LL | let z = match 22 { //~ ERROR incompatible types | ||
LL | let z = match 22 { //~ ERROR cannot infer | ||
| _____________^ | ||
LL | | 0 => x, | ||
LL | | _ => y, | ||
| | - match arm with an incompatible type | ||
LL | | }; | ||
| |_____^ expected bound lifetime parameter 'a, found concrete lifetime | ||
| |_____^ | ||
| | ||
= note: expected type `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>` | ||
found type `&dyn for<'a> Foo<&'a u8, &'a u8>` | ||
= note: first, the lifetime cannot outlive lifetime RePlaceholder(Placeholder { universe: U5, name: BrNamed(crate0:DefIndex(1:11), 'a) })... | ||
= note: ...but the lifetime must also be valid for lifetime RePlaceholder(Placeholder { universe: U5, name: BrNamed(crate0:DefIndex(1:12), 'b) })... | ||
= note: ...so that the types are compatible: | ||
expected dyn for<'a, 'b> Foo<&'a u8, &'b u8> | ||
found dyn for<'a> Foo<&'a u8, &'a u8> | ||
|
||
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 E0495`. |