1
Fork 0

Change error code number

This commit is contained in:
Esteban Küber 2020-07-20 13:56:50 -07:00
parent 53d96b5159
commit 889a4d9a0b
8 changed files with 22 additions and 23 deletions

View file

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

View file

@ -48,7 +48,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let mut err = struct_span_err!( let mut err = struct_span_err!(
tcx.sess, tcx.sess,
cause.span, cause.span,
E0767, E0772,
"{} has {} but calling `{}` introduces an implicit `'static` lifetime \ "{} has {} but calling `{}` introduces an implicit `'static` lifetime \
requirement", requirement",
param param
@ -196,7 +196,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
} }
if let (Some(ident), true) = (override_error_code, fn_returns.is_empty()) { if let (Some(ident), true) = (override_error_code, fn_returns.is_empty()) {
// Provide a more targetted error code and description. // Provide a more targetted error code and description.
err.code(rustc_errors::error_code!(E0767)); err.code(rustc_errors::error_code!(E0772));
err.set_primary_message(&format!( err.set_primary_message(&format!(
"{} has {} but calling `{}` introduces an implicit `'static` lifetime \ "{} has {} but calling `{}` introduces an implicit `'static` lifetime \
requirement", requirement",

View file

@ -1,5 +1,5 @@
error[E0597]: `val` does not live long enough error[E0597]: `val` does not live long enough
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:22:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
| |
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> { LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
| -- lifetime `'a` defined here ------------------- opaque type requires that `val` is borrowed for `'a` | -- 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
| ^^^^ | ^^^^
error[E0515]: cannot return value referencing function parameter `val` error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:44:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
| |
LL | val.use_self() LL | val.use_self()
| ---^^^^^^^^^^^ | ---^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | val.use_self()
| `val` is borrowed here | `val` is borrowed here
error[E0515]: cannot return value referencing function parameter `val` error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:110:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
| |
LL | val.use_self() LL | val.use_self()
| ---^^^^^^^^^^^ | ---^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
// FIXME: the following cases need to suggest more things to make users reach a working end state. // FIXME: the following cases need to suggest more things to make users reach a working end state.
mod bav { mod bav {
@ -64,7 +63,7 @@ mod bay {
impl Bar for i32 {} impl Bar for i32 {}
fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () { fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }

View file

@ -1,5 +1,5 @@
error[E0597]: `val` does not live long enough error[E0597]: `val` does not live long enough
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:22:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
| |
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> { LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
| -- lifetime `'a` defined here ------------------- opaque type requires that `val` is borrowed for `'a` | -- 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
| ^^^^ | ^^^^
error[E0515]: cannot return value referencing function parameter `val` error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:44:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
| |
LL | val.use_self() LL | val.use_self()
| ---^^^^^^^^^^^ | ---^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | val.use_self()
| `val` is borrowed here | `val` is borrowed here
error[E0515]: cannot return value referencing function parameter `val` error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:110:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
| |
LL | val.use_self() LL | val.use_self()
| ---^^^^^^^^^^^ | ---^^^^^^^^^^^
@ -31,8 +31,8 @@ LL | val.use_self()
| returns a value referencing data owned by the current function | returns a value referencing data owned by the current function
| `val` is borrowed here | `val` is borrowed here
error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:67:13 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:66:13
| |
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () { LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
| -------------------------------------- this data with lifetime `'a`... | -------------------------------------- this data with lifetime `'a`...
@ -40,7 +40,7 @@ LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is captured and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:61:30 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30
| |
LL | impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> { LL | impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement | ^^^^^^^^^^^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement

View file

@ -34,7 +34,7 @@ mod bar {
impl Irrelevant for dyn ObjectTrait {} impl Irrelevant for dyn ObjectTrait {}
fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }
@ -51,7 +51,7 @@ mod baz {
impl Irrelevant for Box<dyn ObjectTrait> {} impl Irrelevant for Box<dyn ObjectTrait> {}
fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () { fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }
@ -66,7 +66,7 @@ mod bat {
} }
fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }

View file

@ -34,7 +34,7 @@ mod bar {
impl Irrelevant for dyn ObjectTrait {} impl Irrelevant for dyn ObjectTrait {}
fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }
@ -51,7 +51,7 @@ mod baz {
impl Irrelevant for Box<dyn ObjectTrait> {} impl Irrelevant for Box<dyn ObjectTrait> {}
fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () { fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }
@ -66,7 +66,7 @@ mod bat {
} }
fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
val.use_self() //~ ERROR E0767 val.use_self() //~ ERROR E0772
} }
} }

View file

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