]> git.lizzy.rs Git - rust.git/commitdiff
turn the RFC1592 warnings into hard errors
authorAriel Ben-Yehuda <ariel.byd@gmail.com>
Thu, 1 Sep 2016 10:34:56 +0000 (13:34 +0300)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Thu, 1 Sep 2016 10:34:56 +0000 (13:34 +0300)
The warnings have already reached stable

The test rfc1592_deprecated is covered by `bad_sized` and
`unsized6`.

Fixes #33242
Fixes #33243

28 files changed:
src/librustc/lint/builtin.rs
src/librustc/middle/free_region.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/fulfill.rs
src/librustc/traits/object_safety.rs
src/librustc/traits/select.rs
src/librustc/traits/util.rs
src/librustc/ty/mod.rs
src/librustc/ty/structural_impls.rs
src/librustc/ty/util.rs
src/librustc/ty/wf.rs
src/librustc/util/ppaux.rs
src/librustc_lint/lib.rs
src/librustc_metadata/tyencode.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/collect.rs
src/librustdoc/clean/mod.rs
src/test/compile-fail/bad-sized.rs
src/test/compile-fail/issue-32963.rs
src/test/compile-fail/rfc1592-deprecated.rs [deleted file]
src/test/compile-fail/unsized6.rs
src/test/run-pass/rfc1592-deprecated.rs [deleted file]

index b2ee38741fcabc1927d01c0107a9a9317c4ef0ad..ed94e5fe377c495165a21de8a6949c4458fe4b29 100644 (file)
     "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 @@ fn get_lints(&self) -> LintArray {
             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
         )
