rust/tests/ui/privacy
bors 003a902792 Auto merge of #125958 - BoxyUwU:remove_const_ty, r=lcnr
Remove the `ty` field from type system `Const`s

Fixes #125556
Fixes #122908

Part of the work on `adt_const_params`/`generic_const_param_types`/`min_generic_const_exprs`/generally making the compiler nicer. cc rust-lang/project-const-generics#44

Please review commit-by-commit otherwise I wasted a lot of time not just squashing this into a giant mess (and also it'll be SO much nicer because theres a lot of fluff changes mixed in with other more careful changes if looking via File Changes

---

Why do this?
- The `ty` field keeps causing ICEs and weird behaviour due to it either being treated as "part of the const" or it being forgotten about leading to ICEs.
- As we move forward with `adt_const_params` and a potential `min_generic_const_exprs` it's going to become more complex to actually lower the correct `Ty<'tcx>`
- It muddles the idea behind how we check `Const` arguments have the correct type. By having the `ty` field it may seem like we ought to be relating it when we relate two types, or that its generally important information about the `Const`.
- Brings the compiler more in line with `a-mir-formality` as that also tracks the type of type system `Const`s via `ConstArgHasType` bounds in the env instead of on the `Const` itself.
- A lot of stuff is a lot nicer when you dont have to pass around the type of a const lol. Everywhere we construct `Const` is now significantly nicer 😅

See #125671's description for some more information about the `ty` field

---

General summary of changes in this PR:

- Add `Ty` to `ConstKind::Value` as otherwise there is no way to implement `ConstArgHasType` to ensure that const arguments are correctly typed for the parameter when we stop creating anon consts for all const args. It's also just incredibly difficult/annoying to thread the correct `Ty` around to a bunch of ctfe functions otherwise.
-  Fully implement `ConstArgHasType` in both the old and new solver. Since it now has no reliance on the `ty` field it serves its originally intended purpose of being able to act as a double check that trait vs impls have correctly typed const parameters. It also will now be able to be responsible for checking types of const arguments to parameters under `min_generic_const_exprs`.
- Add `Ty` to `mir::Const::Ty`. I dont have a great understanding of why mir constants are setup like this to be honest. Regardless they need to be able to determine the type of the const and the easiest way to make this happen was to simply store the `Ty` along side the `ty::Const`. Maybe we can do better here in the future but I'd have to spend way more time looking at everywhere we use `mir::Const`.
- rustdoc has its own `Const` which also has a `ty` field. It was relatively easy to remove this.

---

r? `@lcnr` `@compiler-errors`
2024-06-06 03:41:23 +00:00
..
auxiliary
pub-priv-dep
restricted
sealed-traits
associated-item-privacy-inherent.rs
associated-item-privacy-inherent.stderr
associated-item-privacy-trait.rs
associated-item-privacy-trait.stderr
associated-item-privacy-type-binding.rs
associated-item-privacy-type-binding.stderr
crate-private-reexport.rs
crate-private-reexport.stderr
ctor.rs
decl-macro-infinite-global-import-cycle-ice-64784.rs
decl-macro.rs
decl-macro.stderr
effective_visibilities.rs
effective_visibilities.stderr
effective_visibilities_full_priv.rs
effective_visibilities_full_priv.stderr
effective_visibilities_glob.rs
effective_visibilities_glob.stderr
effective_visibilities_invariants.rs
effective_visibilities_invariants.stderr
export-tag-variant.rs
export-tag-variant.stderr
generic_struct_field_projection.rs
impl-privacy-xc-2.rs
import-list-stem-visibility-issue-119126.rs
issue-11593.rs
issue-11593.stderr
issue-13641.rs
issue-13641.stderr
issue-17718-const-privacy.rs
issue-17718-const-privacy.stderr
issue-29161.rs
issue-29161.stderr
issue-30079.rs
issue-30079.stderr
issue-46209-private-enum-variant-reexport.rs
issue-46209-private-enum-variant-reexport.stderr
issue-57264-1.rs
issue-57264-2.rs
issue-75062-fieldless-tuple-struct.rs
issue-75062-fieldless-tuple-struct.stderr
issue-75906.rs
issue-75906.stderr
issue-75907.rs
issue-75907.stderr
issue-75907_b.rs
issue-75907_b.stderr
issue-79593.rs
issue-79593.stderr
issue-92755.rs
issue-111220-2-tuple-struct-fields-projection.rs
issue-111220-2-tuple-struct-fields-projection.stderr
issue-111220-tuple-struct-fields.rs
issue-111220-tuple-struct-fields.stderr
issue-113860-1.rs
issue-113860-1.stderr
issue-113860-2.rs
issue-113860-2.stderr
issue-113860.rs
issue-113860.stderr
issue-117997.rs
issue-119463.rs
issue-119463.stderr
legacy-ctor-visibility.rs
legacy-ctor-visibility.stderr
macro-private-reexport.rs
macro-private-reexport.stderr
priv-impl-prim-ty.rs
priv-in-bad-locations.rs
priv-in-bad-locations.stderr
privacy-in-paths.rs
privacy-in-paths.stderr
privacy-ns.rs
privacy-ns1.rs
privacy-ns1.stderr
privacy-ns2.rs
privacy-ns2.stderr
privacy-reexport.rs
privacy-sanity.rs
privacy-sanity.stderr
privacy-ufcs.rs
privacy-ufcs.stderr
privacy1-rpass.rs
privacy1.rs
privacy1.stderr
privacy2.rs
privacy2.stderr
privacy3.rs
privacy3.stderr
privacy4.rs
privacy4.stderr
privacy5.rs
privacy5.stderr
private-bounds-locally-allowed.rs
private-class-field.rs
private-field-ty-err.rs
private-field-ty-err.stderr
private-impl-method.rs
private-impl-method.stderr
private-in-public-assoc-ty.rs
private-in-public-assoc-ty.stderr
private-in-public-expr-pat.rs
private-in-public-ill-formed.rs
private-in-public-ill-formed.stderr
private-in-public-non-principal-2.rs
private-in-public-non-principal-2.stderr
private-in-public-non-principal.rs
private-in-public-non-principal.stderr
private-in-public-type-alias-impl-trait.rs
private-in-public-warn.rs
private-in-public-warn.stderr
private-in-public.rs
private-in-public.stderr
private-inferred-type-1.rs
private-inferred-type-1.stderr
private-inferred-type-2.rs
private-inferred-type-2.stderr
private-inferred-type-3.rs
private-inferred-type-3.stderr
private-inferred-type.rs
private-inferred-type.stderr
private-item-simple.rs
private-item-simple.stderr
private-method-cross-crate.rs
private-method-cross-crate.stderr
private-method-inherited.rs
private-method-inherited.stderr
private-method-rpass.rs
private-method.rs
private-method.stderr
private-struct-field-cross-crate.rs
private-struct-field-cross-crate.stderr
private-struct-field-ctor.rs
private-struct-field-ctor.stderr
private-struct-field-pattern.rs
private-struct-field-pattern.stderr
private-struct-field.rs
private-struct-field.stderr
private-type-in-interface.rs
private-type-in-interface.stderr
private-variant-reexport.rs
private-variant-reexport.stderr
projections.rs
projections.stderr
projections2.rs
projections2.stderr
pub-extern-privacy.rs
pub-use-xcrate.rs
pub_use_mods_xcrate_exe.rs
reachable-unnameable-items.rs
struct-field-type.rs
struct-field-type.stderr
suggest-box-new.rs
suggest-box-new.stderr
suggest-making-field-public.fixed
suggest-making-field-public.rs
suggest-making-field-public.stderr
ufc-method-call.different_name.stderr Add test description 2024-06-04 15:34:04 +00:00
ufc-method-call.rs Add test description 2024-06-04 15:34:04 +00:00
ufc-method-call.same_name.stderr Add test description 2024-06-04 15:34:04 +00:00
union-field-privacy-1.rs
union-field-privacy-1.stderr
union-field-privacy-2.rs
union-field-privacy-2.stderr
unnameable_types.rs
unnameable_types.stderr
unreachable-issue-121455.rs
unreachable-issue-121455.stderr
unresolved-trait-impl-item.rs
unresolved-trait-impl-item.stderr
useless-pub.rs
useless-pub.stderr
where-priv-type.rs Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
where-priv-type.stderr Bless tests and handle tests/crashes 2024-06-05 22:25:42 +01:00
where-pub-type-impls-priv-trait.rs
where-pub-type-impls-priv-trait.stderr
xc-private-method.rs
xc-private-method.stderr
xc-private-method2.rs
xc-private-method2.stderr