]> git.lizzy.rs Git - rust.git/commitdiff
Do not attemt to continue parsing after `pub ident`
authorEsteban Küber <esteban@kuber.com.ar>
Tue, 21 Nov 2017 16:03:02 +0000 (08:03 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 24 Nov 2017 15:34:32 +0000 (07:34 -0800)
Try to identify the following code in order to provide better
diagnostics, but return the error to bail out early during the parse.

21 files changed:
src/librustc/hir/lowering.rs
src/librustc/hir/map/def_collector.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_save_analysis/sig.rs
src/libsyntax/ast.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/visit.rs
src/test/ui/pub/pub-restricted-error.rs
src/test/ui/suggestions/pub-ident-fn-2.rs [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-fn-2.stderr [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-fn-or-struct.rs [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-fn-or-struct.stderr [new file with mode: 0644]
src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.rs [deleted file]
src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.stderr [deleted file]
src/test/ui/suggestions/pub-ident-missing-kw.rs [deleted file]
src/test/ui/suggestions/pub-ident-missing-kw.stderr [deleted file]

index 0fd2ae9dbc8aa252da0bfcbbcfb08c5262ccd2f0..eafc6e0decf6733bfe4e6ee73f4605219b7ca461 100644 (file)
@@ -1757,7 +1757,7 @@ fn lower_item_kind(&mut self,
                                bounds,
                                items)
             }
-            ItemKind::Placeholder | ItemKind::MacroDef(..) | ItemKind::Mac(..) => {
+            ItemKind::MacroDef(..) | ItemKind::Mac(..) => {
                 panic!("Shouldn't still be around")
             }
         }
index c2dd7edbb105370392c05d12808766c1f1be3897..d8590c1de94e927ce1319b620e3064a21472a18d 100644 (file)
@@ -113,7 +113,6 @@ fn visit_item(&mut self, i: &'a Item) {
                 return visit::walk_item(self, i);
             }
             ItemKind::Mod(..) => DefPathData::Module(i.ident.name.as_str()),
-            ItemKind::Placeholder |
             ItemKind::Static(..) | ItemKind::Const(..) | ItemKind::Fn(..) =>
                 DefPathData::ValueNs(i.ident.name.as_str()),
             ItemKind::MacroDef(..) => DefPathData::MacroDef(i.ident.name.as_str()),
index 1492c817ffd3999c174ea96c614394cf1f3c4cd7..46513a5740aede76ac59469faa3426aeef7b2bfb 100644 (file)
@@ -269,7 +269,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, expansion: Mark) {
                 self.define(parent, ident, TypeNS, imported_binding);
             }
 
-            ItemKind::GlobalAsm(..) | ItemKind::Placeholder => {}
+            ItemKind::GlobalAsm(..) => {}
 
             ItemKind::Mod(..) if item.ident == keywords::Invalid.ident() => {} // Crate root
 
index 64d242307a7d8694315156396a00a38af62b643c..ae92cb81e273ed6b2f6794400abeaf8a5651f6cf 100644 (file)
@@ -1947,8 +1947,7 @@ fn resolve_item(&mut self, item: &Item) {
                 }
             }
 
-            ItemKind::ExternCrate(_) | ItemKind::MacroDef(..) | ItemKind::GlobalAsm(_) |
-            ItemKind::Placeholder => {
+            ItemKind::ExternCrate(_) | ItemKind::MacroDef(..) | ItemKind::GlobalAsm(_) => {
                 // do nothing, these are just around to be encoded
             }
 
index e7cf5782290addca53d1164c7de09f241e6f9ebd..b244876226c484a71ea789880070da50fdcf3ec9 100644 (file)
@@ -548,7 +548,6 @@ fn make(&self, offset: usize, _parent_id: Option<NodeId>, scx: &SaveContext) ->
             // FIXME should implement this (e.g., pub use).
             ast::ItemKind::Use(_) => Err("import"),
             ast::ItemKind::Mac(..) | ast::ItemKind::MacroDef(_) => Err("Macro"),
-            ast::ItemKind::Placeholder => Err("placeholder"),
         }
     }
 }
