about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-01-06 09:44:33 +1300
committerNick Cameron <ncameron@mozilla.com>2015-01-06 14:20:47 +1300
commit48f50e1e98691d74427e23e82694f528b3fb4d56 (patch)
tree3d3baaa54f40c13d58c2e9ebde1f12bcc5cc7ea7 /src
parent595a08258700f2f5689ad63d99b5d65d5dfb5eab (diff)
downloadrust-48f50e1e98691d74427e23e82694f528b3fb4d56.tar.gz
rust-48f50e1e98691d74427e23e82694f528b3fb4d56.zip
Obsolete `Sized? T`
[breaking-change]

Use `T: ?Sized`
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/parse/obsolete.rs7
-rw-r--r--src/libsyntax/parse/parser.rs5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index df18b41198a..d1b6034457d 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -22,6 +22,7 @@ use ptr::P;
 /// The specific types of unsupported syntax
 #[derive(Copy, PartialEq, Eq, Hash)]
 pub enum ObsoleteSyntax {
+    Sized,
     OwnedType,
     OwnedExpr,
     OwnedPattern,
@@ -92,7 +93,11 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
             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);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index cf7b93ac59f..673a9aefd8b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4092,8 +4092,8 @@ impl<'a> Parser<'a> {
         // 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 @@ impl<'a> Parser<'a> {
             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);