Commit Graph

14 Commits

Author SHA1 Message Date
Makai
e3f2096849 refactor: avoid calling internal functions in predicates_of() and explicit_predicates_of() 2025-07-04 01:57:46 +00:00
Makai
a61e5080ec refactor: move convert to unstable
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-04 01:57:46 +00:00
Makai
efa26e1d64 fix: resolve the unsoundness
add a new trait `InternalCx`, which defines the methods that are fine to call from `RustcInternal`. `RustcInternal::internal()` then takes a `impl InternalCx<'tcx>` instead of `TyCtxt<'tcx>`.

make `tcx` in `SmirCtxt` public, since we need to pass it to `RustcInternal::internal()` in `SmirInterface`.
2025-07-04 01:57:38 +00:00
Makai
62d60319d6 refactor: unify Tables implementation with bridge types and re-export IndexedVal
define bridge types for `***Def`s.
consolidate scattered `Tables` implementations into single inherent impl.
2025-07-04 01:33:18 +00:00
Makai
45cf29d651 refactor: remove the tcx field in Tables
the only functionality of `Tables` is caching results. this commit moves calls to rustc queries from `Tables` to `SmirCtxt`.
2025-07-04 01:33:18 +00:00
Makai
663e2b7e29 refactor: move convert module to stable_mir
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-04 01:33:17 +00:00
Makai
7f5e382df4 refactor: make SmirInterface a trait and impl it for SmirContainer
- 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-07-04 01:33:09 +00:00
NotLebedev
d4de03208b Add discriminant_for_variant to CoroutineDef 2025-06-16 10:51:57 +03:00
NotLebedev
94f7790b19 Add discriminant_for_variant to AdtDef 2025-06-16 10:51:47 +03:00
Shoyu Vanilla
dabed3372c Implement representation options to smir 2025-06-10 22:58:27 +09:00
Andrew Zhogin
c366756a85 AsyncDrop implementation using shim codegen of async_drop_in_place::{closure}, scoped async drop added. 2025-04-28 16:23:13 +07:00
Makai
5b390cdc58 Make SmirInterface pub(crate) and rename Context to SmirContext
Co-authored-by: Celina G. Val <celinval@amazon.com>
2025-04-23 12:28:14 +08:00
Makai
35a20ded32 Implement SmirInterface
- With `Context` wrapped by `SmirInterface`, the stable-mir's TLV stores a pointer to `SmirInterface`, while the rustc-specific TLV stores a pointer to tables.
 - This PR make the `rustc_smir` mod public.
2025-04-18 14:34:20 +08:00
Makai
707d356d00 let rustc_smir host stable_mir for refactoring 2025-04-05 18:23:07 +08:00