about summary refs log tree commit diff
path: root/tests/ui/moves/use-correct-generic-args-in-borrow-suggest.rs
blob: 0fb0cee20131e0dd3e8b54d2462bd39340b94631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Regression test for #145164: For normal calls, make sure the suggestion to borrow generic inputs
//! uses the generic args from the callee's type rather than those attached to the callee's HIR
//! node. In cases where the callee isn't an identifier expression, its HIR node won't have its
//! generic arguments attached, which could lead to ICE when it had other generic args. In this
//! case, the callee expression is `run.clone()`, to which `clone`'s generic arguments are attached.

fn main() {
    let value = String::new();
    run.clone()(value, ());
    run(value, ());
    //~^ ERROR use of moved value: `value`
}
fn run<F, T: Clone>(value: T, f: F) {}