Auto merge of #14036 - Veykril:write-method-resolution, r=Veykril

Record method resolution for remaining operator expressions

This allows goto def and future substituted hover to work for the concrete impls.
This commit is contained in:
bors 2023-02-01 10:23:33 +00:00
commit bfe82cda48
13 changed files with 163 additions and 103 deletions

View file

@ -106,6 +106,11 @@ pub mod marker {
impl<T: ?Sized> Copy for &T {}
}
// endregion:copy
// region:fn
#[lang = "tuple_trait"]
pub trait Tuple {}
// endregion:fn
}
// region:default
@ -347,19 +352,26 @@ pub mod ops {
// region:fn
mod function {
use crate::marker::Tuple;
#[lang = "fn"]
#[fundamental]
pub trait Fn<Args>: FnMut<Args> {}
pub trait Fn<Args: Tuple>: FnMut<Args> {
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}
#[lang = "fn_mut"]
#[fundamental]
pub trait FnMut<Args>: FnOnce<Args> {}
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
}
#[lang = "fn_once"]
#[fundamental]
pub trait FnOnce<Args> {
pub trait FnOnce<Args: Tuple> {
#[lang = "fn_once_output"]
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
}
pub use self::function::{Fn, FnMut, FnOnce};