index a09cfbec879aa7c9dac2c2bc5ea53c95304b2998..ad9d58651207dce71d38c192c27c3339bbe056f6 100644 (file)
@@ -1977,7 +1977,6 @@ pub enum ItemKind {
 
     /// A macro definition.
     MacroDef(MacroDef),
-    Placeholder,
 }
 
 impl ItemKind {
@@ -1999,7 +1998,6 @@ pub fn descriptive_variant(&self) -> &str {
             ItemKind::Mac(..) |
             ItemKind::MacroDef(..) |
             ItemKind::Impl(..) |
-            ItemKind::Placeholder |
             ItemKind::AutoImpl(..) => "item"
         }
     }
index 40370eb809688cf93eec38e6ec9daca37674fbad..cc63bffec48a1652eca563e33bc0b58096eb8768 100644 (file)
@@ -935,7 +935,6 @@ pub fn noop_fold_item_kind<T: Folder>(i: ItemKind, folder: &mut T) -> ItemKind {
         ),
         ItemKind::Mac(m) => ItemKind::Mac(folder.fold_mac(m)),
         ItemKind::MacroDef(def) => ItemKind::MacroDef(folder.fold_macro_def(def)),
-        ItemKind::Placeholder => ItemKind::Placeholder,
     }
 }
 
index 0eda8e4d66b310d8809996d7100c7f76ac5deafc..f839a83985315d6da64db3539e9df965a8c7a83f 100644 (file)
@@ -72,50 +72,6 @@ pub struct Restrictions: u8 {
 
 type ItemInfo = (Ident, ItemKind, Option<Vec<Attribute> >);
 
-enum HasRecovered<'a, T> {
-    Success(T),
-    Recovered(T, DiagnosticBuilder<'a>),
-}
-
-impl<'a, T> HasRecovered<'a, T> {
-    fn new(t: T, err: Option<DiagnosticBuilder<'a>>) -> HasRecovered<'a, T> {
-        if let Some(err) = err {
-            HasRecovered::Recovered(t, err)
-        } else {
-            HasRecovered::Success(t)
-        }
-    }
-
-    fn map<O, F: FnOnce(T) -> O>(self, f: F) -> HasRecovered<'a, O> {
-        let (t, e) = self.full_unwrap();
-        HasRecovered::new(f(t), e)
-    }
-
-    fn emit(self) -> T {
-        match self {
-            HasRecovered::Recovered(t, mut err) => {
-                err.emit();
-                t
-            }
-            HasRecovered::Success(t) => t,
-        }
-    }
-
-    fn full_unwrap(self) -> (T, Option<DiagnosticBuilder<'a>>) {
-        match self {
-            HasRecovered::Recovered(t, err) => (t, Some(err)),
-            HasRecovered::Success(t) => (t, None),
-        }
-    }
-
-    fn into_result(self) -> PResult<'a, T> {
-        match self {
-            HasRecovered::Recovered(_, err) => Err(err),
-            HasRecovered::Success(t) => Ok(t),
-        }
-    }
-}
-
 /// How to parse a path.
 #[derive(Copy, Clone, PartialEq)]
 pub enum PathStyle {
@@ -1411,7 +1367,6 @@ fn parse_trait_item_(&mut self,
                     debug!("parse_trait_methods(): parsing provided method");
                     *at_end = true;
                     let (inner_attrs, body) = self.parse_inner_attrs_and_block()?;
-                    let body = body.emit();
                     attrs.extend(inner_attrs.iter().cloned());
                     Some(body)
                 }
@@ -2447,7 +2402,7 @@ pub fn parse_block_expr(&mut self, lo: Span, blk_mode: BlockCheckMode,
         let mut attrs = outer_attrs;
         attrs.extend(self.parse_inner_attributes()?);
 
-        let blk = self.parse_block_tail(lo, blk_mode)?.emit();
+        let blk = self.parse_block_tail(lo, blk_mode)?;
         return Ok(self.mk_expr(blk.span, ExprKind::Block(blk), attrs));
     }
 
@@ -3204,7 +3159,7 @@ pub fn parse_for_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
 
         let hi = self.prev_span;
         Ok(self.mk_expr(span_lo.to(hi),
-                        ExprKind::ForLoop(pat, expr, loop_block.emit(), opt_ident),
+                        ExprKind::ForLoop(pat, expr, loop_block, opt_ident),
                         attrs))
     }
 
