about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2024-03-05Avoid using feed_unit_query from within queriesOli Scherer-3/+7
2024-03-05Remove a use of feed_local_crate and make it fail if used within queriesOli Scherer-1/+8
2024-03-05Change message type in bug functions.Nicholas Nethercote-3/+4
From `impl Into<DiagnosticMessage>` to `impl Into<Cow<'static, str>>`. Because these functions don't produce user-facing output and we don't want their strings to be translated.
2024-03-05Prevent feeding `CRATE_DEF_ID` queries outside the resolverOli Scherer-2/+10
2024-03-05Prevent leaking `Feed`s into query resultsOli Scherer-0/+8
2024-03-05Get rid of `feed_local_def_id`Oli Scherer-4/+5
2024-03-05Keep `TyCtxtFeed` around longer in the resolverOli Scherer-1/+37
2024-03-05Avoid invoking the `intrinsic` query for DefKinds other than `Fn` or `AssocFn`Oli Scherer-7/+11
2024-03-05Auto merge of #121780 - nnethercote:diag-renaming2, r=davidtwcobors-26/+20
Diagnostic renaming 2 A sequel to #121489. r? `@davidtwco`
2024-03-05Rename `BuiltinLintDiagnostics` as `BuiltinLintDiag`.Nicholas Nethercote-2/+2
Not the dropping of the trailing `s` -- this type describes a single diagnostic and its name should be singular.
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-24/+18
2024-03-05Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelixbors-6/+33
Add a scheme for moving away from `extern "rust-intrinsic"` entirely All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic. This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic. cc https://github.com/rust-lang/rust/issues/63585 follow-up to #120500 MCP at https://github.com/rust-lang/compiler-team/issues/720
2024-03-04Rollup merge of #121969 - nnethercote:ParseSess-cleanups, r=wesleywiserMatthias Krüger-1/+1
`ParseSess` cleanups The main change here is to rename all `ParseSess` values as `psess`. Plus a few other small cleanups. r? `@wesleywiser`
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-1/+1
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-03-04make `intrinsic` query legal for any `DefId`Oli Scherer-0/+4
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-1/+6
2024-03-04Return a struct from `query intrinsic` to be able to add another field in ↵Oli Scherer-7/+14
the next commit
2024-03-04Add `is_intrinsic` helperOli Scherer-0/+11
2024-03-04Allow a way to add constructors for rustc_type_ir typesMichael Goulet-22/+27
2024-03-04Rollup merge of #121927 - Zoxc:print-no-query, r=estebankMatthias Krüger-8/+18
Add a proper `with_no_queries` to printing
2024-03-03Add a proper `with_no_queries` to printingJohn Kåre Alsaker-8/+18
2024-03-03Rollup merge of #121917 - GuillaumeGomez:pattern-complexity_limit.rs, ↵Guillaume Gomez-2/+9
r=Nadrieril Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching Needed for https://github.com/rust-lang/rust-analyzer/issues/9528. This PR adds a new attribute only available when running rust testsuite called `pattern_complexity` which allows to set the maximum recursion for the pattern matching. It is quite useful to ensure the complexity doesn't grow, like in `tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs`. r? `@Nadrieril`
2024-03-03Add new `pattern_complexity` attribute to add possibility to limit and check ↵Guillaume Gomez-2/+9
recursion in pattern matching
2024-03-02Rollup merge of #121841 - tgross35:f16-f128-step2-intrinsics, r=compiler-errorsGuillaume Boisseau-0/+2
`f16` and `f128` step 2: intrinsics Continuation of https://github.com/rust-lang/rust/pull/121728, another portion of https://github.com/rust-lang/rust/pull/114607. This PR adds `f16` and `f128` intrinsics, and hooks them up to both HIR and LLVM. This is all still unexposed to the frontend, which will probably be the next step. Also update itanium mangling per `@rcvalle's` in https://github.com/rust-lang/rust/pull/121728/files#r1506570300, and fix a typo from step 1. Once these types are usable in code, I will add the codegen tests from #114607 (codegen is passing on that branch) This does add more `unimplemented!`s to Clippy, but I still don't think we can do better until library support is added. r? `@compiler-errors` cc `@Nilstrieb` `@rustbot` label +T-compiler +F-f16_and_f128
2024-03-01Rollup merge of #121497 - lcnr:coherence-suggest-increasing-recursion-limit, ↵Matthias Krüger-10/+20
r=compiler-errors `-Znext-solver=coherence`: suggest increasing recursion limit r? `@compiler-errors`
2024-03-01Add `f16` and `f128` to the ASTTrevor Gross-0/+2
2024-03-01Rollup merge of #121416 - veera-sivarajan:bugfix-120785, r=nnethercoteMatthias Krüger-0/+24
Improve error messages for generics with default parameters Fixes #120785 Issue: Previously, all type parameters with default types were deliberately ignored to simplify error messages. For example, an error message for Box type would display `Box<T>` instead of `Box<T, _>`. But, this resulted in unclear error message when a concrete type was used instead of the default type. Fix: This PR fixes it by checking if a concrete type is specified after a default type to display the entire type name or the simplified type name.
2024-03-01Use FxIndexMap instead FxHashMap to stabilize iteration order in ↵Michael Woerister-5/+4
EffectiveVisibilities. Part of https://github.com/rust-lang/compiler-team/issues/533
2024-03-01Auto merge of #121462 - compiler-errors:eq-and-sub, r=lcnrbors-70/+33
Combine `Sub` and `Equate` Combine `Sub` and `Equate` into a new relation called `TypeRelating` (that name sounds familiar...) Tracks the difference between `Sub` and `Equate` via `ambient_variance: ty::Variance` much like the `NllTypeRelating` relation, but implemented slightly jankier because it's a more general purpose relation. r? lcnr
2024-03-01Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errorsbors-1/+11
Add stubs in IR and ABI for `f16` and `f128` This is the very first step toward the changes in https://github.com/rust-lang/rust/pull/114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary. These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`. The next steps will probably be AST support with parsing and the feature gate. r? `@compiler-errors` cc `@Nilstrieb` suggested breaking the PR up in https://github.com/rust-lang/rust/pull/120645#issuecomment-1925900572
2024-03-01Fallout from removing a_is_expectedMichael Goulet-59/+27
2024-03-01Remove causeMichael Goulet-11/+6
2024-02-29Rollup merge of #121782 - RalfJung:mutable-ref-in-static, r=oli-obkMatthias Krüger-1/+0
allow statics pointing to mutable statics Fixes https://github.com/rust-lang/rust/issues/120450 for good. We can even simplify our checks: no need to specifically go looking for mutable references in const, we can just reject any reference that points to something mutable. r? `@oli-obk`
2024-02-29Rollup merge of #121669 - nnethercote:count-stashed-errs-again, r=estebankGuillaume Gomez-11/+13
Count stashed errors again Stashed diagnostics are such a pain. Their "might be emitted, might not" semantics messes with lots of things. #120828 and #121206 made some big changes to how they work, improving some things, but still leaving some problems, as seen by the issues caused by #121206. This PR aims to fix all of them by restricting them in a way that eliminates the "might be emitted, might not" semantics while still allowing 98% of their benefit. Details in the individual commit logs. r? `@oli-obk`
2024-02-29Rollup merge of #121376 - Nadrieril:mir-half-ranges, r=pnkfelixGuillaume Gomez-16/+2
Skip unnecessary comparison with half-open range patterns This is the last remaining detail in the implementation of half-open range patterns. Until now, a half-open range pattern like `10..` was converted to `10..T::MAX` before lowering to MIR, which generated an extra pointless comparison. With this PR we don't generate it.
2024-02-29distinguish recursion limit based overflow for diagnosticslcnr-10/+20
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
2024-02-29allow statics pointing to mutable staticsRalf Jung-1/+0
2024-02-28Avoid code duplicationVeera-10/+7
2024-02-28Improve error messages for generics with default parametersVeera-0/+27
Fixes #120785
2024-02-29Overhaul how stashed diagnostics work, again.Nicholas Nethercote-15/+13
Stashed errors used to be counted as errors, but could then be cancelled, leading to `ErrorGuaranteed` soundness holes. #120828 changed that, closing the soundness hole. But it introduced other difficulties because you sometimes have to account for pending stashed errors when making decisions about whether errors have occured/will occur and it's easy to overlook these. This commit aims for a middle ground. - Stashed errors (not warnings) are counted immediately as emitted errors, avoiding the possibility of forgetting to consider them. - The ability to cancel (or downgrade) stashed errors is eliminated, by disallowing the use of `steal_diagnostic` with errors, and introducing the more restrictive methods `try_steal_{modify,replace}_and_emit_err` that can be used instead. Other things: - `DiagnosticBuilder::stash` and `DiagCtxt::stash_diagnostic` now both return `Option<ErrorGuaranteed>`, which enables the removal of two `delayed_bug` calls and one `Ty::new_error_with_message` call. This is possible because we store error guarantees in `DiagCtxt::stashed_diagnostics`. - Storing the guarantees also saves us having to maintain a counter. - Calls to the `stashed_err_count` method are no longer necessary alongside calls to `has_errors`, which is a nice simplification, and eliminates two more `span_delayed_bug` calls and one FIXME comment. - Tests are added for three of the four fixed PRs mentioned below. - `issue-121108.rs`'s output improved slightly, omitting a non-useful error message. Fixes #121451. Fixes #121477. Fixes #121504. Fixes #121508.
2024-02-29Don't cancel stashed `OpaqueHiddenTypeMismatch` errors.Nicholas Nethercote-1/+5
This gives one extra error message on one test, but is necessary to fix bigger problems caused by the cancellation of stashed errors. (Note: why not just avoid stashing altogether? Because that resulted in additional output changes.)
2024-02-28Auto merge of #121489 - nnethercote:diag-renaming, r=davidtwcobors-63/+59
Diagnostic renaming Renaming various diagnostic types from `Diagnostic*` to `Diag*`. Part of https://github.com/rust-lang/compiler-team/issues/722. There are more to do but this is enough for one PR. r? `@davidtwco`
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-1/+11
Make changes necessary to support these types in the compiler.
2024-02-28Rollup merge of #121695 - oli-obk:split_ty_utils, r=compiler-errorsGuillaume Gomez-1/+2
Split rustc_type_ir to avoid rustc_ast from depending on it unblocks #121576 and resolves a FIXME in `rustc_ast`'s `Cargo.toml` The new crate is tiny, but it will get bigger in #121576
2024-02-28Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.Nicholas Nethercote-37/+37
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-26/+22
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-28Rename `Diagnostic` as `DiagInner`.Nicholas Nethercote-2/+2
I started by changing it to `DiagData`, but that didn't feel right. `DiagInner` felt much better.
2024-02-27Split rustc_type_ir to avoid rustc_ast from depending on itOli Scherer-1/+2
2024-02-27Print RPITIT like an opaqueMichael Goulet-8/+12
2024-02-27Document invariant in `thir::PatRange`Nadrieril-0/+2