diff options
| author | bors <bors@rust-lang.org> | 2021-08-12 13:24:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-12 13:24:29 +0000 |
| commit | 4498e300e41f47c75abe4e49ec91ae949aaeea5f (patch) | |
| tree | d63b62629e1256e38245e5e0194de0759ab0a891 /src/tools | |
| parent | 6bed1f0bc3cc50c10aab26d5f94b16a00776b8a5 (diff) | |
| parent | faf7fb94f9cb7c66ecbc5e922726cabd3016da2d (diff) | |
| download | rust-4498e300e41f47c75abe4e49ec91ae949aaeea5f.tar.gz rust-4498e300e41f47c75abe4e49ec91ae949aaeea5f.zip | |
Auto merge of #87963 - GuillaumeGomez:rollup-e54sbez, r=GuillaumeGomez
Rollup of 4 pull requests
Successful merges:
- #87819 (Use a more accurate span on assoc types WF checks)
- #87863 (Fix Windows Command::env("PATH"))
- #87885 (Link to edition guide instead of issues for 2021 lints.)
- #87941 (Fix/improve rustdoc-js tool)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/clippy/tests/ui/crashes/ice-3969.stderr | 6 | ||||
| -rw-r--r-- | src/tools/rustdoc-js/tester.js | 33 |
2 files changed, 22 insertions, 17 deletions
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr index 8b2c318acf8..9a89047f072 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr @@ -6,7 +6,7 @@ LL | for<'a> Dst<A + 'a>: Sized, | = note: `-D bare-trait-objects` implied by `-D warnings` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-3969.rs:27:16 @@ -15,7 +15,7 @@ LL | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>); | ^ help: use `dyn`: `dyn A` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-3969.rs:27:57 @@ -24,7 +24,7 @@ LL | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>); | ^ help: use `dyn`: `dyn A` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: aborting due to 3 previous errors diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index 86b16f8b0e6..bb9cd00f3f5 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -20,15 +20,17 @@ function getNextStep(content, pos, stop) { // will blow up. Template strings are not tested and might also be // broken. function extractFunction(content, functionName) { - var indent = 0; + var level = 0; var splitter = "function " + functionName + "("; + var stop; + var pos, start; while (true) { - var start = content.indexOf(splitter); + start = content.indexOf(splitter); if (start === -1) { break; } - var pos = start; + pos = start; while (pos < content.length && content[pos] !== ')') { pos += 1; } @@ -44,30 +46,33 @@ function extractFunction(content, functionName) { } while (pos < content.length) { // Eat single-line comments - if (content[pos] === '/' && pos > 0 && content[pos-1] === '/') { + if (content[pos] === '/' && pos > 0 && content[pos - 1] === '/') { do { pos += 1; } while (pos < content.length && content[pos] !== '\n'); + // Eat multiline comment. + } else if (content[pos] === '*' && pos > 0 && content[pos - 1] === '/') { + do { + pos += 1; + } while (pos < content.length && content[pos] !== '/' && content[pos - 1] !== '*'); + // Eat quoted strings } else if (content[pos] === '"' || content[pos] === "'" || content[pos] === "`") { - var stop = content[pos]; - var is_escaped = false; + stop = content[pos]; do { if (content[pos] === '\\') { - pos += 2; - } else { pos += 1; } - } while (pos < content.length && - (content[pos] !== stop || content[pos - 1] === '\\')); + pos += 1; + } while (pos < content.length && content[pos] !== stop); - // Otherwise, check for indent + // Otherwise, check for block level. } else if (content[pos] === '{') { - indent += 1; + level += 1; } else if (content[pos] === '}') { - indent -= 1; - if (indent === 0) { + level -= 1; + if (level === 0) { return content.slice(start, pos + 1); } } |
