forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#133559 - compiler-errors:structurally-resolve…
…-adjust-for-branch, r=lcnr Structurally resolve in `adjust_for_branches` r? lcnr
- Loading branch information
Showing
8 changed files
with
62 additions
and
50 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
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),)); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/ui/traits/next-solver/typeck/structurally-resolve-in-resolve_for_branch.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,8 @@ | ||
//@ compile-flags: -Znext-solver | ||
//@ check-pass | ||
|
||
pub fn repro() -> impl FnMut() { | ||
if true { || () } else { || () } | ||
} | ||
|
||
fn main() {} |