diff options
Diffstat (limited to 'tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs')
-rw-r--r-- | tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs new file mode 100644 index 000000000..dd0320bc5 --- /dev/null +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs @@ -0,0 +1,24 @@ +// Regression test for #82126. Checks that mismatched lifetimes and types are +// properly handled. + +// edition:2018 + +use std::sync::Mutex; + +struct MarketMultiplier {} + +impl MarketMultiplier { + fn buy(&mut self) -> &mut usize { + todo!() + } +} + +async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> { + //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied + //~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied + LockedMarket(generator.lock().unwrap().buy()) +} + +struct LockedMarket<T>(T); + +fn main() {} |