Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the known-bug test directive, use it, and do some cleanup #93953

Merged
merged 4 commits into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-80626.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but it requires `Sized` to be coinductive.

Expand All @@ -11,7 +12,6 @@ trait Allocator {
enum LinkedList<A: Allocator> {
Head,
Next(A::Allocated<Self>)
//~^ overflow
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -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>)
| ^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-86218.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but seems to run into a TAIT issue.

Expand All @@ -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!() }
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/generic-associated-types/bugs/issue-86218.stderr
Original file line number Diff line number Diff line change
@@ -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;
| ^^
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/generic-associated-types/bugs/issue-87735.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but we need an extension of implied bounds (probably).

Expand All @@ -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
//
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/generic-associated-types/bugs/issue-87748.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but unnormalized input args aren't treated as implied.

Expand All @@ -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<'_, '_>) {}
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/generic-associated-types/bugs/issue-87748.stderr
Original file line number Diff line number Diff line change
@@ -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) {}
| ^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-87755.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass.

Expand All @@ -15,7 +16,6 @@ struct Bar;

impl Foo for Bar {
type Ass = Bar;
//~^ overflow
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -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;
| ^^^
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/generic-associated-types/bugs/issue-87803.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-88382.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but has a missed normalization due to HRTB.

Expand All @@ -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>) {}
4 changes: 2 additions & 2 deletions src/test/ui/generic-associated-types/bugs/issue-88382.stderr
Original file line number Diff line number Diff line change
@@ -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>) -> _`
Expand All @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/generic-associated-types/bugs/issue-88460.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but has a missed normalization due to HRTB.

Expand Down Expand Up @@ -27,5 +28,4 @@ impl Trait for Foo {

fn main() {
test(Foo);
//~^ the trait bound
}
4 changes: 2 additions & 2 deletions src/test/ui/generic-associated-types/bugs/issue-88460.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/generic-associated-types/bugs/issue-88526.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// check-fail
// known-bug

// This should pass, but requires more logic.

Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui/generic-associated-types/bugs/issue-89008.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// check-fail
// edition:2021
// known-bug

// This should pass, but seems to run into a TAIT bug.

Expand Down Expand Up @@ -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()}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/generic-associated-types/bugs/issue-89008.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading