]> git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / borrowck / issue-82126-mismatched-subst-and-hir.rs
1 // Regression test for #82126. Checks that mismatched lifetimes and types are
2 // properly handled.
3
4 // edition:2018
5
6 use std::sync::Mutex;
7
8 struct MarketMultiplier {}
9
10 impl MarketMultiplier {
11 fn buy(&mut self) -> &mut usize {
12 todo!()
13 }
14 }
15
16 async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
17 //~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
18 //~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
19 LockedMarket(generator.lock().unwrap().buy())
20 //~^ ERROR cannot return value referencing temporary
21 }
22
23 struct LockedMarket<T>(T);
24
25 fn main() {}