diff options
Diffstat (limited to 'tests/ui/traits/bound/suggest-complex-bound-on-method.rs')
| -rw-r--r-- | tests/ui/traits/bound/suggest-complex-bound-on-method.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/traits/bound/suggest-complex-bound-on-method.rs b/tests/ui/traits/bound/suggest-complex-bound-on-method.rs new file mode 100644 index 00000000000..39cec571242 --- /dev/null +++ b/tests/ui/traits/bound/suggest-complex-bound-on-method.rs @@ -0,0 +1,23 @@ +//@ run-rustfix +#![allow(dead_code)] +struct Application; +// https://github.com/rust-lang/rust/issues/144734 +trait Trait { + type Error: std::error::Error; + + fn run(&self) -> Result<(), Self::Error>; +} + +#[derive(Debug)] +enum ApplicationError { + Quit, +} + +impl Application { + fn thing<T: Trait>(&self, t: T) -> Result<(), ApplicationError> { + t.run()?; //~ ERROR E0277 + Ok(()) + } +} + +fn main() {} |