@@ -3217,7 +3172,6 @@ pub fn parse_while_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
         }
         let cond = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?;
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
-        let body = body.emit();
         attrs.extend(iattrs);
         let span = span_lo.to(body.span);
         return Ok(self.mk_expr(span, ExprKind::While(cond, body, opt_ident), attrs));
@@ -3233,7 +3187,6 @@ pub fn parse_while_let_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
         let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?;
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
         attrs.extend(iattrs);
-        let body = body.emit();
         let span = span_lo.to(body.span);
         return Ok(self.mk_expr(span, ExprKind::WhileLet(pat, expr, body, opt_ident), attrs));
     }
@@ -3243,7 +3196,6 @@ pub fn parse_loop_expr(&mut self, opt_ident: Option<ast::SpannedIdent>,
                            span_lo: Span,
                            mut attrs: ThinVec<Attribute>) -> PResult<'a, P<Expr>> {
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
-        let body = body.emit();
         attrs.extend(iattrs);
         let span = span_lo.to(body.span);
         Ok(self.mk_expr(span, ExprKind::Loop(body, opt_ident), attrs))
@@ -3254,7 +3206,6 @@ pub fn parse_catch_expr(&mut self, span_lo: Span, mut attrs: ThinVec<Attribute>)
         -> PResult<'a, P<Expr>>
     {
         let (iattrs, body) = self.parse_inner_attrs_and_block()?;
-        let body = body.emit();
         attrs.extend(iattrs);
         Ok(self.mk_expr(span_lo.to(body.span), ExprKind::Catch(body), attrs))
     }
@@ -4301,14 +4252,14 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
             return Err(e);
         }
 
-        Ok(self.parse_block_tail(lo, BlockCheckMode::Default)?.emit())
+        Ok(self.parse_block_tail(lo, BlockCheckMode::Default)?)
     }
 
     /// Parse a block. Inner attrs are allowed.
     fn parse_inner_attrs_and_block(&mut self)
-        -> PResult<'a, (Vec<Attribute>, HasRecovered<'a, P<Block>>)>
+        -> PResult<'a, (Vec<Attribute>, P<Block>)>
     {
-        maybe_whole!(self, NtBlock, |x| (Vec::new(), HasRecovered::Success(x)));
+        maybe_whole!(self, NtBlock, |x| (Vec::new(), x));
 
         let lo = self.span;
         self.expect(&token::OpenDelim(token::Brace))?;
@@ -4319,15 +4270,14 @@ fn parse_inner_attrs_and_block(&mut self)
     /// Parse the rest of a block expression or function body
     /// Precondition: already parsed the '{'.
     fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode)
-        -> PResult<'a, HasRecovered<'a, P<Block>>>
+        -> PResult<'a, P<Block>>
     {
         let mut stmts = vec![];
 
-        let mut error = None;
         while !self.eat(&token::CloseDelim(token::Brace)) {
             let stmt = match self.parse_full_stmt(false) {
-                Err(err) => {
-                    error = Some(err);
+                Err(mut err) => {
+                    err.emit();
                     self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Break);
                     break;
                 }
@@ -4342,14 +4292,12 @@ fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode)
                 continue;
             };
         }
