about summary refs log tree commit diff
path: root/compiler/stable_mir/src/crate_def.rs
AgeCommit message (Collapse)AuthorLines
2025-07-14rename `stable_mir` to `rustc_public`, and `rustc_smir` to `rustc_public_bridge`Makai-174/+0
2025-07-06move `stable_mir` back to its own crate and move `rustc_internal` to ↵Makai-0/+174
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-05let `rustc_smir` host `stable_mir` for refactoringMakai-174/+0
2025-04-01Implement `associated_items` api.makai410-1/+15
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-4/+2
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-7/+10
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-25Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinvalbors-1/+2
Add basic Serde serialization capabilities to Stable MIR This PR adds basic Serde serialization capabilities to Stable MIR. It is intentionally minimal (just wrapping all stable MIR types with a Serde `derive`), so that any important design decisions can be discussed before going further. A simple test is included with this PR to validate that JSON can actually be emitted. ## Notes When I wrapped the Stable MIR error types in `compiler/stable_mir/src/error.rs`, it caused test failures (though I'm not sure why) so I backed those out. ## Future Work So, this PR will support serializing basic stable MIR, but it _does not_ support serializing interned values beneath `Ty`s and `AllocId`s, etc... My current thinking about how to handle this is as follows: 1. Add new `visited_X` fields to the `Tables` struct for each interned category of interest. 2. As serialization is occuring, serialize interned values as usual _and_ also record the interned value we referenced in `visited_X`. (Possibly) In addition, if an interned value recursively references other interned values, record those interned values as well. 3. Teach the stable MIR `Context` how to access the `visited_X` values and expose them with wrappers in `stable_mir/src/lib.rs` to users (e.g. to serialize and/or further analyze them). ### Pros This approach does not commit to any specific serialization format regarding interned values or other more complex cases, which avoids us locking into any behaviors that may not be desired long-term. ### Cons The user will need to manually handle serializing interned values. ### Alternatives 1. We can directly provide access to the underlying `Tables` maps for interned values; the disadvantage of this approach is that it either requires extra processing for users to filter out to only use the values that they need _or_ users may serialize extra values that they don't need. The advantage is that the implementation is even simpler. The other pros/cons are similar to the above. 2. We can directly serialize interned values by expanding them in-place. The pro is that this may make some basic inputs easier to consume. However, the cons are that there will need to be special provisions for dealing with cyclical values on both the producer and consumer _and_ global values will possibly need to be de-duplicated on the consumer side.
2024-06-28Add method to get all attributes on a definitionAdwin White-1/+32
2024-06-28Support fetching `Attribute` of items.Adwin White-1/+7
2024-06-26add serde derive Serialize to stable_mirStephen Skeirik-1/+2
2024-06-12Add a new trait to retrieve StableMir definition TyCelina G. Val-1/+36
We implement the trait only for definitions that should have a type. It's possible that I missed a few definitions, but we can add them later if needed.
2023-11-23Improve documentation and fix the fixme commentCelina G. Val-6/+9
2023-11-22Add CrateDef trait and methods to get def namesCelina G. Val-0/+66