Mark GAT WC as GoalSource::AliasWellFormed so that we recurse into them in error reporting
This commit is contained in:
parent
27836e1e57
commit
ccdfd310be
4 changed files with 9 additions and 25 deletions
|
@ -134,7 +134,7 @@ where
|
||||||
// Add GAT where clauses from the trait's definition
|
// Add GAT where clauses from the trait's definition
|
||||||
// FIXME: We don't need these, since these are the type's own WF obligations.
|
// FIXME: We don't need these, since these are the type's own WF obligations.
|
||||||
ecx.add_goals(
|
ecx.add_goals(
|
||||||
GoalSource::Misc,
|
GoalSource::AliasWellFormed,
|
||||||
cx.own_predicates_of(goal.predicate.def_id())
|
cx.own_predicates_of(goal.predicate.def_id())
|
||||||
.iter_instantiated(cx, goal.predicate.alias.args)
|
.iter_instantiated(cx, goal.predicate.alias.args)
|
||||||
.map(|pred| goal.with(cx, pred)),
|
.map(|pred| goal.with(cx, pred)),
|
||||||
|
@ -199,7 +199,7 @@ where
|
||||||
// Add GAT where clauses from the trait's definition.
|
// Add GAT where clauses from the trait's definition.
|
||||||
// FIXME: We don't need these, since these are the type's own WF obligations.
|
// FIXME: We don't need these, since these are the type's own WF obligations.
|
||||||
ecx.add_goals(
|
ecx.add_goals(
|
||||||
GoalSource::Misc,
|
GoalSource::AliasWellFormed,
|
||||||
cx.own_predicates_of(goal.predicate.def_id())
|
cx.own_predicates_of(goal.predicate.def_id())
|
||||||
.iter_instantiated(cx, goal.predicate.alias.args)
|
.iter_instantiated(cx, goal.predicate.alias.args)
|
||||||
.map(|pred| goal.with(cx, pred)),
|
.map(|pred| goal.with(cx, pred)),
|
||||||
|
|
|
@ -83,8 +83,11 @@ pub enum GoalSource {
|
||||||
/// Instantiating a higher-ranked goal and re-proving it.
|
/// Instantiating a higher-ranked goal and re-proving it.
|
||||||
InstantiateHigherRanked,
|
InstantiateHigherRanked,
|
||||||
/// Predicate required for an alias projection to be well-formed.
|
/// Predicate required for an alias projection to be well-formed.
|
||||||
/// This is used in two places: projecting to an opaque whose hidden type
|
/// This is used in three places:
|
||||||
/// is already registered in the opaque type storage, and for rigid projections.
|
/// 1. projecting to an opaque whose hidden type is already registered in
|
||||||
|
/// the opaque type storage,
|
||||||
|
/// 2. for rigid projections's trait goal,
|
||||||
|
/// 3. for GAT where clauses.
|
||||||
AliasWellFormed,
|
AliasWellFormed,
|
||||||
/// In case normalizing aliases in nested goals cycles, eagerly normalizing these
|
/// In case normalizing aliases in nested goals cycles, eagerly normalizing these
|
||||||
/// aliases in the context of the parent may incorrectly change the cycle kind.
|
/// aliases in the context of the parent may incorrectly change the cycle kind.
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
error[E0271]: type mismatch resolving `<[()] as Bad>::Assert normalizes-to <[()] as Bad>::Assert`
|
|
||||||
--> $DIR/trivial-unsized-projection.rs:20:12
|
|
||||||
|
|
|
||||||
LL | const FOO: <[()] as Bad>::Assert = todo!();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: statics and constants must have a statically known size
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `[()]` cannot be known at compilation time
|
error[E0277]: the size for values of type `[()]` cannot be known at compilation time
|
||||||
--> $DIR/trivial-unsized-projection.rs:20:12
|
--> $DIR/trivial-unsized-projection.rs:20:12
|
||||||
|
|
|
|
||||||
|
@ -47,15 +39,6 @@ help: consider relaxing the implicit `Sized` restriction
|
||||||
LL | type Assert: ?Sized
|
LL | type Assert: ?Sized
|
||||||
| ++++++++
|
| ++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<[()] as Bad>::Assert normalizes-to <[()] as Bad>::Assert`
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/trivial-unsized-projection.rs:20:36
|
|
||||||
|
|
|
||||||
LL | const FOO: <[()] as Bad>::Assert = todo!();
|
|
||||||
| ^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ const FOO: <[()] as Bad>::Assert = todo!();
|
||||||
//[bad]~| ERROR the size for values of type `[()]` cannot be known at compilation time
|
//[bad]~| ERROR the size for values of type `[()]` cannot be known at compilation time
|
||||||
//[bad_new]~^^^ ERROR the size for values of type `[()]` cannot be known at compilation time
|
//[bad_new]~^^^ ERROR the size for values of type `[()]` cannot be known at compilation time
|
||||||
//[bad_new]~| ERROR the size for values of type `[()]` cannot be known at compilation time
|
//[bad_new]~| ERROR the size for values of type `[()]` cannot be known at compilation time
|
||||||
//[bad_new]~| ERROR type mismatch resolving `<[()] as Bad>::Assert normalizes-to <[()] as Bad>::Assert`
|
|
||||||
//[bad_new]~| ERROR type mismatch resolving `<[()] as Bad>::Assert normalizes-to <[()] as Bad>::Assert`
|
|
||||||
|
|
||||||
#[cfg(any(good, good_new))]
|
#[cfg(any(good, good_new))]
|
||||||
// Well-formed in trivially false param-env
|
// Well-formed in trivially false param-env
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue