Skip to content

Commit afdc38d

Browse files
committed
address review comments
1 parent c89872c commit afdc38d

File tree

6 files changed

+13
-24
lines changed

6 files changed

+13
-24
lines changed

src/librustc/ty/query/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ rustc_query_append! { [define_queries!][ <'tcx>
272272

273273
TypeChecking {
274274
[] fn typeck_item_bodies:
275-
typeck_item_bodies_dep_node(CrateNum) -> Result<(), ErrorReported>,
275+
typeck_item_bodies_dep_node(CrateNum) -> (),
276276

277277
[] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>,
278278
},
@@ -325,8 +325,7 @@ rustc_query_append! { [define_queries!][ <'tcx>
325325
},
326326

327327
TypeChecking {
328-
[] fn check_match: CheckMatch(DefId)
329-
-> Result<(), ErrorReported>,
328+
[] fn check_match: CheckMatch(DefId) -> (),
330329

331330
/// Performs part of the privacy check and computes "access levels".
332331
[] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Lrc<AccessLevels>,

src/librustc_mir/build/matches/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,17 +438,18 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
438438
// always convert all match-pairs into bindings.
439439
self.simplify_candidate(&mut candidate);
440440

441-
if !candidate.match_pairs.is_empty() && self.hir.tcx().sess.err_count() == 0 {
441+
if !candidate.match_pairs.is_empty() {
442442
// Only abort compilation if no other errors have been emitted. This used to be a hard
443443
// error that wouldn't be reached because `hair::pattern::check_match::check_match`
444444
// wouldn't have let the compiler continue. In our tests this is only ever hit by
445445
// `ui/consts/const-match-check.rs` with `--cfg eval1`, and that file already generates
446446
// a different error before hand.
447-
span_bug!(
447+
self.hir.tcx().sess.delay_span_bug(
448448
candidate.match_pairs[0].pattern.span,
449-
"match pairs {:?} remaining after simplifying \
450-
irrefutable pattern",
451-
candidate.match_pairs
449+
&format!(
450+
"match pairs {:?} remaining after simplifying irrefutable pattern",
451+
candidate.match_pairs,
452+
),
452453
);
453454
}
454455

src/librustc_mir/const_eval.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc::ty::layout::{self, LayoutOf, VariantIdx};
1515
use rustc::ty::subst::Subst;
1616
use rustc::traits::Reveal;
1717
use rustc_data_structures::fx::FxHashMap;
18-
use rustc::util::common::ErrorReported;
1918

2019
use syntax::ast::Mutability;
2120
use syntax::source_map::{Span, DUMMY_SP};
@@ -619,9 +618,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
619618
let tables = tcx.typeck_tables_of(def_id);
620619

621620
// Do match-check before building MIR
622-
if let Err(ErrorReported) = tcx.check_match(def_id) {
623-
return Err(ErrorHandled::Reported)
624-
}
621+
tcx.check_match(def_id);
625622

626623
if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) {
627624
tcx.mir_const_qualif(def_id);

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc::ty::{self, Ty, TyCtxt, TyKind};
1414
use rustc::ty::subst::{InternalSubsts, SubstsRef};
1515
use rustc::lint;
1616
use rustc_errors::{Applicability, DiagnosticBuilder};
17-
use rustc::util::common::ErrorReported;
1817

1918
use rustc::hir::def::*;
2019
use rustc::hir::def_id::DefId;
@@ -27,14 +26,11 @@ use std::slice;
2726
use syntax::ptr::P;
2827
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
2928

30-
pub(crate) fn check_match<'a, 'tcx>(
31-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
32-
def_id: DefId,
33-
) -> Result<(), ErrorReported> {
29+
pub(crate) fn check_match<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
3430
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
3531
tcx.hir().body_owned_by(id)
3632
} else {
37-
return Ok(());
33+
return;
3834
};
3935

4036
MatchVisitor {
@@ -44,7 +40,6 @@ pub(crate) fn check_match<'a, 'tcx>(
4440
param_env: tcx.param_env(def_id),
4541
identity_substs: InternalSubsts::identity_for_item(tcx, def_id),
4642
}.visit_body(tcx.hir().body(body_id));
47-
Ok(())
4843
}
4944

5045
fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> DiagnosticBuilder<'a> {

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,11 @@ fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId)
702702
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
703703
}
704704

705-
fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum)
706-
-> Result<(), ErrorReported>
707-
{
705+
fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) {
708706
debug_assert!(crate_num == LOCAL_CRATE);
709707
tcx.par_body_owners(|body_owner_def_id| {
710708
tcx.ensure().typeck_tables_of(body_owner_def_id);
711709
});
712-
Ok(())
713710
}
714711

715712
fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {

src/librustc_typeck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
363363
})
364364
})?;
365365

366-
time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE))?;
366+
time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE));
367367

368368
check_unused::check_crate(tcx);
369369
check_for_entry_fn(tcx);

0 commit comments

Comments
 (0)