Any of the methods provided by a visible trait implemented by T. If T is a type parameter, methods provided by trait bounds on T are looked up first. Then all remaining methods in scope are looked up.
“In scope” isn't actually given a definition but I believe that's referring to the behavior you are asking about.
That's because it doesn't have to - see this playground:
mod processor {
pub struct Data(u64);
pub fn process<F: FnOnce(Data)>(f: F) {
f(Data(42))
}
impl Data {
pub fn inner(&self) -> u64 {
self.0
}
}
}
mod user {
pub fn use_data() {
// `Data` is not in scope here, since it's not `use`d
// But we can call `Data::inner` anyway, since the compiler knows,
// that the closure passed to `process` has its first argument of type `Data`
super::processor::process(|data| println!("{}", data.inner()));
}
}