Skip to content

Move rustc_smir to driver #116806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3346,8 +3346,6 @@ dependencies = [
"rustc_codegen_ssa",
"rustc_driver",
"rustc_driver_impl",
"rustc_smir",
"stable_mir",
]

[[package]]
Expand Down Expand Up @@ -3770,6 +3768,7 @@ dependencies = [
"rustc_trait_selection",
"rustc_ty_utils",
"serde_json",
"stable_mir",
"time",
"tracing",
"windows",
Expand Down Expand Up @@ -4500,21 +4499,6 @@ dependencies = [
"windows",
]

[[package]]
name = "rustc_smir"
version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_driver",
"rustc_hir",
"rustc_interface",
"rustc_middle",
"rustc_span",
"rustc_target",
"stable_mir",
"tracing",
]

[[package]]
name = "rustc_span"
version = "0.0.0"
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ rustc_driver_impl = { path = "../rustc_driver_impl" }
# Make sure rustc_codegen_ssa ends up in the sysroot, because this
# crate is intended to be used by codegen backends, which may not be in-tree.
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
# Make sure rustc_smir ends up in the sysroot, because this
# crate is intended to be used by stable MIR consumers, which are not in-tree
rustc_smir = { path = "../rustc_smir" }
stable_mir = { path = "../stable_mir" }


[dependencies.jemalloc-sys]
version = "0.5.0"
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_driver_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
rustc_mir_transform = { path = "../rustc_mir_transform" }
stable_mir = {path = "../stable_mir"}

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ use {do_not_use_print as print, do_not_use_print as println};

pub mod args;
pub mod pretty;
pub mod rustc_internal;
pub mod rustc_smir;
#[macro_use]
mod print;
mod session_diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

use crate::rustc_internal;
use crate::rustc_smir::Tables;
use crate::{catch_fatal_errors, Callbacks, Compilation, RunCompiler};
use rustc_data_structures::fx;
use rustc_driver::{Callbacks, Compilation, RunCompiler};
use rustc_interface::{interface, Queries};
use rustc_middle::mir::interpret::AllocId;
use rustc_middle::ty::TyCtxt;
Expand Down Expand Up @@ -150,7 +150,7 @@ where
/// Runs the compiler against given target and tests it with `test_function`
pub fn run(&mut self) -> Result<C, CompilerError<B>> {
let compiler_result =
rustc_driver::catch_fatal_errors(|| RunCompiler::new(&self.args.clone(), self).run());
catch_fatal_errors(|| RunCompiler::new(&self.args.clone(), self).run());
match (compiler_result, self.result.take()) {
(Ok(Ok(())), Some(ControlFlow::Continue(value))) => Ok(value),
(Ok(Ok(())), Some(ControlFlow::Break(value))) => Err(CompilerError::Interrupted(value)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
//! The WIP stable interface to rustc internals.
//!
//! For more information see <https://github.com/rust-lang/project-stable-mir>
//!
//! # Note
//!
//! This API is still completely unstable and subject to change.

//! Module that implements what will become the rustc side of Stable MIR.

//! This module is responsible for building Stable MIR components from internal components.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_smir/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions compiler/rustc_smir/Cargo.toml

This file was deleted.

20 changes: 0 additions & 20 deletions compiler/rustc_smir/src/lib.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tests/ui-fulldeps/stable-mir/compilation-result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#![feature(assert_matches)]

extern crate rustc_middle;
extern crate rustc_smir;
extern crate rustc_driver;
extern crate stable_mir;

use rustc_middle::ty::TyCtxt;
use rustc_smir::rustc_internal;
use rustc_driver::rustc_internal;
use std::io::Write;
use std::ops::ControlFlow;

Expand Down
4 changes: 2 additions & 2 deletions tests/ui-fulldeps/stable-mir/crate-info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

extern crate rustc_hir;
extern crate rustc_middle;
extern crate rustc_smir;
extern crate rustc_driver;
extern crate stable_mir;

use rustc_hir::def::DefKind;
use rustc_middle::ty::TyCtxt;
use rustc_smir::rustc_internal;
use rustc_driver::rustc_internal;

use stable_mir::fold::Foldable;
use std::assert_matches::assert_matches;
Expand Down