-        let block = HasRecovered::new(P(ast::Block {
+        Ok(P(ast::Block {
             stmts,
             id: ast::DUMMY_NODE_ID,
             rules: s,
             span: lo.to(self.prev_span),
-        }), error);
-
-        Ok(block)
+        }))
     }
 
     /// Parse a statement, including the trailing semicolon.
@@ -4984,22 +4932,11 @@ fn parse_item_fn(&mut self,
                      constness: Spanned<Constness>,
                      abi: abi::Abi)
                      -> PResult<'a, ItemInfo> {
-
-        self.parse_item_fn_recoverable(unsafety, constness, abi)?.into_result()
-    }
-
-    fn parse_item_fn_recoverable(&mut self,
-                                 unsafety: Unsafety,
-                                 constness: Spanned<Constness>,
-                                 abi: abi::Abi)
-                                 -> PResult<'a, HasRecovered<'a, ItemInfo>> {
         let (ident, mut generics) = self.parse_fn_header()?;
         let decl = self.parse_fn_decl(false)?;
         generics.where_clause = self.parse_where_clause()?;
         let (inner_attrs, body) = self.parse_inner_attrs_and_block()?;
-        Ok(body.map(|body| (ident,
-                            ItemKind::Fn(decl, unsafety, constness, abi, generics, body),
-                            Some(inner_attrs))))
+        Ok((ident, ItemKind::Fn(decl, unsafety, constness, abi, generics, body), Some(inner_attrs)))
     }
 
     /// true if we are looking at `const ID`, false for things like `const fn` etc
@@ -5183,7 +5120,6 @@ fn parse_impl_method(&mut self, vis: &Visibility, at_end: &mut bool)
             generics.where_clause = self.parse_where_clause()?;
             *at_end = true;
             let (inner_attrs, body) = self.parse_inner_attrs_and_block()?;
-            let body = body.into_result()?;
             Ok((ident, inner_attrs, generics, ast::ImplItemKind::Method(ast::MethodSig {
                 abi,
                 unsafety,
@@ -6369,49 +6305,31 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
                 let mut err = self.diagnostic()
                     .struct_span_err(sp, "missing `struct` for struct definition");
                 err.span_suggestion_short(sp, &msg, " struct ".into());
-                err.emit();
-                self.consume_block(token::Brace);
-                let prev_span = self.prev_span;
-                let item = self.mk_item(lo.to(prev_span),
-                                        ident,
-                                        ItemKind::Placeholder,
-                                        visibility,
-                                        vec![]);
-                return Ok(Some(item));
+                return Err(err);
             } else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) {
                 let ident = self.parse_ident().unwrap();
                 self.consume_block(token::Paren);
-                let (kw, ambiguous) = if self.check(&token::OpenDelim(token::Brace)) {
-                    self.consume_block(token::Brace);
-                    ("fn", false)
+                let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) ||
+                    self.check(&token::OpenDelim(token::Brace))
+                {
+                    ("fn", "method", false)
                 } else if self.check(&token::Colon) {
                     let kw = "struct";
-                    (kw, false)
+                    (kw, kw, false)
                 } else {
-                    ("fn` or `struct", true)
+                    ("fn` or `struct", "method or struct", true)
                 };
 
-                let msg = format!("missing `{}`{}", kw,
-                                   if ambiguous {
-                                       "".to_string()
-                                   } else {
-                                       format!(" for {} definition", kw)
-                                   });
+                let msg = format!("missing `{}` for {} definition", kw, kw_name);
                 let mut err = self.diagnostic().struct_span_err(sp, &msg);
                 if !ambiguous {
-                    let suggestion = format!("add `{kw}` here to parse `{}` as a public {kw}",
+                    let suggestion = format!("add `{}` here to parse `{}` as a public {}",
+                                             kw,
                                              ident,
-                                             kw=kw);
+                                             kw_name);
                     err.span_suggestion_short(sp, &suggestion, format!(" {} ", kw));
                 }
-                err.emit();
-                let prev_span = self.prev_span;
-                let item = self.mk_item(lo.to(prev_span),
-                                        ident,
-                                        ItemKind::Placeholder,
-                                        visibility,
-                                        vec![]);
-                return Ok(Some(item));
+                return Err(err);
             }
         }
         self.parse_macro_use_or_failure(attrs, macros_allowed, attributes_allowed, lo, visibility)
index 926bdd2a95776bdb2e09fea74ad02debf535873d..38627b40544f5a500c1eec64040c32c04fc92795 100644 (file)
@@ -1386,12 +1386,6 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
                 self.s.word(";")?;
                 self.end()?;
             }
