File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
29
29
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
30
30
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
31
31
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32
- refs/heads/batch: bbf7e4e58a9b565342b5990cb3e750932a90a1b6
32
+ refs/heads/batch: 4ed2800701fa0634c2aa73e7b090e84be665166a
33
33
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34
34
refs/heads/beta: 496dc4eae7de9d14cd49511a9acfbf5f11ae6c3f
35
35
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ use ptr::P;
24
24
/// The specific types of unsupported syntax
25
25
#[ derive( Copy , PartialEq , Eq , Hash ) ]
26
26
pub enum ObsoleteSyntax {
27
+ ObsoleteForSized ,
27
28
ObsoleteOwnedType ,
28
29
ObsoleteOwnedExpr ,
29
30
ObsoleteOwnedPattern ,
@@ -55,6 +56,11 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
55
56
/// Reports an obsolete syntax non-fatal error.
56
57
fn obsolete ( & mut self , sp : Span , kind : ObsoleteSyntax ) {
57
58
let ( kind_str, desc) = match kind {
59
+ ObsoleteForSized => (
60
+ "for Sized?" ,
61
+ "no longer required, traits apply to sized and unsized types by default, use \
62
+ `: Sized` to opt-out of unsized types",
63
+ ) ,
58
64
ObsoleteProcType => (
59
65
"the `proc` type" ,
60
66
"use unboxed closures instead" ,
Original file line number Diff line number Diff line change @@ -5003,6 +5003,7 @@ impl<'a> Parser<'a> {
5003
5003
// re-jigged shortly in any case, so leaving the hacky version for now.
5004
5004
if self . eat_keyword ( keywords:: For ) {
5005
5005
let span = self . span ;
5006
+
5006
5007
let mut ate_question = false ;
5007
5008
if self . eat ( & token:: Question ) {
5008
5009
ate_question = true ;
@@ -5020,8 +5021,11 @@ impl<'a> Parser<'a> {
5020
5021
"expected `?Sized` after `for` in trait item" ) ;
5021
5022
return None ;
5022
5023
}
5023
- let tref = Parser :: trait_ref_from_ident ( ident, span) ;
5024
- Some ( tref)
5024
+ let _tref = Parser :: trait_ref_from_ident ( ident, span) ;
5025
+
5026
+ self . obsolete ( span, ObsoleteForSized ) ;
5027
+
5028
+ None
5025
5029
} else {
5026
5030
None
5027
5031
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // Test that we generate obsolete syntax errors around usages of `for Sized?`
12
+
13
+ trait Foo for Sized ? { } //~ ERROR obsolete syntax: for Sized?
14
+
15
+ trait Bar for ?Sized { } //~ ERROR obsolete syntax: for Sized?
16
+
17
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments