mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
inline_call: remove macro self->this test
To be added back later once we have a fix. See #16471 and https://github.com/rust-lang/rust-analyzer/pull/16497#issuecomment-1934243409.
This commit is contained in:
parent
57a454233c
commit
18be556b37
1 changed files with 0 additions and 86 deletions
|
@ -1792,92 +1792,6 @@ fn _hash2(self_: &u64, state: &mut u64) {
|
||||||
_write_u64(state, *inner_self_)
|
_write_u64(state, *inner_self_)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
"#,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn inline_call_with_reference_in_macro_generated_trait_impl() {
|
|
||||||
check_assist(
|
|
||||||
inline_call,
|
|
||||||
r#"
|
|
||||||
trait Hash2 {
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H);
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Hasher2 {
|
|
||||||
fn write2_u64(&mut self, x: u64);
|
|
||||||
}
|
|
||||||
impl Hasher2 for u64 {
|
|
||||||
fn write2_u64(&mut self, x: u64) {
|
|
||||||
*self += x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_write {
|
|
||||||
($(($ty:ident, $meth:ident),)*) => {$(
|
|
||||||
impl Hash2 for $ty {
|
|
||||||
#[inline]
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H) {
|
|
||||||
state.$meth(*self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)*}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_write! { (u64, write2_u64), }
|
|
||||||
|
|
||||||
pub struct MyStruct {
|
|
||||||
value: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hash2 for MyStruct {
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H) {
|
|
||||||
self.value.$0hash2(state)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
//
|
|
||||||
r#"
|
|
||||||
trait Hash2 {
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H);
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Hasher2 {
|
|
||||||
fn write2_u64(&mut self, x: u64);
|
|
||||||
}
|
|
||||||
impl Hasher2 for u64 {
|
|
||||||
fn write2_u64(&mut self, x: u64) {
|
|
||||||
*self += x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! impl_write {
|
|
||||||
($(($ty:ident, $meth:ident),)*) => {$(
|
|
||||||
impl Hash2 for $ty {
|
|
||||||
#[inline]
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H) {
|
|
||||||
state.$meth(*self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)*}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl_write! { (u64, write2_u64), }
|
|
||||||
|
|
||||||
pub struct MyStruct {
|
|
||||||
value: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hash2 for MyStruct {
|
|
||||||
fn hash2<H: Hasher2>(&self, state: &mut H) {
|
|
||||||
{
|
|
||||||
let this = &self.value;
|
|
||||||
let state: &mut H = state;
|
|
||||||
state.write2_u64(*this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue