-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ac93cd
commit cfe3a82
Showing
8 changed files
with
50 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 4 additions & 17 deletions
21
tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,9 @@ | ||
error[E0283]: type annotations needed | ||
--> $DIR/auto-trait-selection-freeze.rs:19:16 | ||
error[E0284]: type annotations needed: cannot satisfy `impl Sized == _` | ||
--> $DIR/auto-trait-selection-freeze.rs:19:5 | ||
| | ||
LL | if false { is_trait(foo()) } else { Default::default() } | ||
| ^^^^^^^^ ----- type must be known at this point | ||
| | | ||
| cannot infer type of the type parameter `T` declared on the function `is_trait` | ||
| | ||
= note: cannot satisfy `_: Trait<_>` | ||
note: required by a bound in `is_trait` | ||
--> $DIR/auto-trait-selection-freeze.rs:11:16 | ||
| | ||
LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { | ||
| ^^^^^^^^ required by this bound in `is_trait` | ||
help: consider specifying the generic arguments | ||
| | ||
LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } | ||
| ++++++++ | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `impl Sized == _` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0283`. | ||
For more information about this error, try `rustc --explain E0284`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,9 @@ | ||
error[E0283]: type annotations needed | ||
--> $DIR/auto-trait-selection.rs:15:16 | ||
error[E0284]: type annotations needed: cannot satisfy `impl Sized == _` | ||
--> $DIR/auto-trait-selection.rs:15:5 | ||
| | ||
LL | if false { is_trait(foo()) } else { Default::default() } | ||
| ^^^^^^^^ ----- type must be known at this point | ||
| | | ||
| cannot infer type of the type parameter `T` declared on the function `is_trait` | ||
| | ||
= note: cannot satisfy `_: Trait<_>` | ||
note: required by a bound in `is_trait` | ||
--> $DIR/auto-trait-selection.rs:7:16 | ||
| | ||
LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { | ||
| ^^^^^^^^ required by this bound in `is_trait` | ||
help: consider specifying the generic arguments | ||
| | ||
LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } | ||
| ++++++++ | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `impl Sized == _` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0283`. | ||
For more information about this error, try `rustc --explain E0284`. |
26 changes: 26 additions & 0 deletions
26
tests/ui/traits/next-solver/typeck/resolve-expectations.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//@ check-pass | ||
//@ compile-flags: -Znext-solver | ||
|
||
trait Mirror { | ||
type Assoc; | ||
} | ||
impl<T> Mirror for T { | ||
type Assoc = T; | ||
} | ||
|
||
fn id<T>(t: T) -> T { t } | ||
|
||
trait Foo {} | ||
impl Foo for i32 {} | ||
impl Foo for u32 {} | ||
|
||
fn main() { | ||
// Make sure we resolve expected pointee of addr-of. | ||
id::<<&&dyn Foo as Mirror>::Assoc>(&id(&1)); | ||
|
||
// Make sure we resolve expected element of array. | ||
id::<<[Box<dyn Foo>; 2] as Mirror>::Assoc>([Box::new(1i32), Box::new(1u32)]); | ||
|
||
// Make sure we resolve expected element of tuple. | ||
id::<<(Box<dyn Foo>,) as Mirror>::Assoc>((Box::new(1i32),)); | ||
} |