about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-18 23:23:11 +0100
committerGitHub <noreply@github.com>2022-02-18 23:23:11 +0100
commit620b0c5122ee539124ed9442772e4648ac1d8b3f (patch)
tree72f050cf5c6395ecc1f33a6ca878e2f30e55c7e3 /src/test/ui
parent576afec73a15e918ab6d1e85ba7d8dd6fb1626d3 (diff)
parent36cf48bae70957f28c141cdefdb248688c87e11c (diff)
downloadrust-620b0c5122ee539124ed9442772e4648ac1d8b3f.tar.gz
rust-620b0c5122ee539124ed9442772e4648ac1d8b3f.zip
Rollup merge of #93953 - jackh726:known_bug, r=Mark-Simulacrum
Add the `known-bug` test directive, use it, and do some cleanup

cc rust-lang/compiler-team#476

Now tests can be annotated with `known-bug`, which should indicate that the test *should* pass (or at least that the current output is a bug). Adding it relaxes the requirement to add error annotations to the test (though it is still allowed). In the future, this could be extended with further relaxations - with the goal to make adding these tests need minimal effort.

I've used this attribute for the GAT tests added in #93757.

Finally, I've also cleaned up `header.rs` in compiletest a bit, by extracting out a bit of common logic. I've also split out some of the directives into their own consts. This removes a lot of very similar functions from `Config` and makes `TestProps::load_from` read nicer.

I've split these into separate commits, so I in theory could split these into separate PRs if they're controversial, but I think they're pretty straightforward.

r? ``@Mark-Simulacrum``
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-80626.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-86218.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-86218.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87735.rs3
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87735.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87748.rs3
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87748.stderr6
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87755.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87755.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87803.rs3
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-87803.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88382.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88382.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88460.rs2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88460.stderr4
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88526.rs3
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-88526.stderr2
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-89008.rs5
-rw-r--r--src/test/ui/generic-associated-types/bugs/issue-89008.stderr4
20 files changed, 32 insertions, 27 deletions
diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.rs b/src/test/ui/generic-associated-types/bugs/issue-80626.rs
index aea8aaf4bb3..a637da6cf6f 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but it requires `Sized` to be coinductive.
 
