about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2024-06-21Rename a bunch of thingsMichael Goulet-34/+32
2024-06-21add as_ptr to trait AllocBytes, fix 2 impls; add pub fn ↵Strophox-3/+23
get_bytes_unchecked_raw in allocation.rs; add pub fn get_alloc_bytes_unchecked_raw[_mut] in memory.rs
2024-06-20More GVN for PtrMetadataScott McMurray-2/+4
`PtrMetadata` doesn't care about `*const`/`*mut`/`&`/`&mut`, so GVN away those casts in its argument. This includes updating MIR to allow calling PtrMetadata on references too, not just raw pointers. That means that `[T]::len` can be just `_0 = PtrMetadata(_1)`, for example. # Conflicts: # tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir # tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
2024-06-20Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgrbors-2/+6
Rollup of 7 pull requests Successful merges: - #126380 (Add std Xtensa targets support) - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s ) - #126659 (More status-quo tests for the `#[coverage(..)]` attribute) - #126711 (Make Option::as_[mut_]slice const) - #126717 (Clean up some comments near `use` declarations) - #126719 (Fix assertion failure for some `Expect` diagnostics.) - #126730 (Add opaque type corner case test) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-20Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxuMatthias Krüger-2/+6
Clean up some comments near `use` declarations #125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge. r? ``@lqd``
2024-06-20Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJungbors-35/+1
Stabilise `c_unwind` Fix #74990 Fix #115285 (that's also where FCP is happening) Marking as draft PR for now due to `compiler_builtins` issues r? `@Amanieu`
2024-06-20Auto merge of #126409 - pacak:incr-uplorry, r=michaelwoeristerbors-25/+9
Trying to address an incremental compilation issues This pull request contains two independent changes, one makes it so when `try_force_from_dep_node` fails to recover a query - it marks the node as "red" instead of "green" and the second one makes Debug impl for `DepNode` less panicky if it encounters something from the previous compilation that doesn't map to anything in the current one. I'm not 100% confident that this is the correct approach, but so far I managed to find a bunch of comments suggesting that some things are allowed to fail in a certain way and changes I made are allowing for those things to fail this way and it fixes all the small reproducers I managed to find. Compilation panic this pull request avoids is caused by an automatically generated code on an associated type and it is not happening if something else marks it as outdated first (or close like that, but scenario is quite obscure). Fixes https://github.com/rust-lang/rust/issues/107226 Fixes https://github.com/rust-lang/rust/issues/125367
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+2
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-20Convert some module-level `//` and `///` comments to `//!`.Nicholas Nethercote-2/+4
This makes their intent and expected location clearer. We see some examples where these comments were not clearly separate from `use` declarations, which made it hard to understand what the comment is describing.
2024-06-19Ban `ArrayToPointer` and `MutToConstPointer` from runtime MIRScott McMurray-2/+11
Apparently MIR borrowck cares about at least one of these for checking variance. In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing. (Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)
2024-06-19Stabilise c_unwindGary Guo-35/+1
2024-06-19local_def_path_hash_to_def_id can failMichael Baikov-25/+9
local_def_path_hash_to_def_id is used by Debug impl for DepNode and it looks for DefPathHash inside the current compilation. During incremental compilation we are going through nodes that belong to a previous compilation and might not be present and a simple attempt to print such node with tracing::debug (try_mark_parent_green does it for example) results in a otherwise avoidable panic Panic was added in https://github.com/rust-lang/rust/pull/82183, specifically in 2b60338ee9, with a comment "We only use this mapping for cases where we know that it must succeed.", but I'm not sure if this property holds when we traverse nodes from the old compilation in order to figure out if they are valid or not
2024-06-19Auto merge of #126679 - fmease:rollup-njrv2py, r=fmeasebors-4/+7
Rollup of 6 pull requests Successful merges: - #125447 (Allow constraining opaque types during subtyping in the trait system) - #125766 (MCDC Coverage: instrument last boolean RHS operands from condition coverage) - #125880 (Remove `src/tools/rust-demangler`) - #126154 (StorageLive: refresh storage (instead of UB) when local is already live) - #126572 (override user defined channel when using precompiled rustc) - #126662 (Unconditionally warn on usage of `wasm32-wasi`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-19Rollup merge of #126154 - RalfJung:storage-live, r=compiler-errorsLeón Orell Valerian Liehr-4/+7
StorageLive: refresh storage (instead of UB) when local is already live Blocked on [this FCP](https://github.com/rust-lang/rust/issues/99160#issuecomment-2155924538), which also contains the motivation. Fixes https://github.com/rust-lang/rust/issues/99160 Fixes https://github.com/rust-lang/rust/issues/98896 (by declaring it not-a-bug) Fixes https://github.com/rust-lang/rust/issues/119366 Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/129
2024-06-19Rollup merge of #126654 - tgross35:f16-f128-pretty-print, r=jackh726León Orell Valerian Liehr-1/+9
Make pretty printing for `f16` and `f128` consistent Currently the docs show e.g. {transmute(0xfffeffffffffffffffffffffffffffff): f128} for f128 constants. This should fix that to instead use apfloat for printing, as is done for `f32` and `f64`.
2024-06-19Rollup merge of #126594 - zetanumbers:fix-cross-crate-async-drop-glue, r=oli-obkLeón Orell Valerian Liehr-13/+43
Make async drop code more consistent with regular drop code Fixes #126573 Relates to #126482 r? ````@petrochenkov````
2024-06-18Make pretty printing for `f16` and `f128` consistentTrevor Gross-1/+9
Currently the docs show e.g. {transmute(0xfffeffffffffffffffffffffffffffff): f128} for f128 constants. This should fix that to instead use apfloat for printing, as is done for `f32` and `f64`.
2024-06-18Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnrbors-102/+448
Uplift next trait solver to `rustc_next_trait_solver` 🎉 There's so many FIXMEs! Sorry! Ideally this merges with the FIXMEs and we track and squash them over the near future. Also, this still doesn't build on anything other than rustc. I still need to fix `feature = "nightly"` in `rustc_type_ir`, and remove and fix all the nightly feature usage in the new trait solver (notably: let-chains). Also, sorry `@lcnr` I know you asked for me to separate the commit where we `mv rustc_trait_selection/solve/... rustc_next_trait_solver/solve/...`, but I had already done all the work by that point. Luckily, `git` understands the file moves so it should still be relatively reviewable. If this is still very difficult to review, then I can do some rebasing magic to try to separate this out. Please let me know! r? lcnr
2024-06-18Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwcobors-9/+11
Replace all `&DiagCtxt` with a `DiagCtxtHandle<'_>` wrapper type r? `@davidtwco` This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle Basically I will add a field to the `DiagCtxtHandle` that refers back to the `InferCtxt`'s (and others) `Option<ErrorHandled>`, allowing us to immediately taint these contexts when emitting an error and not needing manual tainting anymore (which is easy to forget and we don't do in general anyway)
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-1/+1
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-8/+10
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Fix transmute goalMichael Goulet-0/+4
2024-06-18Uplift the new trait solverMichael Goulet-84/+417
2024-06-18Uplift PredefinedOpaquesDataMichael Goulet-12/+6
2024-06-18Make SearchGraph fully genericMichael Goulet-18/+33
2024-06-18Rollup merge of #126583 - RalfJung:interpret-oom, r=saethlinGuillaume Gomez-2/+5
interpret: better error when we ran out of memory
2024-06-18Apply suggestions from oli-obk's reviewDaria Sukhonina-24/+11
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2024-06-18Make async drop code more consistent with regular drop codeDaria Sukhonina-9/+52
Fixes #126573
2024-06-17Rollup merge of #126567 - compiler-errors:instance-kind, r=oli-obk,lcnrMatthias Krüger-176/+176
Rename `InstanceDef` -> `InstanceKind` Renames `InstanceDef` to `InstanceKind`. The `Def` here is confusing, and makes it hard to distinguish `Instance` and `InstanceDef`. `InstanceKind` makes this more obvious, since it's really just describing what *kind* of instance we have. Not sure if this is large enough to warrant a types team MCP -- it's only 53 files. I don't personally think it does, but happy to write one if anyone disagrees. cc ``@rust-lang/types`` r? types
2024-06-17Remove an unused validation error variantOli Scherer-3/+0
2024-06-17interpret: better error when we ran out of memoryRalf Jung-2/+5
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-176/+176
2024-06-16Uplift OpaqueTypeKey too, use it in responseMichael Goulet-39/+3
2024-06-16Uplift ExternalConstraintDataMichael Goulet-27/+9
2024-06-16Make ExternalConstraints just carry outlivesMichael Goulet-2/+1
2024-06-16Uplift Reveal to rustc_type_irMichael Goulet-48/+1
2024-06-16Auto merge of #126505 - compiler-errors:no-vtable, r=lcnrbors-1/+14
Only compute vtable information during codegen This PR removes vtable information from the `Object` and `TraitUpcasting` candidate sources in the trait solvers, and defers the computation of relevant information to `Instance::resolve`. This is because vtables really aren't a thing in the trait world -- they're an implementation detail in codegen. Previously it was just easiest to tangle this information together since we were already doing the work of looking at all the supertraits in the trait solver, and specifically because we use traits to represent when it's possible to call a method via a vtable (`Object` candidate) and do upcasting (`Unsize` candidate). but I am somewhat suspicious we're doing a *lot* of extra work, especially in polymorphic contexts, so let's see what perf says.
2024-06-15Rollup merge of #126410 - RalfJung:smir-const-operand, r=oli-obkGuillaume Gomez-9/+9
smir: merge identical Constant and ConstOperand types The first commit renames the const operand visitor functions on regular MIR to match the type name, that was forgotten in the original rename. The second commit changes stable MIR, fixing https://github.com/rust-lang/project-stable-mir/issues/71. Previously there were two different smir types for the MIR type `ConstOperand`, one used in `Operand` and one in `VarDebugInfoContents`. Maybe we should have done this with https://github.com/rust-lang/rust/pull/125967, so there's only a single breaking change... but I saw that PR too late. Fixes https://github.com/rust-lang/project-stable-mir/issues/71
2024-06-15Auto merge of #126518 - matthiaskrgr:rollup-wb70rzq, r=matthiaskrgrbors-0/+14
Rollup of 9 pull requests Successful merges: - #125829 (rustc_span: Add conveniences for working with span formats) - #126361 (Unify intrinsics body handling in StableMIR) - #126417 (Add `f16` and `f128` inline ASM support for `x86` and `x86-64`) - #126424 ( Also sort `crt-static` in `--print target-features` output) - #126428 (Polish `std::path::absolute` documentation.) - #126429 (Add `f16` and `f128` const eval for binary and unary operationations) - #126448 (End support for Python 3.8 in tidy) - #126488 (Use `std::path::absolute` in bootstrap) - #126511 (.mailmap: Associate both my work and my private email with me) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-15Rollup merge of #126429 - tgross35:f16-f128-const-eval, r=RalfJungMatthias Krüger-0/+14
Add `f16` and `f128` const eval for binary and unary operationations Add const evaluation and Miri support for f16 and f128, including unary and binary operations. Casts are not yet included. Fixes https://github.com/rust-lang/rust/issues/124583 r? ``@RalfJung``
2024-06-15Rollup merge of #126469 - RalfJung:mir-shifts, r=scottmcmMatthias Krüger-2/+4
MIR Shl/Shr: the offset can be computed with rem_euclid r? ````@scottmcm````
2024-06-15Rollup merge of #126354 - compiler-errors:variance, r=lcnrMatthias Krüger-2/+1
Use `Variance` glob imported variants everywhere Fully commit to using the globbed variance. Could be convinced the other way, and change this PR to not use the globbed variants anywhere, but I'd rather we do one or the other. r? lcnr
2024-06-14Only compute vtable information during codegenMichael Goulet-1/+14
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-19/+19
2024-06-14Add TyCtxt::is_lang_itemMichael Goulet-0/+4
2024-06-14Enable const evaluation for `f16` and `f128`Trevor Gross-0/+14
This excludes casting, which needs more tests.
2024-06-14MIR Shl/Shr: the offset can be computed with rem_euclidRalf Jung-2/+4
2024-06-14Rollup merge of #123962 - oli-obk:define_opaque_types5, r=lcnrMatthias Krüger-1/+1
change method resolution to constrain hidden types instead of rejecting method candidates Some of these are in probes and may affect inference. This is therefore a breaking change. This allows new code to compile on stable: ```rust trait Trait {} impl Trait for u32 {} struct Bar<T>(T); impl Bar<u32> { fn foo(self) {} } fn foo(x: bool) -> Bar<impl Sized> { if x { let x = foo(false); x.foo(); //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so } todo!() } ``` r? ```````@compiler-errors``````` fixes #121404 cc https://github.com/rust-lang/rust/issues/116652
2024-06-13Address nitsMichael Goulet-4/+8
- Remove the ValuePairs glob import - Make DummyPairs -> ValuePairs::Dummy and make it bug more - Fix WC - Make interner return `impl IntoIterator`s
2024-06-13MIR visitor: constant -> const_operandRalf Jung-9/+9