builtin dyn impl no guide inference
This commit is contained in:
parent
2f176126aa
commit
bde63bb251
4 changed files with 62 additions and 1 deletions
|
|
@ -0,0 +1,16 @@
|
|||
error[E0283]: type annotations needed
|
||||
--> $DIR/no-incomplete-inference.rs:16:5
|
||||
|
|
||||
LL | impls_equals::<dyn Equals<u32>, _>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `impls_equals`
|
||||
|
|
||||
= note: cannot satisfy `dyn Equals<u32>: Equals<_>`
|
||||
note: required by a bound in `impls_equals`
|
||||
--> $DIR/no-incomplete-inference.rs:13:20
|
||||
|
|
||||
LL | fn impls_equals<T: Equals<U> + ?Sized, U: ?Sized>() {}
|
||||
| ^^^^^^^^^ required by this bound in `impls_equals`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0283`.
|
||||
16
tests/ui/traits/object/no-incomplete-inference.next.stderr
Normal file
16
tests/ui/traits/object/no-incomplete-inference.next.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error[E0283]: type annotations needed
|
||||
--> $DIR/no-incomplete-inference.rs:16:5
|
||||
|
|
||||
LL | impls_equals::<dyn Equals<u32>, _>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `impls_equals`
|
||||
|
|
||||
= note: cannot satisfy `dyn Equals<u32>: Equals<_>`
|
||||
note: required by a bound in `impls_equals`
|
||||
--> $DIR/no-incomplete-inference.rs:13:20
|
||||
|
|
||||
LL | fn impls_equals<T: Equals<U> + ?Sized, U: ?Sized>() {}
|
||||
| ^^^^^^^^^ required by this bound in `impls_equals`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0283`.
|
||||
18
tests/ui/traits/object/no-incomplete-inference.rs
Normal file
18
tests/ui/traits/object/no-incomplete-inference.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
|
||||
// Make sure that having an applicable user-written
|
||||
// and builtin impl is ambiguous.
|
||||
|
||||
trait Equals<T: ?Sized> {}
|
||||
|
||||
impl<T: ?Sized> Equals<T> for T {}
|
||||
|
||||
fn impls_equals<T: Equals<U> + ?Sized, U: ?Sized>() {}
|
||||
|
||||
fn main() {
|
||||
impls_equals::<dyn Equals<u32>, _>();
|
||||
//~^ ERROR type annotations needed
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue