]> git.lizzy.rs Git - rust.git/commitdiff
Address review comments
authorJoshua Nelson <jyn514@gmail.com>
Tue, 4 May 2021 02:19:49 +0000 (22:19 -0400)
committerJoshua Nelson <jyn514@gmail.com>
Tue, 18 May 2021 01:31:05 +0000 (21:31 -0400)
- Simplify boolean expression
- Give an example of invalid syntax
- Remove explanation of why code block is text

compiler/rustc_mir/src/borrow_check/region_infer/mod.rs
src/doc/rustdoc/src/lints.md
src/librustdoc/passes/check_code_block_syntax.rs

index 9dc2e3d292359446e5fb38d353cfa62206a1d6f4..f4d78ac04cb029832ac6bf40d8f19033c6e825a4 100644 (file)
@@ -1241,7 +1241,7 @@ fn eval_if_eq(
     /// it. However, it works pretty well in practice. In particular,
     /// this is needed to deal with projection outlives bounds like
     ///
-    /// ```text (internal compiler representation so lifetime syntax is invalid)
+    /// ```text
     /// <T as Foo<'0>>::Item: '1
     /// ```
     ///
index 9f1e1a5b88b2f066e198dcf6c193b8b7e288fc0a..16b091eb255b0257bc2090414f418f0dd7b081ba 100644 (file)
@@ -305,30 +305,37 @@ examples that are invalid (e.g. empty, not parsable as Rust). For example:
 /// ```rust
 /// ```
 ///
-/// Unclosed code blocks (with and without the `rust` marker):
+/// Invalid syntax in code blocks:
 ///
 /// ```rust
-fn main() {}
+/// '<
+/// ```
+pub fn foo() {}
 ```
 
 Which will give:
 
 ```text
 warning: Rust code block is empty
---> src/lib.rs:3:5
-|
+ --> lint.rs:3:5
+  |
 3 |   /// ```rust
-|  _____^
+  |  _____^
 4 | | /// ```
-| |_______^
-|
-= note: `#[warn(rustdoc::invalid_rust_codeblocks)]` on by default
+  | |_______^
+  |
+  = note: `#[warn(rustdoc::invalid_rust_codeblocks)]` on by default
 
-warning: Rust code block is empty
---> src/lib.rs:8:5
-|
-8 | /// ```rust
-|       ^^^^^^^
+warning: could not parse code block as Rust code
+  --> lint.rs:8:5
+   |
+8  |   /// ```rust
+   |  _____^
+9  | | /// '<
+10 | | /// ```
+   | |_______^
+   |
+   = note: error from rustc: unterminated character literal
 ```
 
 ## bare_urls
index 72d3e9544c4111f54fcbb37e434f575d091464ff..0b94a74eeef976cdc95f82cb3cad7b44135bc0cc 100644 (file)
@@ -48,7 +48,7 @@ fn check_rust_syntax(&self, item: &clean::Item, dox: &str, code_block: RustCodeB
         .unwrap_or(false);
         let buffer = buffer.borrow();
 
-        if !(buffer.has_errors || is_empty) {
+        if !buffer.has_errors && !is_empty {
             // No errors in a non-empty program.
             return;
         }