mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Move the pattern checking code to hair
This commit is contained in:
parent
bb81f9bdec
commit
ef995bde50
@ -1048,7 +1048,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
|
||||
|
||||
time(time_passes,
|
||||
"match checking",
|
||||
|| mir::pattern::check_crate(tcx));
|
||||
|| mir::matchck_crate(tcx));
|
||||
|
||||
// this must run before MIR dump, because
|
||||
// "not all control paths return a value" is reported here.
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
use build;
|
||||
use hair::cx::Cx;
|
||||
use hair::LintLevel;
|
||||
use hair::{LintLevel, BindingMode, PatternKind};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::{DefId, LocalDefId};
|
||||
use rustc::middle::region;
|
||||
@ -21,7 +21,6 @@ use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::util::nodemap::NodeMap;
|
||||
use rustc_back::PanicStrategy;
|
||||
use pattern::pattern::{BindingMode, PatternKind};
|
||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||
use shim;
|
||||
use std::mem;
|
||||
|
@ -26,7 +26,8 @@ use self::cx::Cx;
|
||||
|
||||
pub mod cx;
|
||||
|
||||
pub use pattern::pattern::{BindingMode, Pattern, PatternKind, FieldPattern};
|
||||
pub mod pattern;
|
||||
pub use self::pattern::{BindingMode, Pattern, PatternKind, FieldPattern};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum LintLevel {
|
||||
|
@ -17,8 +17,8 @@ use rustc::middle::const_val::ConstVal;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
|
||||
use super::pattern::{FieldPattern, Pattern, PatternKind};
|
||||
use super::pattern::{PatternFoldable, PatternFolder, compare_const_vals};
|
||||
use super::{FieldPattern, Pattern, PatternKind};
|
||||
use super::{PatternFoldable, PatternFolder, compare_const_vals};
|
||||
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::RangeEnd;
|
@ -12,7 +12,7 @@ use super::_match::{MatchCheckCtxt, Matrix, expand_pattern, is_useful};
|
||||
use super::_match::Usefulness::*;
|
||||
use super::_match::WitnessPreference::*;
|
||||
|
||||
use super::pattern::{Pattern, PatternContext, PatternError, PatternKind};
|
||||
use super::{Pattern, PatternContext, PatternError, PatternKind};
|
||||
|
||||
use rustc::middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
|
||||
use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
|
1186
src/librustc_mir/hair/pattern/mod.rs
Normal file
1186
src/librustc_mir/hair/pattern/mod.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -71,9 +71,9 @@ pub mod transform;
|
||||
pub mod util;
|
||||
pub mod interpret;
|
||||
pub mod monomorphize;
|
||||
pub mod pattern;
|
||||
pub mod check_const_err;
|
||||
|
||||
pub use hair::pattern::check_crate as matchck_crate;
|
||||
use rustc::ty::maps::Providers;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
@ -81,7 +81,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
shim::provide(providers);
|
||||
transform::provide(providers);
|
||||
providers.const_eval = interpret::const_eval_provider;
|
||||
providers.check_match = pattern::check_match;
|
||||
providers.check_match = hair::pattern::check_match;
|
||||
}
|
||||
|
||||
__build_diagnostic_array! { librustc_mir, DIAGNOSTICS }
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! constant evaluation on the HIR and code to validate patterns/matches
|
||||
|
||||
mod _match;
|
||||
mod check_match;
|
||||
pub(crate) mod pattern;
|
||||
|
||||
pub use self::check_match::check_crate;
|
||||
pub(crate) use self::check_match::check_match;
|
Loading…
Reference in New Issue
Block a user