Skip to content

Commit

Permalink
Add "reference" as a known compiletest header
Browse files Browse the repository at this point in the history
This adds the "reference" compiletest header so that the Rust reference
can add annotations to the test suite in order to link tests to
individual rules in the reference.

Tooling in the reference repo will be responsible for collecting these
annotations and linking to the tests.

More details are in MCP 783: rust-lang/compiler-team#783
  • Loading branch information
ehuss committed Oct 7, 2024
1 parent baaf3e6 commit fe33856
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/tools/compiletest/src/command-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"pretty-compare-only",
"pretty-expanded",
"pretty-mode",
"reference",
"regex-error-pattern",
"remap-src-base",
"revisions",
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/include-all-symbols-linking/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Linkers treat archives differently from object files: all object files participate in linking,
// while archives will only participate in linking if they can satisfy at least one undefined
// reference (version scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to
// while archives will only participate in linking if they can satisfy at least one undefined reference
// (version scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to
// be ignored by the linker, and since they never participate in the linking, using `KEEP` in the
// linker scripts can't keep them either. This causes #47384. After the fix in #95604, this test
// checks that these symbols and sections successfully appear in the output dynamic library.
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/destructure-trait-ref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// The regression test for #15031 to make sure destructuring trait
// reference work properly.
// The regression test for #15031 to make sure destructuring trait reference work properly.

#![feature(box_patterns)]

Expand Down
12 changes: 6 additions & 6 deletions tests/ui/destructure-trait-ref.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0033]: type `&dyn T` cannot be dereferenced
--> $DIR/destructure-trait-ref.rs:26:9
--> $DIR/destructure-trait-ref.rs:25:9
|
LL | let &x = &1isize as &dyn T;
| ^^ type `&dyn T` cannot be dereferenced

error[E0033]: type `&dyn T` cannot be dereferenced
--> $DIR/destructure-trait-ref.rs:27:10
--> $DIR/destructure-trait-ref.rs:26:10
|
LL | let &&x = &(&1isize as &dyn T);
| ^^ type `&dyn T` cannot be dereferenced

error[E0033]: type `Box<dyn T>` cannot be dereferenced
--> $DIR/destructure-trait-ref.rs:28:9
--> $DIR/destructure-trait-ref.rs:27:9
|
LL | let box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ type `Box<dyn T>` cannot be dereferenced

error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:32:10
--> $DIR/destructure-trait-ref.rs:31:10
|
LL | let &&x = &1isize as &dyn T;
| ^^ ----------------- this expression has type `&dyn T`
Expand All @@ -33,7 +33,7 @@ LL + let &x = &1isize as &dyn T;
|

error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:36:11
--> $DIR/destructure-trait-ref.rs:35:11
|
LL | let &&&x = &(&1isize as &dyn T);
| ^^ -------------------- this expression has type `&&dyn T`
Expand All @@ -49,7 +49,7 @@ LL + let &&x = &(&1isize as &dyn T);
|

error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:40:13
--> $DIR/destructure-trait-ref.rs:39:13
|
LL | let box box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/unboxed-closures/unboxed-closure-region.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Test that an unboxed closure that captures a free variable by
// reference cannot escape the region of that variable.
// Test that an unboxed closure that captures a free variable by reference
// cannot escape the region of that variable.


fn main() {
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/variance/variance-use-covariant-struct-1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Test that a covariant struct does not permit the lifetime of a
// reference to be enlarged.
// Test that a covariant struct does not permit the lifetime of a reference to be enlarged.

struct SomeStruct<T>(T);

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/variance/variance-use-covariant-struct-1.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/variance-use-covariant-struct-1.rs:10:5
--> $DIR/variance-use-covariant-struct-1.rs:9:5
|
LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
| ---- ---- lifetime `'max` defined here
Expand Down

0 comments on commit fe33856

Please sign in to comment.