-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Otherwise the specialization graph fails to pick it up, even though other code assumes that all impl blocks have an entry in the specialization graph.
- Loading branch information
Showing
4 changed files
with
138 additions
and
5 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
16 changes: 16 additions & 0 deletions
16
tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs
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,16 @@ | ||
trait Foo { | ||
type Context<'c> | ||
where | ||
Self: 'c; | ||
} | ||
|
||
impl Foo for Box<dyn Foo> {} | ||
//~^ ERROR `Foo` cannot be made into an object | ||
//~| ERROR `Foo` cannot be made into an object | ||
//~| ERROR cycle detected | ||
//~| ERROR cycle detected | ||
//~| ERROR cycle detected | ||
//~| ERROR the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied | ||
//~| ERROR not all trait items implemented | ||
|
||
fn main() {} |
119 changes: 119 additions & 0 deletions
119
tests/ui/generic-associated-types/unknown-lifetime-ice-119827.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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
error[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: ...which requires finding trait impls of `Foo`... | ||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1 | ||
| | ||
LL | trait Foo { | ||
| ^^^^^^^^^ | ||
= note: ...which again requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>`, completing the cycle | ||
note: cycle used when collecting item types in top-level module | ||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1 | ||
| | ||
LL | / trait Foo { | ||
LL | | type Context<'c> | ||
LL | | where | ||
LL | | Self: 'c; | ||
... | | ||
LL | | | ||
LL | | fn main() {} | ||
| |____________^ | ||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | ||
|
||
error[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: ...which immediately requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` again | ||
note: cycle used when collecting item types in top-level module | ||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1 | ||
| | ||
LL | / trait Foo { | ||
LL | | type Context<'c> | ||
LL | | where | ||
LL | | Self: 'c; | ||
... | | ||
LL | | | ||
LL | | fn main() {} | ||
| |____________^ | ||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | ||
|
||
error[E0391]: cycle detected when computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: ...which immediately requires computing type of `<impl at $DIR/unknown-lifetime-ice-119827.rs:7:1: 7:26>` again | ||
note: cycle used when collecting item types in top-level module | ||
--> $DIR/unknown-lifetime-ice-119827.rs:1:1 | ||
| | ||
LL | / trait Foo { | ||
LL | | type Context<'c> | ||
LL | | where | ||
LL | | Self: 'c; | ||
... | | ||
LL | | | ||
LL | | fn main() {} | ||
| |____________^ | ||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error[E0038]: the trait `Foo` cannot be made into an object | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:22 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^ `Foo` cannot be made into an object | ||
| | ||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/unknown-lifetime-ice-119827.rs:2:10 | ||
| | ||
LL | trait Foo { | ||
| --- this trait cannot be made into an object... | ||
LL | type Context<'c> | ||
| ^^^^^^^ ...because it contains the generic associated type `Context` | ||
= help: consider moving `Context` to another trait | ||
= help: only type `{type error}` implements the trait, consider using it directly instead | ||
|
||
error[E0277]: the trait bound `Box<(dyn Foo + 'static)>: Foo` is not satisfied | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:14 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^ the trait `Foo` is not implemented for `Box<(dyn Foo + 'static)>` | ||
| | ||
= help: the trait `Foo` is implemented for `Box<(dyn Foo + 'static)>` | ||
|
||
error[E0038]: the trait `Foo` cannot be made into an object | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:14 | ||
| | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^ `Foo` cannot be made into an object | ||
| | ||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> | ||
--> $DIR/unknown-lifetime-ice-119827.rs:2:10 | ||
| | ||
LL | trait Foo { | ||
| --- this trait cannot be made into an object... | ||
LL | type Context<'c> | ||
| ^^^^^^^ ...because it contains the generic associated type `Context` | ||
= help: consider moving `Context` to another trait | ||
= help: only type `std::boxed::Box<(dyn Foo + 'static)>` implements the trait, consider using it directly instead | ||
|
||
error[E0046]: not all trait items implemented, missing: `Context` | ||
--> $DIR/unknown-lifetime-ice-119827.rs:7:1 | ||
| | ||
LL | type Context<'c> | ||
| ---------------- `Context` from trait | ||
... | ||
LL | impl Foo for Box<dyn Foo> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Context` in implementation | ||
|
||
error: aborting due to 7 previous errors | ||
|
||
Some errors have detailed explanations: E0038, E0046, E0277, E0391. | ||
For more information about an error, try `rustc --explain E0038`. |