]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #82370 - 0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank
authorDylan DPC <dylan.dpc@gmail.com>
Sat, 27 Feb 2021 01:34:22 +0000 (02:34 +0100)
committerGitHub <noreply@github.com>
Sat, 27 Feb 2021 01:34:22 +0000 (02:34 +0100)
commitf0c98b15cc82ac711432e038166fb2a8c5f32f10
tree24958c7630b16fb498596522e9b4003c4210a975
parentcabe97272d782294e0d642135f3d8b13579b2929
parent75d1e303af04758c26e1aee63f2f0afd53dfd6f8
Rollup merge of #82370 - 0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank

Improve anonymous lifetime note to indicate the target span

Improvement for  #81650
Cc #81995

Message after this improvement:
(Improve note in the middle)

```
error[E0311]: the parameter type `T` may not live long enough
  --> src/main.rs:25:11
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |              -- help: consider adding an explicit lifetime bound...: `T: 'a +`
25 |     scope.spawn(move |_| {
   |           ^^^^^
   |
note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40...
  --> src/main.rs:24:40
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |                                        ^^^^^
note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds
  --> src/main.rs:25:11
   |
25 |     scope.spawn(move |_| {
   |           ^^^^^
```

r? ``````@estebank``````
compiler/rustc_infer/src/infer/error_reporting/mod.rs