Skip to content

Fix known-bug annotations #106738

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

Merged
merged 2 commits into from
Jan 20, 2023
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
7 changes: 6 additions & 1 deletion src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,15 @@ impl TestProps {
self.known_bug = true;
} else {
panic!(
"Invalid known-bug value: {known_bug}\nIt requires comma-separated issue references (`#000` or `chalk#000`) or `unknown`."
"Invalid known-bug value: {known_bug}\nIt requires comma-separated issue references (`#000` or `chalk#000`) or `known-bug: unknown`."
);
}
} else if config.parse_name_directive(ln, KNOWN_BUG) {
panic!(
"Invalid known-bug attribute, requires comma-separated issue references (`#000` or `chalk#000`) or `known-bug: unknown`."
);
}

config.set_name_value_directive(ln, MIR_UNIT_TEST, &mut self.mir_unit_test, |s| {
s.trim().to_string()
});
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/chalkify/bugs/async.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-fail
// known-bug
// edition:2021
// known-bug: unknown
// unset-rustc-env:RUST_BACKTRACE
// compile-flags:-Z trait-solver=chalk --edition=2021
// compile-flags:-Z trait-solver=chalk
// error-pattern:internal compiler error
// failure-status:101
// normalize-stderr-test "DefId([^)]*)" -> "..."
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/const-generics/issues/issue-85031-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-pass
// known-bug
// known-bug: unknown

// This should not compile, as the compiler should not know
// `A - 0` is satisfied `?x - 0` if `?x` is inferred to `A`.
Expand All @@ -10,7 +10,6 @@ pub struct Ref<'a>(&'a i32);

impl<'a> Ref<'a> {
pub fn foo<const A: usize>() -> [(); A - 0] {
//~^ WARN function cannot
Self::foo()
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/ui/const-generics/issues/issue-85031-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ warning: function cannot return without recursing
|
LL | pub fn foo<const A: usize>() -> [(); A - 0] {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL |
LL | Self::foo()
| ----------- recursive call site
|
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/generic-associated-types/bugs/hrtb-implied-1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-fail
// known-bug
// known-bug: unknown

// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for
// all 'a where I::Item<'a> is WF", but really means "for all 'a possible"
Expand Down Expand Up @@ -29,7 +29,6 @@ where

fn main() {
let slice = &mut ();
//~^ temporary value dropped while borrowed
let windows = WindowsMut { slice };
print_items::<WindowsMut<'_>>(windows);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ error[E0716]: temporary value dropped while borrowed
|
LL | let slice = &mut ();
| ^^ creates a temporary value which is freed while still in use
...
LL | let windows = WindowsMut { slice };
LL | print_items::<WindowsMut<'_>>(windows);
| -------------------------------------- argument requires that borrow lasts for `'static`
LL | }
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/generic-associated-types/bugs/hrtb-implied-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-fail
// known-bug
// known-bug: unknown

// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for
// all 'a where I::Item<'a> is WF", but really means "for all 'a possible"
Expand All @@ -16,7 +16,6 @@ where
{
let mut iter2 = Eat(iter, f);
let _next = iter2.next();
//~^ borrowed data escapes
true
}
impl<I: LendingIterator> LendingIterator for &mut I {
Expand Down
6 changes: 1 addition & 5 deletions tests/ui/generic-associated-types/bugs/issue-100013.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-fail
// known-bug
// known-bug: unknown
// edition: 2021

// We really should accept this, but we need implied bounds between the regions
Expand All @@ -13,24 +13,20 @@ pub trait FutureIterator {

fn call<I: FutureIterator>() -> impl Send {
async { // a generator checked for autotrait impl `Send`
//~^ lifetime bound not satisfied
let x = None::<I::Future<'_, '_>>; // a type referencing GAT
async {}.await; // a yield point
}
}

fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
async { // a generator checked for autotrait impl `Send`
//~^ lifetime bound not satisfied
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
//~^ lifetime may not live long enough
async {}.await; // a yield point
}
}

fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
async { // a generator checked for autotrait impl `Send`
//~^ lifetime bound not satisfied
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
async {}.await; // a yield point
}
Expand Down
24 changes: 10 additions & 14 deletions tests/ui/generic-associated-types/bugs/issue-100013.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,73 @@ error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:15:5
|
LL | / async { // a generator checked for autotrait impl `Send`
LL | |
LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
note: the lifetime defined here...
--> $DIR/issue-100013.rs:17:38
--> $DIR/issue-100013.rs:16:38
|
LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
| ^^
note: ...must outlive the lifetime defined here
--> $DIR/issue-100013.rs:17:34
--> $DIR/issue-100013.rs:16:34
|
LL | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
| ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)

error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:23:5
--> $DIR/issue-100013.rs:22:5
|
LL | / async { // a generator checked for autotrait impl `Send`
LL | |
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | |
LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
note: the lifetime defined here...
--> $DIR/issue-100013.rs:22:14
--> $DIR/issue-100013.rs:21:14
|
LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
| ^^
note: ...must outlive the lifetime defined here
--> $DIR/issue-100013.rs:22:10
--> $DIR/issue-100013.rs:21:10
|
LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
| ^^
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)

error: lifetime may not live long enough
--> $DIR/issue-100013.rs:25:17
--> $DIR/issue-100013.rs:23:17
|
LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
...
LL | async { // a generator checked for autotrait impl `Send`
LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
| ^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'b`
|
= help: consider adding the following bound: `'a: 'b`

error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:32:5
--> $DIR/issue-100013.rs:29:5
|
LL | / async { // a generator checked for autotrait impl `Send`
LL | |
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
| |_____^
|
note: the lifetime defined here...
--> $DIR/issue-100013.rs:31:18
--> $DIR/issue-100013.rs:28:18
|
LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
| ^^
note: ...must outlive the lifetime defined here
--> $DIR/issue-100013.rs:31:10
--> $DIR/issue-100013.rs:28:10
|
LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
| ^^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/generic-associated-types/bugs/issue-91762.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// check-fail
// known-bug
// known-bug: unknown

// We almost certainly want this to pass, but
// it's particularly difficult currently, because we need a way of specifying
Expand All @@ -22,7 +22,6 @@ pub trait FunctorExt<T>: Sized {

arg = self;
ret = <Self::Base as Functor>::fmap(arg);
//~^ type annotations needed
}
}

Expand Down