about summary refs log tree commit diff
path: root/compiler/rustc_privacy/src
AgeCommit message (Collapse)AuthorLines
2025-09-26fix doc comments to be more standardMarijn Schouten-18/+4
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-1/+2
2025-08-02Auto merge of #144554 - cjgillot:no-hir-eff-vis, r=petrochenkovbors-101/+119
Use less HIR to compute effective visibility. r? `@ghost`
2025-08-02Use less HIR to compute effective visibility.Camille GILLOT-101/+119
2025-08-02Auto merge of #144479 - cjgillot:incr-privacy-mod, r=petrochenkovbors-13/+11
Perform check_private_in_public by module. Based on https://github.com/rust-lang/rust/pull/116316
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-3/+4
2025-07-28use let chains in mir, resolve, targetKivooeo-6/+5
2025-07-27Do not fetch spans if not required.Camille GILLOT-2/+4
2025-07-27Parallelize check_private_in_public.Camille GILLOT-9/+5
2025-07-26Perform check_private_in_public by module.Camille GILLOT-2/+2
2025-07-24Rollup merge of #144276 - cjgillot:no-hir-privacy, r=petrochenkovLeón Orell Valerian Liehr-77/+45
Use less HIR in check_private_in_public. r? ````````@petrochenkov````````
2025-07-22Use less HIR in check_private_in_public.Camille GILLOT-77/+45
2025-07-17Do not check privacy for RPITIT.Camille GILLOT-0/+8
2025-07-15Implement other logicstiif-0/+1
2025-07-13Retire hir::*ItemRef.Camille GILLOT-5/+5
2025-07-13Retire hir::ForeignItemRef.Camille GILLOT-4/+4
2025-07-13Remove hir::AssocItemKind.Camille GILLOT-88/+60
2025-05-30Reorder fields in `hir::ItemKind` variants.Nicholas Nethercote-10/+10
Specifically `TyAlias`, `Enum`, `Struct`, `Union`. So the fields match the textual order in the source code. The interesting part of the change is in `compiler/rustc_hir/src/hir.rs`. The rest is extremely mechanical refactoring.
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-3/+2
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-09don't depend on rustc_attr_parsing if rustc_data_structures will domejrs-3/+2
2025-04-28Rollup merge of #140249 - BoxyUwU:remove_weak_alias_terminology, r=oli-obkGuillaume Gomez-2/+2
Remove `weak` alias terminology I find the "weak" alias terminology to be quite confusing. It implies the existence of "strong" aliases (which do not exist) and I'm not really sure what about weak aliases is "weak". I much prefer "free alias" as the term. I think it's much more obvious what it means as "free function" is a well defined term that already exists in rust. It's also a little confusing given "weak alias" is already a term in linker/codegen spaces which are part of the compiler too. Though I'm not particularly worried about that as it's usually very obvious if you're talking about the type system or not lol. I'm also currently trying to write documentation about aliases and it's somewhat awkward/confusing to be talking about *weak* aliases, when I'm not really sure what the basis for that as the term actually *is*. I would also be happy to just find out there's a nice meaning behind calling them "weak" aliases :-) r? `@oli-obk` maybe we want a types MCP to decide on a specific naming here? or maybe we think its just too late to go back on this naming decision ^^'
2025-04-26convert some `GenericArg` to `Term`lcnr-1/+1
2025-04-24Remove `weak` alias terminologyBoxy-2/+2
2025-04-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-02Remove `recursion_limit` increases.Nicholas Nethercote-1/+0
These are no longer needed now that `Nonterminal` is gone.
2025-03-25privacy: Visit types and traits in impls in type privacy lintsVadim Petrochenkov-9/+31
2025-03-18Auto merge of #138630 - matthiaskrgr:rollup-kk1gogr, r=matthiaskrgrbors-11/+12
Rollup of 7 pull requests Successful merges: - #138384 (Move `hir::Item::ident` into `hir::ItemKind`.) - #138508 (Clarify "owned data" in E0515.md) - #138531 (Store test diffs in job summaries and improve analysis formatting) - #138533 (Only use `DIST_TRY_BUILD` for try jobs that were not selected explicitly) - #138556 (Fix ICE: attempted to remap an already remapped filename) - #138608 (rustc_target: Add target feature constraints for LoongArch) - #138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-18Move `hir::Item::ident` into `hir::ItemKind`.Nicholas Nethercote-11/+12
`hir::Item` has an `ident` field. - It's always non-empty for these item kinds: `ExternCrate`, `Static`, `Const`, `Fn`, `Macro`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`, Trait`, TraitAalis`. - It's always empty for these item kinds: `ForeignMod`, `GlobalAsm`, `Impl`. - For `Use`, it is non-empty for `UseKind::Single` and empty for `UseKind::{Glob,ListStem}`. All of this is quite non-obvious; the only documentation is a single comment saying "The name might be a dummy name in case of anonymous items". Some sites that handle items check for an empty ident, some don't. This is a very C-like way of doing things, but this is Rust, we have sum types, we can do this properly and never forget to check for the exceptional case and never YOLO possibly empty identifiers (or possibly dummy spans) around and hope that things will work out. The commit is large but it's mostly obvious plumbing work. Some notable things. - A similar transformation makes sense for `ast::Item`, but this is already a big change. That can be done later. - Lots of assertions are added to item lowering to ensure that identifiers are empty/non-empty as expected. These will be removable when `ast::Item` is done later. - `ItemKind::Use` doesn't get an `Ident`, but `UseKind::Single` does. - `lower_use_tree` is significantly simpler. No more confusing `&mut Ident` to deal with. - `ItemKind::ident` is a new method, it returns an `Option<Ident>`. It's used with `unwrap` in a few places; sometimes it's hard to tell exactly which item kinds might occur. None of these unwraps fail on the test suite. It's conceivable that some might fail on alternative input. We can deal with those if/when they happen. - In `trait_path` the `find_map`/`if let` is replaced with a loop, and things end up much clearer that way. - `named_span` no longer checks for an empty name; instead the call site now checks for a missing identifier if necessary. - `maybe_inline_local` doesn't need the `glob` argument, it can be computed in-function from the `renamed` argument. - `arbitrary_source_item_ordering::check_mod` had a big `if` statement that was just getting the ident from the item kinds that had one. It could be mostly replaced by a single call to the new `ItemKind::ident` method. - `ItemKind` grows from 56 to 64 bytes, but `Item` stays the same size, and that's what matters, because `ItemKind` only occurs within `Item`.
2025-03-16Suppress must_use in compiler and toolsMichael Goulet-7/+11
2025-03-13Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearthbors-3/+3
Rollup of 12 pull requests Successful merges: - #134076 (Stabilize `std::io::ErrorKind::InvalidFilename`) - #137504 (Move methods from Map to TyCtxt, part 4.) - #138175 (Support rmeta inputs for --crate-type=bin --emit=obj) - #138259 (Disentangle `ForwardGenericParamBan` and `ConstParamTy` ribs) - #138280 (fix ICE in pretty-printing `global_asm!`) - #138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138357 (merge `TypeChecker` and `TypeVerifier`) - #138394 (remove unnecessary variant) - #138403 (Delegation: one more ICE fix for `MethodCall` generation) - #138407 (Delegation: reject C-variadics) - #138409 (Use sa_sigaction instead of sa_union.__su_sigaction for AIX) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #137314 (change definitely unproductive cycles to error) - #137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`) - #138269 (uefi: fs: Implement FileType, FilePermissions and FileAttr) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138345 (Some autodiff cleanups) - #138387 (intrinsics: remove unnecessary leading underscore from argument names) - #138390 (fix incorrect tracing log) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Manish Goregaokar-1/+0
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? `````@jieyouxu`````
2025-03-12Rollup merge of #137504 - nnethercote:remove-Map-4, r=ZalatharManish Goregaokar-3/+3
Move methods from Map to TyCtxt, part 4. A follow-up to https://github.com/rust-lang/rust/pull/137350. r? ```@Zalathar```
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Matthias Krüger-1/+0
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? ````@jieyouxu````
2025-03-12Auto merge of #138083 - nnethercote:rm-NtItem-NtStmt, r=petrochenkovbors-0/+1
Remove `NtItem` and `NtStmt` Another piece of #124141. r? `@petrochenkov`
2025-03-12Convert a `kw::Empty` occurrence to `sym::dummy`.Nicholas Nethercote-3/+3
`adjust_ident_and_get_scope` returns the symbol it receives unchanged, and the call site ignores the returned symbol, so this symbol is unused.
2025-03-12Move methods from `Map` to `TyCtxt`, part 4.Nicholas Nethercote-3/+3
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-0/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-07Increase recursion_limit in numerous crates.Nicholas Nethercote-0/+1
This is temporarily needed for `x doc compiler` to work. They can be removed once the `Nonterminal` is removed (#124141).
2025-02-24Introduce new-style attribute parsers for several attributesJana Dönszelmann-1/+6
note: compiler compiles but librustdoc and clippy don't
2025-02-22Make asm a named fieldMichael Goulet-1/+1
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-4/+4
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-10/+10
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-01-31Make comma separated lists of anything easier to make for errorsEsteban Küber-19/+5
Provide a new function `listify`, meant to be used in cases similar to `pluralize!`. When you have a slice of arbitrary elements that need to be presented to the user, `listify` allows you to turn that into a list of comma separated strings. This reduces a lot of redundant logic that happens often in diagnostics.
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-8/+14
2025-01-18Emit a single privacy error for multiple fields on the same struct expressionEsteban Küber-49/+110
Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field. ``` error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private --> $DIR/visibility.rs:18:13 | LL | let _x = Alpha { | ----- in this type LL | beta: 0, | ^^^^^^^ private field LL | .. | ^^ field `gamma` is private ```
2025-01-18Add context on private fields that are not on the same line as the struct nameEsteban Küber-4/+36
``` error[E0451]: field `x` of struct `S` is private --> $DIR/visibility.rs:24:9 | LL | let a = baz::S { | ------ in this type LL | .. | ^^ field `x` is private ```