about summary refs log tree commit diff
path: root/compiler/stable_mir/src
AgeCommit message (Collapse)AuthorLines
2025-07-14rename `stable_mir` to `rustc_public`, and `rustc_smir` to `rustc_public_bridge`Makai-10811/+0
2025-07-09Add opaque TypeId handles for CTFEOli Scherer-0/+6
2025-07-06move `stable_mir` back to its own crate and move `rustc_internal` to ↵Makai-6/+10800
the`stable_mir` crate As part of this reorganization, some traits need to be moved from `rustc_smir::context::traits` to `stable_mir::unstable::internal_cx`. These traits are specifically designed for `InternalCx` to clarify the behavior of different functions that share the same name. This move is necessary to avoid orphan rule violations.
2025-04-30Change rustc_driver dependency on stable_mir crateCelina G. Val-0/+4
This fixes issues with RustAnalyzer not finding stable_mir crate. It is also part of the long term architecture plan for these crates, since we are moving towards having stable_mir depend on rustc_smir and not the other way around. I believe this is an utility function that will come handy eventually for stable_mir users, but I'm keeping it as part of rustc_internal since it initializes the StableMir context and requires `TyCtxt`. Finally, I added the rustc_internal crate under a feature since the APIs from this module shall not be stabilized.
2025-04-05let `rustc_smir` host `stable_mir` for refactoringMakai-5694/+5
2025-04-05Rollup merge of #138826 - makai410:assoc-items, r=celinvalStuart Cook-7/+102
StableMIR: Add `associated_items`. Resolves: https://github.com/rust-lang/project-stable-mir/issues/87
2025-04-01Implement `associated_items` api.makai410-7/+102
2025-03-28use `try_fold` instead of `fold`Yotam Ofek-3/+2
2025-03-22Rollup merge of #138536 - makai410:mut-mir-visitor, r=celinvalMatthias Krüger-332/+428
stable_mir: Add `MutMirVisitor` Resolves: [rust-lang/project-stable-mir#81](https://github.com/rust-lang/project-stable-mir/issues/81). I am unsure if we should add a `MutableBody` like Kani did. Currently, I use `&mut Body` in `MutMirVisitor::visit_body()`. r? ``````@celinval``````
2025-03-18Add `MutMirVisitor`makai410-332/+428
Implement `make_mir_visitor` macro to generate `MirVisitor` and `MutMirVisitor`. Add `ret_local_mut()`, `arg_locals_mut()` and `inner_locals_mut()` to `Body`, specifically for `MutMirVisitor`.
2025-03-09Rollup merge of #138040 - thaliaarchi:use-prelude-size-of.compiler, ↵Matthias Krüger-2/+2
r=compiler-errors compiler: Use `size_of` from the prelude instead of imported Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. Apply this change across the compiler. These functions were added to all preludes in Rust 1.80. r? ``@compiler-errors``
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-2/+2
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-03-04Make CrateItem::body() function return an optionCelina G. Val-5/+16
When we initially created `CrateItem`, it would only represent items that contain a body. That is no longer the case, for now, make this explicit by expanding the APIs to retrieve the item body. This is related to https://github.com/rust-lang/project-stable-mir/issues/34
2025-03-02Remove duplication in `name`/`trimmed_anem` docsNotLebedev-8/+3
Reference `DefId` in `CrateDef` docs to avoid duplicating long description of `trimmed_name`
2025-03-02Replace usages of `Context.def_name`NotLebedev-8/+3
Use `DefId.name` and `DefId.trimmed_name` instead
2025-03-02Add name and trimmed_name methods to DefIdNotLebedev-0/+21
2025-02-24change smir attributes getters to only support tool attributesJana Dönszelmann-12/+18
2025-02-23Rollup merge of #137448 - compiler-errors:control-flow-oops, r=scottmcmJacob Pratt-1/+1
Fix bugs due to unhandled `ControlFlow` in compiler Well, one bug and one nit.
2025-02-22Fix bugs due to unhandled ControlFlowMichael Goulet-1/+1
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-2/+2
2025-02-20Remove `BackendRepr::Uninhabited`, replaced with an `uninhabited: bool` ↵Zachary S-5/+1
field in `LayoutData`. Also update comments that refered to BackendRepr::Uninhabited.
2025-02-10Extend the renaming to coerce_unsafe_ptrBastian Kersting-1/+1
2025-02-08occured -> occurredMichael Goulet-2/+2
2025-02-03Contracts core intrinsics.Felix S. Klock II-1/+4
These are hooks to: 1. control whether contract checks are run 2. allow 3rd party tools to intercept and reintepret the results of running contracts.
2025-01-31Insert null checks for pointer dereferences when debug assertions are enabledBastian Kersting-1/+9
Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a MirPass. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177.
2025-01-28Represent the raw pointer for a array length check as a new kind of fake borrowMichael Goulet-5/+33
2025-01-16Add gpu-kernel calling conventionFlakebi-0/+3
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-1/+3
2024-12-18Variants::Single: do not use invalid VariantIdx for uninhabited enumsRalf Jung-0/+1
2024-12-14Encode coroutine-closures in SMIRMichael Goulet-2/+22
2024-11-08Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errorsStuart Cook-25/+84
[StableMIR] A few fixes to pretty printing Improve identation, and a few other rvalue printing try-job: x86_64-msvc try-job: test-various
2024-11-07Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errorsJubilee-1/+18
[StableMIR] API to retrieve definitions from crates Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, we're still missing items from trait implementation and primitives. r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07[StableMIR] A few fixes to pretty printingCelina G. Val-25/+84
Improve identation, and a few other rvalue printing
2024-11-07[StableMIR] API to retrieve definitions from cratesCelina G. Val-1/+18
Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, add a query to retrieve the number of defs in a foreign crate.
2024-10-24Remove associated type based effects logicMichael Goulet-1/+0
2024-10-16Rollup merge of #131778 - practicalrs:fix_needless_lifetimes, r=jieyouxuMatthias Krüger-1/+1
Fix needless_lifetimes in stable_mir Hi, This PR fixes the following clippy warning ``` warning: the following explicit lifetimes could be elided: 'a --> compiler/stable_mir/src/mir/visit.rs:490:6 | 490 | impl<'a> PlaceRef<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 490 - impl<'a> PlaceRef<'a> { 490 + impl PlaceRef<'_> { | ``` Best regards, Michal
2024-10-16Rollup merge of #131777 - practicalrs:fix_trivially_copy_pass_by_ref, r=jieyouxuMatthias Krüger-3/+3
Fix trivially_copy_pass_by_ref in stable_mir Hi, This PR fixes the following clippy warnings ``` warning: this argument (8 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> compiler/stable_mir/src/mir/body.rs:1042:34 | 1042 | fn subslice_ty(ty: Ty, from: &u64, to: &u64, from_end: &bool) -> Result<Ty, Error> { | ^^^^ help: consider passing by value instead: `u64` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref = note: requested on the command line with `-W clippy::trivially-copy-pass-by-ref` warning: this argument (8 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> compiler/stable_mir/src/mir/body.rs:1042:44 | 1042 | fn subslice_ty(ty: Ty, from: &u64, to: &u64, from_end: &bool) -> Result<Ty, Error> { | ^^^^ help: consider passing by value instead: `u64` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> compiler/stable_mir/src/mir/body.rs:1042:60 | 1042 | fn subslice_ty(ty: Ty, from: &u64, to: &u64, from_end: &bool) -> Result<Ty, Error> { | ^^^^^ help: consider passing by value instead: `bool` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref ``` Best regards, Michal
2024-10-16Fix needless_lifetimes in stable_mirMichal Piotrowski-1/+1
2024-10-16Fix trivially_copy_pass_by_ref in stable_mirMichal Piotrowski-3/+3
2024-10-16Rollup merge of #131700 - practicalrs:fix_match_same_arms, r=celinvalUrgau-38/+24
Fix match_same_arms in stable_mir Hi, This PR fixes some clippy warnings (Reopened https://github.com/rust-lang/rust/pull/131688) ``` warning: this match arm has an identical body to another arm --> compiler/stable_mir/src/mir/visit.rs:197:13 | 197 | / StatementKind::FakeRead(_, place) => { 198 | | self.visit_place(place, PlaceContext::NON_MUTATING, location); 199 | | } | |_____________^ | = help: try changing either arm body = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms help: or try merging the arm patterns | 197 | StatementKind::FakeRead(_, place) | StatementKind::PlaceMention(place) => { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: and remove this obsolete arm | 209 - StatementKind::PlaceMention(place) => { 210 - self.visit_place(place, PlaceContext::NON_MUTATING, location); 211 - } | ``` Best regards, Michal
2024-10-15Fix uninlined_format_args in stable_mirMichal Piotrowski-12/+12
2024-10-14Fix match_same_arms in stable_mirMichal Piotrowski-38/+24
2024-10-05clarify semantics of ConstantIndex MIR projectionRalf Jung-2/+4
2024-10-04Rollup merge of #131194 - practicalrs:fix_needless_lifetimes, r=celinvalJubilee-2/+2
Fix needless_lifetimes in stable_mir Hi, This PR fixes the following clippy warning in stable_mir ``` warning: the following explicit lifetimes could be elided: 'a --> compiler/stable_mir/src/mir/visit.rs:79:30 | 79 | fn visit_projection_elem<'a>( | ^^ 80 | &mut self, 81 | place_ref: PlaceRef<'a>, | ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 79 ~ fn visit_projection_elem( 80 | &mut self, 81 ~ place_ref: PlaceRef<'_>, | ``` Best regards, Michal
2024-10-04Use wide pointers consistenly across the compilerUrgau-3/+3
2024-10-03Fix needless_lifetimes in stable_mirMichal Piotrowski-2/+2
2024-09-27Auto merge of #130946 - matthiaskrgr:rollup-ia4mf0y, r=matthiaskrgrbors-1/+1
Rollup of 6 pull requests Successful merges: - #130718 (Cleanup some known-bug issues) - #130730 (Reorganize Test Headers) - #130826 (Compiler: Rename "object safe" to "dyn compatible") - #130915 (fix typo in triagebot.toml) - #130926 (Update cc to 1.1.22 in library/) - #130932 (etc: Add sample rust-analyzer configs for eglot & helix) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-1/+1
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-26Use `&raw` in the compilerJosh Stone-1/+1
Like #130865 did for the standard library, we can use `&raw` in the compiler now that stage0 supports it. Also like the other issue, I did not make any doc or test changes at this time.
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1