about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-11-27 15:28:50 -0600
committerGitHub <noreply@github.com>2019-11-27 15:28:50 -0600
commit6a1fe67cac7866941dacd735f899f4532c816faa (patch)
tree49ed6058a00e2c4031a2cf4492cf1f58780ff30d
parentae49770918af86a3eac0471461190ce40545ac30 (diff)
parent5bb70c14be426e4fac6f5aadf46a564cc23c5267 (diff)
downloadrust-6a1fe67cac7866941dacd735f899f4532c816faa.tar.gz
rust-6a1fe67cac7866941dacd735f899f4532c816faa.zip
Rollup merge of #66777 - GuillaumeGomez:tidy-err-codes, r=Mark-Simulacrum
Put back tidy check on error codes

I just realized that the tidy checks were not run anymore on the error code long explanations. This add it back.

cc @Dylan-DPC
r? @Mark-Simulacrum
-rw-r--r--src/librustc_error_codes/error_codes/E0015.md3
-rw-r--r--src/librustc_error_codes/error_codes/E0107.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0369.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0404.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0458.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0633.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0635.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0636.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0641.md2
-rw-r--r--src/librustc_error_codes/error_codes/E0644.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0706.md20
-rw-r--r--src/librustc_error_codes/error_codes/E0745.md2
-rw-r--r--src/tools/tidy/src/style.rs15
13 files changed, 28 insertions, 22 deletions
diff --git a/src/librustc_error_codes/error_codes/E0015.md b/src/librustc_error_codes/error_codes/E0015.md
index 361cb425809..021a0219d13 100644
--- a/src/librustc_error_codes/error_codes/E0015.md
+++ b/src/librustc_error_codes/error_codes/E0015.md
@@ -1,4 +1,5 @@
-A constant item was initialized with something that is not a constant expression.
+A constant item was initialized with something that is not a constant
+expression.
 
 Erroneous code example:
 
diff --git a/src/librustc_error_codes/error_codes/E0107.md b/src/librustc_error_codes/error_codes/E0107.md
index 3a8acba061c..bfe0d21f312 100644
--- a/src/librustc_error_codes/error_codes/E0107.md
+++ b/src/librustc_error_codes/error_codes/E0107.md
@@ -25,4 +25,3 @@ fn main() {
                     //        expected 0, found 1
 }
 ```
-
diff --git a/src/librustc_error_codes/error_codes/E0369.md b/src/librustc_error_codes/error_codes/E0369.md
index 08db342428c..397979e5641 100644
--- a/src/librustc_error_codes/error_codes/E0369.md
+++ b/src/librustc_error_codes/error_codes/E0369.md
@@ -26,4 +26,3 @@ left and may require reallocation. This requires ownership of the string
 on the left. If something should be added to a string literal, move the
 literal to the heap by allocating it with `to_owned()` like in
 `"Your text".to_owned()`.
-
diff --git a/src/librustc_error_codes/error_codes/E0404.md b/src/librustc_error_codes/error_codes/E0404.md
index 861a50bfd8c..201107c05a0 100644
--- a/src/librustc_error_codes/error_codes/E0404.md
+++ b/src/librustc_error_codes/error_codes/E0404.md
@@ -41,4 +41,3 @@ trait Foo {
 
 fn bar<T: Foo>(t: T) {} // ok!
 ```
-
diff --git a/src/librustc_error_codes/error_codes/E0458.md b/src/librustc_error_codes/error_codes/E0458.md
index e6baeb8f692..385079d403d 100644
--- a/src/librustc_error_codes/error_codes/E0458.md
+++ b/src/librustc_error_codes/error_codes/E0458.md
@@ -10,4 +10,3 @@ Please specify a valid "kind" value, from one of the following:
 * static
 * dylib
 * framework
-
diff --git a/src/librustc_error_codes/error_codes/E0633.md b/src/librustc_error_codes/error_codes/E0633.md
index a68da1188b5..65cdf90036a 100644
--- a/src/librustc_error_codes/error_codes/E0633.md
+++ b/src/librustc_error_codes/error_codes/E0633.md
@@ -21,4 +21,3 @@ The `#[unwind]` attribute should be used as follows:
 
 NB. The default behavior here is "allowed", but this is unspecified
 and likely to change in the future.
-
diff --git a/src/librustc_error_codes/error_codes/E0635.md b/src/librustc_error_codes/error_codes/E0635.md
index 2382ce0d3ff..a39d2be4f8f 100644
--- a/src/librustc_error_codes/error_codes/E0635.md
+++ b/src/librustc_error_codes/error_codes/E0635.md
@@ -5,4 +5,3 @@ Erroneous code example:
 ```compile_fail,E0635
 #![feature(nonexistent_rust_feature)] // error: unknown feature
 ```
