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

Revision-related tweaks for next-solver tests #122318

Merged
merged 2 commits into from
Mar 11, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: the type `Foo::Bar<Vec<[u32]>>` is not well-formed
--> $DIR/wf-check-skipped.rs:17:14
|
LL | fn main() -> Foo::Bar::<Vec<[u32]>> {}
| ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

11 changes: 7 additions & 4 deletions tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
//@ known-bug: #100041
//@ check-pass
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[current] known-bug: #100041
//@[current] check-pass
// FIXME(inherent_associated_types): This should fail.

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

// FIXME(inherent_associated_types): This should fail.

struct Foo;

impl Foo {
type Bar<T> = ();
}

fn main() -> Foo::Bar::<Vec<[u32]>> {}
//[next]~^ ERROR the type `Foo::Bar<Vec<[u32]>>` is not well-formed
1 change: 1 addition & 0 deletions tests/ui/associated-inherent-types/inference.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Testing inference capabilities.
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

#![feature(inherent_associated_types)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-1.rs:20:96
--> $DIR/defaults-unsound-62211-1.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ `Self` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-1.rs:20:86
--> $DIR/defaults-unsound-62211-1.rs:26:86
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display {
| +++++++++++++++++++

error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-1.rs:20:96
--> $DIR/defaults-unsound-62211-1.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ no implementation for `Self += &'static str`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-1.rs:20:47
--> $DIR/defaults-unsound-62211-1.rs:26:47
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
| +++++++++++++++++++++++++

error[E0277]: the trait bound `Self: Deref` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:20:96
--> $DIR/defaults-unsound-62211-1.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ the trait `Deref` is not implemented for `Self`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-1.rs:20:25
--> $DIR/defaults-unsound-62211-1.rs:26:25
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref {
| +++++++

error[E0277]: the trait bound `Self: Copy` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:20:96
--> $DIR/defaults-unsound-62211-1.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ the trait `Copy` is not implemented for `Self`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-1.rs:20:18
--> $DIR/defaults-unsound-62211-1.rs:26:18
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ required by this bound in `UncheckedCopy::Output`
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/associated-types/defaults-unsound-62211-1.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
--> $DIR/defaults-unsound-62211-1.rs:52:5
|
LL | drop(origin);
| ^^^^^------^
| |
| argument has type `<T as UncheckedCopy>::Output`
|
= note: use `let _ = ...` to ignore the expression or result
= note: `#[warn(dropping_copy_types)]` on by default

warning: 1 warning emitted

14 changes: 10 additions & 4 deletions tests/ui/associated-types/defaults-unsound-62211-1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46
//@[next] check-pass

//! Regression test for https://github.com/rust-lang/rust/issues/62211
//!
//! The old implementation of defaults did not check whether the provided
Expand All @@ -18,10 +24,10 @@ trait UncheckedCopy: Sized {
// This Output is said to be Copy. Yet we default to Self
// and it's accepted, not knowing if Self ineed is Copy
type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
//~^ ERROR the trait bound `Self: Copy` is not satisfied
//~| ERROR the trait bound `Self: Deref` is not satisfied
//~| ERROR cannot add-assign `&'static str` to `Self`
//~| ERROR `Self` doesn't implement `std::fmt::Display`
//[current]~^ ERROR the trait bound `Self: Copy` is not satisfied
//[current]~| ERROR the trait bound `Self: Deref` is not satisfied
//[current]~| ERROR cannot add-assign `&'static str` to `Self`
//[current]~| ERROR `Self` doesn't implement `std::fmt::Display`

// We said the Output type was Copy, so we can Copy it freely!
fn unchecked_copy(other: &Self::Output) -> Self::Output {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-2.rs:20:96
--> $DIR/defaults-unsound-62211-2.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ `Self` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-2.rs:20:86
--> $DIR/defaults-unsound-62211-2.rs:26:86
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display {
| +++++++++++++++++++

error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-2.rs:20:96
--> $DIR/defaults-unsound-62211-2.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ no implementation for `Self += &'static str`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-2.rs:20:47
--> $DIR/defaults-unsound-62211-2.rs:26:47
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
| +++++++++++++++++++++++++

error[E0277]: the trait bound `Self: Deref` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:20:96
--> $DIR/defaults-unsound-62211-2.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ the trait `Deref` is not implemented for `Self`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-2.rs:20:25
--> $DIR/defaults-unsound-62211-2.rs:26:25
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
Expand All @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref {
| +++++++

error[E0277]: the trait bound `Self: Copy` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:20:96
--> $DIR/defaults-unsound-62211-2.rs:26:96
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ the trait `Copy` is not implemented for `Self`
|
note: required by a bound in `UncheckedCopy::Output`
--> $DIR/defaults-unsound-62211-2.rs:20:18
--> $DIR/defaults-unsound-62211-2.rs:26:18
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
| ^^^^ required by this bound in `UncheckedCopy::Output`
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/associated-types/defaults-unsound-62211-2.next.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
--> $DIR/defaults-unsound-62211-2.rs:52:5
|
LL | drop(origin);
| ^^^^^------^
| |
| argument has type `<T as UncheckedCopy>::Output`
|
= note: use `let _ = ...` to ignore the expression or result
= note: `#[warn(dropping_copy_types)]` on by default

warning: 1 warning emitted

14 changes: 10 additions & 4 deletions tests/ui/associated-types/defaults-unsound-62211-2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46
//@[next] check-pass

//! Regression test for https://github.com/rust-lang/rust/issues/62211
//!
//! The old implementation of defaults did not check whether the provided
Expand All @@ -18,10 +24,10 @@ trait UncheckedCopy: Sized {
// This Output is said to be Copy. Yet we default to Self
// and it's accepted, not knowing if Self ineed is Copy
type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
//~^ ERROR the trait bound `Self: Copy` is not satisfied
//~| ERROR the trait bound `Self: Deref` is not satisfied
//~| ERROR cannot add-assign `&'static str` to `Self`
//~| ERROR `Self` doesn't implement `std::fmt::Display`
//[current]~^ ERROR the trait bound `Self: Copy` is not satisfied
//[current]~| ERROR the trait bound `Self: Deref` is not satisfied
//[current]~| ERROR cannot add-assign `&'static str` to `Self`
//[current]~| ERROR `Self` doesn't implement `std::fmt::Display`

// We said the Output type was Copy, so we can Copy it freely!
fn unchecked_copy(other: &Self::Output) -> Self::Output {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/async-closures/is-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ edition:2021
//@ build-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

#![feature(async_closure)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/async-closures/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@ edition:2021
//@ build-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

#![feature(async_closure)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/async-fn/higher-ranked-async-fn.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ aux-build:block-on.rs
//@ edition:2018
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ build-pass (since it ICEs during mono)

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/async-fn/project.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition:2018
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ edition:2021
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:6:12
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:6:12
--> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ edition:2021

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/auto-traits/issue-23080-2.current.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0380]: auto traits cannot have associated items
--> $DIR/issue-23080-2.rs:8:10
--> $DIR/issue-23080-2.rs:9:10
|
LL | unsafe auto trait Trait {
| ----- auto traits cannot have associated items
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/auto-traits/issue-23080-2.next.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0380]: auto traits cannot have associated items
--> $DIR/issue-23080-2.rs:8:10
--> $DIR/issue-23080-2.rs:9:10
|
LL | unsafe auto trait Trait {
| ----- auto traits cannot have associated items
Expand Down
1 change: 1 addition & 0 deletions tests/ui/auto-traits/issue-23080-2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

#![feature(auto_traits)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/closures/infer-signature-from-impl.next.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0282]: type annotations needed
--> $DIR/infer-signature-from-impl.rs:17:16
--> $DIR/infer-signature-from-impl.rs:18:16
|
LL | needs_foo(|x| {
| ^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/closures/infer-signature-from-impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#71
//@[current] check-pass
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0284]: type annotations needed: cannot satisfy `<dyn Object<U, Output = T> as Object<U>>::Output == T`
--> $DIR/indirect-impl-for-trait-obj-coherence.rs:25:41
|
LL | foo::<dyn Object<U, Output = T>, U>(x)
| ^ cannot satisfy `<dyn Object<U, Output = T> as Object<U>>::Output == T`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0284`.
8 changes: 6 additions & 2 deletions tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//@ check-pass
//@ known-bug: #57893
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[current] check-pass
//@[current] known-bug: #57893

// Should fail. Because we see an impl that uses a certain associated type, we
// type-check assuming that impl is used. However, this conflicts with the
Expand All @@ -20,6 +23,7 @@ fn foo<T: ?Sized, U>(x: <T as Object<U>>::Output) -> U {
#[allow(dead_code)]
fn transmute<T, U>(x: T) -> U {
foo::<dyn Object<U, Output = T>, U>(x)
//[next]~^ ERROR type annotations needed: cannot satisfy `<dyn Object<U, Output = T> as Object<U>>::Output == T`
}

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/coherence/normalize-for-errors.current.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, _)`
--> $DIR/normalize-for-errors.rs:16:1
--> $DIR/normalize-for-errors.rs:17:1
|
LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {}
| ------------------------------------------------------ first implementation here
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/coherence/normalize-for-errors.next.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, <_ as Iterator>::Item)`
--> $DIR/normalize-for-errors.rs:16:1
--> $DIR/normalize-for-errors.rs:17:1
|
LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {}
| ------------------------------------------------------ first implementation here
Expand Down
1 change: 1 addition & 0 deletions tests/ui/coherence/normalize-for-errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

struct MyType;
Expand Down
Loading
Loading