]> git.lizzy.rs Git - rust.git/commitdiff
Obsolete `Sized? T`
authorNick Cameron <ncameron@mozilla.com>
Mon, 5 Jan 2015 20:44:33 +0000 (09:44 +1300)
committerNick Cameron <ncameron@mozilla.com>
Tue, 6 Jan 2015 01:20:47 +0000 (14:20 +1300)
[breaking-change]

Use `T: ?Sized`

src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs

index df18b41198a9fd005133640a07d3f1cbd6d2a622..d1b6034457d3ab60ccaa7456904569b96a9f397c 100644 (file)
@@ -22,6 +22,7 @@
 /// The specific types of unsupported syntax
 #[derive(Copy, PartialEq, Eq, Hash)]
 pub enum ObsoleteSyntax {
+    Sized,
     OwnedType,
     OwnedExpr,
     OwnedPattern,
@@ -92,7 +93,11 @@ fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
             ObsoleteSyntax::ExternCrateRenaming => (
                 "`extern crate foo = bar` syntax",
                 "write `extern crate bar as foo` instead"
-            )
+            ),
+            ObsoleteSyntax::Sized => (
+                "`Sized? T` syntax for removing the `Sized` bound",
+                "write `T: ?Sized` instead"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
index cf7b93ac59f0fddf135a2e99dfd0242eca2e3d5d..673a9aefd8b628869568ee1c0e3631ea6808c797 100644 (file)
@@ -4092,8 +4092,8 @@ fn parse_ty_param(&mut self) -> TyParam {
         // unbound, and it may only be `Sized`. To avoid backtracking and other
         // complications, we parse an ident, then check for `?`. If we find it,
         // we use the ident as the unbound, otherwise, we use it as the name of
-        // type param. Even worse, for now, we need to check for `?` before or
-        // after the bound.
+        // type param. Even worse, we need to check for `?` before or after the
+        // bound.
         let mut span = self.span;
         let mut ident = self.parse_ident();
         let mut unbound = None;
@@ -4102,6 +4102,7 @@ fn parse_ty_param(&mut self) -> TyParam {
             unbound = Some(tref);
             span = self.span;
             ident = self.parse_ident();
+            self.obsolete(span, ObsoleteSyntax::Sized);
         }
 
         let mut bounds = self.parse_colon_then_ty_param_bounds(BoundParsingMode::Modified);