From 3e0c1c8e0cdeab8871f96b1703f6b8a852d51568 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 25 May 2022 07:30:04 +0000 Subject: [PATCH] Add WIP stable MIR crate --- Cargo.toml | 10 ++++++++++ src/lib.rs | 10 ++++++++++ src/mir.rs | 10 ++++++++++ src/very_unstable.rs | 9 +++++++++ 4 files changed, 39 insertions(+) create mode 100644 Cargo.toml create mode 100644 src/lib.rs create mode 100644 src/mir.rs create mode 100644 src/very_unstable.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000000..0c5a19d4034 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "rustc_smir" +version = "0.0.0" +edition = "2021" + +[dependencies] +rustc_middle = { path = "../rustc_middle" } +rustc_driver = { path = "../rustc_driver" } +rustc_borrowck = { path = "../rustc_borrowck" } +rustc_interface = { path = "../rustc_interface" } diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000000..405ee1388dd --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,10 @@ +//! The WIP stable interface to rustc internals. + +#![doc( + html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/", + test(attr(allow(unused_variables), deny(warnings))) +)] + +pub mod mir; + +pub mod very_unstable; diff --git a/src/mir.rs b/src/mir.rs new file mode 100644 index 00000000000..97969be669d --- /dev/null +++ b/src/mir.rs @@ -0,0 +1,10 @@ +pub use rustc_middle::mir::{ + visit::MutVisitor, AggregateKind, AssertKind, BasicBlock, BasicBlockData, BinOp, BindingForm, + BlockTailInfo, Body, BorrowKind, CastKind, ClearCrossCrate, Constant, ConstantKind, + CopyNonOverlapping, Coverage, FakeReadCause, Field, GeneratorInfo, ImplicitSelfKind, + InlineAsmOperand, Local, LocalDecl, LocalInfo, LocalKind, Location, MirPhase, MirSource, + NullOp, Operand, Place, PlaceRef, ProjectionElem, ProjectionKind, Promoted, RetagKind, Rvalue, + Safety, SourceInfo, SourceScope, SourceScopeData, SourceScopeLocalData, Statement, + StatementKind, UnOp, UserTypeProjection, UserTypeProjections, VarBindingForm, VarDebugInfo, + VarDebugInfoContents, +}; diff --git a/src/very_unstable.rs b/src/very_unstable.rs new file mode 100644 index 00000000000..8ba0251629d --- /dev/null +++ b/src/very_unstable.rs @@ -0,0 +1,9 @@ +//! This module reexports various crates and modules from unstable rustc APIs. +//! Add anything you need here and it will get slowly transferred to a stable API. +//! Only use rustc_smir in your dependencies and use the reexports here instead of +//! directly referring to the unstable crates. + +pub use rustc_borrowck as borrowck; +pub use rustc_driver as driver; +pub use rustc_interface as interface; +pub use rustc_middle as middle;