-
diff --git a/src/librustc_error_codes/error_codes/E0636.md b/src/librustc_error_codes/error_codes/E0636.md
index dabf9b64123..57cf72db556 100644
--- a/src/librustc_error_codes/error_codes/E0636.md
+++ b/src/librustc_error_codes/error_codes/E0636.md
@@ -7,4 +7,3 @@ Erroneous code example:
 #![feature(rust1)]
 #![feature(rust1)] // error: the feature `rust1` has already been declared
 ```
-
diff --git a/src/librustc_error_codes/error_codes/E0641.md b/src/librustc_error_codes/error_codes/E0641.md
index e39bebce1fe..e2110042c7e 100644
--- a/src/librustc_error_codes/error_codes/E0641.md
+++ b/src/librustc_error_codes/error_codes/E0641.md
@@ -16,4 +16,4 @@ let a = &(String::from("Hello world!")) as *const _; // Ok
 let b = 0 as *const i32; // Ok
 
 let c: *const i32 = 0 as *const _; // Ok
-```
\ No newline at end of file
+```
diff --git a/src/librustc_error_codes/error_codes/E0644.md b/src/librustc_error_codes/error_codes/E0644.md
index 61acb084a45..7a653bd2264 100644
--- a/src/librustc_error_codes/error_codes/E0644.md
+++ b/src/librustc_error_codes/error_codes/E0644.md
@@ -27,4 +27,3 @@ closure call itself by capturing a `&Fn()` object or `fn()` pointer
 that refers to itself. That is permitting, since the closure would be
 invoking itself via a virtual call, and hence does not directly
 reference its own *type*.
-
diff --git a/src/librustc_error_codes/error_codes/E0706.md b/src/librustc_error_codes/error_codes/E0706.md
index bee9219af7c..d379b8a2384 100644
--- a/src/librustc_error_codes/error_codes/E0706.md
+++ b/src/librustc_error_codes/error_codes/E0706.md
@@ -1,4 +1,4 @@
- `async fn`s are not yet supported in traits in Rust.
+`async fn`s are not yet supported in traits in Rust.
 
 Erroneous code example:
 
@@ -10,7 +10,8 @@ trait T {
 }
 ```
 
-`async fn`s return an `impl Future`, making the following two examples equivalent:
+`async fn`s return an `impl Future`, making the following two examples
+equivalent:
 
 ```edition2018,ignore (example-of-desugaring-equivalence)
 async fn foo() -> User {
@@ -23,8 +24,8 @@ fn foo(&self) -> impl Future<Output = User> + '_ {
 ```
 
 But when it comes to supporting this in traits, there are [a few implementation
-issues][async-is-hard]. One of them is returning `impl Trait` in traits is not supported,
-as it would require [Generic Associated Types] to be supported:
+issues][async-is-hard]. One of them is returning `impl Trait` in traits is not
+supported, as it would require [Generic Associated Types] to be supported:
 
 ```edition2018,ignore (example-of-desugaring-equivalence)
 impl MyDatabase {
@@ -40,13 +41,14 @@ impl MyDatabase {
 }
 ```
 
-Until these issues are resolved, you can use the [`async-trait` crate], allowing you to use
-`async fn` in traits by desugaring to "boxed futures"
+Until these issues are resolved, you can use the [`async-trait` crate], allowing
+you to use `async fn` in traits by desugaring to "boxed futures"
 (`Pin<Box<dyn Future + Send + 'async>>`).
 
-Note that using these trait methods will result in a heap allocation per-function-call. This is not
-a significant cost for the vast majority of applications, but should be considered when deciding
-whether to use this functionality in the public API of a low-level function that is expected to be
+Note that using these trait methods will result in a heap allocation
+per-function-call. This is not a significant cost for the vast majority of
+applications, but should be considered when deciding whether to use this
+functionality in the public API of a low-level function that is expected to be
 called millions of times a second.
 
 You might be interested in visiting the [async book] for further information.
diff --git a/src/librustc_error_codes/error_codes/E0745.md b/src/librustc_error_codes/error_codes/E0745.md
index 7c478a1e0c8..39bebdcd375 100644
--- a/src/librustc_error_codes/error_codes/E0745.md
+++ b/src/librustc_error_codes/error_codes/E0745.md
@@ -11,7 +11,7 @@ fn temp_address() {
 
 To avoid the error, first bind the temporary to a named local variable.
 
-```ignore
+```ignore (not yet implemented)
 # #![feature(raw_ref_op)]
 fn temp_address() {
     let val = 2;
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index 5abe481368d..20636c86e1e 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -141,17 +141,28 @@ pub fn check(path: &Path, bad: &mut bool) {
     super::walk(path, &mut super::filter_dirs, &mut |entry, contents| {
         let file = entry.path();
         let filename = file.file_name().unwrap().to_string_lossy();
-        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h"];
+        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md"];
         if extensions.iter().all(|e| !filename.ends_with(e)) ||
            filename.starts_with(".#") {
             return
         }
 
+        if filename.ends_with(".md") &&
+           file.parent()
+               .unwrap()
+               .file_name()
+               .unwrap()
+               .to_string_lossy() != "error_codes" {
+            // We don't want to check all ".md" files (almost of of them aren't compliant
+            // currently), just the long error code explanation ones.
+            return;
+        }
+
         if contents.is_empty() {
             tidy_error!(bad, "{}: empty file", file.display());
         }
 
-        let max_columns = if filename == "error_codes.rs" {
+        let max_columns = if filename == "error_codes.rs" || filename.ends_with(".md") {
             ERROR_CODE_COLS
         } else {
             COLS