@@ -11,7 +12,6 @@ trait Allocator {
 enum LinkedList<A: Allocator> {
     Head,
     Next(A::Allocated<Self>)
-    //~^ overflow
 }
 
 fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
index e18af9c257f..8b0cc78e999 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr
@@ -1,5 +1,5 @@
 error[E0275]: overflow evaluating the requirement `LinkedList<A>: Sized`
-  --> $DIR/issue-80626.rs:13:10
+  --> $DIR/issue-80626.rs:14:10
    |
 LL |     Next(A::Allocated<Self>)
    |          ^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/bugs/issue-86218.rs
index 3f8776a3637..68cd0fd7efc 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-86218.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but seems to run into a TAIT issue.
 
@@ -20,7 +21,6 @@ trait Yay<AdditionalValue> {
 
 impl<'a> Yay<&'a ()> for () {
     type InnerStream<'s> = impl Stream<Item = i32> + 's;
-    //~^ the type
     fn foo<'s>() -> Self::InnerStream<'s> { todo!() }
 }
 
diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
index 9f4efc0addb..98a5f4254bb 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr
@@ -1,11 +1,11 @@
 error[E0477]: the type `impl Stream<Item = i32>` does not fulfill the required lifetime
-  --> $DIR/issue-86218.rs:22:28
+  --> $DIR/issue-86218.rs:23:28
    |
 LL |     type InnerStream<'s> = impl Stream<Item = i32> + 's;
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: type must outlive the lifetime `'s` as defined here as required by this binding
-  --> $DIR/issue-86218.rs:22:22
+  --> $DIR/issue-86218.rs:23:22
    |
 LL |     type InnerStream<'s> = impl Stream<Item = i32> + 's;
    |                      ^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.rs b/src/test/ui/generic-associated-types/bugs/issue-87735.rs
index 5f7a42a740d..6d6063f8085 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87735.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87735.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but we need an extension of implied bounds (probably).
 
@@ -23,7 +24,7 @@ struct Foo<T>(T);
 #[derive(Debug)]
 struct FooRef<'a, U>(&'a [U]);
 
-impl<'b, T, U> AsRef2 for Foo<T> //~ the type parameter
+impl<'b, T, U> AsRef2 for Foo<T>
 where
     // * `for<'b, 'c> T: AsRef2<Output<'b> = &'c [U]>>` does not work
     //
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
index 31b3a9619b6..0a18b5f0cbd 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr
@@ -1,5 +1,5 @@
 error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
-  --> $DIR/issue-87735.rs:26:13
+  --> $DIR/issue-87735.rs:27:13
    |
 LL | impl<'b, T, U> AsRef2 for Foo<T>
    |             ^ unconstrained type parameter
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.rs b/src/test/ui/generic-associated-types/bugs/issue-87748.rs
index 4dbaf429ead..ffcfd62cbb3 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87748.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87748.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but unnormalized input args aren't treated as implied.
 
@@ -14,7 +15,7 @@ struct Foo;
 impl MyTrait for Foo {
     type Assoc<'a, 'b> where 'b: 'a = u32;
 
-    fn do_sth(_: u32) {} //~ lifetime bound
+    fn do_sth(_: u32) {}
     // fn do_sth(_: Self::Assoc<'static, 'static>) {}
     // fn do_sth(_: Self::Assoc<'_, '_>) {}
 }
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr b/src/test/ui/generic-associated-types/bugs/issue-87748.stderr
index c38d4478592..60bb48efbc8 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87748.stderr
@@ -1,16 +1,16 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/issue-87748.rs:17:5
+  --> $DIR/issue-87748.rs:18:5
    |
 LL |     fn do_sth(_: u32) {}
    |     ^^^^^^^^^^^^^^^^^
    |
 note: lifetime parameter instantiated with the anonymous lifetime #2 defined here
-  --> $DIR/issue-87748.rs:17:5
+  --> $DIR/issue-87748.rs:18:5
    |
 LL |     fn do_sth(_: u32) {}
    |     ^^^^^^^^^^^^^^^^^
 note: but lifetime parameter must outlive the anonymous lifetime #1 defined here
-  --> $DIR/issue-87748.rs:17:5
+  --> $DIR/issue-87748.rs:18:5
    |
 LL |     fn do_sth(_: u32) {}
    |     ^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.rs b/src/test/ui/generic-associated-types/bugs/issue-87755.rs
index 1cd3534ba77..31cea12a3e2 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87755.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87755.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass.
 
@@ -15,7 +16,6 @@ struct Bar;
 
 impl Foo for Bar {
     type Ass = Bar;
-    //~^ overflow
 }
 
 fn main() {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
index d2dc991a2b6..5d1aff0117c 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr
@@ -1,5 +1,5 @@
 error[E0275]: overflow evaluating the requirement `<Bar as Foo>::Ass == _`
-  --> $DIR/issue-87755.rs:17:16
+  --> $DIR/issue-87755.rs:18:16
    |
 LL |     type Ass = Bar;
    |                ^^^
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.rs b/src/test/ui/generic-associated-types/bugs/issue-87803.rs
index 3d2ff38ab04..57a4b028d93 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87803.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-87803.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but using a type alias vs a reference directly
 // changes late-bound -> early-bound.
@@ -18,7 +19,7 @@ impl Scanner for IdScanner {
     type Input<'a> = &'a str;
     type Token<'a> = &'a str;
 
-    fn scan<'a>(&mut self, s : &'a str) -> &'a str { //~ lifetime parameters
+    fn scan<'a>(&mut self, s : &'a str) -> &'a str {
         s
     }
 }
diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
index 759c0440d07..c81c051d32a 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr
@@ -1,5 +1,5 @@
 error[E0195]: lifetime parameters or bounds on method `scan` do not match the trait declaration
-  --> $DIR/issue-87803.rs:21:12
+  --> $DIR/issue-87803.rs:22:12
    |
 LL |     fn scan<'a>(&mut self, i : Self::Input<'a>) -> Self::Token<'a>;
    |            ---- lifetimes in impl do not match this method in trait
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs
index f4633ca5169..c9f34240527 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88382.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but has a missed normalization due to HRTB.
 
