Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc lowering cleanups #51654

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4093d37
Use `PathParameters` even if just the `lifetimes` field is used
oli-obk Jun 18, 2018
5181218
Cleanup in preparation of generic extraction
oli-obk Jun 18, 2018
dea4d5b
Generate the `NodeId` for `existential type` in the AST
oli-obk Jun 18, 2018
2b7f86a
Reduce repetition around `lower_method_sig`
oli-obk Jun 19, 2018
0dcb45e
Deduplicate code in `lower_lifetime`
oli-obk Jun 19, 2018
98d4500
Remove some global state from the lowering pass
oli-obk Jun 19, 2018
3ae2e31
Pass generics through to existential impl Trait lowering
oli-obk Jun 19, 2018
3dbe348
Don't generate a new NodeId for universal impl Trait
oli-obk Jun 20, 2018
90a54c1
Generate `DefId`s for impl Trait in the def_collector
oli-obk Jun 20, 2018
2fdb64c
Update ui tests
oli-obk Jun 20, 2018
19f5e5e
While we don't have full existential types yet, there is some duplica…
oli-obk Jun 20, 2018
a83733f
Flatten some occurrences of `[P<T>]` to `[T]`
oli-obk Jun 20, 2018
47732a4
Prevent lowering item ids from behaving differently than lowering items
oli-obk Jun 21, 2018
057cf0f
Update rustdoc
oli-obk Jun 21, 2018
1bf351d
We now have proper locations for the `existential type` items.
oli-obk Jun 22, 2018
356d683
Also place method impl trait into the surrounding module
oli-obk Jun 22, 2018
398a5f8
Ignore existential type items during collection for now
oli-obk Jun 22, 2018
9859a52
Don't try to do impl Trait lowering for `impl Trait for Type` items
oli-obk Jun 22, 2018
a152770
Generics Unification rebase fallout
oli-obk Jun 25, 2018
922249c
Update tests
oli-obk Jun 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update tests
oli-obk committed Jun 25, 2018
commit 922249c1faea7cb32662faac6be4ac8b3aac00b2
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0657.rs
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ fn free_fn_capture_hrtb_in_impl_trait()
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
{
() //~ ERROR mismatched types
()
}

struct Foo;
@@ -28,7 +28,7 @@ impl Foo {
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
{
() //~ ERROR mismatched types
()
}
}

23 changes: 2 additions & 21 deletions src/test/ui/error-codes/E0657.stderr
Original file line number Diff line number Diff line change
@@ -10,25 +10,6 @@ error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl le
LL | -> Box<for<'a> Id<impl Lt<'a>>>
| ^^

error[E0308]: mismatched types
--> $DIR/E0657.rs:22:5
|
LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found ()
|
= note: expected type `std::boxed::Box<Id<_> + 'static>`
found type `()`

error[E0308]: mismatched types
--> $DIR/E0657.rs:31:9
|
LL | () //~ ERROR mismatched types
| ^^ expected struct `std::boxed::Box`, found ()
|
= note: expected type `std::boxed::Box<Id<_> + 'static>`
found type `()`

error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

Some errors occurred: E0308, E0657.
For more information about an error, try `rustc --explain E0308`.
For more information about this error, try `rustc --explain E0657`.
5 changes: 2 additions & 3 deletions src/test/ui/impl_trait_projections.rs
Original file line number Diff line number Diff line change
@@ -34,9 +34,8 @@ fn projection_with_named_trait_is_disallowed(x: impl Iterator)
fn projection_with_named_trait_inside_path_is_disallowed()
-> <::std::ops::Range<impl Debug> as Iterator>::Item
//~^ ERROR `impl Trait` is not allowed in path parameters
//~| ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
{ //~ ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
(1i32..100).next().unwrap() //~ ERROR mismatched types
{
(1i32..100).next().unwrap()
}

fn projection_from_impl_trait_inside_dyn_trait_is_disallowed()
33 changes: 3 additions & 30 deletions src/test/ui/impl_trait_projections.stderr
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^

error[E0667]: `impl Trait` is not allowed in path parameters
--> $DIR/impl_trait_projections.rs:43:29
--> $DIR/impl_trait_projections.rs:42:29
|
LL | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
| ^^^^^^^^^^
@@ -30,34 +30,7 @@ LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item {
|
= note: specify the type using the syntax `<impl std::iter::Iterator as Trait>::Item`

error[E0277]: the trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
--> $DIR/impl_trait_projections.rs:38:1
|
LL | / { //~ ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
LL | | (1i32..100).next().unwrap() //~ ERROR mismatched types
LL | | }
| |_^ the trait `std::iter::Step` is not implemented for `impl std::fmt::Debug`
|
= note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range<impl std::fmt::Debug>`

error[E0308]: mismatched types
--> $DIR/impl_trait_projections.rs:39:5
|
LL | (1i32..100).next().unwrap() //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected anonymized type, found i32
|
= note: expected type `impl std::fmt::Debug`
found type `i32`

error[E0277]: the trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
--> $DIR/impl_trait_projections.rs:35:8
|
LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::iter::Step` is not implemented for `impl std::fmt::Debug`
|
= note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range<impl std::fmt::Debug>`

error: aborting due to 8 previous errors
error: aborting due to 5 previous errors

Some errors occurred: E0223, E0277, E0308, E0667.
Some errors occurred: E0223, E0667.
For more information about an error, try `rustc --explain E0223`.