@@ -29,7 +29,10 @@ the source file.
29
29
See [ Error annotations] ( #error-annotations ) for more.
30
30
31
31
[ Headers] ( headers.md ) in the form of comments at the top of the file control
32
- how the test is compiled and what the expected behavior is.
32
+ how the test is compiled and what the expected behavior is. Note that ui
33
+ tests require the use of ` //@ header-name ` instead of ` // header-name ` like
34
+ the other test suites do. The other test suites will be migrated to use the ` //@ `
35
+ syntax, too, but that is in progress.
33
36
34
37
Tests are expected to fail to compile, since most tests are testing compiler
35
38
errors.
@@ -126,7 +129,7 @@ more suitable for UI testing.
126
129
For example, it will anonymize line numbers in the output (line numbers
127
130
prefixing each source line are replaced with ` LL ` ).
128
131
In extremely rare situations, this mode can be disabled with the header
129
- command ` // compile-flags: -Z ui-testing=no ` .
132
+ command ` //@ compile-flags: -Z ui-testing=no ` .
130
133
131
134
Note: The line and column numbers for ` --> ` lines pointing to the test are
132
135
* not* normalized, and left as-is. This ensures that the compiler continues
@@ -139,9 +142,9 @@ Sometimes these built-in normalizations are not enough. In such cases, you
139
142
may provide custom normalization rules using the header commands, e.g.
140
143
141
144
``` rust,ignore
142
- // normalize-stdout-test: "foo" -> "bar"
143
- // normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)"
144
- // normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)"
145
+ //@ normalize-stdout-test: "foo" -> "bar"
146
+ //@ normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)"
147
+ //@ normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)"
145
148
```
146
149
147
150
This tells the test, on 32-bit platforms, whenever the compiler writes
@@ -291,7 +294,7 @@ We want to ensure this shows "index out of bounds" but we cannot use the
291
294
Then it's time to use the ` error-pattern ` header:
292
295
293
296
``` rust,ignore
294
- // error-pattern: index out of bounds
297
+ //@ error-pattern: index out of bounds
295
298
fn main() {
296
299
let a: *const [_] = &[1, 2, 3];
297
300
unsafe {
@@ -330,9 +333,9 @@ conditionally checked based on the current revision.
330
333
This is done by placing the revision cfg name in brackets like this:
331
334
332
335
``` rust,ignore
333
- // edition:2018
334
- // revisions: mir thir
335
- // [thir]compile-flags: -Z thir-unsafeck
336
+ //@ edition:2018
337
+ //@ revisions: mir thir
338
+ //@ [thir]compile-flags: -Z thir-unsafeck
336
339
337
340
async unsafe fn f() {}
338
341
@@ -363,20 +366,20 @@ and you can even run the resulting program.
363
366
Just add one of the following [ header commands] ( headers.md ) :
364
367
365
368
* Pass headers:
366
- * ` // check-pass ` — compilation should succeed but skip codegen
369
+ * ` //@ check-pass ` — compilation should succeed but skip codegen
367
370
(which is expensive and isn't supposed to fail in most cases).
368
- * ` // build-pass ` — compilation and linking should succeed but do
371
+ * ` //@ build-pass ` — compilation and linking should succeed but do
369
372
not run the resulting binary.
370
- * ` // run-pass ` — compilation should succeed and running the resulting
373
+ * ` //@ run-pass ` — compilation should succeed and running the resulting
371
374
binary should also succeed.
372
375
* Fail headers:
373
- * ` // check-fail ` — compilation should fail (the codegen phase is skipped).
376
+ * ` //@ check-fail ` — compilation should fail (the codegen phase is skipped).
374
377
This is the default for UI tests.
375
- * ` // build-fail ` — compilation should fail during the codegen phase.
378
+ * ` //@ build-fail ` — compilation should fail during the codegen phase.
376
379
This will run ` rustc ` twice, once to verify that it compiles successfully
377
380
without the codegen phase, then a second time the full compile should
378
381
fail.
379
- * ` // run-fail ` — compilation should succeed, but running the resulting
382
+ * ` //@ run-fail ` — compilation should succeed, but running the resulting
380
383
binary should fail.
381
384
382
385
For ` run-pass ` and ` run-fail ` tests, by default the output of the program
@@ -466,8 +469,8 @@ and that the resulting changes compile correctly.
466
469
This can be done with the ` run-rustfix ` header:
467
470
468
471
``` rust,ignore
469
- // run-rustfix
470
- // check-pass
472
+ //@ run-rustfix
473
+ //@ check-pass
471
474
#![crate_type = "lib"]
472
475
473
476
pub struct not_camel_case {}
0 commit comments