diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-09-22 01:45:42 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-09-22 01:45:42 -0700 |
| commit | 003c4ffa836acd6901fa0d4b00624fc012bd5bd3 (patch) | |
| tree | fd307bfc1aa73d87fd39a73ee2fc8476cca2ca8e /src/test | |
| parent | ed45f9cbf48d67ea4ca36d71b7c28c4768fb36de (diff) | |
| download | rust-003c4ffa836acd6901fa0d4b00624fc012bd5bd3.tar.gz rust-003c4ffa836acd6901fa0d4b00624fc012bd5bd3.zip | |
Allow both explicit and elided lifetimes in the same impl header
(While still prohibiting explicit and in-band in the same header.)
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs new file mode 100644 index 00000000000..56dd6691abb --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs @@ -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() { +} |
