Allow both explicit and elided lifetimes in the same impl header

(While still prohibiting explicit and in-band in the same header.)
This commit is contained in:
Scott McMurray 2018-09-22 01:45:42 -07:00
parent ed45f9cbf4
commit 003c4ffa83
5 changed files with 83 additions and 29 deletions

View file

@ -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() {
}