about summary refs log tree commit diff
path: root/src/libsyntax/error_codes.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-10 12:18:53 +0000
committerbors <bors@rust-lang.org>2019-11-10 12:18:53 +0000
commita3b6e5705cff9c69362b7ed2d273ffc148b564db (patch)
treea35b1a91d6a3c92e9c6d9f8bb5b2384044dd975d /src/libsyntax/error_codes.rs
parent86c28325ff813e5cf4d0cab320a7c9f6fb0766b8 (diff)
parent4ae2728fa8052915414127dce28245eb8f70842a (diff)
downloadrust-a3b6e5705cff9c69362b7ed2d273ffc148b564db.tar.gz
rust-a3b6e5705cff9c69362b7ed2d273ffc148b564db.zip
Auto merge of #65324 - Centril:organize-syntax, r=petrochenkov
Split libsyntax apart

In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax):

- libsyntax:

   - concrete syntax tree (`syntax::ast`)

   - definition of tokens and token-streams (`syntax::{token, tokenstream}`) -- used by `syntax::ast`

   - visitors (`syntax::visit`, `syntax::mut_visit`)

   - shared definitions between `libsyntax_expand`

   - feature gating (`syntax::feature_gate`) -- we could possibly move this out to its own crater later.

   - attribute and meta item utilities, including used-marking (`syntax::attr`)

   - pretty printer (`syntax::print`) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken via `ParseSess`. This entails that e.g. `Debug` impls for `Path` cannot reference the pretty printer.

   - definition of `ParseSess` (`syntax::sess`) -- this is used by `syntax::{attr, print, feature_gate}` and is a common definition used by the parser and other things like librustc.

   - the `syntax::source_map` -- this includes definitions used by `syntax::ast` and other things but could ostensibly be moved `syntax_pos` since that is more related to this module.

   - a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR.

- librustc_parse:

   - parser (`rustc_parse::parser`) -- reading a file and such are defined in the crate root tho.

   - lexer (`rustc_parse::lexer`)

   - validation of meta grammar (post-expansion) in (`rustc_parse::validate_attr`)

- libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not.

   - conditional compilation (`syntax_expand::config`) -- moved from `syntax::config` to here

   - the bulk of this crate is made up of the old `syntax::ext`

r? @estebank
Diffstat (limited to 'src/libsyntax/error_codes.rs')
-rw-r--r--src/libsyntax/error_codes.rs165
1 files changed, 0 insertions, 165 deletions
diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs
index c23c8d65a7f..0e81de7d4a7 100644
--- a/src/libsyntax/error_codes.rs
+++ b/src/libsyntax/error_codes.rs
@@ -4,28 +4,6 @@
 // `:set tw=0` to disable.
 register_diagnostics! {
 
-E0178: r##"
-In types, the `+` type operator has low precedence, so it is often necessary
-to use parentheses.
-
-For example:
-
-```compile_fail,E0178
-trait Foo {}
-
-struct Bar<'a> {
-    w: &'a Foo + Copy,   // error, use &'a (Foo + Copy)
-    x: &'a Foo + 'a,     // error, use &'a (Foo + 'a)
-    y: &'a mut Foo + 'a, // error, use &'a mut (Foo + 'a)
-    z: fn() -> Foo + 'a, // error, use fn() -> (Foo + 'a)
-}
-```
-
-More details can be found in [RFC 438].
-
-[RFC 438]: https://github.com/rust-lang/rfcs/pull/438
-"##,
-
 E0536: r##"
 The `not` cfg-predicate was malformed.
 
@@ -278,106 +256,6 @@ pub fn something() {}
 ```
 "##,
 
-E0583: r##"
-A file wasn't found for an out-of-line module.
-
-Erroneous code example:
-
-```ignore (compile_fail not working here; see Issue #43707)
-mod file_that_doesnt_exist; // error: file not found for module
-
-fn main() {}
-```
-
-Please be sure that a file corresponding to the module exists. If you
-want to use a module named `file_that_doesnt_exist`, you need to have a file
-named `file_that_doesnt_exist.rs` or `file_that_doesnt_exist/mod.rs` in the
-same directory.
-"##,
-
-E0584: r##"
-A doc comment that is not attached to anything has been encountered.
-
-Erroneous code example:
-
-```compile_fail,E0584
-trait Island {
-    fn lost();
-
-    /// I'm lost!
-}
-```
-
-A little reminder: a doc comment has to be placed before the item it's supposed
-to document. So if you want to document the `Island` trait, you need to put a
-doc comment before it, not inside it. Same goes for the `lost` method: the doc
-comment needs to be before it:
-
-```
-/// I'm THE island!
-trait Island {
-    /// I'm lost!
-    fn lost();
-}
-```
-"##,
-
-E0585: r##"
-A documentation comment that doesn't document anything was found.
-
-Erroneous code example:
-
-```compile_fail,E0585
-fn main() {
-    // The following doc comment will fail:
-    /// This is a useless doc comment!
-}
-```
-
-Documentation comments need to be followed by items, including functions,
-types, modules, etc. Examples:
-
-```
-/// I'm documenting the following struct:
-struct Foo;
-
-/// I'm documenting the following function:
-fn foo() {}
-```
-"##,
-
-E0586: r##"
-An inclusive range was used with no end.
-
-Erroneous code example:
-
-```compile_fail,E0586
-fn main() {
-    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
-    let x = &tmp[1..=]; // error: inclusive range was used with no end
-}
-```
-
-An inclusive range needs an end in order to *include* it. If you just need a
-start and no end, use a non-inclusive range (with `..`):
-
-```
-fn main() {
-    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
-    let x = &tmp[1..]; // ok!
-}
-```
-
-Or put an end to your inclusive range:
-
-```
-fn main() {
-    let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
-    let x = &tmp[1..=3]; // ok!
-}
-```
-"##,
-
 E0589: r##"
 The value of `N` that was specified for `repr(align(N))` was not a power
 of two, or was greater than 2^29.
@@ -446,35 +324,6 @@ and likely to change in the future.
 
 "##,
 
-E0704: r##"
-This error indicates that a incorrect visibility restriction was specified.
-
-Example of erroneous code:
-
-```compile_fail,E0704
-mod foo {
-    pub(foo) struct Bar {
-        x: i32
-    }
-}
-```
-
-To make struct `Bar` only visible in module `foo` the `in` keyword should be
-used:
-```
-mod foo {
-    pub(in crate::foo) struct Bar {
-        x: i32
-    }
-}
-# fn main() {}
-```
-
-For more information see the Rust Reference on [Visibility].
-
-[Visibility]: https://doc.rust-lang.org/reference/visibility-and-privacy.html
-"##,
-
 E0705: r##"
 A `#![feature]` attribute was declared for a feature that is stable in
 the current edition, but not in all editions.
@@ -504,20 +353,6 @@ Delete the offending feature attribute, or add it to the list of allowed
 features in the `-Z allow_features` flag.
 "##,
 
-E0743: r##"
-C-variadic has been used on a non-foreign function.
-
-Erroneous code example:
-
-```compile_fail,E0743
-fn foo2(x: u8, ...) {} // error!
-```
-
-Only foreign functions can use C-variadic (`...`). It is used to give an
-undefined number of parameters to a given function (like `printf` in C). The
-equivalent in Rust would be to use macros directly.
-"##,
-
 ;
 
     E0539, // incorrect meta item