Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dbf994b

Browse files
committedDec 18, 2015
Make RFC 1214 warnings into errors, and rip out the "warn or err"
associated machinery. Future such attempts should go through lints anyhow. There is a fair amount of fallout in the compile-fail tests, as WF checking now occurs earlier in the process.
1 parent de62f9d commit dbf994b

File tree

88 files changed

+291
-1187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+291
-1187
lines changed
 

‎src/librustc/middle/infer/error_reporting.rs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -578,11 +578,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
578578
// where the error was detected. But that span is not readily
579579
// accessible.
580580

581-
let is_warning = match origin {
582-
infer::RFC1214Subregion(_) => true,
583-
_ => false,
584-
};
585-
586581
let labeled_user_string = match bound_kind {
587582
GenericKind::Param(ref p) =>
588583
format!("the parameter type `{}`", p),
@@ -593,8 +588,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
593588
match sub {
594589
ty::ReFree(ty::FreeRegion {bound_region: ty::BrNamed(..), ..}) => {
595590
// Does the required lifetime have a nice name we can print?
596-
span_err_or_warn!(
597-
is_warning, self.tcx.sess, origin.span(), E0309,
591+
span_err!(
592+
self.tcx.sess, origin.span(), E0309,
598593
"{} may not live long enough", labeled_user_string);
599594
self.tcx.sess.fileline_help(
600595
origin.span(),
@@ -606,8 +601,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
606601

607602
ty::ReStatic => {
608603
// Does the required lifetime have a nice name we can print?
609-
span_err_or_warn!(
610-
is_warning, self.tcx.sess, origin.span(), E0310,
604+
span_err!(
605+
self.tcx.sess, origin.span(), E0310,
611606
"{} may not live long enough", labeled_user_string);
612607
self.tcx.sess.fileline_help(
613608
origin.span(),
@@ -618,8 +613,8 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
618613

619614
_ => {
620615
// If not, be less specific.
621-
span_err_or_warn!(
622-
is_warning, self.tcx.sess, origin.span(), E0311,
616+
span_err!(
617+
self.tcx.sess, origin.span(), E0311,
623618
"{} may not live long enough",
624619
labeled_user_string);
625620
self.tcx.sess.fileline_help(
@@ -634,10 +629,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
634629
}
635630
}
636631

637-
if is_warning {
638-
self.tcx.sess.note_rfc_1214(origin.span());
639-
}
640-
641632
self.note_region_origin(&origin);
642633
}
643634

@@ -646,13 +637,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
646637
sub: Region,
647638
sup: Region) {
648639
match origin {
649-
infer::RFC1214Subregion(ref suborigin) => {
650-
// Ideally, this would be a warning, but it doesn't
651-
// seem to come up in practice, since the changes from
652-
// RFC1214 mostly trigger errors in type definitions
653-
// that don't wind up coming down this path.
654-
self.report_concrete_failure((**suborigin).clone(), sub, sup);
655-
}
656640
infer::Subtype(trace) => {
657641
let terr = TypeError::RegionsDoesNotOutlive(sup, sub);
658642
self.report_and_explain_type_error(trace, &terr);
@@ -1599,9 +1583,6 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
15991583

16001584
fn note_region_origin(&self, origin: &SubregionOrigin<'tcx>) {
16011585
match *origin {
1602-
infer::RFC1214Subregion(ref suborigin) => {
1603-
self.note_region_origin(suborigin);
1604-
}
16051586
infer::Subtype(ref trace) => {
16061587
let desc = match trace.origin {
16071588
TypeOrigin::Misc(_) => {

‎src/librustc/middle/infer/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use middle::ty::relate::{Relate, RelateResult, TypeRelation};
3737
use rustc_data_structures::unify::{self, UnificationTable};
3838
use std::cell::{RefCell, Ref};
3939
use std::fmt;
40-
use std::rc::Rc;
4140
use syntax::ast;
4241
use syntax::codemap;
4342
use syntax::codemap::{Span, DUMMY_SP};
@@ -198,11 +197,6 @@ pub struct TypeTrace<'tcx> {
198197
/// See `error_reporting.rs` for more details
199198
#[derive(Clone, Debug)]
200199
pub enum SubregionOrigin<'tcx> {
201-
// Marker to indicate a constraint that only arises due to new
202-
// provisions from RFC 1214. This will result in a warning, not an
203-
// error.
204-
RFC1214Subregion(Rc<SubregionOrigin<'tcx>>),
205-
206200
// Arose from a subtyping relation
207201
Subtype(TypeTrace<'tcx>),
208202

@@ -1568,7 +1562,6 @@ impl TypeOrigin {
15681562
impl<'tcx> SubregionOrigin<'tcx> {
15691563
pub fn span(&self) -> Span {
15701564
match *self {
1571-
RFC1214Subregion(ref a) => a.span(),
15721565
Subtype(ref a) => a.span(),
15731566
InfStackClosure(a) => a,
15741567
InvokeClosure(a) => a,

0 commit comments

Comments
 (0)
Please sign in to comment.