Skip to content

Commit 6c70909

Browse files
---
yaml --- r: 227894 b: refs/heads/try c: 0d74311 h: refs/heads/master v: v3
1 parent e90585b commit 6c70909

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 6c88a2833d6982b1632b623901e3c30245377550
4+
refs/heads/try: 0d74311e2baa73d883aec065dd300d48d34a0158
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,51 @@ The number of supplied parameters much exactly match the number of defined type
934934
parameters.
935935
"##,
936936

937+
E0088: r##"
938+
You gave too many lifetime parameters. Erroneous code example:
939+
940+
```
941+
fn f() {}
942+
943+
fn main() {
944+
f::<'static>() // error: too many lifetime parameters provided
945+
}
946+
```
947+
948+
Please check you give the right number of lifetime parameters. Example:
949+
950+
```
951+
fn f() {}
952+
953+
fn main() {
954+
f() // ok!
955+
}
956+
```
957+
958+
It's also important to note that the Rust compiler can generally
959+
determine the lifetime by itself. Example:
960+
961+
```
962+
struct Foo {
963+
value: String
964+
}
965+
966+
impl Foo {
967+
// it can be written like this
968+
fn get_value<'a>(&'a self) -> &'a str { &self.value }
969+
// but the compiler works fine with this too:
970+
fn without_lifetime(&self) -> &str { &self.value }
971+
}
972+
973+
fn main() {
974+
let f = Foo { value: "hello".to_owned() };
975+
976+
println!("{}", f.get_value());
977+
println!("{}", f.without_lifetime());
978+
}
979+
```
980+
"##,
981+
937982
E0089: r##"
938983
Not enough type parameters were supplied for a function. For example:
939984
@@ -960,13 +1005,14 @@ fn main() {
9601005
"##,
9611006

9621007
E0091: r##"
963-
You gave an unnecessary type parameter. Erroneous code example:
1008+
You gave an unnecessary type parameter in a type alias. Erroneous code
1009+
example:
9641010
9651011
```
9661012
type Foo<T> = u32; // error: type parameter `T` is unused
9671013
```
9681014
969-
Please check you didn't write to many type parameter. Example:
1015+
Please check you didn't write too many type parameters. Example:
9701016
9711017
```
9721018
type Foo = u32; // ok!
@@ -1599,7 +1645,6 @@ register_diagnostics! {
15991645
E0077,
16001646
E0085,
16011647
E0086,
1602-
E0088,
16031648
E0090,
16041649
E0092,
16051650
E0093,

0 commit comments

Comments
 (0)