about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/generics.rs
AgeCommit message (Collapse)AuthorLines
2025-09-01Remove dead code stemming from an old effects desugaringLeón Orell Valerian Liehr-1/+1
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-1/+1
2025-03-26Remove `kw::Empty` uses from `rustc_middle`.Nicholas Nethercote-3/+1
There are several places in `rustc_middle` that check for an empty lifetime name. These checks appear to be totally unnecessary, because empty lifetime names aren't produced here. (Empty lifetime names *are* possible in `hir::Lifetime`. Perhaps there was some confusion between it and the `rustc_middle` types?) This commit removes the `kw::Empty` checks.
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-11-11Simplify some places that deal with generic parameter defaultsLeón Orell Valerian Liehr-2/+2
2024-10-26Effects cleanupDeadbeef-1/+0
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-24Implement const effect predicate in new solverMichael Goulet-0/+70
2024-10-24Remove associated type based effects logicMichael Goulet-16/+3
2024-10-23More compare_impl_item simplificationsMichael Goulet-1/+3
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-16Don't ICE when RPITIT captures more method args than trait definitionMichael Goulet-3/+5
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-06Stop unnecessarily taking GenericPredicates by &selfMichael Goulet-6/+6
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-07iter_identity is a better nameMichael Goulet-1/+1
2024-06-28implement new effects desugaringDeadbeef-1/+2
2024-06-18Uplift the new trait solverMichael Goulet-0/+4
2024-06-05Basic removal of `Ty` from places (boring)Boxy-10/+2
2024-05-27Rollup merge of #125597 - compiler-errors:early-binder, r=jackh726Guillaume Gomez-1/+1
Uplift `EarlyBinder` into `rustc_type_ir` We also need to give `EarlyBinder` a `'tcx` param, so that we can carry the `Interner` in the `EarlyBinder` too. This is necessary because otherwise we have an unconstrained `I: Interner` parameter in many of the `EarlyBinder`'s inherent impls. I also generally think that this is desirable to have, in case we later want to track some state in the `EarlyBinder`. r? lcnr
2024-05-27Auto merge of #125468 - BoxyUwU:remove_defid_from_regionparam, r=compiler-errorsbors-1/+1
Remove `DefId` from `EarlyParamRegion` Currently we represent usages of `Region` parameters via the `ReEarlyParam` or `ReLateParam` variants. The `ReEarlyParam` is effectively equivalent to `TyKind::Param` and `ConstKind::Param` (i.e. it stores a `Symbol` and a `u32` index) however it also stores a `DefId` for the definition of the lifetime parameter. This was used in roughly two places: - Borrowck diagnostics instead of threading the appropriate `body_id` down to relevant locations. Interestingly there were already some places that had to pass down a `DefId` manually. - Some opaque type checking logic was using the `DefId` field to track captured lifetimes I've split this PR up into a commit for generate rote changes to diagnostics code to pass around a `DefId` manually everywhere, and another commit for the opaque type related changes which likely require more careful review as they might change the semantics of lints/errors. Instead of manually passing the `DefId` around everywhere I previously tried to bundle it in with `TypeErrCtxt` but ran into issues with some call sites of `infcx.err_ctxt` being unable to provide a `DefId`, particularly places involved with trait solving and normalization. It might be worth investigating adding some new wrapper type to pass this around everywhere but I think this might be acceptable for now. This pr also has the effect of reducing the size of `EarlyParamRegion` from 16 bytes -> 8 bytes. I wouldn't expect this to have any direct performance improvement however, other variants of `RegionKind` over `8` bytes are all because they contain a `BoundRegionKind` which is, as far as I know, mostly there for diagnostics. If we're ever able to remove this it would shrink the `RegionKind` type from `24` bytes to `12` (and with clever bit packing we might be able to get it to `8` bytes). I am curious what the performance impact would be of removing interning of `Region`'s if we ever manage to shrink `RegionKind` that much. Sidenote: by removing the `DefId` the `Debug` output for `Region` has gotten significantly nicer. As an example see this opaque type debug print before vs after this PR: `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0, T, DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0])` `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])` r? `@compiler-errors` (I would like someone who understands the opaque type setup to atleast review the type system commit, but the rest is likely reviewable by anyone)
2024-05-26Give EarlyBinder a tcx parameterMichael Goulet-1/+1
We are gonna need it to uplift EarlyBinder
2024-05-25Auto merge of #124187 - compiler-errors:self-ctor, r=petrochenkovbors-28/+0
Warn (or error) when `Self` ctor from outer item is referenced in inner nested item This implements a warning `SELF_CONSTRUCTOR_FROM_OUTER_ITEM` when a self constructor from an outer impl is referenced in an inner nested item. This is a proper fix mentioned https://github.com/rust-lang/rust/pull/117246#discussion_r1374648388. This warning is additionally bumped to a hard error when the self type references generic parameters, since it's almost always going to ICE, and is basically *never* correct to do. This also reverts part of https://github.com/rust-lang/rust/pull/117246, since I believe this is the proper fix and we shouldn't need the helper functions (`opt_param_at`/`opt_type_param`) any longer, since they shouldn't really ever be used in cases where we don't have this problem.
2024-05-24Remove `DefId` from `EarlyParamRegion` (tedium/diagnostics)Boxy-1/+1
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-0/+8
generics' attributes
2024-05-18(Mostly) revert "Account for type param from other item in `note_and_explain`"Michael Goulet-28/+0
This mostly reverts commit 7449478c2f6fd2d72c12a51d8562f1e6108facab. It also removes an `opt_param_at` that really is unnecessary given our ICE policy for malformed intrinsics.
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-0/+6
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-12/+12
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-0/+1
2024-04-19Stop taking ParamTy/ParamConst/EarlyParamRegion/AliasTy by refMichael Goulet-4/+4
2024-04-08Actually create ranged int types in the type system.Oli Scherer-3/+3
2024-02-28Avoid code duplicationVeera-10/+7
2024-02-28Improve error messages for generics with default parametersVeera-0/+27
Fixes #120785
2024-02-12Dejargnonize substShoyu Vanilla-2/+2
2023-12-19rename to verbose-internalsjyn-2/+2
2023-12-10clean up leftover FIXMEDeadbeef-2/+4
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-8/+4
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-10filter out trailing effect param in `own_args_no_defaults`Deadbeef-0/+2
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-4/+8
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-14finish `RegionKind` renamelcnr-5/+5
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-10-27Account for type param from other item in `note_and_explain`Esteban Küber-0/+28
Fix #89868.
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-0/+4
2023-09-14treat host effect params as erased generics in codegenDeadbeef-2/+4
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-09-11add `is_host_effect` to `GenericParamDefKind::Const` and address reviewDeadbeef-3/+3
2023-07-17Rename arg_iter to iter_instantiatedMichael Goulet-1/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-22/+22
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-2/+2
2023-07-05Auto merge of #113210 - fee1-dead-contrib:effects-mvp, r=oli-obkbors-0/+3
Effects/keyword generics MVP This adds `feature(effects)`, which adds `const host: bool` to the generics of const functions, const traits and const impls. This will be used to replace the current logic around const traits. r? `@oli-obk`
2023-07-04include `host_effect_index` in `Generics`Deadbeef-0/+3