Skip to content

Commit f9f6083

Browse files
Add invalid rust code for test
1 parent c0a94c1 commit f9f6083

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/test/rustdoc-ui/nocapture-fail.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// check-pass
2+
// compile-flags:--test -Zunstable-options --nocapture
3+
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
4+
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
5+
6+
/// ```compile_fail
7+
/// fn foo() {
8+
/// Input: 123
9+
/// }
10+
/// ```
11+
pub struct Foo;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: struct literal body without path
2+
--> $DIR/nocapture-fail.rs:7:10
3+
|
4+
LL | fn foo() {
5+
| __________^
6+
LL | | Input: 123
7+
LL | | }
8+
| |_^
9+
|
10+
help: you might have forgotten to add the struct literal inside the block
11+
|
12+
LL | fn foo() { SomeStruct {
13+
LL | Input: 123
14+
LL | } }
15+
|
16+
17+
error: aborting due to previous error
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
running 1 test
3+
test $DIR/nocapture-fail.rs - Foo (line 6) - compile fail ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+

0 commit comments

Comments
 (0)