Skip to content

Rollup of 5 pull requests - #71046

Closed
Dylan-DPC-zz wants to merge 18 commits into
rust-lang:masterfrom
Dylan-DPC-zz:rollup-e5aez0f
Closed

Rollup of 5 pull requests#71046
Dylan-DPC-zz wants to merge 18 commits into
rust-lang:masterfrom
Dylan-DPC-zz:rollup-e5aez0f

Conversation

@Dylan-DPC-zz

Copy link
Copy Markdown

Successful merges:

Failed merges:

r? @ghost

jonas-schievinkand others added 18 commits April 11, 2020 01:39
… r=Centril
Handle `impl Trait` where `Trait` has an assoc type with missing bounds
When encountering a type parameter that needs more bounds the trivial case is `T` `where T: Bound`, but it can also be an `impl Trait` param that needs to be decomposed to a type param for cleaner code. For example, given
```rust
fn foo(constraints: impl Iterator) {
for constraint in constraints {
println!("{:?}", constraint);
}
}
```
the previous output was
```
error[E0277]: `<impl Iterator as std::iter::Iterator>::Item` doesn't implement `std::fmt::Debug`
--> src/main.rs:3:26
|
1 | fn foo(constraints: impl Iterator) {
| - help: consider further restricting the associated type: `where <impl Iterator as std::iter::Iterator>::Item: std::fmt::Debug`
2 | for constraint in constraints {
3 | println!("{:?}", constraint);
| ^^^^^^^^^^ `<impl Iterator as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<impl Iterator as std::iter::Iterator>::Item`
= note: required by `std::fmt::Debug::fmt`
```
which is incorrect as `where <impl Iterator as std::iter::Iterator>::Item: std::fmt::Debug` is not valid syntax nor would it restrict the positional `impl Iterator` parameter if it were.
The output being introduced is
```
error[E0277]: `<impl Iterator as std::iter::Iterator>::Item` doesn't implement `std::fmt::Debug`
--> src/main.rs:3:26
|
3 | println!("{:?}", constraint);
| ^^^^^^^^^^ `<impl Iterator as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<impl Iterator as std::iter::Iterator>::Item`
= note: required by `std::fmt::Debug::fmt`
help: introduce a type parameter with a trait bound instead of using `impl Trait`
|
LL | fn foo<T: Iterator>(constraints: T) where <T as std::iter::Iterator>::Item: std::fmt::Debug {
| ^^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
This suggestion is correct and lead the user in the right direction: because you have an associated type restriction you can no longer use `impl Trait`, the only reasonable alternative is to introduce a named type parameter, bound by `Trait` and with a `where` binding on the associated type for the new type parameter `as Trait` for the missing bound.
*Ideally*, we would want to suggest something like the following, but that is not valid syntax today
```
error[E0277]: `<impl Iterator as std::iter::Iterator>::Item` doesn't implement `std::fmt::Debug`
--> src/main.rs:3:26
|
3 | println!("{:?}", constraint);
| ^^^^^^^^^^ `<impl Iterator as std::iter::Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<impl Iterator as std::iter::Iterator>::Item`
= note: required by `std::fmt::Debug::fmt`
help: introduce a type parameter with a trait bound instead of using `impl Trait`
|
LL | fn foo(constraints: impl Iterator<Item: std::fmt::Debug>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Fixrust-lang#69638.
…=eddyb
Pass the `PlaceElem::Index` local to `visit_local`
Fixesrust-lang#71008
cc @rust-lang/wg-mir-opt
r? @spastorino
…p, r=Amanieu
[windows] Add testscase for self-contained executables
…schievink
Update links of `rustc guide`
Picks up the things we left behind in the transition, hopefully they're last ones.
r? @spastorino
@Dylan-DPC-zz

Copy link
Copy Markdown
Author

@bors r+ p=5 rollup=never

@bors

bors commented Apr 12, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 082db80 has been approved by Dylan-DPC

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 12, 2020
@Dylan-DPC-zzDylan-DPC-zz added the rollup A PR which is a rollup label Apr 12, 2020
@bors

bors commented Apr 12, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 082db80 with merge 4006305ff68920a709ca1a671a69552264f16931...

@bors

bors commented Apr 12, 2020

Copy link
Copy Markdown
Collaborator

💔 Test failed - checks-azure

@borsbors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 12, 2020
@Dylan-DPC-zz
Dylan-DPC-zz deleted the rollup-e5aez0f branch April 12, 2020 12:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollupA PR which is a rollupS-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@Dylan-DPC-zz@bors@jonas-schievink@GuillaumeGomez@mati865@JohnTitor@estebank@Dylan-DPC