os-rust/tests/ui/moves/region-var-in-moved-ty-issue-133118.rs
dianne 546ba3d310 suggest_borrow_generic_arg: instantiate clauses properly
Fixes issue 133118.
This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more
useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut`
arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would
make it suggest a shared borrow for that argument.
2024-11-17 18:09:36 -08:00

25 lines
419 B
Rust

//! regression test for #133118
pub trait Alpha {
fn y(self) -> usize;
}
pub trait Beta {
type Gamma;
fn gamma(&self) -> Self::Gamma;
}
pub fn a<T: Alpha>(_x: T) -> usize {
todo!();
}
pub fn x<B>(beta: &B) -> usize
where
for<'a> &'a B: Beta,
for<'a> <&'a B as Beta>::Gamma: Alpha,
{
let g1 = beta.gamma();
a(g1) + a(g1) //~ ERROR use of moved value: `g1` [E0382]
}
pub fn main() {}