Skip to content

Commit c367cc3

Browse files
Remove unneeded handling of backlines in doctest attributes
1 parent 2383985 commit c367cc3

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

src/librustdoc/doctest/make.rs

-2
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,6 @@ fn handle_attr(mod_attr_pending: &mut String, source_info: &mut SourceInfo, edit
537537
push_to.push('\n');
538538
// If it's complete, then we can clear the pending content.
539539
mod_attr_pending.clear();
540-
} else if mod_attr_pending.ends_with('\\') {
541-
mod_attr_pending.push('n');
542540
} else {
543541
mod_attr_pending.push_str("\n");
544542
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ compile-flags:--test --test-args --test-threads=1
2+
//@ failure-status: 101
3+
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
4+
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
5+
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
6+
7+
//! ```
8+
#![doc = "#![all\
9+
ow(unused)]"]
10+
//! ```
11+
//!
12+
//! ```
13+
#![doc = r#"#![all\
14+
ow(unused)]"#]
15+
//! ```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
running 2 tests
3+
test $DIR/comment-in-attr-134221-2.rs - (line 11) ... FAILED
4+
test $DIR/comment-in-attr-134221-2.rs - (line 7) ... ok
5+
6+
failures:
7+
8+
---- $DIR/comment-in-attr-134221-2.rs - (line 11) stdout ----
9+
error: unknown start of token: \
10+
--> $DIR/comment-in-attr-134221-2.rs:$LINE:$COL
11+
|
12+
LL | #![all\
13+
| ^
14+
15+
error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `ow`
16+
--> $DIR/comment-in-attr-134221-2.rs:$LINE:$COL
17+
|
18+
LL | #![all\
19+
| - expected one of `(`, `::`, `=`, `[`, `]`, or `{`
20+
LL | ow(unused)]
21+
| ^^ unexpected token
22+
23+
error: aborting due to 2 previous errors
24+
25+
Couldn't compile the test.
26+
27+
failures:
28+
$DIR/comment-in-attr-134221-2.rs - (line 11)
29+
30+
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
31+

0 commit comments

Comments
 (0)