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
Next Next commit
Deduplicate code in lower_lifetime
oli-obk committed Jun 22, 2018
commit 0dcb45e9e9ace948f07c449592a5a007fb19fd8b
15 changes: 7 additions & 8 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
@@ -1889,24 +1889,23 @@ impl<'a> LoweringContext<'a> {

fn lower_lifetime(&mut self, l: &Lifetime) -> hir::Lifetime {
let span = l.ident.span;
match self.lower_ident(l.ident) {
x if x == "'static" => self.new_named_lifetime(l.id, span, hir::LifetimeName::Static),
let name = match self.lower_ident(l.ident) {
x if x == "'static" => hir::LifetimeName::Static,
x if x == "'_" => match self.anonymous_lifetime_mode {
AnonymousLifetimeMode::CreateParameter => {
let fresh_name = self.collect_fresh_in_band_lifetime(span);
self.new_named_lifetime(l.id, span, hir::LifetimeName::Param(fresh_name))
hir::LifetimeName::Param(fresh_name)
}

AnonymousLifetimeMode::PassThrough => {
self.new_named_lifetime(l.id, span, hir::LifetimeName::Underscore)
}
AnonymousLifetimeMode::PassThrough => hir::LifetimeName::Underscore,
},
name => {
self.maybe_collect_in_band_lifetime(span, name);
let param_name = ParamName::Plain(name);
self.new_named_lifetime(l.id, span, hir::LifetimeName::Param(param_name))
hir::LifetimeName::Param(param_name)
}
}
};
self.new_named_lifetime(l.id, span, name)
}

fn new_named_lifetime(