about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-31 01:06:33 +0000
committerbors <bors@rust-lang.org>2018-05-31 01:06:33 +0000
commitc1287c018328fb5eaf5c74494ae57241715758f0 (patch)
treef819caa73016e9192c29d28c8364931b49dd4d03 /src/rustllvm/RustWrapper.cpp
parente1eed38fed677017cc504f4f01a7f2b2b52b6718 (diff)
parentda69bbce68b8c477701a07ed8fcf0c9d29e74c42 (diff)
downloadrust-c1287c018328fb5eaf5c74494ae57241715758f0.tar.gz
rust-c1287c018328fb5eaf5c74494ae57241715758f0.zip
Auto merge of #51220 - nikomatsakis:issue-51008-false-positive-lifetime-must-be-declared, r=cramertj
reset anonymous-lifetime-mode as we enter `()` scopes

Background:

The anonymous lifetime mode is used to prohibit elided lifetimes where
they didn't used to be permitted, and instead require that `'_` be
used. For example:

```rust
impl Trait for Ref<T> { .. }
//             ^^^^^^ ERROR: should be `Ref<'_, T>`
```

When we are parsing the parts of the impl header, we enter into an alternate mode called `CreateParameter`. In this mode, we give an error for things like `Ref<T>`, but for elided lifetimes in a reference type like `&T` we make the elided lifetime into an in-band lifetime:

https://github.com/rust-lang/rust/blob/4f99f37b7e213d69a489884f651adfc6d217cef5/src/librustc/hir/lowering.rs#L4017-L4035

This was not intended to change behavior because we only enter into that mode in contexts where elision was not historically permitted. However, the problem is that we fail to reset the mode when we enter into bounds like `Fn(&u32)`, where elision *was* allowed -- the same occurs for fn types like `fn(&u32`). This PR restores the original mode in those contexts.

Fixes #51008

r? @cramertj
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions