about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/values.rs
AgeCommit message (Collapse)AuthorLines
2025-04-27Use `search_for_cycle_permutation` to look for `variances_of`John Kåre Alsaker-12/+20
2025-03-26Avoiding calling queries when collecting active queriesJohn Kåre Alsaker-2/+2
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-1/+1
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-02-11Simplify intra-crate qualifiers.Nicholas Nethercote-1/+1
The following is a weird pattern for a file within `rustc_middle`: ``` use rustc_middle::aaa; use crate::bbb; ``` More sensible and standard would be this: ``` use crate::{aaa, bbb}; ``` I.e. we generally prefer using `crate::` to using a crate's own name. (Exceptions are things like in macros where `crate::` doesn't work because the macro is used in multiple crates.) This commit fixes a bunch of these weird qualifiers.
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-1/+7
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-1/+1
2024-12-13Rename ty_def_id so people will stop using it by accidentMichael Goulet-3/+3
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-1/+1
Stop reexporting ReprOptions from middle::ty
2024-10-02only query `params_in_repr` if def kind is adtbohan-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-09-17Fix circular fn_sig queries to return the correct number of arguments for ↵Jesse Rusak-1/+1
methods
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+9
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-12Use Variance glob import everywhereMichael Goulet-1/+1
2024-05-26Give EarlyBinder a tcx parameterMichael Goulet-3/+3
We are gonna need it to uplift EarlyBinder
2024-05-17Rename Unsafe to SafetySantiago Pastorino-1/+1
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-1/+1
2024-03-14make `Representability::Infinite` carry `ErrorGuaranteed`Lukas Markeffsky-4/+4
2024-03-07Merge collect_mod_item_types query into check_well_formedOli Scherer-0/+21
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-1/+1
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-10Rename consuming chaining methods on `DiagnosticBuilder`.Nicholas Nethercote-1/+1
In #119606 I added them and used a `_mv` suffix, but that wasn't great. A `with_` prefix has three different existing uses. - Constructors, e.g. `Vec::with_capacity`. - Wrappers that provide an environment to execute some code, e.g. `with_session_globals`. - Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`. The third case is exactly what we want, so this commit changes `DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`. Thanks to @compiler-errors for the suggestion.
2024-01-10Rename `struct_span_err!` as `struct_span_code_err!`.Nicholas Nethercote-3/+3
Because it takes an error code after the span. This avoids the confusing overlap with the `DiagCtxt::struct_span_err` method, which doesn't take an error code.
2024-01-08Last nitsMichael Goulet-9/+31
2024-01-08Make cycle error more resilient to where it startsMichael Goulet-62/+69
Also don't recomment recursive_async crate anymore Co-authored-by: lcnr <rust@lcnr.de>
2024-01-08Point out source of recursionMichael Goulet-7/+51
2024-01-08Don't check for recursion in generator witness fieldsMichael Goulet-5/+31
2024-01-08Value recovery can take the whole CycleErrorMichael Goulet-14/+34
2024-01-08Use chaining for `DiagnosticBuilder` construction and `emit`.Nicholas Nethercote-5/+5
To avoid the use of a mutable local variable, and because it reads more nicely.
2023-12-24Remove more `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-2/+3
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-1/+1
cleanup
2023-11-12make LayoutError::Cycle carry ErrorGuaranteedMichael Goulet-3/+2
2023-10-13Format all the let chains in compilerMichael Goulet-3/+7
2023-09-26Don't store lazyness in DefKindMichael Goulet-1/+1
2023-09-21Move `DepKind` to `rustc_query_system` and define it as `u16`John Kåre Alsaker-52/+20
2023-08-27More precisely detect cycle errors from type_of on opaqueMichael Goulet-0/+11
2023-08-27Pass ErrorGuaranteed to cycle errorMichael Goulet-12/+41
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+1
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-2/+2
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-2/+5
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-2/+2
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-2/+2
2023-05-02Avoid ICEing miri on layout query cyclesOli Scherer-0/+6
2023-04-21Allow `LocalDefId` as the argument to `def_path_str`Oli Scherer-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_miscMichael Goulet-2/+2
2023-02-17Fix ICE on type alias in recursionclubby789-2/+3
2023-01-14add EarlyBinder::subst_identity; impl ParameterizedOverTcx (needed for ↵Kyle Matsuda-0/+12
rustc_metadata) and Value for EarlyBinder
2022-12-23Use DepKind instead of &strgimbles-11/+12
2022-12-01Properly synthesize fn sig value during cycleMichael Goulet-5/+15