about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/values.rs
AgeCommit message (Collapse)AuthorLines
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
2022-11-09Add domain size check to fix ICECameron Steffen-1/+2
2022-10-10Check representability in adt_sized_constraintCameron Steffen-13/+1
2022-10-07Rewrite representabilityCameron Steffen-5/+165
2022-09-06Make `HandleCycleError` an enum instead of a macro-generated closureJoshua Nelson-0/+54
- Add a `HandleCycleError` enum to rustc_query_system, along with a `handle_cycle_error` function - Move `Value` to rustc_query_system, so `handle_cycle_error` can use it - Move the `Value` impls from rustc_query_impl to rustc_middle. This is necessary due to orphan rules.