From 8841ede3648b5f12284dae850ec065374fd3af46 Mon Sep 17 00:00:00 2001 From: csmoe Date: Sat, 16 May 2020 17:10:08 +0800 Subject: [PATCH] bless suggestion on spell out --- src/librustc_error_codes/error_codes.rs | 2 +- .../error_codes/{E0754.md => E0755.md} | 7 +++++-- src/librustc_typeck/check/mod.rs | 2 +- .../ui/async-await/issue-61949-self-return-type.stderr | 5 +++-- src/test/ui/async-await/issue-69276.stderr | 8 -------- src/test/ui/impl-trait/bound-normalization-fail.stderr | 5 +++-- 6 files changed, 13 insertions(+), 16 deletions(-) rename src/librustc_error_codes/error_codes/{E0754.md => E0755.md} (70%) delete mode 100644 src/test/ui/async-await/issue-69276.stderr diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 52d40fd0f2fa..6467561e509f 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -435,7 +435,7 @@ E0750: include_str!("./error_codes/E0750.md"), E0751: include_str!("./error_codes/E0751.md"), E0752: include_str!("./error_codes/E0752.md"), E0753: include_str!("./error_codes/E0753.md"), -E0754: include_str!("./error_codes/E0754.md"), +E0755: include_str!("./error_codes/E0755.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard diff --git a/src/librustc_error_codes/error_codes/E0754.md b/src/librustc_error_codes/error_codes/E0755.md similarity index 70% rename from src/librustc_error_codes/error_codes/E0754.md rename to src/librustc_error_codes/error_codes/E0755.md index e7cea9820100..b6eb2e34ccfc 100644 --- a/src/librustc_error_codes/error_codes/E0754.md +++ b/src/librustc_error_codes/error_codes/E0755.md @@ -1,4 +1,5 @@ -`async fn`/`impl trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope. +`async fn`/`impl trait` return type cannot contain a projection +or `Self` that references lifetimes from a parent scope. Erroneous code example: @@ -24,6 +25,8 @@ impl<'a> S<'a> { } ``` -This will be allowed at some point in the future, but the implementation is not yet complete. See the [issue-61949] for this limitation. +This will be allowed at some point in the future, +but the implementation is not yet complete. +See the [issue-61949] for this limitation. [issue-61949]: https://github.com/rust-lang/rust/issues/61949 diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 0906c25baef0..bd8f628957dc 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1701,7 +1701,7 @@ fn check_opaque_for_inheriting_lifetimes(tcx: TyCtxt<'tcx>, def_id: LocalDefId, let mut err = struct_span_err!( tcx.sess, span, - E0754, + E0755, "`{}` return type cannot contain a projection or `Self` that references lifetimes from \ a parent scope", if is_async { "async fn" } else { "impl Trait" }, diff --git a/src/test/ui/async-await/issue-61949-self-return-type.stderr b/src/test/ui/async-await/issue-61949-self-return-type.stderr index 12fb77d8dd63..fe05754c83ff 100644 --- a/src/test/ui/async-await/issue-61949-self-return-type.stderr +++ b/src/test/ui/async-await/issue-61949-self-return-type.stderr @@ -1,8 +1,9 @@ -error: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope +error[E0755]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope --> $DIR/issue-61949-self-return-type.rs:11:40 | LL | pub async fn new(_bar: &'a i32) -> Self { - | ^^^^ + | ^^^^ help: consider spelling out the type instead: `Foo<'a>` error: aborting due to previous error +For more information about this error, try `rustc --explain E0754`. diff --git a/src/test/ui/async-await/issue-69276.stderr b/src/test/ui/async-await/issue-69276.stderr deleted file mode 100644 index 1ebfdfa8b54c..000000000000 --- a/src/test/ui/async-await/issue-69276.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/issue-69276.rs:6:33 - | -LL | async fn new(i: &'a i32) -> Self { - | ^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr index f5092044627f..04b398f5b528 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.stderr +++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr @@ -20,7 +20,7 @@ help: consider constraining the associated type `::Assoc LL | fn foo_fail>() -> impl FooLike { | ^^^^^^^^^^^^ -error: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope +error[E0755]: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope --> $DIR/bound-normalization-fail.rs:43:41 | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike { @@ -42,4 +42,5 @@ LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike