about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2024-03-05only set noalias on Box with the global allocatorRalf Jung-8/+33
2024-03-05Avoid using feed_unit_query from within queriesOli Scherer-1/+6
2024-03-05Remove a use of feed_local_crate and make it fail if used within queriesOli Scherer-0/+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-6/+10
2024-03-05Auto merge of #121780 - nnethercote:diag-renaming2, r=davidtwcobors-9/+7
Diagnostic renaming 2 A sequel to #121489. r? `@davidtwco`
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-9/+7
2024-03-05Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelixbors-4/+31
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-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-5/+12
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-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-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-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-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-36/+33
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-0/+1
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-22/+22
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-14/+11
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-0/+1
2024-02-27Print RPITIT like an opaqueMichael Goulet-8/+12
2024-02-27Auto merge of #121285 - nnethercote:delayed_bug-audit, r=lcnrbors-13/+24
Delayed bug audit I went through all the calls to `delayed_bug` and `span_delayed_bug` and found a few places where they could be avoided. r? `@compiler-errors`
2024-02-27Avoid `span_delayed_bug` on one path in `AdtDef::eval_explicit_discr`.Nicholas Nethercote-13/+24
Also change its return type to `Result`.
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-2/+1
2024-02-24Rollup merge of #121556 - GrigorenkoPV:addr_of, r=NilstriebMatthias Krüger-1/+1
Use `addr_of!` As per https://github.com/rust-lang/rust/pull/121303#discussion_r1500954662
2024-02-24compiler: use `addr_of!`Pavel Grigorenko-1/+1
2024-02-23compiler: clippy::complexity fixesMatthias Krüger-1/+1
2024-02-23Auto merge of #120730 - estebank:confusable-api, r=oli-obkbors-1/+1
Provide suggestions through `rustc_confusables` annotations Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` Fix #59450 (we can open subsequent tickets for specific cases). Fix #108437: ``` error[E0599]: `Option<{integer}>` is not an iterator --> f101.rs:3:9 | 3 | opt.flat_map(|val| Some(val)); | ^^^^^^^^ `Option<{integer}>` is not an iterator | ::: /home/gh-estebank/rust/library/core/src/option.rs:571:1 | 571 | pub enum Option<T> { | ------------------ doesn't satisfy `Option<{integer}>: Iterator` | = note: the following trait bounds were not satisfied: `Option<{integer}>: Iterator` which is required by `&mut Option<{integer}>: Iterator` help: you might have meant to use `and_then` | 3 | opt.and_then(|val| Some(val)); | ~~~~~~~~ ``` On type error of method call arguments, look at confusables for suggestion. Fix #87212: ``` error[E0308]: mismatched types --> f101.rs:8:18 | 8 | stuff.append(Thing); | ------ ^^^^^ expected `&mut Vec<Thing>`, found `Thing` | | | arguments to this method are incorrect | = note: expected mutable reference `&mut Vec<Thing>` found struct `Thing` note: method defined here --> /home/gh-estebank/rust/library/alloc/src/vec/mod.rs:2025:12 | 2025 | pub fn append(&mut self, other: &mut Self) { | ^^^^^^ help: you might have meant to use `push` | 8 | stuff.push(Thing); | ~~~~ ```
2024-02-22drive-by fmt cleanupEsteban Küber-1/+1
2024-02-22Rollup merge of #121441 - lcnr:typesystem-cleanup, r=compiler-errorsMatthias Krüger-2/+3
`DefId` to `LocalDefId`
2024-02-22Rollup merge of #121386 - oli-obk:no_higher_ranked_opaques, r=lcnrMatthias Krüger-4/+5
test that we do not support higher-ranked regions in opaque type inference We already do all the right checks in `check_opaque_type_parameter_valid`, and we have done so since at least 2 years. I collected the tests from https://github.com/rust-lang/rust/pull/116935 and https://github.com/rust-lang/rust/pull/100503 and added some more cc https://github.com/rust-lang/rust/issues/96146 r? `@lcnr`
2024-02-22`report_mismatch` did not actually report anymoreOli Scherer-1/+1
2024-02-22Avoid emitting type mismatches against `{type error}`Oli Scherer-3/+4