about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/sty.rs
AgeCommit message (Collapse)AuthorLines
2025-08-13`fn new_coroutine_witness_for_coroutine` woopslcnr-0/+33
2025-08-13check args in new_coroutine_witnesslcnr-2/+5
2025-08-04drive-by cleanup: fix outdated documentationWaffle Lapkin-1/+1
2025-08-03Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnrbors-6/+0
Improve bound const handling A few changes to make const handling more similar to type handling. r? `@compiler-errors` -errors
2025-07-31Make const bound handling more like types/regions.Nicholas Nethercote-6/+0
Currently there is `Ty` and `BoundTy`, and `Region` and `BoundRegion`, and `Const` and... `BoundVar`. An annoying inconsistency. This commit repurposes the existing `BoundConst`, which was barely used, so it's the partner to `Const`. Unlike `BoundTy`/`BoundRegion` it lacks a `kind` field but it's still nice to have because it makes the const code more similar to the ty/region code everywhere. The commit also removes `impl From<BoundVar> for BoundTy`, which has a single use and doesn't seem worth it. These changes fix the "FIXME: We really should have a separate `BoundConst` for consts".
2025-07-31Fix up size asserts.Nicholas Nethercote-2/+2
- Put them in the module that defines the type. - Add some `WithCachedTypeInfo<T>` asserts for consistency.
2025-07-25Pre-intern some `TyKind::Bound` values.Nicholas Nethercote-1/+9
We already do the same thing for bound regions. This is a small perf win for the new trait solver.
2025-07-04Same for typesMichael Goulet-1/+1
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-1/+1
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-07-01Remove support for dyn*Michael Goulet-9/+1
2025-06-27Auto merge of #142223 - compiler-errors:perf-wf, r=lcnrbors-1/+47
Fast path for WF goals in new solver Hopefully self-explanatory.
2025-06-24Introduce trivial WF functions, use it in fast pathMichael Goulet-1/+47
2025-06-23Add note to find_const_ty_from_envMichael Goulet-3/+14
2025-06-16trait_sel: extend fast path with sized hierarchyDavid Wood-9/+17
Extend the fast path for `Sized` traits to include constness and `MetaSized`.
2025-06-16trait_sel: `{Meta,Pointee}Sized` on `?Sized` typesDavid Wood-1/+1
Expand the automatic implementation of `MetaSized` and `PointeeSized` so that it is also implemented on non-`Sized` types, just not `ty::Foreign` (extern type).
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-7/+7
2025-05-29Tweak fast path trait handlingMichael Goulet-4/+2
2025-05-18Fast path for sized predMichael Goulet-2/+2
2025-05-13Some require_lang_item -> is_lang_item replacementsOli Scherer-2/+1
2025-05-07Only include associated type bounds for Self:Sized associated types if they ↵Michael Goulet-1/+4
are provided
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-1/+1
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-129/+43
async_drop_in_place::{closure}, scoped async drop added.
2025-04-24Remove `weak` alias terminologyBoxy-1/+1
2025-04-22Use `is_lang_item` and `as_lang_item` instead of handrolling their logicOli Scherer-3/+1
2025-04-15Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obkStuart Cook-1/+1
Overhaul `AssocItem` `AssocItem` has multiple fields that only make sense some of the time. E.g. the `name` can be empty if it's an RPITIT associated type. It's clearer and less error prone if these fields are moved to the relevant `kind` variants. r? ``@fee1-dead``
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-1/+1
From `hir::AssocItem`.
2025-04-14Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obkbors-7/+7
re-use `Sized` fast-path There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance and was found to be beneficial in #137944. r? types
2025-04-12Move FlagComputation, PatternKind, and TypeWalker to rustc_type_irjackh726-0/+15
2025-04-09re-use sized fast pathDavid Wood-7/+7
There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance, particularly in anticipation of new sizedness traits being added which can take advantage of this.
2025-04-03Deduplicate some `rustc_middle` function bodies by calling the ↵Oli Scherer-44/+3
`rustc_type_ir` equivalent
2025-03-15Fold visit into tyMichael Goulet-2/+1
2025-03-01Rollup merge of #137763 - compiler-errors:ty-nits, r=BoxyUwUMatthias Krüger-1/+1
Use `mk_ty_from_kind` a bit less, clean up lifetime handling in borrowck r? ``@BoxyUwU`` Pulled out of my attempt to turn that `*const dyn Tr + '_` casting into a lint (which failed lmao)
2025-02-28Introduce `feature(generic_const_parameter_types)`Boxy-0/+1
2025-02-28Use mk_ty_from_kind a bit less, clean up lifetime handling in borrowckMichael Goulet-1/+1
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-3/+2
2025-02-22Rollup merge of #137333 - compiler-errors:edition-2024-fresh, r=NadrierilMatthias Krüger-1/+1
Use `edition = "2024"` in the compiler (redux) Most of this is binding mode changes, which I fixed by running `x.py fix`. Also adds some miscellaneous `unsafe` blocks for new unsafe standard library functions (the setenv ones), and a missing `unsafe extern` block in some enzyme codegen code, and fixes some precise capturing lifetime changes (but only when they led to errors). cc ``@ehuss`` ``@traviscross``
2025-02-22Fix binding mode problemsMichael Goulet-1/+1
2025-02-21Assert that we always construct dyn types with the right number of projectionsMichael Goulet-1/+29
2025-02-10Extend the renaming to coerce_unsafe_ptrBastian Kersting-1/+1
2025-02-10Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptrBastian Kersting-2/+2
The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method. This came up during the review of https://github.com/rust-lang/rust/pull/134424.
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-2/+2
2025-01-09Harden `Ty` constructors a bit in debug modeOli Scherer-2/+37
`Ty::new` wasn't used anywhere outside this module `Ty::new_adt` shouldn't ever be used for anything but adts. This hasn't caught any bugs, but seems good to check anyway
2025-01-09Rollup merge of #128110 - veera-sivarajan:bugfix-80173, r=cjgillotMatthias Krüger-1/+13
Suggest Replacing Comma with Semicolon in Incorrect Repeat Expressions Fixes #80173 This PR detects typos in repeat expressions like `["_", 10]` and `vec![String::new(), 10]` and suggests replacing comma with semicolon. Also, improves code in other place by adding doc comments and making use of a helper function to check if a type implements `Clone`. References: 1. For `vec![T; N]`: https://doc.rust-lang.org/std/macro.vec.html 2. For `[T; N]`: https://doc.rust-lang.org/std/primitive.array.html
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-1/+17
2024-12-21Suggest Semicolon in Incorrect Repeat ExpressionsVeera-1/+13
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-07Make `Copy` unsafe to implement for ADTs with `unsafe` fieldsJack Wrenn-5/+1
As a rule, the application of `unsafe` to a declaration requires that use-sites of that declaration also require `unsafe`. For example, a field declared `unsafe` may only be read in the lexical context of an `unsafe` block. For nearly all safe traits, the safety obligations of fields are explicitly discharged when they are mentioned in method definitions. For example, idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields will require `unsafe` to clone those fields. Prior to this commit, `Copy` violated this rule. The trait is marked safe, and although it has no explicit methods, its implementation permits reads of `Self`. This commit resolves this by making `Copy` conditionally safe to implement. It remains safe to implement for ADTs without unsafe fields, but unsafe to implement for ADTs with unsafe fields. Tracking: #132922
2024-12-05do not implement unsafe auto traits for types with unsafe fieldsJack Wrenn-0/+8
If a type has unsafe fields, its safety invariants are not simply the conjunction of its field types' safety invariants. Consequently, it's invalid to reason about the safety properties of these types in a purely structural manner — i.e., the manner in which `auto` traits are implemented. Makes progress towards #132922.
2024-11-09Add str to "expected primitive, found type" diagnosticZachary S-0/+1