From fe3385691fd8917e7f227c02f468b20d8a2c4f7b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 7 Oct 2024 15:08:20 -0700 Subject: [PATCH] Add "reference" as a known compiletest header 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: https://github.com/rust-lang/compiler-team/issues/783 --- src/tools/compiletest/src/command-list.rs | 1 + tests/run-make/include-all-symbols-linking/rmake.rs | 4 ++-- tests/ui/destructure-trait-ref.rs | 3 +-- tests/ui/destructure-trait-ref.stderr | 12 ++++++------ tests/ui/unboxed-closures/unboxed-closure-region.rs | 4 ++-- tests/ui/variance/variance-use-covariant-struct-1.rs | 3 +-- .../variance/variance-use-covariant-struct-1.stderr | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/tools/compiletest/src/command-list.rs b/src/tools/compiletest/src/command-list.rs index bcdd4a69b66c3..fdc077dc4014e 100644 --- a/src/tools/compiletest/src/command-list.rs +++ b/src/tools/compiletest/src/command-list.rs @@ -208,6 +208,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "pretty-compare-only", "pretty-expanded", "pretty-mode", + "reference", "regex-error-pattern", "remap-src-base", "revisions", diff --git a/tests/run-make/include-all-symbols-linking/rmake.rs b/tests/run-make/include-all-symbols-linking/rmake.rs index 77fd71ab20d21..3e786fc108ca2 100644 --- a/tests/run-make/include-all-symbols-linking/rmake.rs +++ b/tests/run-make/include-all-symbols-linking/rmake.rs @@ -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. diff --git a/tests/ui/destructure-trait-ref.rs b/tests/ui/destructure-trait-ref.rs index 50b64aeebf0ef..b95c8c8b2fbd9 100644 --- a/tests/ui/destructure-trait-ref.rs +++ b/tests/ui/destructure-trait-ref.rs @@ -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)] diff --git a/tests/ui/destructure-trait-ref.stderr b/tests/ui/destructure-trait-ref.stderr index 38d2018882727..6e4764fa7bc79 100644 --- a/tests/ui/destructure-trait-ref.stderr +++ b/tests/ui/destructure-trait-ref.stderr @@ -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` 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; | ^^^^^ type `Box` 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` @@ -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` @@ -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; | ^^^^^ ------------------------------ this expression has type `Box` diff --git a/tests/ui/unboxed-closures/unboxed-closure-region.rs b/tests/ui/unboxed-closures/unboxed-closure-region.rs index 51fe118c93ff1..0fb1db138e845 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-region.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-region.rs @@ -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() { diff --git a/tests/ui/variance/variance-use-covariant-struct-1.rs b/tests/ui/variance/variance-use-covariant-struct-1.rs index f0fd7b26e4e49..d76d8b08d015e 100644 --- a/tests/ui/variance/variance-use-covariant-struct-1.rs +++ b/tests/ui/variance/variance-use-covariant-struct-1.rs @@ -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); diff --git a/tests/ui/variance/variance-use-covariant-struct-1.stderr b/tests/ui/variance/variance-use-covariant-struct-1.stderr index bd8458cd85dbe..cd384e0fdc3e2 100644 --- a/tests/ui/variance/variance-use-covariant-struct-1.stderr +++ b/tests/ui/variance/variance-use-covariant-struct-1.stderr @@ -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