about summary refs log tree commit diff
path: root/compiler/stable_mir
diff options
context:
space:
mode:
authorCelina G. Val <celinval@amazon.com>2025-04-30 15:39:52 -0700
committerCelina G. Val <celinval@amazon.com>2025-04-30 15:39:52 -0700
commit0f81fca8ec623e849225a254ef6f639963ff54c0 (patch)
treecb542d18ff166088fa67cb4aa23acc95425714d8 /compiler/stable_mir
parent7188f453111502962326022740e2657fce0a6939 (diff)
downloadrust-0f81fca8ec623e849225a254ef6f639963ff54c0.tar.gz
rust-0f81fca8ec623e849225a254ef6f639963ff54c0.zip
Change rustc_driver dependency on stable_mir crate
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.
Diffstat (limited to 'compiler/stable_mir')
-rw-r--r--compiler/stable_mir/Cargo.toml6
-rw-r--r--compiler/stable_mir/src/lib.rs4
2 files changed, 10 insertions, 0 deletions
diff --git a/compiler/stable_mir/Cargo.toml b/compiler/stable_mir/Cargo.toml
index 3a01ee5783e..516c8e9c718 100644
--- a/compiler/stable_mir/Cargo.toml
+++ b/compiler/stable_mir/Cargo.toml
@@ -5,3 +5,9 @@ edition = "2024"
 
 [dependencies]
 rustc_smir = { path = "../rustc_smir" }
+
+[features]
+# Provides access to APIs that expose internals of the rust compiler.
+# APIs enabled by this feature are unstable. They can be removed or modified
+# at any point and they are not included in the crate's semantic versioning.
+rustc_internal = []
diff --git a/compiler/stable_mir/src/lib.rs b/compiler/stable_mir/src/lib.rs
index cc0fb52433d..688f3936b26 100644
--- a/compiler/stable_mir/src/lib.rs
+++ b/compiler/stable_mir/src/lib.rs
@@ -4,4 +4,8 @@
 //! This is a transitional measure as described in [PR #139319](https://github.com/rust-lang/rust/pull/139319).
 //! Once the refactoring is complete, the `stable_mir` implementation will be moved back here.
 
+/// Export the rustc_internal APIs. Note that this module has no stability
+/// guarantees and it is not taken into account for semver.
+#[cfg(feature = "rustc_internal")]
+pub use rustc_smir::rustc_internal;
 pub use rustc_smir::stable_mir::*;