Skip to content

Commit 0bf8322

Browse files
---
yaml --- r: 234965 b: refs/heads/stable c: 0d74311 h: refs/heads/master i: 234963: 64eef49 v: v3
1 parent de25f9f commit 0bf8322

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
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 6c88a2833d6982b1632b623901e3c30245377550
32+
refs/heads/stable: 0d74311e2baa73d883aec065dd300d48d34a0158
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/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)