Rollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakis
Allow both explicit and elided lifetimes in the same impl header While still prohibiting explicit and in-band in the same header. Fixes #54456 As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better. Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs
This commit is contained in:
commit
ab338eadfa
5 changed files with 83 additions and 29 deletions
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
#![feature(impl_header_lifetime_elision)]
|
||||
|
||||
// This works for functions...
|
||||
fn foo<'a>(x: &str, y: &'a str) {}
|
||||
|
||||
// ...so this should work for impls
|
||||
impl<'a> Foo<&str> for &'a str {}
|
||||
trait Foo<T> {}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue