rust/tests/ui/const-generics
Dylan DPC be4f9f5bec
Rollup merge of #110512 - compiler-errors:fix-elaboration-with-associated-type-bounds, r=spastorino
Fix elaboration with associated type bounds

When computing a trait's supertrait predicates, do not add any associated type *trait* bounds to that list of supertrait predicates. This is because supertrait predicates are expected to have the same `Self` type as the trait.

For example, given:

```rust
trait Foo: Bar<Assoc: Send>
```

Before, we would compute that the supertrait predicates of `T: Foo` are `T: Bar` and `<T as Bar>::Assoc: Send`. However, the last bound is a trait predicate for a totally different type than `T`, and existing code that uses supertrait bounds such as vtable construction, closure fn signature deduction, etc. all rely on the invariant that we have a list of predicates for self type `T`.

Fixes #76593

The reason for all the extra diagnostic noise is that we're recomputing predicates with a different filter now. These diagnostics should be deduplicated for any end-user though.

---

This does bring up an interesting question -- is the predicate `<T as Bar>::Assoc: Send` an implied bound of `T: Foo`? Because currently the only bounds implied by a (non-alias) trait are its supertraits. I guess I could fix this too, but it would require even more changes, and I'm inclined to punt this question along.
2023-05-02 11:44:51 +05:30
..
adt_const_params --bless ConstParamTy ui tests 2023-04-27 17:26:59 +00:00
array-impls Move /src/test to /tests 2023-01-11 09:32:08 +00:00
auxiliary Move /src/test to /tests 2023-01-11 09:32:08 +00:00
backcompat Move /src/test to /tests 2023-01-11 09:32:08 +00:00
defaults update tests/ui 2023-04-07 18:07:11 +10:00
early const generic -> const parameter in err msg 2023-02-20 12:58:11 +01:00
generic_arg_infer Move /src/test to /tests 2023-01-11 09:32:08 +00:00
generic_const_exprs fix library and rustdoc tests 2023-04-16 11:38:52 +00:00
infer diagnostics: update test cases to refer to assoc fn with self as method 2023-02-22 08:40:47 -07:00
issues Special-case item attributes in the suggestion output 2023-04-12 22:50:10 +00:00
late-bound-vars Move /src/test to /tests 2023-01-11 09:32:08 +00:00
min_const_generics preserve delim spans during macro_rules! expansion if able 2023-01-20 20:16:37 +01:00
occurs-check vars are ? 2023-04-25 19:53:09 +00:00
parser-error-recovery diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
std Move /src/test to /tests 2023-01-11 09:32:08 +00:00
type-dependent Move /src/test to /tests 2023-01-11 09:32:08 +00:00
apit-with-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
arg-in-pat-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
arg-in-pat-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
arg-in-pat-3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
argument_order.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
argument_order.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
array-wrapper-struct-ctor.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
assoc_const_eq_diagnostic.rs Don't use implied trait predicates in gather_explicit_predicates_of 2023-05-01 15:45:28 +00:00
assoc_const_eq_diagnostic.stderr Don't use implied trait predicates in gather_explicit_predicates_of 2023-05-01 15:45:28 +00:00
associated-type-bound-fail.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
associated-type-bound-fail.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
associated-type-bound.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
bad-const-generic-exprs.rs recover more unbraced const args 2023-01-27 19:26:04 +01:00
bad-const-generic-exprs.stderr recover more unbraced const args 2023-01-27 19:26:04 +01:00
bad-generic-in-copy-impl.rs Suppress copy impl error when post-normalized type references errors 2023-03-08 00:12:33 +00:00
bad-generic-in-copy-impl.stderr Suppress copy impl error when post-normalized type references errors 2023-03-08 00:12:33 +00:00
bad-subst-const-kind.rs Constrain const vars to error if const types are mismatched 2023-03-19 03:45:47 +00:00
bad-subst-const-kind.stderr Constrain const vars to error if const types are mismatched 2023-03-19 03:45:47 +00:00
broken-mir-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
broken-mir-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
cannot-infer-type-for-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce_unsized_array.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
concrete-const-as-fn-arg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
concrete-const-impl-method.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
condition-in-trait-const-arg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-arg-in-const-arg.full.stderr Error code E0794 for late-bound lifetime parameter error. 2023-03-07 21:26:19 +01:00
const-arg-in-const-arg.min.stderr Error code E0794 for late-bound lifetime parameter error. 2023-03-07 21:26:19 +01:00
const-arg-in-const-arg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-arg-in-fn.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-arg-type-arg-misordered.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-arg-type-arg-misordered.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-cross-crate-mismatch.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-cross-crate-mismatch.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-cross-crate.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-if-length.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-if-length.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-if-length.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-argument-non-static-lifetime.min.stderr Remove save-analysis. 2023-02-16 15:14:45 +11:00
const-argument-non-static-lifetime.rs Remove save-analysis. 2023-02-16 15:14:45 +11:00
const-fn-with-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-generic-default-wont-borrowck.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-generic-default-wont-borrowck.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-generic-function.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-generic-function.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-generic-type_name.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-after-const-literal-arg.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-before-other-params.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-before-other-params.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-elided-lifetime.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-elided-lifetime.min.stderr Introduce ReError 2023-02-09 10:26:49 +00:00
const-param-elided-lifetime.rs Introduce ReError 2023-02-09 10:26:49 +00:00
const-param-in-async.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-type-depends-on-const-param.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-type-depends-on-const-param.min.stderr defer array len printing to const arg printing 2023-01-18 04:07:39 +00:00
const-param-type-depends-on-const-param.rs defer array len printing to const arg printing 2023-01-18 04:07:39 +00:00
const-param-type-depends-on-type-param-ungated.rs Remove save-analysis. 2023-02-16 15:14:45 +11:00
const-param-type-depends-on-type-param-ungated.stderr Remove save-analysis. 2023-02-16 15:14:45 +11:00
const-param-type-depends-on-type-param.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-type-depends-on-type-param.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-param-type-depends-on-type-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-parameter-uppercase-lint.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const-parameter-uppercase-lint.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
const_trait_fn-issue-88433.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
core-types.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
cross_crate_complex.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
deref-into-array-generic.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
different_generic_args.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
different_generic_args.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
different_generic_args.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
different_generic_args_array.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
different_generic_args_array.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
dont-evaluate-array-len-on-err-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
dont-evaluate-array-len-on-err-1.stderr defer array len printing to const arg printing 2023-01-18 04:07:39 +00:00
dyn-supertraits.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ensure_is_evaluatable.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ensure_is_evaluatable.stderr Specify what 'this' actually is 2023-02-21 05:21:07 +00:00
enum-variants.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
exhaustive-value.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
exhaustive-value.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
expose-default-substs-param-env.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-generic.adt_const_params.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-generic.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
float-generic.simple.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-call.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-call.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-call.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-infer.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-infer.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn-const-param-infer.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn_with_two_const_inputs.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
fn_with_two_const_inputs.stderr Specify what 'this' actually is 2023-02-21 05:21:07 +00:00
fn_with_two_same_const_inputs.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
forbid-non-structural_match-types.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
forbid-non-structural_match-types.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
foreign-item-const-parameter.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
foreign-item-const-parameter.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
generic-param-mismatch.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
generic-param-mismatch.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ice-68875.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ice-68875.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ice-const-generic-function-return-ty.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ice-const-generic-function-return-ty.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
impl-const-generic-struct.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
incorrect-number-of-const-args.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
incorrect-number-of-const-args.stderr diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
infer_arg_from_pat.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
infer_arr_len_from_pat.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
inhabited-assoc-ty-ice-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
inhabited-assoc-ty-ice-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
integer-literal-generic-arg-in-where-clause.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
intrinsics-type_name-as-const-argument.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
intrinsics-type_name-as-const-argument.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invalid-const-arg-for-type-param.rs diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
invalid-const-arg-for-type-param.stderr diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
invalid-constant-in-args.rs diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
invalid-constant-in-args.stderr diagnostics: remove inconsistent English article "this" from E0107 2023-02-23 10:27:06 -07:00
invalid-enum.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invalid-enum.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invariant.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
invariant.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-46511.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-46511.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-66451.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-66451.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-70408.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80471.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-80471.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-93647.rs Move const trait bounds checks to MIR constck 2023-03-28 08:39:55 +00:00
issue-93647.stderr Move const trait bounds checks to MIR constck 2023-03-28 08:39:55 +00:00
issue-97007.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-102124.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-105689.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-106419-struct-with-multiple-const-params.rs Added UI test case for issue #106419 2023-01-19 15:39:05 +01:00
legacy-const-generics-bad.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
legacy-const-generics-bad.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
legacy-const-generics.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
nested-type.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
nested-type.min.stderr add predicate evaluation logic 2023-02-17 09:32:39 +00:00
nested-type.rs fixup tests wrt new normalization 2023-04-28 11:56:02 +00:00
outer-lifetime-in-const-generic-default.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
outer-lifetime-in-const-generic-default.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overlapping_impls.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
params-in-ct-in-ty-param-lazy-norm.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
params-in-ct-in-ty-param-lazy-norm.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
params-in-ct-in-ty-param-lazy-norm.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
parent_generics_of_encoding.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
parent_generics_of_encoding_impl_trait.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
parent_generics_of_encoding_impl_trait.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
projection-as-arg-const.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
projection-as-arg-const.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
promotion.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param-deref.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param-deref.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param-deref.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
raw-ptr-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-const-param-mismatch.full.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-const-param-mismatch.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-const-param-mismatch.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
sneaky-array-repeat-expr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
sneaky-array-repeat-expr.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
struct-with-invalid-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
struct-with-invalid-const-param.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
suggest_const_for_array.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
suggest_const_for_array.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
trait-const-args.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
transmute-const-param-static-reference.min.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
transmute-const-param-static-reference.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
transmute-fail.rs Add feature gate 2023-04-07 11:18:07 -07:00
transmute-fail.stderr Add feature gate 2023-04-07 11:18:07 -07:00
transmute.rs Add feature gate 2023-04-07 11:18:07 -07:00
transmute_no_gate.rs Add feature gate 2023-04-07 11:18:07 -07:00
transmute_no_gate.stderr Add feature gate 2023-04-07 11:18:07 -07:00
transparent-maybeunit-array-wrapper.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
try_unify_ignore_lifetimes.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
two_matching_preds.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
type-after-const-ok.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
type_mismatch.rs Use param's real type in try_eval_lit_or_param 2023-03-09 20:49:11 +00:00
type_mismatch.stderr Note type mismatch on ConstArgHasType 2023-03-23 19:09:34 +00:00
type_not_in_scope.rs Use param's real type in try_eval_lit_or_param 2023-03-09 20:49:11 +00:00
type_not_in_scope.stderr Use param's real type in try_eval_lit_or_param 2023-03-09 20:49:11 +00:00
type_of_anon_const.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
types-mismatch-const-args.full.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
types-mismatch-const-args.min.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
types-mismatch-const-args.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unify_with_nested_expr.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unify_with_nested_expr.stderr Specify what 'this' actually is 2023-02-21 05:21:07 +00:00
uninferred-consts-during-codegen-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
uninferred-consts-during-codegen-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unknown_adt.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unknown_adt.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused-const-param.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused-type-param-suggestion.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused-type-param-suggestion.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused_braces.fixed Fix unused_braces on generic const expr macro call 2023-01-14 15:49:08 +00:00
unused_braces.full.fixed Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused_braces.min.fixed Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unused_braces.rs Fix unused_braces on generic const expr macro call 2023-01-14 15:49:08 +00:00
unused_braces.stderr Fix unused_braces on generic const expr macro call 2023-01-14 15:49:08 +00:00
where-clauses.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
wrong-normalization.rs Add test for implementation on projection 2023-02-10 14:44:54 +01:00
wrong-normalization.stderr Tighter spans for bad inherent impl types 2023-02-13 18:41:18 +00:00