-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Remove track_errors
from check_match
, typeck_item_bodies
and register_plugins
#59199
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
Changes from all commits
d1808aa
936dec8
c89872c
afdc38d
5723632
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ use rustc::ty::layout::{self, LayoutOf, VariantIdx}; | |
use rustc::ty::subst::Subst; | ||
use rustc::traits::Reveal; | ||
use rustc_data_structures::fx::FxHashMap; | ||
use rustc::util::common::ErrorReported; | ||
|
||
use syntax::ast::Mutability; | ||
use syntax::source_map::{Span, DUMMY_SP}; | ||
|
@@ -619,9 +618,8 @@ pub fn const_eval_raw_provider<'a, 'tcx>( | |
let tables = tcx.typeck_tables_of(def_id); | ||
|
||
// Do match-check before building MIR | ||
if let Err(ErrorReported) = tcx.check_match(def_id) { | ||
return Err(ErrorHandled::Reported) | ||
} | ||
// FIXME(#59378) check_match may have errored but we're not checking for that anymore | ||
tcx.check_match(def_id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling this feels pointless, also similar for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I seem to remember that building MIR before match checking results in ICEs. Not sure this belongs here though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That shouldn't make sense nowadays, though, there should be no mutable state involved? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, sure, but that means MIR building should be handling this gracefully. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you ok with this being addressed in a separate PR? If so, I'll open an issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be handled here, as the behavior of "exit if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I guess I'd be fine with a |
||
|
||
if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) { | ||
tcx.mir_const_qualif(def_id); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ use rustc::ty::{self, Ty, TyCtxt, TyKind}; | |
use rustc::ty::subst::{InternalSubsts, SubstsRef}; | ||
use rustc::lint; | ||
use rustc_errors::{Applicability, DiagnosticBuilder}; | ||
use rustc::util::common::ErrorReported; | ||
|
||
use rustc::hir::def::*; | ||
use rustc::hir::def_id::DefId; | ||
|
@@ -27,25 +26,20 @@ use std::slice; | |
use syntax::ptr::P; | ||
use syntax_pos::{Span, DUMMY_SP, MultiSpan}; | ||
|
||
pub(crate) fn check_match<'a, 'tcx>( | ||
tcx: TyCtxt<'a, 'tcx, 'tcx>, | ||
def_id: DefId, | ||
) -> Result<(), ErrorReported> { | ||
pub(crate) fn check_match<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { | ||
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { | ||
tcx.hir().body_owned_by(id) | ||
} else { | ||
return Ok(()); | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @nikomatsakis Is this intentional? I remember some of the queries I wrote would panic if they got a non-local |
||
}; | ||
|
||
tcx.sess.track_errors(|| { | ||
MatchVisitor { | ||
tcx, | ||
tables: tcx.body_tables(body_id), | ||
region_scope_tree: &tcx.region_scope_tree(def_id), | ||
param_env: tcx.param_env(def_id), | ||
identity_substs: InternalSubsts::identity_for_item(tcx, def_id), | ||
}.visit_body(tcx.hir().body(body_id)); | ||
}) | ||
MatchVisitor { | ||
tcx, | ||
tables: tcx.body_tables(body_id), | ||
region_scope_tree: &tcx.region_scope_tree(def_id), | ||
param_env: tcx.param_env(def_id), | ||
identity_substs: InternalSubsts::identity_for_item(tcx, def_id), | ||
}.visit_body(tcx.hir().body(body_id)); | ||
} | ||
|
||
fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> DiagnosticBuilder<'a> { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
fn foo<T>() where for<'a> T: 'a {} | ||
|
||
fn main<'a>() { | ||
fn bar<'a>() { | ||
foo::<&'a i32>(); | ||
//~^ ERROR the type `&'a i32` does not fulfill the required lifetime | ||
} | ||
|
||
fn main() { | ||
bar(); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.