about summary refs log tree commit diff
path: root/compiler/rustc_smir/src/stable_mir/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-07-06move `stable_mir` back to its own crate and move `rustc_internal` to ↵Makai-304/+0
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-07-04refactor: implement a new bridge trait `Allocation`Makai-1/+26
2025-07-04refactor: move `convert` to `unstable`Makai-40/+2
We want to keep StableMIR definitions and logic separate from any sort of conversion and usage of internal rustc code. So we bundle all unstable items that have no stability guarantees into `stable_mir::unstable`.
2025-07-04refactor: unify `Tables` implementation with bridge types and re-export ↵Makai-0/+37
`IndexedVal` define bridge types for `***Def`s. consolidate scattered `Tables` implementations into single inherent impl.
2025-07-04refactor: move `convert` module to `stable_mir`Makai-0/+1
note that this commit delete `convert/error.rs`, we would use `SmirError::from_internal` instead. **Unresolved questions:** - There are still a few direct calls to rustc's internals scattered across `impl Stable`s, but most of them appear to be relatively stable, e.g., `mir::interpret::ConstAllocation::inner(self)` and `mir::syntax::SwitchTargets::otherwise(self)`.
2025-07-04refactor: split `rustc_smir::alloc` into two partsMakai-0/+1
The previous `rustc_smir::alloc` had many direct calls to rustc queries. This commit splits it into two parts: `rustc_smir::alloc` and `stable_mir::alloc`. Following the same pattern as `SmirCtxt` and `SmirInterface`, the `rustc_smir::alloc` handles all direct interactions with rustc queries and performs the actual memory allocations, while the `stable_mir::alloc` is responsible for constructing stable components.
2025-07-04refactor: move `IndexedVal` from `stable_mir` to `rustc_smir`Makai-2/+3
2025-07-04refactor: make `SmirInterface` a trait and impl it for `SmirContainer`Makai-0/+38
- rewrite all `SmirInterface` apis. - add `BridgeTys` to impl those associated types in `Bridge`. - move `**_def()` stuffs living in `impl Tables` from `rustc_internal` to `stable_mir`.
2025-04-05let `rustc_smir` host `stable_mir` for refactoringMakai-0/+239
2023-09-25Split out the stable part of smir into its own crate to prevent accidental ↵Oli Scherer-230/+0
usage of forever unstable things
2023-09-25Move `Opaque` to `stable_mir`Oli Scherer-2/+20
2023-09-25Fix test by adding a stable way to get an opaque DefKindOli Scherer-0/+10
2023-09-25Eliminate escape hatchOli Scherer-5/+5
2023-09-14Rollup merge of #115772 - ouz-a:smir_span2, r=oli-obkMatthias Krüger-1/+1
Improve Span in smir Addressing https://github.com/rust-lang/project-stable-mir/issues/31 r? ``@oli-obk``
2023-09-14span is indexouz-a-1/+1
2023-09-12Add explicit_predicates_of to SMIRSantiago Pastorino-0/+1
2023-09-09add function that returns span of an itemouz-a-0/+7
2023-09-06Allow fetching the SMIR body of FnDefsOli Scherer-2/+2
2023-09-06Add type folder to SMIROli Scherer-0/+4
2023-09-05Add tests and use ControlFlowCelina G. Val-1/+6
2023-09-05Diferentiate between ICE and compilation errorCelina G. Val-1/+6
2023-09-05Adjust StableMIR interface to return and not crashCelina G. Val-0/+4
Invoking StableMir::run() on a crate that has any compilation error was crashing the entire process. Instead, return a `CompilerError` so the user knows compilation did not succeed. I believe ICE will also be converted to `CompilerError`. I'm also adding a return value to the callback, because I think it will be handy for users (at least it was for my current task of implementing a tool to validate stable-mir). However, if people disagree, I can remove that.
2023-09-04provide more useful info for DefId Debugouz-a-1/+15
2023-09-03Auto merge of #115470 - ericmarkmartin:stable-prov, r=oli-obkbors-0/+4
add stable provenance r? `@spastorino` implements rust-lang/project-stable-mir#22
2023-09-02add stable provenanceEric Mark Martin-0/+4
2023-09-01Create a SMIR visitorOli Scherer-0/+1
2023-08-29Rollup merge of #115300 - spastorino:smir-tweaks, r=oli-obkMatthias Krüger-18/+5
Tweaks and improvements on SMIR around generics_of and predicates_of r? `@oli-obk` This allows an API like the following ... ```rust let trait_decls = stable_mir::all_trait_decls().iter().map(|trait_def| { let trait_decl = stable_mir::trait_decl(trait_def); let generics = trait_decl.generics_of(); let predicates = trait_decl.predicates_of().predicates; ``` I didn't like that much `trait_def.trait_decl()` which is it possible but adding a method to a def_id that loads up a whole trait definition looks backwards to me.
2023-08-29Create StableMir replacer for SMirCallsouz-a-2/+1
2023-08-29Deduplicate GenericPredicatesSantiago Pastorino-7/+1
2023-08-29Add stable_mir::DefId as new type wrapperSantiago Pastorino-1/+2
2023-08-28Context::generics _of/predicates_of should receive stable_mir::DefIdSantiago Pastorino-3/+3
2023-08-28Remove stable_mir::generics_of/predicates_of those shouldn't be exposedSantiago Pastorino-8/+0
2023-08-25Add missing high-level stable_mir::generics_of fnSantiago Pastorino-0/+4
2023-08-23predicates ofEric Mark Martin-1/+14
2023-08-22add generics_of to smirouz-a-1/+2
2023-08-21stable_mir: docs clarificationRalf Jung-1/+1
2023-08-15Add trait related queries to SMIR's rustc_internalSantiago Pastorino-0/+16
2023-08-10Add impl trait declarations to SMIRSantiago Pastorino-1/+6
2023-08-10Fix copy & paste doc errorSantiago Pastorino-1/+1
2023-08-07Add all_trait_decls to SMIRSantiago Pastorino-0/+4
2023-08-07Convert trait declaration to SMIRSantiago Pastorino-1/+2
2023-07-02Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructuresyukang-14/+14
2023-05-08Create a trait to abstract over the smir APIOli Scherer-6/+60
2023-04-14Add a stable MIR way to get the main functionOli Scherer-0/+7
2023-03-16Implement a minimal subset of MIR statements and terminators for smirOli Scherer-0/+8
2023-03-16Remove `DefId` from `CrateItem` in favor of a lookup tableOli Scherer-3/+1
2023-03-07Change item collection to be on demandCelina G. Val-2/+10
2023-03-06Create new rustc_smir struct to map future cratesCelina G. Val-0/+52
+ Add some information to the README.md