update tests
This commit is contained in:
parent
412c6e0b07
commit
30ed152330
@ -1,8 +1,8 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-109789.rs:18:1
|
||||
--> $DIR/issue-109789.rs:18:11
|
||||
|
|
||||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected struct `Foo<fn(&'static ())>`
|
||||
found struct `Foo<for<'a> fn(&'a ())>`
|
||||
|
@ -1,18 +0,0 @@
|
||||
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/param-env-infer.rs:5:12
|
||||
|
|
||||
LL | #![feature(dyn_star, pointer_like_trait)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/param-env-infer.rs:13:10
|
||||
|
|
||||
LL | t as _
|
||||
| ^ cannot infer type
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
@ -1,38 +0,0 @@
|
||||
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/param-env-infer.rs:5:12
|
||||
|
|
||||
LL | #![feature(dyn_star, pointer_like_trait)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
|
||||
--> $DIR/param-env-infer.rs:11:60
|
||||
|
|
||||
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires type-checking `make_dyn_star`...
|
||||
--> $DIR/param-env-infer.rs:11:1
|
||||
|
|
||||
LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
|
||||
= note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
|
||||
= note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/param-env-infer.rs:5:1
|
||||
|
|
||||
LL | / #![feature(dyn_star, pointer_like_trait)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | use std::fmt::Debug;
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
9
tests/ui/dyn-star/param-env-region-infer.current.stderr
Normal file
9
tests/ui/dyn-star/param-env-region-infer.current.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/param-env-region-infer.rs:16:10
|
||||
|
|
||||
LL | t as _
|
||||
| ^ cannot infer type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
@ -1,15 +1,18 @@
|
||||
// revisions: current next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
//[next] check-pass
|
||||
// incremental
|
||||
|
||||
// checks that we don't ICE if there are region inference variables in the environment
|
||||
// when computing `PointerLike` builtin candidates.
|
||||
|
||||
#![feature(dyn_star, pointer_like_trait)]
|
||||
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::marker::PointerLike;
|
||||
|
||||
fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
|
||||
//[next]~^ ERROR cycle detected when computing type of `make_dyn_star::{opaque#0}`
|
||||
t as _
|
||||
//[current]~^ ERROR type annotations needed
|
||||
}
|
@ -20,6 +20,53 @@ error: the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error[E0277]: `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
|
||||
--> $DIR/issue-20605.rs:5:17
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^ `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter`
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
|
||||
--> $DIR/issue-20605.rs:5:17
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
|
||||
--> $DIR/issue-20605.rs:5:27
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^
|
||||
|
||||
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
|
||||
--> $DIR/issue-20605.rs:5:9
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item`
|
||||
= note: all local variables must have a statically known size
|
||||
= help: unsized locals are gated as an unstable feature
|
||||
|
||||
error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
|
||||
--> $DIR/issue-20605.rs:5:17
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
|
||||
--> $DIR/issue-20605.rs:5:5
|
||||
|
|
||||
LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item`
|
||||
note: required by a bound in `None`
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0614.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -3,9 +3,18 @@
|
||||
|
||||
fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
|
||||
for item in *things { *item = 0 }
|
||||
//~^ ERROR the size for values of type
|
||||
//[next]~^^ ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
|
||||
//[next]~| ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
||||
//[current]~^ ERROR the size for values of type
|
||||
//[next]~^^ ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
|
||||
//[next]~| ERROR the size for values of type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` cannot be known at compilation time
|
||||
//[next]~| ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
|
||||
//[next]~| ERROR `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator
|
||||
//[next]~| ERROR the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
|
||||
//[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
|
||||
//[next]~| ERROR the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
|
||||
//[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
|
||||
//[next]~| ERROR type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
|
||||
// FIXME(-Ztrait-solver=next): these error messages are horrible and have to be
|
||||
// improved before we stabilize the new solver.
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -7,7 +7,6 @@ trait Trait2<'a> {
|
||||
|
||||
fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
|
||||
//~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
||||
//~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
||||
let _e: (usize, usize) = unsafe{mem::transmute(param)};
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,6 @@ error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
||||
LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
|
||||
|
||||
error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied
|
||||
--> $DIR/issue-35570.rs:8:1
|
||||
|
|
||||
LL | / fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _e: (usize, usize) = unsafe{mem::transmute(param)};
|
||||
LL | | }
|
||||
| |_^ the trait `for<'a> Trait2<'a>` is not implemented for `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -20,7 +20,6 @@ trait Trait2<'a, 'b> {
|
||||
// do not infer that.
|
||||
fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
//~^ ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
|
||||
//~| ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -9,21 +9,6 @@ help: consider restricting type parameter `T`
|
||||
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
| ++++++++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied
|
||||
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1
|
||||
|
|
||||
LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | {
|
||||
LL | | }
|
||||
| |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
|
||||
| ++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -21,9 +21,7 @@ impl Foo for () {
|
||||
fn main() {
|
||||
let x = String::from("hello, world");
|
||||
drop(<() as Foo>::copy_me(&x));
|
||||
//~^ ERROR `<() as Foo>::Item: Copy` is not satisfied
|
||||
//~| ERROR `<() as Foo>::Item` is not well-formed
|
||||
//~| ERROR `<() as Foo>::Item` is not well-formed
|
||||
//~^ ERROR the type `&<() as Foo>::Item` is not well-formed
|
||||
//~| ERROR `<() as Foo>::Item` is not well-formed
|
||||
println!("{x}");
|
||||
}
|
||||
|
@ -1,17 +1,8 @@
|
||||
error[E0277]: the trait bound `<() as Foo>::Item: Copy` is not satisfied
|
||||
--> $DIR/alias-bound-unsound.rs:23:10
|
||||
error: the type `&<() as Foo>::Item` is not well-formed
|
||||
--> $DIR/alias-bound-unsound.rs:23:31
|
||||
|
|
||||
LL | drop(<() as Foo>::copy_me(&x));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `<() as Foo>::Item`
|
||||
|
|
||||
note: required by a bound in `Foo::Item`
|
||||
--> $DIR/alias-bound-unsound.rs:10:30
|
||||
|
|
||||
LL | type Item: Copy
|
||||
| ---- required by a bound in this associated type
|
||||
LL | where
|
||||
LL | <Self as Foo>::Item: Copy;
|
||||
| ^^^^ required by this bound in `Foo::Item`
|
||||
| ^^
|
||||
|
||||
error: the type `<() as Foo>::Item` is not well-formed
|
||||
--> $DIR/alias-bound-unsound.rs:23:10
|
||||
@ -19,18 +10,5 @@ error: the type `<() as Foo>::Item` is not well-formed
|
||||
LL | drop(<() as Foo>::copy_me(&x));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: the type `<() as Foo>::Item` is not well-formed
|
||||
--> $DIR/alias-bound-unsound.rs:23:5
|
||||
|
|
||||
LL | drop(<() as Foo>::copy_me(&x));
|
||||
| ^^^^
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: the type `<() as Foo>::Item` is not well-formed
|
||||
--> $DIR/alias-bound-unsound.rs:23:10
|
||||
|
|
||||
LL | drop(<() as Foo>::copy_me(&x));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
@ -1,22 +1,17 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
|
||||
// check-pass
|
||||
// (should not pass, should be turned into a coherence-only test)
|
||||
|
||||
// check that a `alias-eq(<?0 as TraitB>::Assoc, <T as TraitB>::Assoc)` goal fails.
|
||||
|
||||
// FIXME(deferred_projection_equality): add a test that this is true during coherence
|
||||
// check that a `alias-eq(<?a as TraitB>::Assoc, <?b as TraitB>::Assoc)` goal fails
|
||||
// during coherence. We must not incorrectly constrain `?a` and `?b` to be
|
||||
// equal.
|
||||
|
||||
trait TraitB {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
fn needs_a<T: TraitB>() -> T::Assoc {
|
||||
unimplemented!()
|
||||
}
|
||||
trait Overlaps<T> {}
|
||||
|
||||
fn bar<T: TraitB>() {
|
||||
let _: <_ as TraitB>::Assoc = needs_a::<T>();
|
||||
}
|
||||
impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
|
||||
impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
|
||||
//~^ ERROR conflicting implementations of trait
|
||||
|
||||
fn main() {}
|
||||
|
@ -0,0 +1,11 @@
|
||||
error[E0119]: conflicting implementations of trait `Overlaps<Box<_>>` for type `<_ as TraitB>::Assoc`
|
||||
--> $DIR/alias_eq_substs_eq_not_intercrate.rs:14:1
|
||||
|
|
||||
LL | impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {}
|
||||
| --------------------------------------------------------- first implementation here
|
||||
LL | impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0119`.
|
@ -1,8 +1,8 @@
|
||||
error[E0271]: expected `[async block@$DIR/async.rs:12:17: 12:25]` to be a future that resolves to `i32`, but it resolves to `()`
|
||||
error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32`
|
||||
--> $DIR/async.rs:12:17
|
||||
|
|
||||
LL | needs_async(async {});
|
||||
| ----------- ^^^^^^^^ expected `i32`, found `()`
|
||||
| ----------- ^^^^^^^^ types differ
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
|
@ -10,7 +10,7 @@ fn needs_async(_: impl Future<Output = i32>) {}
|
||||
#[cfg(fail)]
|
||||
fn main() {
|
||||
needs_async(async {});
|
||||
//[fail]~^ ERROR to be a future that resolves to `i32`, but it resolves to `()`
|
||||
//[fail]~^ ERROR type mismatch
|
||||
}
|
||||
|
||||
#[cfg(pass)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// check-pass
|
||||
// known-bug: #112825
|
||||
|
||||
// Makes sure we don't prepopulate the MIR typeck of `define`
|
||||
// with `Foo<T, U> = T`, but instead, `Foo<B, A> = B`, so that
|
||||
|
99
tests/ui/traits/new-solver/dont-remap-tait-substs.stderr
Normal file
99
tests/ui/traits/new-solver/dont-remap-tait-substs.stderr
Normal file
@ -0,0 +1,99 @@
|
||||
error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
|
||||
--> $DIR/dont-remap-tait-substs.rs:10:24
|
||||
|
|
||||
LL | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `define`...
|
||||
--> $DIR/dont-remap-tait-substs.rs:15:1
|
||||
|
|
||||
LL | fn define<A, B: Send>(a: A, b: B) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/dont-remap-tait-substs.rs:8:1
|
||||
|
|
||||
LL | / #![feature(type_alias_impl_trait)]
|
||||
LL | |
|
||||
LL | | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
|
||||
--> $DIR/dont-remap-tait-substs.rs:10:24
|
||||
|
|
||||
LL | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `define`...
|
||||
--> $DIR/dont-remap-tait-substs.rs:15:1
|
||||
|
|
||||
LL | fn define<A, B: Send>(a: A, b: B) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/dont-remap-tait-substs.rs:8:1
|
||||
|
|
||||
LL | / #![feature(type_alias_impl_trait)]
|
||||
LL | |
|
||||
LL | | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
|
||||
--> $DIR/dont-remap-tait-substs.rs:10:24
|
||||
|
|
||||
LL | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `define`...
|
||||
--> $DIR/dont-remap-tait-substs.rs:15:1
|
||||
|
|
||||
LL | fn define<A, B: Send>(a: A, b: B) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/dont-remap-tait-substs.rs:8:1
|
||||
|
|
||||
LL | / #![feature(type_alias_impl_trait)]
|
||||
LL | |
|
||||
LL | | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
|
||||
--> $DIR/dont-remap-tait-substs.rs:10:24
|
||||
|
|
||||
LL | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: ...which requires borrow-checking `define`...
|
||||
--> $DIR/dont-remap-tait-substs.rs:15:1
|
||||
|
|
||||
LL | fn define<A, B: Send>(a: A, b: B) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
|
||||
note: cycle used when checking item types in top-level module
|
||||
--> $DIR/dont-remap-tait-substs.rs:8:1
|
||||
|
|
||||
LL | / #![feature(type_alias_impl_trait)]
|
||||
LL | |
|
||||
LL | | type Foo<T: Send, U> = impl NeedsSend<T>;
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
@ -1,11 +1,10 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// known-bug: unknown
|
||||
|
||||
trait Test {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
fn transform<T: Test>(x: T) -> T::Assoc {
|
||||
fn transform<T: Test>(x: Inv<T>) -> Inv<T::Assoc> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@ -17,8 +16,13 @@ impl Test for String {
|
||||
type Assoc = String;
|
||||
}
|
||||
|
||||
struct Inv<T>(Option<*mut T>);
|
||||
|
||||
fn main() {
|
||||
let mut x = Default::default();
|
||||
let mut x: Inv<_> = Inv(None);
|
||||
// This ends up equating `Inv<?x>` with `Inv<<?x as Test>::Assoc>`
|
||||
// which fails the occurs check when generalizing `?x`.
|
||||
x = transform(x);
|
||||
x = 1i32;
|
||||
//~^ ERROR mismatched types
|
||||
x = Inv::<i32>(None);
|
||||
}
|
||||
|
@ -1,13 +1,8 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/equating-projection-cyclically.rs:22:19
|
||||
--> $DIR/equating-projection-cyclically.rs:25:9
|
||||
|
|
||||
LL | x = transform(x);
|
||||
| ^ expected inferred type, found associated type
|
||||
|
|
||||
= note: expected type `_`
|
||||
found associated type `<_ as Test>::Assoc`
|
||||
= help: consider constraining the associated type `<_ as Test>::Assoc` to `_`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
| ^^^^^^^^^^^^ cyclic type of infinite size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// check-pass
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// Issue 95863
|
||||
// known-bug: #95863
|
||||
|
||||
pub trait With {
|
||||
type F;
|
||||
|
39
tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr
Normal file
39
tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr
Normal file
@ -0,0 +1,39 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/lazy-nested-obligations-2.rs:15:23
|
||||
|
|
||||
LL | let _: V<i32> = V(f);
|
||||
| - ^ types differ
|
||||
| |
|
||||
| arguments to this struct are incorrect
|
||||
|
|
||||
= note: expected associated type `<i32 as With>::F`
|
||||
found fn item `for<'a> fn(&'a str) {f}`
|
||||
= help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
note: tuple struct defined here
|
||||
--> $DIR/lazy-nested-obligations-2.rs:16:16
|
||||
|
|
||||
LL | pub struct V<T: With>(<T as With>::F);
|
||||
| ^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/lazy-nested-obligations-2.rs:21:30
|
||||
|
|
||||
LL | let _: E3<i32> = E3::Var(f);
|
||||
| ------- ^ types differ
|
||||
| |
|
||||
| arguments to this enum variant are incorrect
|
||||
|
|
||||
= note: expected associated type `<i32 as With>::F`
|
||||
found fn item `for<'a> fn(&'a str) {f}`
|
||||
= help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
note: tuple variant defined here
|
||||
--> $DIR/lazy-nested-obligations-2.rs:19:9
|
||||
|
|
||||
LL | Var(<T as With>::F),
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -10,7 +10,15 @@ fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
|
||||
|
||||
pub fn copy_any<T>(t: &T) -> T {
|
||||
copy::<dyn Setup<From=T>>(t)
|
||||
//~^ ERROR the trait bound `dyn Setup<From = T>: Setup` is not satisfied
|
||||
//~^ ERROR the type `&<dyn Setup<From = T> as Setup>::From` is not well-formed
|
||||
//~| ERROR the trait bound `dyn Setup<From = T>: Setup` is not satisfied
|
||||
//~| ERROR mismatched types
|
||||
//~| ERROR mismatched types
|
||||
//~| ERROR the type `<dyn Setup<From = T> as Setup>::From` is not well-formed
|
||||
//~| ERROR the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time
|
||||
|
||||
// FIXME(-Ztrait-solver=next): These error messages are horrible and some of them
|
||||
// are even simple fallout from previous error.
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -14,6 +14,65 @@ help: consider introducing a `where` clause, but there might be an alternative b
|
||||
LL | pub fn copy_any<T>(t: &T) -> T where dyn Setup<From = T>: Setup {
|
||||
| ++++++++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
error: the type `&<dyn Setup<From = T> as Setup>::From` is not well-formed
|
||||
--> $DIR/object-unsafety.rs:12:31
|
||||
|
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/object-unsafety.rs:12:31
|
||||
|
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ------------------------- ^ types differ
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected reference `&<dyn Setup<From = T> as Setup>::From`
|
||||
found reference `&T`
|
||||
note: function defined here
|
||||
--> $DIR/object-unsafety.rs:7:4
|
||||
|
|
||||
LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
|
||||
| ^^^^ --------------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/object-unsafety.rs:12:5
|
||||
|
|
||||
LL | pub fn copy_any<T>(t: &T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
||||
|
|
||||
= note: expected type parameter `T`
|
||||
found associated type `<dyn Setup<From = T> as Setup>::From`
|
||||
= note: you might be missing a type parameter or trait bound
|
||||
|
||||
error: the type `<dyn Setup<From = T> as Setup>::From` is not well-formed
|
||||
--> $DIR/object-unsafety.rs:12:5
|
||||
|
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time
|
||||
--> $DIR/object-unsafety.rs:12:5
|
||||
|
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^---
|
||||
| |
|
||||
| doesn't have a size known at compile-time
|
||||
| this returned value is of type `<dyn Setup<From = T> as Setup>::From`
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `<dyn Setup<From = T> as Setup>::From`
|
||||
= note: the return type of a function must have a statically known size
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | pub fn copy_any<T>(t: &T) -> T where <dyn Setup<From = T> as Setup>::From: Sized {
|
||||
| +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -1,3 +1,4 @@
|
||||
//~ ERROR overflow
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
|
||||
trait Foo1 {
|
||||
|
@ -1,16 +1,20 @@
|
||||
error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar`
|
||||
--> $DIR/recursive-self-normalization-2.rs:15:5
|
||||
--> $DIR/recursive-self-normalization-2.rs:16:5
|
||||
|
|
||||
LL | needs_bar::<T::Assoc1>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`)
|
||||
note: required by a bound in `needs_bar`
|
||||
--> $DIR/recursive-self-normalization-2.rs:12:17
|
||||
--> $DIR/recursive-self-normalization-2.rs:13:17
|
||||
|
|
||||
LL | fn needs_bar<S: Bar>() {}
|
||||
| ^^^ required by this bound in `needs_bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0275]: overflow evaluating the requirement `<T as Foo2>::Assoc2`
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
|
@ -1,3 +1,4 @@
|
||||
//~ ERROR overflow evaluating the requirement `<T as Foo>::Assoc` [E0275]
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
|
||||
trait Foo {
|
||||
|
@ -1,16 +1,20 @@
|
||||
error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Bar`
|
||||
--> $DIR/recursive-self-normalization.rs:11:5
|
||||
--> $DIR/recursive-self-normalization.rs:12:5
|
||||
|
|
||||
LL | needs_bar::<T::Assoc>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`)
|
||||
note: required by a bound in `needs_bar`
|
||||
--> $DIR/recursive-self-normalization.rs:8:17
|
||||
--> $DIR/recursive-self-normalization.rs:9:17
|
||||
|
|
||||
LL | fn needs_bar<S: Bar>() {}
|
||||
| ^^^ required by this bound in `needs_bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc`
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0271]: type mismatch resolving `[u8; 3] <: <Range<usize> as SliceIndex<[u8]>>::Output`
|
||||
error[E0271]: type mismatch resolving `[u8; 3] <: <[u8] as Index<Range<usize>>>::Output`
|
||||
--> $DIR/slice-match-byte-lit.rs:6:9
|
||||
|
|
||||
LL | match &s[0..3] {
|
||||
| -------- this expression has type `&<std::ops::Range<usize> as SliceIndex<[u8]>>::Output`
|
||||
| -------- this expression has type `&<[u8] as Index<std::ops::Range<usize>>>::Output`
|
||||
LL | b"uwu" => {}
|
||||
| ^^^^^^ types differ
|
||||
|
||||
|
@ -10,12 +10,11 @@ trait Default {
|
||||
}
|
||||
|
||||
impl<T> Default for T {
|
||||
default type Id = T;
|
||||
|
||||
fn intu(&self) -> &Self::Id {
|
||||
default type Id = T;
|
||||
// This will be fixed by #111994
|
||||
fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed
|
||||
self
|
||||
//~^ ERROR cannot satisfy `T <: <T as Default>::Id`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U {
|
||||
@ -24,7 +23,6 @@ fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U {
|
||||
|
||||
use std::num::NonZeroU8;
|
||||
fn main() {
|
||||
let s = transmute::<u8, Option<NonZeroU8>>(0);
|
||||
//~^ ERROR cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8>
|
||||
let s = transmute::<u8, Option<NonZeroU8>>(0); // this call should then error
|
||||
assert_eq!(s, None);
|
||||
}
|
||||
|
@ -8,24 +8,14 @@ LL | #![feature(specialization)]
|
||||
= help: consider using `min_specialization` instead, which is more stable and complete
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0284]: type annotations needed: cannot satisfy `T <: <T as Default>::Id`
|
||||
--> $DIR/specialization-transmute.rs:16:9
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/specialization-transmute.rs:15:23
|
||||
|
|
||||
LL | self
|
||||
| ^^^^ cannot satisfy `T <: <T as Default>::Id`
|
||||
LL | fn intu(&self) -> &Self::Id {
|
||||
| ^^^^^^^^^ cannot infer type
|
||||
|
|
||||
= note: cannot satisfy `<T as Default>::Id == _`
|
||||
|
||||
error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8>`
|
||||
--> $DIR/specialization-transmute.rs:27:13
|
||||
|
|
||||
LL | let s = transmute::<u8, Option<NonZeroU8>>(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8>`
|
||||
|
|
||||
note: required by a bound in `transmute`
|
||||
--> $DIR/specialization-transmute.rs:21:25
|
||||
|
|
||||
LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U {
|
||||
| ^^^^^^ required by this bound in `transmute`
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
||||
|
@ -11,7 +11,7 @@ trait Default {
|
||||
}
|
||||
|
||||
impl<T> Default for T {
|
||||
default type Id = T;
|
||||
default type Id = T; //~ ERROR type annotations needed
|
||||
}
|
||||
|
||||
fn test<T: Default<Id = U>, U>() {}
|
||||
|
@ -8,6 +8,12 @@ LL | #![feature(specialization)]
|
||||
= help: consider using `min_specialization` instead, which is more stable and complete
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/specialization-unconstrained.rs:14:22
|
||||
|
|
||||
LL | default type Id = T;
|
||||
| ^ cannot infer type for associated type `<T as Default>::Id`
|
||||
|
||||
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
|
||||
--> $DIR/specialization-unconstrained.rs:20:5
|
||||
|
|
||||
@ -20,6 +26,7 @@ note: required by a bound in `test`
|
||||
LL | fn test<T: Default<Id = U>, U>() {}
|
||||
| ^^^^^^ required by this bound in `test`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
||||
Some errors have detailed explanations: E0282, E0284.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
|
@ -5,8 +5,8 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
fn main() {
|
||||
type T = impl Copy;
|
||||
let foo: T = (1u32, 2u32);
|
||||
type Tait = impl Copy;
|
||||
let foo: Tait = (1u32, 2u32);
|
||||
let x: (_, _) = foo;
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user