Skip to content

Commit 889a4d9

Browse files
committed
Change error code number
1 parent 53d96b5 commit 889a4d9

8 files changed

+22
-23
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,5 +633,5 @@ E0771: include_str!("./error_codes/E0771.md"),
633633
E0755, // `#[ffi_pure]` is only allowed on foreign functions
634634
E0756, // `#[ffi_const]` is only allowed on foreign functions
635635
E0757, // `#[ffi_const]` functions cannot be `#[ffi_pure]`
636-
E0767, // `'static' obligation coming from `impl dyn Trait {}` or `impl Foo for dyn Bar {}`.
636+
E0772, // `'static' obligation coming from `impl dyn Trait {}` or `impl Foo for dyn Bar {}`.
637637
}

src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
4848
let mut err = struct_span_err!(
4949
tcx.sess,
5050
cause.span,
51-
E0767,
51+
E0772,
5252
"{} has {} but calling `{}` introduces an implicit `'static` lifetime \
5353
requirement",
5454
param
@@ -196,7 +196,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
196196
}
197197
if let (Some(ident), true) = (override_error_code, fn_returns.is_empty()) {
198198
// Provide a more targetted error code and description.
199-
err.code(rustc_errors::error_code!(E0767));
199+
err.code(rustc_errors::error_code!(E0772));
200200
err.set_primary_message(&format!(
201201
"{} has {} but calling `{}` introduces an implicit `'static` lifetime \
202202
requirement",

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `val` does not live long enough
2-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:22:9
2+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
33
|
44
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
55
| -- lifetime `'a` defined here ------------------- opaque type requires that `val` is borrowed for `'a`
@@ -14,7 +14,7 @@ LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrai
1414
| ^^^^
1515

1616
error[E0515]: cannot return value referencing function parameter `val`
17-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:44:9
17+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
1818
|
1919
LL | val.use_self()
2020
| ---^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | val.use_self()
2323
| `val` is borrowed here
2424

2525
error[E0515]: cannot return value referencing function parameter `val`
26-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:110:9
26+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
2727
|
2828
LL | val.use_self()
2929
| ---^^^^^^^^^^^

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// FIXME: the following cases need to suggest more things to make users reach a working end state.
32

43
mod bav {
@@ -64,7 +63,7 @@ mod bay {
6463
impl Bar for i32 {}
6564

6665
fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
67-
val.use_self() //~ ERROR E0767
66+
val.use_self() //~ ERROR E0772
6867
}
6968
}
7069

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0597]: `val` does not live long enough
2-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:22:9
2+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
33
|
44
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
55
| -- lifetime `'a` defined here ------------------- opaque type requires that `val` is borrowed for `'a`
@@ -14,7 +14,7 @@ LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrai
1414
| ^^^^
1515

1616
error[E0515]: cannot return value referencing function parameter `val`
17-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:44:9
17+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
1818
|
1919
LL | val.use_self()
2020
| ---^^^^^^^^^^^
@@ -23,24 +23,24 @@ LL | val.use_self()
2323
| `val` is borrowed here
2424

2525
error[E0515]: cannot return value referencing function parameter `val`
26-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:110:9
26+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
2727
|
2828
LL | val.use_self()
2929
| ---^^^^^^^^^^^
3030
| |
3131
| returns a value referencing data owned by the current function
3232
| `val` is borrowed here
3333

34-
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
35-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:67:13
34+
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
35+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:66:13
3636
|
3737
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
3838
| -------------------------------------- this data with lifetime `'a`...
3939
LL | val.use_self()
4040
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
4141
|
4242
note: the used `impl` has a `'static` requirement
43-
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:61:30
43+
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30
4444
|
4545
LL | impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
4646
| ^^^^^^^^^^^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.fixed

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mod bar {
3434
impl Irrelevant for dyn ObjectTrait {}
3535

3636
fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
37-
val.use_self() //~ ERROR E0767
37+
val.use_self() //~ ERROR E0772
3838
}
3939
}
4040

@@ -51,7 +51,7 @@ mod baz {
5151
impl Irrelevant for Box<dyn ObjectTrait> {}
5252

5353
fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
54-
val.use_self() //~ ERROR E0767
54+
val.use_self() //~ ERROR E0772
5555
}
5656
}
5757

@@ -66,7 +66,7 @@ mod bat {
6666
}
6767

6868
fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
69-
val.use_self() //~ ERROR E0767
69+
val.use_self() //~ ERROR E0772
7070
}
7171
}
7272

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mod bar {
3434
impl Irrelevant for dyn ObjectTrait {}
3535

3636
fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
37-
val.use_self() //~ ERROR E0767
37+
val.use_self() //~ ERROR E0772
3838
}
3939
}
4040

@@ -51,7 +51,7 @@ mod baz {
5151
impl Irrelevant for Box<dyn ObjectTrait> {}
5252

5353
fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
54-
val.use_self() //~ ERROR E0767
54+
val.use_self() //~ ERROR E0772
5555
}
5656
}
5757

@@ -66,7 +66,7 @@ mod bat {
6666
}
6767

6868
fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
69-
val.use_self() //~ ERROR E0767
69+
val.use_self() //~ ERROR E0772
7070
}
7171
}
7272

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ help: consider relaxing the implicit `'static` requirement
1818
LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ {
1919
| ^^^^
2020

21-
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
21+
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
2222
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:13
2323
|
2424
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
@@ -89,7 +89,7 @@ help: consider relaxing the implicit `'static` requirement
8989
LL | impl MyTrait for dyn ObjectTrait + '_ {}
9090
| ^^^^
9191

92-
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
92+
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
9393
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:37:13
9494
|
9595
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
@@ -109,7 +109,7 @@ help: consider relaxing the implicit `'static` requirement
109109
LL | impl MyTrait for dyn ObjectTrait + '_ {
110110
| ^^^^
111111

112-
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
112+
error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
113113
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:54:13
114114
|
115115
LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {

0 commit comments

Comments
 (0)