rust/tests/ui/const-generics
Matthias Krüger 13314df21b
Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix
Detect pub structs never constructed and unused associated constants

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Lints never constructed public structs.

If we don't provide public methods to construct public structs with private fields, and don't construct them in the local crate. They would be never constructed. So that we can detect such public structs.

---
Update:

Also lints unused associated constants in traits.
2024-06-07 20:14:28 +02:00
..
adt_const_params Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
array-impls
auxiliary
backcompat
defaults Detect pub structs never constructed and unused associated constants in traits 2024-06-05 23:20:09 +08:00
early
generic_arg_infer Partially implement ConstArgHasType 2024-05-29 17:06:54 +01:00
generic_const_exprs Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix 2024-06-07 20:14:28 +02:00
infer
issues Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
late-bound-vars make type_flags(ReError) & HAS_ERROR 2024-03-20 17:29:58 +00:00
min_const_generics
occurs-check add test for #97725 2024-03-22 17:12:43 +01:00
parser-error-recovery Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
std
type-dependent
apit-with-const-param.rs
arg-in-pat-1.rs
arg-in-pat-2.rs
arg-in-pat-3.rs
argument_order.rs
argument_order.stderr
array-wrapper-struct-ctor.rs
assoc_const_as_type_argument.rs
assoc_const_as_type_argument.stderr
assoc_const_eq_diagnostic.rs
assoc_const_eq_diagnostic.stderr
associated-type-bound-fail.rs
associated-type-bound-fail.stderr
associated-type-bound.rs
bad-const-generic-exprs.rs
bad-const-generic-exprs.stderr
bad-generic-in-copy-impl.rs
bad-generic-in-copy-impl.stderr
bad-subst-const-kind.rs Partially implement ConstArgHasType 2024-05-29 17:06:54 +01:00
bad-subst-const-kind.stderr Partially implement ConstArgHasType 2024-05-29 17:06:54 +01:00
broken-mir-1.rs
broken-mir-2.rs
cannot-infer-type-for-const-param.rs
coerce_unsized_array.rs
concrete-const-as-fn-arg.rs
concrete-const-impl-method.rs
condition-in-trait-const-arg.rs
const-arg-in-const-arg.min.stderr
const-arg-in-const-arg.rs Further cleanup cfgs in the UI test suite 2024-04-09 23:58:18 +02:00
const-arg-in-fn.rs
const-arg-type-arg-misordered.rs
const-arg-type-arg-misordered.stderr
const-argument-cross-crate-mismatch.rs
const-argument-cross-crate-mismatch.stderr
const-argument-cross-crate.rs
const-argument-if-length.full.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
const-argument-if-length.min.stderr
const-argument-if-length.rs
const-argument-non-static-lifetime.min.stderr
const-argument-non-static-lifetime.rs
const-fn-with-const-param.rs
const-generic-default-wont-borrowck.fixed Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
const-generic-default-wont-borrowck.rs Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
const-generic-default-wont-borrowck.stderr Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
const-generic-function.rs
const-generic-function.stderr
const-generic-type_name.rs
const-param-after-const-literal-arg.rs
const-param-before-other-params.rs
const-param-before-other-params.stderr
const-param-elided-lifetime.full.stderr
const-param-elided-lifetime.min.stderr
const-param-elided-lifetime.rs
const-param-in-async.rs
const-param-type-depends-on-const-param.full.stderr
const-param-type-depends-on-const-param.min.stderr
const-param-type-depends-on-const-param.rs
const-param-type-depends-on-type-param-ungated.rs
const-param-type-depends-on-type-param-ungated.stderr
const-param-type-depends-on-type-param.full.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
const-param-type-depends-on-type-param.min.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
const-param-type-depends-on-type-param.rs Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
const-param-with-additional-obligations.rs
const-param-with-additional-obligations.stderr
const-parameter-uppercase-lint.rs
const-parameter-uppercase-lint.stderr
const_trait_fn-issue-88433.rs
core-types.rs
cross_crate_complex.rs
default-ty-closure.rs
default-ty-closure.stderr
deref-into-array-generic.rs
different_generic_args.full.stderr
different_generic_args.min.stderr
different_generic_args.rs
different_generic_args_array.rs
different_generic_args_array.stderr
dont-evaluate-array-len-on-err-1.rs
dont-evaluate-array-len-on-err-1.stderr
dyn-supertraits.rs
dyn-supertraits.stderr
ensure_is_evaluatable.rs
ensure_is_evaluatable.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
enum-variants.rs
exhaustive-value.rs
exhaustive-value.stderr Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid 2024-03-27 14:02:15 +00:00
expose-default-substs-param-env.rs
float-generic.adt_const_params.stderr
float-generic.rs
float-generic.simple.stderr
fn-const-param-call.full.stderr
fn-const-param-call.min.stderr
fn-const-param-call.rs
fn-const-param-infer.full.stderr
fn-const-param-infer.min.stderr
fn-const-param-infer.rs
fn_with_two_const_inputs.rs
fn_with_two_const_inputs.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
fn_with_two_same_const_inputs.rs
forbid-non-structural_match-types.rs
forbid-non-structural_match-types.stderr
foreign-item-const-parameter.rs
foreign-item-const-parameter.stderr
generic-param-mismatch.rs
generic-param-mismatch.stderr
ice-68875.rs
ice-68875.stderr
ice-118285-fn-ptr-value.rs
ice-118285-fn-ptr-value.stderr
ice-const-generic-function-return-ty.rs
ice-const-generic-function-return-ty.stderr
ice-unexpected-inference-var-122549.rs add test for #122549 2024-03-21 20:36:13 +01:00
ice-unexpected-inference-var-122549.stderr add test for #122549 2024-03-21 20:36:13 +01:00
impl-const-generic-struct.rs
incorrect-number-of-const-args.rs
incorrect-number-of-const-args.stderr
infer_arg_from_pat.rs
infer_arr_len_from_pat.rs
inhabited-assoc-ty-ice-1.rs
inhabited-assoc-ty-ice-2.rs
integer-literal-generic-arg-in-where-clause.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
intrinsics-type_name-as-const-argument.min.stderr
intrinsics-type_name-as-const-argument.rs
invalid-const-arg-for-type-param.rs
invalid-const-arg-for-type-param.stderr
invalid-constant-in-args.rs
invalid-constant-in-args.stderr
invalid-enum.rs
invalid-enum.stderr
invariant.rs
invariant.stderr
issue-46511.rs
issue-46511.stderr
issue-66451.rs
issue-66451.stderr
issue-70408.rs
issue-80471.rs
issue-80471.stderr
issue-93647.rs
issue-93647.stderr
issue-97007.rs
issue-102124.rs
issue-105689.rs
issue-106419-struct-with-multiple-const-params.rs
issue-112505-overflow.rs
issue-112505-overflow.stderr
kind_mismatch.rs Don't ICE for kind mismatches during error rendering 2024-04-16 11:52:12 +00:00
kind_mismatch.stderr Don't ICE for kind mismatches during error rendering 2024-04-16 11:52:12 +00:00
legacy-const-generics-bad.rs
legacy-const-generics-bad.stderr
legacy-const-generics.rs
lifetime-in-const-param.rs
lifetime-in-const-param.stderr
lookup-method.rs only find segs chain for missing methods when no available candidates 2024-05-14 20:28:55 +08:00
lookup-method.stderr only find segs chain for missing methods when no available candidates 2024-05-14 20:28:55 +08:00
nested-type.full.stderr
nested-type.min.stderr
nested-type.rs
not_wf_param_in_rpitit.rs Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
not_wf_param_in_rpitit.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
opaque_types.rs Add some regression tests for opaque types and const generics 2024-04-04 15:02:27 +00:00
opaque_types.stderr Add some regression tests for opaque types and const generics 2024-04-04 15:02:27 +00:00
opaque_types2.rs Add some regression tests for opaque types and const generics 2024-04-04 15:02:27 +00:00
opaque_types2.stderr Add some regression tests for opaque types and const generics 2024-04-04 15:02:27 +00:00
outer-lifetime-in-const-generic-default.rs
outer-lifetime-in-const-generic-default.stderr
overlapping_impls.rs
params-in-ct-in-ty-param-lazy-norm.full.stderr
params-in-ct-in-ty-param-lazy-norm.min.stderr
params-in-ct-in-ty-param-lazy-norm.rs
parent_generics_of_encoding.rs
parent_generics_of_encoding_impl_trait.rs
parent_generics_of_encoding_impl_trait.stderr
projection-as-arg-const.rs
projection-as-arg-const.stderr
promotion.rs
raw-ptr-const-param-deref.full.stderr
raw-ptr-const-param-deref.min.stderr
raw-ptr-const-param-deref.rs
raw-ptr-const-param.full.stderr
raw-ptr-const-param.min.stderr
raw-ptr-const-param.rs
slice-const-param-mismatch.full.stderr
slice-const-param-mismatch.min.stderr
slice-const-param-mismatch.rs
slice-const-param.rs
sneaky-array-repeat-expr.rs
sneaky-array-repeat-expr.stderr
struct-with-invalid-const-param.rs
struct-with-invalid-const-param.stderr
suggest_const_for_array.rs
suggest_const_for_array.stderr
trait-const-args.rs
transmute-const-param-static-reference.min.stderr
transmute-const-param-static-reference.rs
transmute-fail.rs Sorting arbitrary constants should not be done, as it relies on DefId ordering, which breaks incremental compilation. 2024-03-21 10:45:30 +00:00
transmute-fail.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
transmute.rs Sorting arbitrary constants should not be done, as it relies on DefId ordering, which breaks incremental compilation. 2024-03-21 10:45:30 +00:00
transmute_no_gate.rs
transmute_no_gate.stderr
transparent-maybeunit-array-wrapper.rs Detect pub structs never constructed and unused associated constants in traits 2024-06-05 23:20:09 +08:00
try_unify_ignore_lifetimes.rs
two_matching_preds.rs
type-after-const-ok.rs
type_mismatch.rs
type_mismatch.stderr
type_not_in_scope.rs Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
type_not_in_scope.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
type_of_anon_const.rs
types-mismatch-const-args.full.stderr
types-mismatch-const-args.min.stderr
types-mismatch-const-args.rs
unify_with_nested_expr.rs
unify_with_nested_expr.stderr
uninferred-consts-during-codegen-1.rs
uninferred-consts-during-codegen-2.rs
unknown_adt.rs
unknown_adt.stderr
unused-const-param.rs
unused-type-param-suggestion.rs
unused-type-param-suggestion.stderr
unused_braces.fixed
unused_braces.full.fixed
unused_braces.min.fixed
unused_braces.rs
unused_braces.stderr
variant-discrimiant-no-generics.full.stderr
variant-discrimiant-no-generics.min.stderr
variant-discrimiant-no-generics.rs
where-clauses.rs
wrong-normalization.rs
wrong-normalization.stderr