index 8193d062631c1f4be6309ffae1ad1813ef91f8df..bd35bfc9829a5c08541a83d35585a706f7f873ce 100644 (file)
@@ -55,7 +55,6 @@ pub fn relate_free_regions_from_predicates(&mut self,
             match *predicate {
                 ty::Predicate::Projection(..) |
                 ty::Predicate::Trait(..) |
-                ty::Predicate::Rfc1592(..) |
                 ty::Predicate::Equate(..) |
                 ty::Predicate::WellFormed(..) |
                 ty::Predicate::ObjectSafe(..) |
index 8318a29de1c54e1dd3124a334522815396a46c3e..6d6d7c2b3ba0a830e0237e6e44a9c41d1aeeeba5 100644 (file)
 
 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<ast::NodeId>,
     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<ast::NodeId>) -> 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 @@ fn from_error(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
 impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
     pub fn report_fulfillment_errors(&self, errors: &Vec<FulfillmentError<'tcx>>) {
         for error in errors {
-            self.report_fulfillment_error(error, None);
-        }
-    }
-
-    pub fn report_fulfillment_errors_as_warnings(&self,
-                                                 errors: &Vec<FulfillmentError<'tcx>>,
-                                                 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<ast::NodeId>) {
-        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 @@ fn report_fulfillment_error(&self,
         }
         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 @@ fn report_fulfillment_error(&self,
 
     fn report_projection_error(&self,
                                obligation: &PredicateObligation<'tcx>,
-                               error: &MismatchedProjectionTypes<'tcx>,
-                               warning_node_id: Option<ast::NodeId>)
+                               error: &MismatchedProjectionTypes<'tcx>)
     {
         let predicate =
             self.resolve_type_vars_if_possible(&obligation.predicate);
@@ -110,16 +96,7 @@ fn report_projection_error(&self,
         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 @@ pub fn report_overflow_error_cycle(&self, cycle: &[PredicateObligation<'tcx>]) -
 
     pub fn report_selection_error(&self,
                                   obligation: &PredicateObligation<'tcx>,
-                                  error: &SelectionError<'tcx>,
-                                  warning_node_id: Option<ast::NodeId>)
+                                  error: &SelectionError<'tcx>)
     {
         let span = obligation.cause.span;
         let mut err = match *error {
@@ -466,16 +442,6 @@ pub fn report_selection_error(&self,
                             } 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 @@ pub fn report_selection_error(&self,
 
                         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 @@ pub fn report_selection_error(&self,
                             // (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 @@ pub fn report_selection_error(&self,
 
             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 @@ pub fn recursive_type_with_infinite_size_error(self,
     pub fn report_object_safety_error(self,
                                       span: Span,
                                       trait_def_id: DefId,
-                                      warning_node_id: Option<ast::NodeId>,
                                       violations: Vec<ObjectSafetyViolation>)
-                                      -> Option<DiagnosticBuilder<'tcx>>
+                                      -> 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 @@ pub fn report_object_safety_error(self,
                     &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
     }
index 6598aacc1d3d2d2ee5adffc807bdf4eb772d4c28..65860671c4c636c331fd87d56525a9489966b60a 100644 (file)
@@ -57,9 +57,6 @@ pub struct FulfillmentContext<'tcx> {
     // fulfillment context.
     predicates: ObligationForest<PendingPredicateObligation<'tcx>>,
 
-    // A list of new obligations due to RFC1592.
-    rfc1592_obligations: Vec<PredicateObligation<'tcx>>,
-
     // 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 @@ pub fn register_predicate_obligation(&mut self,
         });
     }
 
-    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 @@ pub fn region_obligations(&self,
         }
     }
 
-    pub fn select_rfc1592_obligations(&mut self,
-                                      infcx: &InferCtxt<'a, 'gcx, 'tcx>)
-                                      -> Result<(),Vec<FulfillmentError<'tcx>>>
-    {
-        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<FulfillmentError<'tcx>>>
@@ -362,7 +336,6 @@ fn select(&mut self, selcx: &mut SelectionContext<'a, 'gcx, '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 @@ fn select(&mut self, selcx: &mut SelectionContext<'a, 'gcx, 'tcx>)
 struct FulfillProcessor<'a, 'b: 'a, 'gcx: 'tcx, 'tcx: 'b> {
     selcx: &'a mut SelectionContext<'b, 'gcx, 'tcx>,
     region_obligations: &'a mut NodeMap<Vec<RegionObligation<'tcx>>>,
-    rfc1592_obligations: &'a mut Vec<PredicateObligation<'tcx>>,
     deferred_obligations: &'a mut Vec<DeferredObligation<'tcx>>
 }
 
@@ -413,7 +385,6 @@ fn process_obligation(&mut self,
         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<Vec<RegionObligation<'tcx>>>,
-    rfc1592_obligations: &mut Vec<PredicateObligation<'tcx>>,
     deferred_obligations: &mut Vec<DeferredObligation<'tcx>>)
     -> Result<Option<Vec<PredicateObligation<'tcx>>>,
               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![]))
-        }
     }
 }
 
index 219d5200467622f8df1f708531206ce12b33a815..5f7b71518291a1f932729f690d1975ea9c4c5a37 100644 (file)
@@ -153,7 +153,6 @@ fn supertraits_reference_self(self, trait_def_id: DefId) -> bool {
                     ty::Predicate::TypeOutlives(..) |
                     ty::Predicate::RegionOutlives(..) |
                     ty::Predicate::ClosureKind(..) |
-                    ty::Predicate::Rfc1592(..) |
                     ty::Predicate::Equate(..) => {
                         false
                     }
@@ -184,7 +183,6 @@ fn generics_require_sized_self(self, def_id: DefId) -> bool {
                     }
                     ty::Predicate::Projection(..) |
                     ty::Predicate::Trait(..) |
-                    ty::Predicate::Rfc1592(..) |
                     ty::Predicate::Equate(..) |
                     ty::Predicate::RegionOutlives(..) |
                     ty::Predicate::WellFormed(..) |
index b015de79be5c690e632d723359960134b3212d6e..0573f0c5bbaa0b144b49ce6ad7b2e1f0a4e090fc 100644 (file)
@@ -513,8 +513,6 @@ fn evaluate_predicate_recursively<'o>(&mut self,
         }
 
         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 @@ fn sized_conditions(&mut self, obligation: &TraitObligation<'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 @@ fn confirm_builtin_unsize_candidate(&mut self,
 
             // 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)
                 }) {
index 038de25312d35b631fb1f6fe41c4abb703d21246..2cefc2ad79646730cc9b9e07e3cc7be784fc6680 100644 (file)
@@ -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 @@ fn push(&mut self, predicate: &ty::Predicate<'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.
index 1ea82a9c639d8a845d2a068a9b1afaf321602009..09420077a8abfa7c42463156cd837bfe7d6f2133 100644 (file)
@@ -804,9 +804,6 @@ pub enum Predicate<'tcx> {
     /// would be the type parameters.
     Trait(PolyTraitPredicate<'tcx>),
 
-    /// A predicate created by RFC1592
-    Rfc1592(Box<Predicate<'tcx>>),
-
     /// where `T1 == T2`.
     Equate(PolyEquatePredicate<'tcx>),
 
@@ -906,8 +903,6 @@ pub fn subst_supertrait(&self, tcx: TyCtxt<'a, 'gcx, '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 @@ pub fn walk_tys(&self) -> IntoIter<Ty<'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 @@ pub fn to_opt_poly_trait_ref(&self) -> Option<PolyTraitRef<'tcx>> {
             Predicate::Trait(ref t) => {
                 Some(t.to_poly_trait_ref())
             }
-            Predicate::Rfc1592(..) |
             Predicate::Projection(..) |
             Predicate::Equate(..) |
             Predicate::RegionOutlives(..) |
@@ -1820,10 +1811,10 @@ fn sized_constraint_for_ty(
             }
 
             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) => {
index 705cca056f24c0d9bf5d7095e2546325b477f7d1..ad3769605abd90023b76362cc4ce16e5a504cb9c 100644 (file)
@@ -178,9 +178,6 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lif
             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 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
         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 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
     fn super_visit_with<V: TypeVisitor<'tcx>>(&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),
index dd5c6a9758abf263d49b0960d8b684932b141d56..77d16287fedc6d5296f2c0063419f29d23d77d73 100644 (file)
@@ -318,7 +318,6 @@ pub fn required_region_bounds(self,
                 match predicate {
                     ty::Predicate::Projection(..) |
                     ty::Predicate::Trait(..) |
-                    ty::Predicate::Rfc1592(..) |
                     ty::Predicate::Equate(..) |
                     ty::Predicate::WellFormed(..) |
                     ty::Predicate::ObjectSafe(..) |
index 1f166cb192fa33c0c686066909f8dea6026315d8..aef646a7aacafdfda6ab9be099be93e046d2342f 100644 (file)
@@ -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 @@ fn compute_projection(&mut self, data: ty::ProjectionTy<'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 @@ fn compute(&mut self, ty0: Ty<'tcx>) -> bool {
 
                 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 @@ fn compute(&mut self, ty0: Ty<'tcx>) -> bool {
 
                     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)
                         )})
                     );
                 }
index 24b68c66e46673d3934f33227212987a1a66bf22..7e2cc2938ca9e4b1763c336288673c36b0181b12 100644 (file)
@@ -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),
index 1a4330f58c3cd7012d4c91c700f61dd5a238e84e..0f0e9cfb3577335923d3bd0c38334815fe5beada 100644 (file)
@@ -191,14 +191,6 @@ macro_rules! add_lint_group {
             id: LintId::of(ILLEGAL_STRUCT_OR_ENUM_CONSTANT_PATTERN),
             reference: "RFC 1445 <https://github.com/rust-lang/rfcs/pull/1445>",
         },
-        FutureIncompatibleInfo {
-            id: LintId::of(UNSIZED_IN_TUPLE),
-            reference: "issue #33242 <https://github.com/rust-lang/rust/issues/33242>",
-        },
-        FutureIncompatibleInfo {
-            id: LintId::of(OBJECT_UNSAFE_FRAGMENT),
-            reference: "issue #33243 <https://github.com/rust-lang/rust/issues/33243>",
-        },
         FutureIncompatibleInfo {
             id: LintId::of(HR_LIFETIME_IN_ASSOC_TYPE),
             reference: "issue #33685 <https://github.com/rust-lang/rust/issues/33685>",
index 7255eae61d4533cd75b205caae28b6f7f256e121..954ca878c01ef7919ea945681528fbca1af3448d 100644 (file)
@@ -479,9 +479,6 @@ pub fn enc_predicate<'a, 'tcx>(w: &mut Cursor<Vec<u8>>,
                                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);
index 9e076851bc37d9b6c900482283ecaf3cb6f6bcc2..2fc90ab27a08559c5db46346635ac0e8b3c265a5 100644 (file)
@@ -1019,10 +1019,6 @@ fn run_pass<'a>(&mut self,
                     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);
-                    }
                 });
             }
         }
index f24a7cf2121ebe7ab67c22e508b9ec3885d8a014..e15b0b4044ee37b6e95d36c286a84ad9ed4ff652 100644 (file)
@@ -1128,8 +1128,8 @@ fn trait_path_to_object_type(&self,
             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;
         }
 
index 46e8c27f6d33bbb38e77cc13d249af197c11c99e..516dd9c64221c491b6267f6ad06ca29e134d968e 100644 (file)
@@ -165,7 +165,6 @@ fn deduce_expectations_from_obligations(&self, expected_vid: ty::TyVid)
                     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
index 26a47055289761b72500e2f96258e74d5f1445c8..365c18d5e666123481616e32034108c9d051dfd0 100644 (file)
@@ -484,7 +484,7 @@ fn coerce_unsized(&self,
 
                 // 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.
index cede9d871ff4d6a77b3f9fccc40457c6e57504c8..3a6076774330dcd26fad834b0fd871d402493478 100644 (file)
@@ -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(())
index 29366823fffdc89feb9ecb176daa1f2879ae0132..2e2cb2765d93de6493105de55f2945865cb7a6b5 100644 (file)
@@ -496,7 +496,6 @@ fn assemble_inherent_candidates_from_param(&mut self,
                     ty::Predicate::WellFormed(..) |
                     ty::Predicate::ObjectSafe(..) |
                     ty::Predicate::ClosureKind(..) |
-                    ty::Predicate::Rfc1592(..) |
                     ty::Predicate::TypeOutlives(..) => {
                         None
                     }
index a7ea8bd7959fe0efcfa33626d88ded27f6f4380b..90a9d9bffe7dc2420a055b4494e39af654b4637a 100644 (file)
@@ -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 @@ fn select_all_obligations_or_error(&self) {
             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.
index 30b9d15587069e704361635dfe35175a59410cd1..f63e7b0994761d0c48e93928a4d236f6ab6eeadf 100644 (file)
@@ -477,7 +477,6 @@ fn get_type_parameter_bounds(&self,
                 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(..) |
index 0af3973f78d21f4b1f45104b9982a07cd53111f0..e4b6a30d5bcb3b35c3f55954ee9cb09545b561e5 100644 (file)
@@ -858,7 +858,6 @@ fn clean(&self, cx: &DocContext) -> WherePredicate {
             Predicate::WellFormed(_) => panic!("not user writable"),
             Predicate::ObjectSafe(_) => panic!("not user writable"),
             Predicate::ClosureKind(..) => panic!("not user writable"),
-            Predicate::Rfc1592(..) => panic!("not user writable"),
         }
     }
 }
index 8aaf752125690d829c7e40518d6032191e8e8969..e9d0b986c11767915ff6d7842e99de01b2f26340 100644 (file)
@@ -13,5 +13,7 @@ trait Trait {}
 pub fn main() {
     let x: Vec<Trait + Sized> = 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
 }
index c4e8f7661175236022333fef3788f65467ccf9c9..8ba95d14931e0b335914711d808c144ad8f5efee 100644 (file)
@@ -17,4 +17,5 @@ fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
 fn main() {
     size_of_copy::<Misc+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 (file)
index e766f97..0000000
+++ /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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<T: Copy> Foo for T {
-    fn foo(&self) -> (Self, Self) {
-        (*self, *self)
-    }
-}
-
-#[deny(warnings)]
-fn main() {
-    assert_eq!((11).foo(), (11, 11));
-
-    let junk: Box<fmt::Debug+Sized> = Box::new(42);
-    //~^ ERROR the trait cannot require that `Self : Sized`
-    //~| WARNING hard error
-    let f = format!("{:?}", junk);
-    assert_eq!(f, "42");
-}
index d40c12f67a08da43a38d3eadf754ab8a5601c78e..462d760a60ceb99647f5c5a7a3f08dcd15a37e32 100644 (file)
@@ -14,9 +14,9 @@ trait T {}
 
 fn f1<X: ?Sized>(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: ?Sized + T>(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 (file)
index 81bf025..0000000
+++ /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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<T: Copy> Foo for T {
-    fn foo(&self) -> (Self, Self) {
-        (*self, *self)
-    }
-}
-
-fn main() {
-    assert_eq!((11).foo(), (11, 11));
-
-    let junk: Box<fmt::Debug+Sized> = Box::new(42);
-    let f = format!("{:?}", junk);
-    assert_eq!(f, "42");
-}