bless suggestion on spell out

This commit is contained in:
csmoe 2020-05-16 17:10:08 +08:00
parent 633e4aafe6
commit 8841ede364
6 changed files with 13 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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" },

View File

@ -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`.

View File

@ -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

View File

@ -20,7 +20,7 @@ help: consider constraining the associated type `<T as impl_trait::Trait>::Assoc
LL | fn foo_fail<T: Trait<Assoc = ()>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^
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<Output=T::Assoc> {
@ -42,4 +42,5 @@ LL | fn foo2_fail<'a, T: Trait<'a, Assoc = ()>>() -> impl FooLike<Output=T::
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0271`.
Some errors have detailed explanations: E0271, E0755.
For more information about an error, try `rustc --explain E0271`.