Skip to content

Commit 48f50e1

Browse files
committed
Obsolete Sized? T
[breaking-change] Use `T: ?Sized`
1 parent 595a082 commit 48f50e1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/libsyntax/parse/obsolete.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use ptr::P;
2222
/// The specific types of unsupported syntax
2323
#[derive(Copy, PartialEq, Eq, Hash)]
2424
pub enum ObsoleteSyntax {
25+
Sized,
2526
OwnedType,
2627
OwnedExpr,
2728
OwnedPattern,
@@ -92,7 +93,11 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
9293
ObsoleteSyntax::ExternCrateRenaming => (
9394
"`extern crate foo = bar` syntax",
9495
"write `extern crate bar as foo` instead"
95-
)
96+
),
97+
ObsoleteSyntax::Sized => (
98+
"`Sized? T` syntax for removing the `Sized` bound",
99+
"write `T: ?Sized` instead"
100+
),
96101
};
97102

98103
self.report(sp, kind, kind_str, desc);

src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,8 +4092,8 @@ impl<'a> Parser<'a> {
40924092
// unbound, and it may only be `Sized`. To avoid backtracking and other
40934093
// complications, we parse an ident, then check for `?`. If we find it,
40944094
// we use the ident as the unbound, otherwise, we use it as the name of
4095-
// type param. Even worse, for now, we need to check for `?` before or
4096-
// after the bound.
4095+
// type param. Even worse, we need to check for `?` before or after the
4096+
// bound.
40974097
let mut span = self.span;
40984098
let mut ident = self.parse_ident();
40994099
let mut unbound = None;
@@ -4102,6 +4102,7 @@ impl<'a> Parser<'a> {
41024102
unbound = Some(tref);
41034103
span = self.span;
41044104
ident = self.parse_ident();
4105+
self.obsolete(span, ObsoleteSyntax::Sized);
41054106
}
41064107

41074108
let mut bounds = self.parse_colon_then_ty_param_bounds(BoundParsingMode::Modified);

0 commit comments

Comments
 (0)