1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // All lifetime parameters in struct constructors are currently considered early bound,
12 // i.e., `S::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::ctor`.
13 // This behavior is a bit weird, because if equivalent constructor were written manually
14 // it would get late bound lifetime parameters.
15 // Variant constructors behave in the same way, lifetime parameters are considered
16 // belonging to the enum and being early bound.
17 // https://github.com/rust-lang/rust/issues/30904
19 struct S<'a, 'b>(&'a u8, &'b u8);
28 //~^ ERROR wrong number of lifetime arguments: expected 2, found 1
29 S::<'static, 'static, 'static>(&0, &0);
30 //~^ ERROR wrong number of lifetime arguments: expected 2, found 3
33 //~^ ERROR wrong number of lifetime arguments: expected 2, found 1
34 E::V::<'static, 'static, 'static>(&0);
35 //~^ ERROR wrong number of lifetime arguments: expected 2, found 3