@@ -25,7 +26,6 @@ fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>))
 fn main() {
     do_something(SomeImplementation(), |_| ());
     do_something(SomeImplementation(), test);
-    //~^ type mismatch
 }
 
 fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {}
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
index 05bc58cbba4..d06c3ec8de7 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr
@@ -1,5 +1,5 @@
 error[E0631]: type mismatch in function arguments
-  --> $DIR/issue-88382.rs:27:40
+  --> $DIR/issue-88382.rs:28:40
    |
 LL |     do_something(SomeImplementation(), test);
    |     ------------                       ^^^^ expected signature of `for<'a> fn(&mut <SomeImplementation as Iterable>::Iterator<'a>) -> _`
@@ -10,7 +10,7 @@ LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {}
    | ------------------------------------------------- found signature of `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _`
    |
 note: required by a bound in `do_something`
-  --> $DIR/issue-88382.rs:21:56
+  --> $DIR/issue-88382.rs:22:56
    |
 LL | fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) {
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.rs b/src/test/ui/generic-associated-types/bugs/issue-88460.rs
index 7e62790cc50..b31d012d2fc 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88460.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88460.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but has a missed normalization due to HRTB.
 
@@ -27,5 +28,4 @@ impl Trait for Foo {
 
 fn main() {
     test(Foo);
-    //~^ the trait bound
 }
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
index 604658da7d2..0b83e9da1ab 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not satisfied
-  --> $DIR/issue-88460.rs:29:5
+  --> $DIR/issue-88460.rs:30:5
    |
 LL |     test(Foo);
    |     ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>`
    |
 note: required by a bound in `test`
-  --> $DIR/issue-88460.rs:16:27
+  --> $DIR/issue-88460.rs:17:27
    |
 LL | fn test<T>(value: T)
    |    ---- required by a bound in this
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.rs b/src/test/ui/generic-associated-types/bugs/issue-88526.rs
index 90568fcb401..c72a450b926 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88526.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-88526.rs
@@ -1,4 +1,5 @@
 // check-fail
+// known-bug
 
 // This should pass, but requires more logic.
 
@@ -23,7 +24,7 @@ struct TestB<Q, F>
     f: F,
 }
 
-impl<'q, Q, I, F> A for TestB<Q, F> //~ the type parameter
+impl<'q, Q, I, F> A for TestB<Q, F>
 where
     Q: A<I<'q> = &'q I>,
     F: Fn(I),
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
index ccc5ae0b621..127c889bf71 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr
@@ -1,5 +1,5 @@
 error[E0207]: the type parameter `I` is not constrained by the impl trait, self type, or predicates
-  --> $DIR/issue-88526.rs:26:13
+  --> $DIR/issue-88526.rs:27:13
    |
 LL | impl<'q, Q, I, F> A for TestB<Q, F>
    |             ^ unconstrained type parameter
diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/bugs/issue-89008.rs
index 5d850849fd2..1581b7105a8 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs
+++ b/src/test/ui/generic-associated-types/bugs/issue-89008.rs
@@ -1,5 +1,6 @@
 // check-fail
 // edition:2021
+// known-bug
 
 // This should pass, but seems to run into a TAIT bug.
 
@@ -31,11 +32,11 @@ trait X {
 struct Y;
 
 impl X for Y {
-    type LineStream<'a, Repr> = impl Stream<Item = Repr>; //~ could not find
+    type LineStream<'a, Repr> = impl Stream<Item = Repr>;
 
     type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;
 
-    fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { //~ type mismatch
+    fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
         async {empty()}
     }
 }
diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
index 48745fe0fbd..c2687ca5401 100644
--- a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
+++ b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr
@@ -1,5 +1,5 @@
 error[E0271]: type mismatch resolving `<impl Future<Output = [async output]> as Future>::Output == impl Stream<Item = Repr>`
-  --> $DIR/issue-89008.rs:38:43
+  --> $DIR/issue-89008.rs:39:43
    |
 LL |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
    |                                 ------------------------ the expected opaque type
@@ -11,7 +11,7 @@ LL |     fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
                    found struct `Empty<_>`
 
 error: could not find defining uses
-  --> $DIR/issue-89008.rs:34:33
+  --> $DIR/issue-89008.rs:35:33
    |
 LL |     type LineStream<'a, Repr> = impl Stream<Item = Repr>;
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^