@@ -29,7 +29,10 @@ the source file.
2929See [ Error annotations] ( #error-annotations ) for more.
3030
3131[ 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.
3336
3437Tests are expected to fail to compile, since most tests are testing compiler
3538errors.
@@ -126,7 +129,7 @@ more suitable for UI testing.
126129For example, it will anonymize line numbers in the output (line numbers
127130prefixing each source line are replaced with ` LL ` ).
128131In 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 ` .
130133
131134Note: The line and column numbers for ` --> ` lines pointing to the test are
132135* 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
139142may provide custom normalization rules using the header commands, e.g.
140143
141144``` 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\)"
145148```
146149
147150This 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
291294Then it's time to use the ` error-pattern ` header:
292295
293296``` rust,ignore
294- // error-pattern: index out of bounds
297+ //@ error-pattern: index out of bounds
295298fn main() {
296299 let a: *const [_] = &[1, 2, 3];
297300 unsafe {
@@ -330,9 +333,9 @@ conditionally checked based on the current revision.
330333This is done by placing the revision cfg name in brackets like this:
331334
332335``` 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
336339
337340async unsafe fn f() {}
338341
@@ -363,20 +366,20 @@ and you can even run the resulting program.
363366Just add one of the following [ header commands] ( headers.md ) :
364367
365368* Pass headers:
366- * ` // check-pass ` — compilation should succeed but skip codegen
369+ * ` //@ check-pass ` — compilation should succeed but skip codegen
367370 (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
369372 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
371374 binary should also succeed.
372375* Fail headers:
373- * ` // check-fail ` — compilation should fail (the codegen phase is skipped).
376+ * ` //@ check-fail ` — compilation should fail (the codegen phase is skipped).
374377 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.
376379 This will run ` rustc ` twice, once to verify that it compiles successfully
377380 without the codegen phase, then a second time the full compile should
378381 fail.
379- * ` // run-fail ` — compilation should succeed, but running the resulting
382+ * ` //@ run-fail ` — compilation should succeed, but running the resulting
380383 binary should fail.
381384
382385For ` run-pass ` and ` run-fail ` tests, by default the output of the program
@@ -466,8 +469,8 @@ and that the resulting changes compile correctly.
466469This can be done with the ` run-rustfix ` header:
467470
468471``` rust,ignore
469- // run-rustfix
470- // check-pass
472+ //@ run-rustfix
473+ //@ check-pass
471474#![crate_type = "lib"]
472475
473476pub struct not_camel_case {}
0 commit comments