Skip to content

Commit defd508

Browse files
committed
cleanup check_match wrt. SignalledError.
1 parent 1eb280e commit defd508

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

src/librustc/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ rustc_queries! {
469469
}
470470

471471
TypeChecking {
472-
query check_match(key: DefId) -> SignalledError {
472+
query check_match(key: DefId) {
473473
cache_on_disk_if { key.is_local() }
474474
}
475475

src/librustc/ty/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::hir::def::{DefKind, Export};
44
use crate::hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
55
use crate::infer::canonical::{self, Canonical};
66
use crate::lint;
7-
use crate::middle::borrowck::{BorrowCheckResult, SignalledError};
7+
use crate::middle::borrowck::BorrowCheckResult;
88
use crate::middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary, ForeignModule};
99
use crate::middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
1010
use crate::middle::privacy::AccessLevels;

src/librustc_mir/hair/pattern/check_match.rs

+5-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use super::_match::WitnessPreference::*;
44

55
use super::{PatCtxt, PatternError, PatKind};
66

7-
use rustc::middle::borrowck::SignalledError;
87
use rustc::session::Session;
98
use rustc::ty::{self, Ty, TyCtxt};
109
use rustc::ty::subst::{InternalSubsts, SubstsRef};
@@ -21,22 +20,19 @@ use std::slice;
2120

2221
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
2322

24-
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) -> SignalledError {
25-
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
26-
tcx.hir().body_owned_by(id)
27-
} else {
28-
return SignalledError::NoErrorsSeen;
23+
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
24+
let body_id = match tcx.hir().as_local_hir_id(def_id) {
25+
None => return,
26+
Some(id) => tcx.hir().body_owned_by(id),
2927
};
3028

3129
let mut visitor = MatchVisitor {
3230
tcx,
3331
tables: tcx.body_tables(body_id),
3432
param_env: tcx.param_env(def_id),
3533
identity_substs: InternalSubsts::identity_for_item(tcx, def_id),
36-
signalled_error: SignalledError::NoErrorsSeen,
3734
};
3835
visitor.visit_body(tcx.hir().body(body_id));
39-
visitor.signalled_error
4036
}
4137

4238
fn create_e0004(sess: &Session, sp: Span, error_message: String) -> DiagnosticBuilder<'_> {
@@ -48,7 +44,6 @@ struct MatchVisitor<'a, 'tcx> {
4844
tables: &'a ty::TypeckTables<'tcx>,
4945
param_env: ty::ParamEnv<'tcx>,
5046
identity_substs: SubstsRef<'tcx>,
51-
signalled_error: SignalledError,
5247
}
5348

5449
impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, 'tcx> {
@@ -136,13 +131,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
136131
// First, check legality of move bindings.
137132
self.check_patterns(arm.guard.is_some(), &arm.pat);
138133

139-
// Second, if there is a guard on each arm, make sure it isn't
140-
// assigning or borrowing anything mutably.
141-
if arm.guard.is_some() {
142-
self.signalled_error = SignalledError::SawSomeError;
143-
}
144-
145-
// Third, perform some lints.
134+
// Second, perform some lints.
146135
check_for_bindings_named_same_as_variants(self, &arm.pat);
147136
}
148137

0 commit comments

Comments
 (0)