about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-02-22 06:15:55 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-02-22 18:56:07 +0000
commit5e6da720f621308a0f44e7c6bbd13a9fad68b240 (patch)
treef5022996203d2cdd2a051cc91488523a9abd37f0 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
parent933a05bd0ba91caf219222e5f61d1c92d141ff61 (diff)
downloadrust-5e6da720f621308a0f44e7c6bbd13a9fad68b240.tar.gz
rust-5e6da720f621308a0f44e7c6bbd13a9fad68b240.zip
Account for RPITIT in E0310 explicit lifetime constraint suggestion
When given

```rust
trait Original {
    fn f() -> impl Fn();
}

trait Erased {
    fn f(&self) -> Box<dyn Fn()>;
}

impl<T: Original> Erased for T {
    fn f(&self) -> Box<dyn Fn()> {
        Box::new(<T as Original>::f())
    }
}
```

avoid suggestion to restrict the `Trait::{opaque}` type in a `where` clause:

```
error[E0310]: the associated type `<T as Original>::{opaque#0}` may not live long enough
  --> $DIR/missing-static-bound-from-impl.rs:11:9
   |
LL |         Box::new(<T as Original>::f())
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |         |
   |         the associated type `<T as Original>::{opaque#0}` must be valid for the static lifetime...
   |         ...so that the type `impl Fn()` will meet its required lifetime bounds
```

CC #119773.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions