diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index b2ee38741fcab..ed94e5fe377c4 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -186,18 +186,6 @@ declare_lint! { "detects super or self keywords at the beginning of global path" } -declare_lint! { - pub UNSIZED_IN_TUPLE, - Warn, - "unsized types in the interior of a tuple were erroneously allowed" -} - -declare_lint! { - pub OBJECT_UNSAFE_FRAGMENT, - Warn, - "object-unsafe non-principal fragments in object types were erroneously allowed" -} - declare_lint! { pub LIFETIME_UNDERSCORE, Warn, @@ -239,8 +227,6 @@ impl LintPass for HardwiredLints { OVERLAPPING_INHERENT_IMPLS, RENAMED_AND_REMOVED_LINTS, SUPER_OR_SELF_IN_GLOBAL_PATH, - UNSIZED_IN_TUPLE, - OBJECT_UNSAFE_FRAGMENT, HR_LIFETIME_IN_ASSOC_TYPE, LIFETIME_UNDERSCORE ) diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index 8193d062631c1..bd35bfc9829a5 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -55,7 +55,6 @@ impl FreeRegionMap { match *predicate { ty::Predicate::Projection(..) | ty::Predicate::Trait(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) | ty::Predicate::WellFormed(..) | ty::Predicate::ObjectSafe(..) | diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 8318a29de1c54..6d6d7c2b3ba0a 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -36,27 +36,23 @@ use util::nodemap::{FnvHashMap, FnvHashSet}; use std::cmp; use std::fmt; -use syntax::ast; use syntax_pos::Span; use errors::DiagnosticBuilder; #[derive(Debug, PartialEq, Eq, Hash)] pub struct TraitErrorKey<'tcx> { span: Span, - warning_node_id: Option, predicate: ty::Predicate<'tcx> } impl<'a, 'gcx, 'tcx> TraitErrorKey<'tcx> { fn from_error(infcx: &InferCtxt<'a, 'gcx, 'tcx>, - e: &FulfillmentError<'tcx>, - warning_node_id: Option) -> Self { + e: &FulfillmentError<'tcx>) -> Self { let predicate = infcx.resolve_type_vars_if_possible(&e.obligation.predicate); TraitErrorKey { span: e.obligation.cause.span, - predicate: infcx.tcx.erase_regions(&predicate), - warning_node_id: warning_node_id + predicate: infcx.tcx.erase_regions(&predicate) } } } @@ -64,22 +60,13 @@ impl<'a, 'gcx, 'tcx> TraitErrorKey<'tcx> { impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn report_fulfillment_errors(&self, errors: &Vec>) { for error in errors { - self.report_fulfillment_error(error, None); - } - } - - pub fn report_fulfillment_errors_as_warnings(&self, - errors: &Vec>, - node_id: ast::NodeId) { - for error in errors { - self.report_fulfillment_error(error, Some(node_id)); + self.report_fulfillment_error(error); } } fn report_fulfillment_error(&self, - error: &FulfillmentError<'tcx>, - warning_node_id: Option) { - let error_key = TraitErrorKey::from_error(self, error, warning_node_id); + error: &FulfillmentError<'tcx>) { + let error_key = TraitErrorKey::from_error(self, error); debug!("report_fulfillment_errors({:?}) - key={:?}", error, error_key); if !self.reported_trait_errors.borrow_mut().insert(error_key) { @@ -88,10 +75,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } match error.code { FulfillmentErrorCode::CodeSelectionError(ref e) => { - self.report_selection_error(&error.obligation, e, warning_node_id); + self.report_selection_error(&error.obligation, e); } FulfillmentErrorCode::CodeProjectionError(ref e) => { - self.report_projection_error(&error.obligation, e, warning_node_id); + self.report_projection_error(&error.obligation, e); } FulfillmentErrorCode::CodeAmbiguity => { self.maybe_report_ambiguity(&error.obligation); @@ -101,8 +88,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn report_projection_error(&self, obligation: &PredicateObligation<'tcx>, - error: &MismatchedProjectionTypes<'tcx>, - warning_node_id: Option) + error: &MismatchedProjectionTypes<'tcx>) { let predicate = self.resolve_type_vars_if_possible(&obligation.predicate); @@ -110,16 +96,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if predicate.references_error() { return } - if let Some(warning_node_id) = warning_node_id { - self.tcx.sess.add_lint( - ::lint::builtin::UNSIZED_IN_TUPLE, - warning_node_id, - obligation.cause.span, - format!("type mismatch resolving `{}`: {}", - predicate, - error.err)); - return - } + self.probe(|_| { let origin = TypeOrigin::Misc(obligation.cause.span); let err_buf; @@ -442,8 +419,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn report_selection_error(&self, obligation: &PredicateObligation<'tcx>, - error: &SelectionError<'tcx>, - warning_node_id: Option) + error: &SelectionError<'tcx>) { let span = obligation.cause.span; let mut err = match *error { @@ -466,16 +442,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } else { let trait_ref = trait_predicate.to_poly_trait_ref(); - if let Some(warning_node_id) = warning_node_id { - self.tcx.sess.add_lint( - ::lint::builtin::UNSIZED_IN_TUPLE, - warning_node_id, - obligation.cause.span, - format!("the trait bound `{}` is not satisfied", - trait_ref.to_predicate())); - return; - } - let mut err = struct_span_err!(self.tcx.sess, span, E0277, "the trait bound `{}` is not satisfied", trait_ref.to_predicate()); @@ -541,15 +507,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::Predicate::ObjectSafe(trait_def_id) => { let violations = self.tcx.object_safety_violations(trait_def_id); - let err = self.tcx.report_object_safety_error(span, - trait_def_id, - warning_node_id, - violations); - if let Some(err) = err { - err - } else { - return; - } + self.tcx.report_object_safety_error(span, + trait_def_id, + violations) } ty::Predicate::ClosureKind(closure_def_id, kind) => { @@ -577,13 +537,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // (which may fail). span_bug!(span, "WF predicate not satisfied for {:?}", ty); } - - ty::Predicate::Rfc1592(ref data) => { - span_bug!( - obligation.cause.span, - "RFC1592 predicate not satisfied for {:?}", - data); - } } } } @@ -605,14 +558,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { TraitNotObjectSafe(did) => { let violations = self.tcx.object_safety_violations(did); - let err = self.tcx.report_object_safety_error(span, did, - warning_node_id, - violations); - if let Some(err) = err { - err - } else { - return; - } + self.tcx.report_object_safety_error(span, did, + violations) } }; self.note_obligation_cause(&mut err, obligation); @@ -640,24 +587,17 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn report_object_safety_error(self, span: Span, trait_def_id: DefId, - warning_node_id: Option, violations: Vec) - -> Option> + -> DiagnosticBuilder<'tcx> { - let mut err = match warning_node_id { - Some(_) => None, - None => { - let trait_str = self.item_path_str(trait_def_id); - let mut db = struct_span_err!( - self.sess, span, E0038, - "the trait `{}` cannot be made into an object", - trait_str); - db.span_label(span, - &format!("the trait `{}` cannot be made \ - into an object", trait_str)); - Some(db) - } - }; + let trait_str = self.item_path_str(trait_def_id); + let mut err = struct_span_err!( + self.sess, span, E0038, + "the trait `{}` cannot be made into an object", + trait_str); + err.span_label(span, &format!( + "the trait `{}` cannot be made into an object", trait_str + )); let mut reported_violations = FnvHashSet(); for violation in violations { @@ -697,19 +637,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { &buf } }; - match (warning_node_id, &mut err) { - (Some(node_id), &mut None) => { - self.sess.add_lint( - ::lint::builtin::OBJECT_UNSAFE_FRAGMENT, - node_id, - span, - note.to_string()); - } - (None, &mut Some(ref mut err)) => { - err.note(note); - } - _ => unreachable!() - } + err.note(note); } err } diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 6598aacc1d3d2..65860671c4c63 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -57,9 +57,6 @@ pub struct FulfillmentContext<'tcx> { // fulfillment context. predicates: ObligationForest>, - // A list of new obligations due to RFC1592. - rfc1592_obligations: Vec>, - // A set of constraints that regionck must validate. Each // constraint has the form `T:'a`, meaning "some type `T` must // outlive the lifetime 'a". These constraints derive from @@ -192,7 +189,6 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { pub fn new() -> FulfillmentContext<'tcx> { FulfillmentContext { predicates: ObligationForest::new(), - rfc1592_obligations: Vec::new(), region_obligations: NodeMap(), deferred_obligations: vec![], } @@ -275,13 +271,6 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { }); } - pub fn register_rfc1592_obligation(&mut self, - _infcx: &InferCtxt<'a, 'gcx, 'tcx>, - obligation: PredicateObligation<'tcx>) - { - self.rfc1592_obligations.push(obligation); - } - pub fn region_obligations(&self, body_id: ast::NodeId) -> &[RegionObligation<'tcx>] @@ -292,21 +281,6 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { } } - pub fn select_rfc1592_obligations(&mut self, - infcx: &InferCtxt<'a, 'gcx, 'tcx>) - -> Result<(),Vec>> - { - while !self.rfc1592_obligations.is_empty() { - for obligation in mem::replace(&mut self.rfc1592_obligations, Vec::new()) { - self.register_predicate_obligation(infcx, obligation); - } - - self.select_all_or_error(infcx)?; - } - - Ok(()) - } - pub fn select_all_or_error(&mut self, infcx: &InferCtxt<'a, 'gcx, 'tcx>) -> Result<(),Vec>> @@ -362,7 +336,6 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { let outcome = self.predicates.process_obligations(&mut FulfillProcessor { selcx: selcx, region_obligations: &mut self.region_obligations, - rfc1592_obligations: &mut self.rfc1592_obligations, deferred_obligations: &mut self.deferred_obligations }); debug!("select: outcome={:?}", outcome); @@ -398,7 +371,6 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { struct FulfillProcessor<'a, 'b: 'a, 'gcx: 'tcx, 'tcx: 'b> { selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>, region_obligations: &'a mut NodeMap>>, - rfc1592_obligations: &'a mut Vec>, deferred_obligations: &'a mut Vec> } @@ -413,7 +385,6 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, process_predicate(self.selcx, obligation, self.region_obligations, - self.rfc1592_obligations, self.deferred_obligations) .map(|os| os.map(|os| os.into_iter().map(|o| PendingPredicateObligation { obligation: o, @@ -455,7 +426,6 @@ fn process_predicate<'a, 'gcx, 'tcx>( selcx: &mut SelectionContext<'a, 'gcx, 'tcx>, pending_obligation: &mut PendingPredicateObligation<'tcx>, region_obligations: &mut NodeMap>>, - rfc1592_obligations: &mut Vec>, deferred_obligations: &mut Vec>) -> Result>>, FulfillmentErrorCode<'tcx>> @@ -644,14 +614,6 @@ fn process_predicate<'a, 'gcx, 'tcx>( s => Ok(s) } } - - ty::Predicate::Rfc1592(ref inner) => { - rfc1592_obligations.push(PredicateObligation { - predicate: ty::Predicate::clone(inner), - ..obligation.clone() - }); - Ok(Some(vec![])) - } } } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 219d520046762..5f7b71518291a 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -153,7 +153,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::Predicate::TypeOutlives(..) | ty::Predicate::RegionOutlives(..) | ty::Predicate::ClosureKind(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) => { false } @@ -184,7 +183,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } ty::Predicate::Projection(..) | ty::Predicate::Trait(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) | ty::Predicate::RegionOutlives(..) | ty::Predicate::WellFormed(..) | diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index b015de79be5c6..0573f0c5bbaa0 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -513,8 +513,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } match obligation.predicate { - ty::Predicate::Rfc1592(..) => EvaluatedToOk, - ty::Predicate::Trait(ref t) => { assert!(!t.has_escaping_regions()); let obligation = obligation.with(t.clone()); @@ -1779,8 +1777,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ty::TyStr | ty::TySlice(_) | ty::TyTrait(..) => Never, ty::TyTuple(tys) => { - // FIXME(#33242) we only need to constrain the last field - Where(ty::Binder(tys.to_vec())) + Where(ty::Binder(tys.last().into_iter().cloned().collect())) } ty::TyStruct(def, substs) | ty::TyEnum(def, substs) => { @@ -2508,12 +2505,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // T -> Trait. (_, &ty::TyTrait(ref data)) => { - let mut object_dids = Some(data.principal.def_id()).into_iter(); - // FIXME(#33243) -// data.builtin_bounds.iter().flat_map(|bound| { -// tcx.lang_items.from_builtin_kind(bound).ok() -// }) -// .chain(Some(data.principal.def_id())); + let mut object_dids = + data.builtin_bounds.iter().flat_map(|bound| { + tcx.lang_items.from_builtin_kind(bound).ok() + }) + .chain(Some(data.principal.def_id())); if let Some(did) = object_dids.find(|did| { !tcx.is_object_safe(*did) }) { diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 038de25312d35..2cefc2ad79646 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -23,9 +23,6 @@ fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::Predicate::Trait(ref data) => ty::Predicate::Trait(tcx.anonymize_late_bound_regions(data)), - ty::Predicate::Rfc1592(ref data) => - ty::Predicate::Rfc1592(Box::new(anonymize_predicate(tcx, data))), - ty::Predicate::Equate(ref data) => ty::Predicate::Equate(tcx.anonymize_late_bound_regions(data)), @@ -150,9 +147,6 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { self.stack.extend(predicates); } - ty::Predicate::Rfc1592(..) => { - // Nothing to elaborate. - } ty::Predicate::WellFormed(..) => { // Currently, we do not elaborate WF predicates, // although we easily could. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 1ea82a9c639d8..09420077a8abf 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -804,9 +804,6 @@ pub enum Predicate<'tcx> { /// would be the type parameters. Trait(PolyTraitPredicate<'tcx>), - /// A predicate created by RFC1592 - Rfc1592(Box>), - /// where `T1 == T2`. Equate(PolyEquatePredicate<'tcx>), @@ -906,8 +903,6 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { match *self { Predicate::Trait(ty::Binder(ref data)) => Predicate::Trait(ty::Binder(data.subst(tcx, substs))), - Predicate::Rfc1592(ref pi) => - Predicate::Rfc1592(Box::new(pi.subst_supertrait(tcx, trait_ref))), Predicate::Equate(ty::Binder(ref data)) => Predicate::Equate(ty::Binder(data.subst(tcx, substs))), Predicate::RegionOutlives(ty::Binder(ref data)) => @@ -1108,9 +1103,6 @@ impl<'tcx> Predicate<'tcx> { ty::Predicate::Trait(ref data) => { data.skip_binder().input_types().collect() } - ty::Predicate::Rfc1592(ref data) => { - return data.walk_tys() - } ty::Predicate::Equate(ty::Binder(ref data)) => { vec![data.0, data.1] } @@ -1148,7 +1140,6 @@ impl<'tcx> Predicate<'tcx> { Predicate::Trait(ref t) => { Some(t.to_poly_trait_ref()) } - Predicate::Rfc1592(..) | Predicate::Projection(..) | Predicate::Equate(..) | Predicate::RegionOutlives(..) | @@ -1820,10 +1811,10 @@ impl<'a, 'tcx> AdtDefData<'tcx, 'tcx> { } TyTuple(ref tys) => { - // FIXME(#33242) we only need to constrain the last field - tys.iter().flat_map(|ty| { - self.sized_constraint_for_ty(tcx, stack, ty) - }).collect() + match tys.last() { + None => vec![], + Some(ty) => self.sized_constraint_for_ty(tcx, stack, ty) + } } TyEnum(adt, substs) | TyStruct(adt, substs) => { diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 705cca056f24c..ad3769605abd9 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -178,9 +178,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { ty::Predicate::WellFormed(ty) => { tcx.lift(&ty).map(ty::Predicate::WellFormed) } - ty::Predicate::Rfc1592(box ref a) => { - tcx.lift(a).map(|a| ty::Predicate::Rfc1592(Box::new(a))) - } ty::Predicate::ClosureKind(closure_def_id, kind) => { Some(ty::Predicate::ClosureKind(closure_def_id, kind)) } @@ -790,8 +787,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> { match *self { ty::Predicate::Trait(ref a) => ty::Predicate::Trait(a.fold_with(folder)), - ty::Predicate::Rfc1592(ref a) => - ty::Predicate::Rfc1592(a.fold_with(folder)), ty::Predicate::Equate(ref binder) => ty::Predicate::Equate(binder.fold_with(folder)), ty::Predicate::RegionOutlives(ref binder) => @@ -812,7 +807,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> { fn super_visit_with>(&self, visitor: &mut V) -> bool { match *self { ty::Predicate::Trait(ref a) => a.visit_with(visitor), - ty::Predicate::Rfc1592(ref a) => a.visit_with(visitor), ty::Predicate::Equate(ref binder) => binder.visit_with(visitor), ty::Predicate::RegionOutlives(ref binder) => binder.visit_with(visitor), ty::Predicate::TypeOutlives(ref binder) => binder.visit_with(visitor), diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index dd5c6a9758abf..77d16287fedc6 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -318,7 +318,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { match predicate { ty::Predicate::Projection(..) | ty::Predicate::Trait(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) | ty::Predicate::WellFormed(..) | ty::Predicate::ObjectSafe(..) | diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 1f166cb192fa3..aef646a7aacaf 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -94,9 +94,6 @@ pub fn predicate_obligations<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } ty::Predicate::ClosureKind(..) => { } - ty::Predicate::Rfc1592(ref data) => { - bug!("RFC1592 predicate `{:?}` in predicate_obligations", data); - } } wf.normalize() @@ -158,7 +155,6 @@ pub fn implied_bounds<'a, 'gcx, 'tcx>( assert!(!obligation.has_escaping_regions()); match obligation.predicate { ty::Predicate::Trait(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) | ty::Predicate::Projection(..) | ty::Predicate::ClosureKind(..) | @@ -282,21 +278,14 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - fn require_sized(&mut self, subty: Ty<'tcx>, cause: traits::ObligationCauseCode<'tcx>, - rfc1592: bool) { + fn require_sized(&mut self, subty: Ty<'tcx>, cause: traits::ObligationCauseCode<'tcx>) { if !subty.has_escaping_regions() { let cause = self.cause(cause); match self.infcx.tcx.trait_ref_for_builtin_bound(ty::BoundSized, subty) { Ok(trait_ref) => { - let predicate = trait_ref.to_predicate(); - let predicate = if rfc1592 { - ty::Predicate::Rfc1592(box predicate) - } else { - predicate - }; self.out.push( traits::Obligation::new(cause, - predicate)); + trait_ref.to_predicate())); } Err(ErrorReported) => { } } @@ -326,13 +315,13 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { ty::TySlice(subty) | ty::TyArray(subty, _) => { - self.require_sized(subty, traits::SliceOrArrayElem, false); + self.require_sized(subty, traits::SliceOrArrayElem); } ty::TyTuple(ref tys) => { if let Some((_last, rest)) = tys.split_last() { for elem in rest { - self.require_sized(elem, traits::TupleElem, true); + self.require_sized(elem, traits::TupleElem); } } } @@ -401,22 +390,15 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { let cause = self.cause(traits::MiscObligation); - // FIXME(#33243): remove RFC1592 - self.out.push(traits::Obligation::new( - cause.clone(), - ty::Predicate::ObjectSafe(data.principal.def_id()) - )); let component_traits = data.builtin_bounds.iter().flat_map(|bound| { tcx.lang_items.from_builtin_kind(bound).ok() - }); -// .chain(Some(data.principal.def_id())); + }) + .chain(Some(data.principal.def_id())); self.out.extend( component_traits.map(|did| { traits::Obligation::new( cause.clone(), - ty::Predicate::Rfc1592( - box ty::Predicate::ObjectSafe(did) - ) + ty::Predicate::ObjectSafe(did) )}) ); } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 24b68c66e4667..7e2cc2938ca9e 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -487,9 +487,6 @@ impl<'tcx> fmt::Debug for ty::Predicate<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { ty::Predicate::Trait(ref a) => write!(f, "{:?}", a), - ty::Predicate::Rfc1592(ref a) => { - write!(f, "RFC1592({:?})", a) - } ty::Predicate::Equate(ref pair) => write!(f, "{:?}", pair), ty::Predicate::RegionOutlives(ref pair) => write!(f, "{:?}", pair), ty::Predicate::TypeOutlives(ref pair) => write!(f, "{:?}", pair), @@ -1083,7 +1080,6 @@ impl<'tcx> fmt::Display for ty::Predicate<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { ty::Predicate::Trait(ref data) => write!(f, "{}", data), - ty::Predicate::Rfc1592(ref data) => write!(f, "{}", data), ty::Predicate::Equate(ref predicate) => write!(f, "{}", predicate), ty::Predicate::RegionOutlives(ref predicate) => write!(f, "{}", predicate), ty::Predicate::TypeOutlives(ref predicate) => write!(f, "{}", predicate), diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 1a4330f58c3cd..0f0e9cfb35773 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -191,14 +191,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { id: LintId::of(ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN), reference: "RFC 1445 ", }, - FutureIncompatibleInfo { - id: LintId::of(UNSIZED_IN_TUPLE), - reference: "issue #33242 ", - }, - FutureIncompatibleInfo { - id: LintId::of(OBJECT_UNSAFE_FRAGMENT), - reference: "issue #33243 ", - }, FutureIncompatibleInfo { id: LintId::of(HR_LIFETIME_IN_ASSOC_TYPE), reference: "issue #33685 ", diff --git a/src/librustc_metadata/tyencode.rs b/src/librustc_metadata/tyencode.rs index 7255eae61d453..954ca878c01ef 100644 --- a/src/librustc_metadata/tyencode.rs +++ b/src/librustc_metadata/tyencode.rs @@ -479,9 +479,6 @@ pub fn enc_predicate<'a, 'tcx>(w: &mut Cursor>, p: &ty::Predicate<'tcx>) { match *p { - ty::Predicate::Rfc1592(..) => { - bug!("RFC1592 predicate in metadata `{:?}`", p); - } ty::Predicate::Trait(ref trait_ref) => { write!(w, "t"); enc_trait_ref(w, cx, trait_ref.0.trait_ref); diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 9e076851bc37d..2fc90ab27a085 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1019,10 +1019,6 @@ impl<'tcx> MirMapPass<'tcx> for QualifyAndPromoteConstants { if let Err(err) = fulfillment_cx.select_all_or_error(&infcx) { infcx.report_fulfillment_errors(&err); } - - if let Err(errors) = fulfillment_cx.select_rfc1592_obligations(&infcx) { - infcx.report_fulfillment_errors_as_warnings(&errors, id); - } }); } } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index f24a7cf2121eb..e15b0b4044ee3 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1128,8 +1128,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { tcx.astconv_object_safety_violations(principal.def_id()); if !object_safety_violations.is_empty() { tcx.report_object_safety_error( - span, principal.def_id(), None, object_safety_violations) - .unwrap().emit(); + span, principal.def_id(), object_safety_violations) + .emit(); return tcx.types.err; } diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 46e8c27f6d33b..516dd9c64221c 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -165,7 +165,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::Predicate::TypeOutlives(..) => None, ty::Predicate::WellFormed(..) => None, ty::Predicate::ObjectSafe(..) => None, - ty::Predicate::Rfc1592(..) => None, // NB: This predicate is created by breaking down a // `ClosureType: FnFoo()` predicate, where diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 26a4705528976..365c18d5e6661 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -484,7 +484,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // Object safety violations or miscellaneous. Err(err) => { - self.report_selection_error(&obligation, &err, None); + self.report_selection_error(&obligation, &err); // Treat this like an obligation and follow through // with the unsizing - the lack of a coercion should // be silent, as it causes a type mismatch later. diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index cede9d871ff4d..3a6076774330d 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -111,10 +111,6 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( return Err(()); } - if let Err(ref errors) = fulfillment_cx.select_rfc1592_obligations(&infcx) { - infcx.report_fulfillment_errors_as_warnings(errors, drop_impl_node_id); - } - let free_regions = FreeRegionMap::new(); infcx.resolve_regions_and_report_errors(&free_regions, drop_impl_node_id); Ok(()) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 29366823fffdc..2e2cb2765d93d 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -496,7 +496,6 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { ty::Predicate::WellFormed(..) | ty::Predicate::ObjectSafe(..) | ty::Predicate::ClosureKind(..) | - ty::Predicate::Rfc1592(..) | ty::Predicate::TypeOutlives(..) => { None } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a7ea8bd7959fe..90a9d9bffe7dc 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -505,10 +505,6 @@ pub fn check_item_bodies(ccx: &CrateCtxt) -> CompileResult { if let Err(errors) = fulfillment_cx.select_all_or_error(&infcx) { infcx.report_fulfillment_errors(&errors); } - - if let Err(errors) = fulfillment_cx.select_rfc1592_obligations(&infcx) { - infcx.report_fulfillment_errors_as_warnings(&errors, item_id); - } }); } }) @@ -2245,10 +2241,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Ok(()) => { } Err(errors) => { self.report_fulfillment_errors(&errors); } } - - if let Err(ref errors) = fulfillment_cx.select_rfc1592_obligations(self) { - self.report_fulfillment_errors_as_warnings(errors, self.body_id); - } } /// Select as many obligations as we can at present. diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 30b9d15587069..f63e7b0994761 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -477,7 +477,6 @@ impl<'tcx> GetTypeParameterBounds<'tcx> for ty::GenericPredicates<'tcx> { ty::Predicate::TypeOutlives(ref data) => { data.skip_binder().0.is_param(def.index) } - ty::Predicate::Rfc1592(..) | ty::Predicate::Equate(..) | ty::Predicate::RegionOutlives(..) | ty::Predicate::WellFormed(..) | diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0af3973f78d21..e4b6a30d5bcb3 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -858,7 +858,6 @@ impl<'a> Clean for ty::Predicate<'a> { Predicate::WellFormed(_) => panic!("not user writable"), Predicate::ObjectSafe(_) => panic!("not user writable"), Predicate::ClosureKind(..) => panic!("not user writable"), - Predicate::Rfc1592(..) => panic!("not user writable"), } } } diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index 8aaf752125690..e9d0b986c1176 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -13,5 +13,7 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); //~^ ERROR `Trait + Sized: std::marker::Sized` is not satisfied + //~| ERROR the trait `std::marker::Sized` cannot be made into an object //~| ERROR `Trait + Sized: std::marker::Sized` is not satisfied + //~| ERROR the trait `std::marker::Sized` cannot be made into an object } diff --git a/src/test/compile-fail/issue-32963.rs b/src/test/compile-fail/issue-32963.rs index c4e8f76611752..8ba95d14931e0 100644 --- a/src/test/compile-fail/issue-32963.rs +++ b/src/test/compile-fail/issue-32963.rs @@ -17,4 +17,5 @@ fn size_of_copy() -> usize { mem::size_of::() } fn main() { size_of_copy::(); //~^ ERROR `Misc + Copy: std::marker::Copy` is not satisfied + //~| ERROR the trait `std::marker::Copy` cannot be made into an object } diff --git a/src/test/compile-fail/rfc1592-deprecated.rs b/src/test/compile-fail/rfc1592-deprecated.rs deleted file mode 100644 index e766f977200c3..0000000000000 --- a/src/test/compile-fail/rfc1592-deprecated.rs +++ /dev/null @@ -1,32 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::fmt; - -#[deny(warnings)] trait Foo { fn foo(&self) -> (Self, Self); } -//~^ ERROR the trait bound `Self: std::marker::Sized` is not satisfied -//~| WARNING hard error - -impl Foo for T { - fn foo(&self) -> (Self, Self) { - (*self, *self) - } -} - -#[deny(warnings)] -fn main() { - assert_eq!((11).foo(), (11, 11)); - - let junk: Box = Box::new(42); - //~^ ERROR the trait cannot require that `Self : Sized` - //~| WARNING hard error - let f = format!("{:?}", junk); - assert_eq!(f, "42"); -} diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index d40c12f67a08d..462d760a60ceb 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -14,9 +14,9 @@ trait T {} fn f1(x: &X) { let _: X; // <-- this is OK, no bindings created, no initializer. - let _: (isize, (X, isize)); + let _: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfie let y: X; //~ERROR `X: std::marker::Sized` is not satisfied - let y: (isize, (X, usize)); //~ERROR `X: std::marker::Sized` is not satisfied + let y: (isize, (X, usize)); } fn f2(x: &X) { let y: X; //~ERROR `X: std::marker::Sized` is not satisfied diff --git a/src/test/run-pass/rfc1592-deprecated.rs b/src/test/run-pass/rfc1592-deprecated.rs deleted file mode 100644 index 81bf02587896f..0000000000000 --- a/src/test/run-pass/rfc1592-deprecated.rs +++ /dev/null @@ -1,29 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::fmt; - -trait Foo { - fn foo(&self) -> (Self, Self); -} - -impl Foo for T { - fn foo(&self) -> (Self, Self) { - (*self, *self) - } -} - -fn main() { - assert_eq!((11).foo(), (11, 11)); - - let junk: Box = Box::new(42); - let f = format!("{:?}", junk); - assert_eq!(f, "42"); -}