-            ast::ItemKind::Placeholder => {
-                self.s.word("<placeholder ")?;
-                self.print_ident(item.ident)?;
-                self.s.word(">")?;
-                self.end()?;
-            }
         }
         self.ann.post(self, NodeItem(item))
     }
index 5a6fbe0a8f89a48a446efdf2ff5c4d71aab1812b..c2e90f0bb13a32f30d19bf688c7a13e89ecc35a2 100644 (file)
@@ -307,7 +307,6 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
         }
         ItemKind::Mac(ref mac) => visitor.visit_mac(mac),
         ItemKind::MacroDef(ref ts) => visitor.visit_mac_def(ts, item.id),
-        ItemKind::Placeholder => (),
     }
     walk_list!(visitor, visit_attribute, &item.attrs);
 }
index 99af031899ab6758b3c2d343d3fe6e08751bf70e..7f300ed23425306b13406354cbb0d952f6dc877f 100644 (file)
@@ -16,4 +16,4 @@ struct Foo {
     pub(crate) () foo: usize,
 }
 
-
+fn main() {}
diff --git a/src/test/ui/suggestions/pub-ident-fn-2.rs b/src/test/ui/suggestions/pub-ident-fn-2.rs
new file mode 100644 (file)
index 0000000..40c50a4
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+pub foo(s: usize) { bar() }
+
+fn main() {
+    foo(2);
+}
diff --git a/src/test/ui/suggestions/pub-ident-fn-2.stderr b/src/test/ui/suggestions/pub-ident-fn-2.stderr
new file mode 100644 (file)
index 0000000..43b81ef
--- /dev/null
@@ -0,0 +1,13 @@
+error: missing `fn` for method definition
+  --> $DIR/pub-ident-fn-2.rs:11:4
+   |
+11 | pub foo(s: usize) { bar() }
+   |    ^
+   |
+help: add `fn` here to parse `foo` as a public method
+   |
+11 | pub fn foo(s: usize) { bar() }
+   |     ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.rs
new file mode 100644 (file)
index 0000000..6b5ae19
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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.
+
+pub S();
+
+fn main() {}
diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr b/src/test/ui/suggestions/pub-ident-fn-or-struct-2.stderr
new file mode 100644 (file)
index 0000000..e8636f6
--- /dev/null
@@ -0,0 +1,8 @@
+error: missing `fn` or `struct` for method or struct definition
+  --> $DIR/pub-ident-fn-or-struct-2.rs:11:4
+   |
+11 | pub S();
+   |    ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct.rs b/src/test/ui/suggestions/pub-ident-fn-or-struct.rs
new file mode 100644 (file)
index 0000000..8bb1c6a
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2017 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.
+
+pub S (foo) bar
+
+fn main() {}
diff --git a/src/test/ui/suggestions/pub-ident-fn-or-struct.stderr b/src/test/ui/suggestions/pub-ident-fn-or-struct.stderr
new file mode 100644 (file)
index 0000000..dc391c1
--- /dev/null
@@ -0,0 +1,8 @@
+error: missing `fn` or `struct` for method or struct definition
+  --> $DIR/pub-ident-fn-or-struct.rs:11:4
+   |
+11 | pub S (foo) bar
+   |    ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.rs b/src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.rs
deleted file mode 100644 (file)
index ceaaa03..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 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.
-
-pub Struct {
-    y: usize,
-}
-
-pub Y {
-    x: usize,
-
-
-pub struct X {
-    foo();
-}
-
-pub Z {
-    x->foo(),
-}
-
-pub foo(foo) {
-    foo
-}
-
-pub struct X {
-    foo();
-}
-
-pub Z {
-    x->foo(),
-}
-
-fn main(){}
diff --git a/src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.stderr b/src/test/ui/suggestions/pub-ident-missing-kw-unclosed-block.stderr
deleted file mode 100644 (file)
index a580aaa..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-error: this file contains an un-closed delimiter
-  --> $DIR/pub-ident-missing-kw-unclosed-block.rs:29:13
-   |
-39 | fn main(){}
-   |             ^
-   |
-help: did you mean to close this delimiter?
-  --> $DIR/pub-ident-missing-kw-unclosed-block.rs:5:7
-   |
-15 | pub Y {
-   |       ^
-
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw-unclosed-block.rs:1:4
-   |
-11 | pub Struct {
-   |    ^
-   |
-help: add `struct` here to parse `Struct` as a public struct
-   |
-11 | pub struct Struct {
-   |     ^^^^^^
-
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw-unclosed-block.rs:5:4
-   |
-15 | pub Y {
-   |    ^
-   |
-help: add `struct` here to parse `Y` as a public struct
-   |
-15 | pub struct Y {
-   |     ^^^^^^
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/suggestions/pub-ident-missing-kw.rs b/src/test/ui/suggestions/pub-ident-missing-kw.rs
deleted file mode 100644 (file)
index e2a7c39..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 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.
-
-pub Struct {
-    y: usize,
-}
-
-pub Y {
-    x: usize,
-}
-
-pub struct X {
-    foo();
-}
-
-pub Z {
-    x->foo(),
-}
-
-pub foo(foo) {
-    foo
-}
-
-pub struct X {
-    foo();
-}
-
-pub Z {
-    x->foo(),
-}
-
-fn main(){}
diff --git a/src/test/ui/suggestions/pub-ident-missing-kw.stderr b/src/test/ui/suggestions/pub-ident-missing-kw.stderr
deleted file mode 100644 (file)
index 23ac4ec..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw.rs:11:4
-   |
-11 | pub Struct {
-   |    ^
-   |
-help: add `struct` here to parse `Struct` as a public struct
-   |
-11 | pub struct Struct {
-   |     ^^^^^^
-
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw.rs:15:4
-   |
-15 | pub Y {
-   |    ^
-   |
-help: add `struct` here to parse `Y` as a public struct
-   |
-15 | pub struct Y {
-   |     ^^^^^^
-
-error: expected `:`, found `(`
-  --> $DIR/pub-ident-missing-kw.rs:20:8
-   |
-20 |     foo();
-   |        ^
-
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw.rs:23:4
-   |
-23 | pub Z {
-   |    ^
-   |
-help: add `struct` here to parse `Z` as a public struct
-   |
-23 | pub struct Z {
-   |     ^^^^^^
-
-error: missing `fn` for fn definition
-  --> $DIR/pub-ident-missing-kw.rs:27:4
-   |
-27 | pub foo(foo) {
-   |    ^
-   |
-help: add `fn` here to parse `foo` as a public fn
-   |
-27 | pub fn foo(foo) {
-   |     ^^
-
-error: expected `:`, found `(`
-  --> $DIR/pub-ident-missing-kw.rs:32:8
-   |
-32 |     foo();
-   |        ^
-
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-missing-kw.rs:35:4
-   |
-35 | pub Z {
-   |    ^
-   |
-help: add `struct` here to parse `Z` as a public struct
-   |
-35 | pub struct Z {
-   |     ^^^^^^
-
-error: aborting due to 7 previous errors
-