forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#96715 - cjgillot:trait-alias-loop, r=compiler…
…-errors Fortify handing of where bounds on trait & trait alias definitions Closes rust-lang#96664 Closes rust-lang#96665 Since rust-lang#93803, when listing all bounds and predicates we now need to account for the possible presence of predicates on any of the generic parameters. Both bugs were hidden by the special handling of bounds at the generic parameter declaration position. Trait alias expansion used to confuse predicates on `Self` and where predicates. Exiting too late when listing all the bounds caused a cycle error.
- Loading branch information
Showing
10 changed files
with
69 additions
and
20 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
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,16 +1,12 @@ | ||
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
error[E0224]: at least one trait is required for an object type | ||
--> $DIR/issue-65673.rs:9:16 | ||
| | ||
LL | trait Alias<T> = where T: Trait; | ||
| -------------------------------- this alias does not contain a trait | ||
... | ||
LL | type Ctx = dyn Alias<T>; | ||
| ^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `(dyn Trait + 'static)` | ||
note: required by a bound in `WithType::Ctx` | ||
--> $DIR/issue-65673.rs:4:5 | ||
| | ||
LL | type Ctx; | ||
| ^^^^^^^^^ required by this bound in `WithType::Ctx` | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. | ||
For more information about this error, try `rustc --explain E0224`. |
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 @@ | ||
// check-pass | ||
|
||
#![feature(trait_alias)] | ||
|
||
pub trait State = Clone + Send + Sync + PartialOrd + PartialEq + std::fmt::Display; | ||
pub trait RandState<S: State> = FnMut() -> S + Send; | ||
|
||
pub trait Evaluator { | ||
type State; | ||
} | ||
|
||
pub struct Evolver<E: Evaluator> { | ||
rand_state: Box<dyn RandState<E::State>>, | ||
} | ||
|
||
fn main() {} |
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 @@ | ||
// check-pass | ||
|
||
pub trait Sequence<Item, Subsequence: Sequence<Item, Subsequence>> {} | ||
|
||
pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>: | ||
Sequence<Graph::NodeIndex, NodeSubwalk> | ||
{ | ||
} | ||
|
||
pub trait GraphBase { | ||
type NodeIndex; | ||
} | ||
|
||
pub trait WalkableGraph: GraphBase {} | ||
|
||
fn main() {} |