about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/stability.rs
AgeCommit message (Collapse)AuthorLines
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-2/+2
2025-09-12Introduce hir::ImplItemImplKindCameron Steffen-2/+1
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-11/+13
2025-08-10Auto merge of #144873 - cjgillot:implications, r=lqdbors-80/+31
Implement `stability_implications` without a visitor. Since https://github.com/rust-lang/rust/pull/143845, the `Annotator` visitor was a no-op when the crate is not staged_api. This PR avoids using a visitor altogether, making `stability_implications` truly a no-op in most cases.
2025-08-03Implement `stability_implications` without a visitor.Camille GILLOT-80/+31
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-16/+17
2025-07-28use let chains in mir, resolve, targetKivooeo-8/+8
2025-07-17Fix formatting.Camille GILLOT-6/+7
2025-07-17Correct comments.Camille GILLOT-4/+2
2025-07-17Include ErrorGuaranteed in StableSince::Err.Camille GILLOT-1/+1
2025-07-17Remove unuseful enums.Camille GILLOT-60/+16
2025-07-17Remove useless debugging.Camille GILLOT-2/+1
2025-07-17Integrate stable feature checking into a query.Camille GILLOT-29/+40
2025-07-17Retire stability_index query.Camille GILLOT-16/+12
2025-07-17Simplify annotator.Camille GILLOT-58/+30
2025-07-17Querify lookup_const_stability.Camille GILLOT-175/+109
2025-07-17Querify lookup_stability.Camille GILLOT-118/+107
2025-07-17Querify lookup_default_body_stability.Camille GILLOT-14/+18
2025-07-17Check for already stable features in check_attr.Camille GILLOT-25/+2
2025-07-17Check stability attributes are compatible in `check_unused_or_stable_features`.Camille GILLOT-163/+179
2025-07-17Querify lookup_deprecation_entry.Camille GILLOT-40/+39
2025-07-17Warn useless deprecation in check_attr.Camille GILLOT-14/+2
2025-07-15Make stability attribute not to error when unstable feature bound is in effecttiif-2/+30
2025-07-13Retire hir::*ItemRef.Camille GILLOT-2/+7
2025-07-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-1/+1
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-06-12Tracking the old name of renamed unstable library attributexizheyin-2/+9
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-30Reorder fields in `hir::ItemKind` variants.Nicholas Nethercote-1/+1
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-09don't depend on rustc_attr_parsing if rustc_data_structures will domejrs-12/+12
2025-04-03Make LevelAndSource a structOli Scherer-1/+1
2025-04-02Move methods from `Map` to `TyCtxt`, part 5.Nicholas Nethercote-2/+2
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
2025-03-18Move `hir::Item::ident` into `hir::ItemKind`.Nicholas Nethercote-3/+3
`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-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-02-27require trait impls to have matching const stabilities as the traitsDeadbeef-14/+46
2025-02-24Introduce new-style attribute parsers for several attributesJana Dönszelmann-17/+30
note: compiler compiles but librustdoc and clippy don't
2025-02-22Fix binding mode problemsMichael Goulet-5/+1
2025-02-21Move methods from Map to TyCtxt, part 3.Nicholas Nethercote-1/+1
Continuing the work from #137162. Every method gains a `hir_` prefix.
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-17Overhaul the `intravisit::Map` trait.Nicholas Nethercote-6/+6
First of all, note that `Map` has three different relevant meanings. - The `intravisit::Map` trait. - The `map::Map` struct. - The `NestedFilter::Map` associated type. The `intravisit::Map` trait is impl'd twice. - For `!`, where the methods are all unreachable. - For `map::Map`, which gets HIR stuff from the `TyCtxt`. As part of getting rid of `map::Map`, this commit changes `impl intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's fairly straightforward except various things are renamed, because the existing names would no longer have made sense. - `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named because it gets some HIR stuff from a `TyCtxt`. - `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`, because it's always `!` or `TyCtxt`. - `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`. I deliberately made the new trait and associated type names different to avoid the old `type Map: Map` situation, which I found confusing. We now have `type MaybeTyCtxt: HirTyCtxt`.
2025-02-09compiler: start using rustc_ast_lowering in rustc_passesJubilee Young-2/+3
2025-02-02rustc_allowed_through_unstable_modules: require deprecation messageRalf Jung-79/+75
2025-01-23`visit_x_unambig`Boxy-3/+3
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-7/+6
2025-01-15Rollup merge of #135003 - RalfJung:deprecate-allowed-through-unstable, ↵Guillaume Gomez-39/+97
r=davidtwco deprecate `std::intrinsics::transmute` etc, use `std::mem::*` instead The `rustc_allowed_through_unstable_modules` attribute lets users call `std::mem::transmute` as `std::intrinsics::transmute`. The former is a reexport of the latter, and for a long time we didn't properly check stability for reexports, so making this a hard error now would be a breaking change for little gain. But at the same time, `std::intrinsics::transmute` is not the intended path for this function, so I think it is a good idea to show a deprecation warning when that path is used. This PR implements that, for all the functions in `std::intrinsics` that carry the attribute. I assume this will need ``@rust-lang/libs-api`` FCP.
2025-01-15allowed_through_unstable_modules: support showing a deprecation message when ↵Ralf Jung-39/+97
the unstable module name is used
2025-01-14Enforce syntactical stability of const traits in HIRMichael Goulet-3/+33
2025-01-04turn hir::ItemKind::Fn into a named-field variantRalf Jung-1/+1
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-1/+1
2024-12-16split attributesJonathan Dönszelmann-9/+17
2024-11-20don't require const stability for const implsDeadbeef-10/+1