mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #125483 - workingjubilee:move-transform-validate-to-mir-transform, r=oli-obk
compiler: validate.rs belongs next to what it validates It's hard to find code that is deeply nested and far away from its callsites, so let's move `rustc_const_eval::transform::validate` into `rustc_mir_transform`, where all of its callers are. As `rustc_mir_transform` already depends on `rustc_const_eval`, the added visible dependency edge doesn't mean the dependency tree got any worse. This also lets us unnest the `check_consts` module. I did look into moving everything inside `rustc_const_eval::transform` into `rustc_mir_transform`. It turned out to be a much more complex operation, with more concerns and real edges into the `const_eval` crate, whereas this was both faster and more obvious.
This commit is contained in:
commit
f23ebf0410
@ -4252,6 +4252,7 @@ dependencies = [
|
|||||||
"rustc_fluent_macro",
|
"rustc_fluent_macro",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
|
"rustc_infer",
|
||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_mir_build",
|
"rustc_mir_build",
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
#![feature(yeet_expr)]
|
#![feature(yeet_expr)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
|
|
||||||
|
pub mod check_consts;
|
||||||
pub mod const_eval;
|
pub mod const_eval;
|
||||||
mod errors;
|
mod errors;
|
||||||
pub mod interpret;
|
pub mod interpret;
|
||||||
pub mod transform;
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
pub mod check_consts;
|
|
||||||
pub mod validate;
|
|
@ -16,6 +16,7 @@ rustc_errors = { path = "../rustc_errors" }
|
|||||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||||
rustc_hir = { path = "../rustc_hir" }
|
rustc_hir = { path = "../rustc_hir" }
|
||||||
rustc_index = { path = "../rustc_index" }
|
rustc_index = { path = "../rustc_index" }
|
||||||
|
rustc_infer = { path = "../rustc_infer" }
|
||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
rustc_mir_build = { path = "../rustc_mir_build" }
|
rustc_mir_build = { path = "../rustc_mir_build" }
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Inlining pass for MIR functions
|
//! Inlining pass for MIR functions
|
||||||
use crate::deref_separator::deref_finder;
|
use crate::deref_separator::deref_finder;
|
||||||
use rustc_attr::InlineAttr;
|
use rustc_attr::InlineAttr;
|
||||||
use rustc_const_eval::transform::validate::validate_types;
|
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_index::bit_set::BitSet;
|
use rustc_index::bit_set::BitSet;
|
||||||
@ -21,6 +20,7 @@ use rustc_target::spec::abi::Abi;
|
|||||||
use crate::cost_checker::CostChecker;
|
use crate::cost_checker::CostChecker;
|
||||||
use crate::simplify::simplify_cfg;
|
use crate::simplify::simplify_cfg;
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
use crate::validate::validate_types;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::ops::{Range, RangeFrom};
|
use std::ops::{Range, RangeFrom};
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ mod simplify_comparison_integral;
|
|||||||
mod sroa;
|
mod sroa;
|
||||||
mod unreachable_enum_branching;
|
mod unreachable_enum_branching;
|
||||||
mod unreachable_prop;
|
mod unreachable_prop;
|
||||||
|
mod validate;
|
||||||
|
|
||||||
use rustc_const_eval::transform::check_consts::{self, ConstCx};
|
use rustc_const_eval::check_consts::{self, ConstCx};
|
||||||
use rustc_const_eval::transform::validate;
|
|
||||||
use rustc_mir_dataflow::rustc_peek;
|
use rustc_mir_dataflow::rustc_peek;
|
||||||
|
|
||||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||||
|
@ -30,7 +30,7 @@ use std::assert_matches::assert_matches;
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::{cmp, iter, mem};
|
use std::{cmp, iter, mem};
|
||||||
|
|
||||||
use rustc_const_eval::transform::check_consts::{qualifs, ConstCx};
|
use rustc_const_eval::check_consts::{qualifs, ConstCx};
|
||||||
|
|
||||||
/// A `MirPass` for promotion.
|
/// A `MirPass` for promotion.
|
||||||
///
|
///
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
use clippy_config::msrvs::{self, Msrv};
|
use clippy_config::msrvs::{self, Msrv};
|
||||||
use hir::LangItem;
|
use hir::LangItem;
|
||||||
use rustc_attr::StableSince;
|
use rustc_attr::StableSince;
|
||||||
use rustc_const_eval::transform::check_consts::ConstCx;
|
use rustc_const_eval::check_consts::ConstCx;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
thread 'rustc' panicked at compiler/rustc_const_eval/src/transform/validate.rs:LL:CC:
|
thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC:
|
||||||
broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
|
broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
|
||||||
(*(_2.0: *mut i32)), has deref at the wrong place
|
(*(_2.0: *mut i32)), has deref at the wrong place
|
||||||
stack backtrace:
|
stack backtrace:
|
||||||
|
Loading…
Reference in New Issue
Block a user