2024-08-15 07:42:57 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
// Check that Self is represented uniformly between inherent impls, trait impls,
|
|
|
|
// and trait definitions, even though it uses both SelfTyParam and SelfTyAlias
|
|
|
|
// internally.
|
|
|
|
//
|
|
|
|
// Each assertion matches 3 times, and should be the same each time.
|
|
|
|
|
|
|
|
impl Foo {
|
2024-08-04 18:44:35 -05:00
|
|
|
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
|
2024-08-15 07:42:57 -05:00
|
|
|
pub fn by_ref(&self) {}
|
|
|
|
|
2024-08-04 18:44:35 -05:00
|
|
|
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
|
2024-08-15 07:42:57 -05:00
|
|
|
pub fn by_exclusive_ref(&mut self) {}
|
|
|
|
|
2024-08-04 18:44:35 -05:00
|
|
|
//@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
|
2024-08-15 07:42:57 -05:00
|
|
|
pub fn by_value(self) {}
|
|
|
|
|
2024-08-04 18:44:35 -05:00
|
|
|
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"'
|
|
|
|
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
|
|
|
|
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
|
2024-08-15 07:42:57 -05:00
|
|
|
pub fn with_lifetime<'a>(&'a self) {}
|
|
|
|
|
2024-08-04 18:44:35 -05:00
|
|
|
//@ ismany '$.index[*][?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
|
2024-08-15 07:42:57 -05:00
|
|
|
pub fn build() -> Self {
|
|
|
|
Self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Bar;
|
|
|
|
|
|
|
|
pub trait SelfParams {
|
|
|
|
fn by_ref(&self);
|
|
|
|
fn by_exclusive_ref(&mut self);
|
|
|
|
fn by_value(self);
|
|
|
|
fn with_lifetime<'a>(&'a self);
|
|
|
|
fn build() -> Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl SelfParams for Bar {
|
|
|
|
fn by_ref(&self) {}
|
|
|
|
fn by_exclusive_ref(&mut self) {}
|
|
|
|
fn by_value(self) {}
|
|
|
|
fn with_lifetime<'a>(&'a self) {}
|
|
|
|
fn build() -> Self {
|
|
|
|
Self
|
|
|
|
}
|
|
|
|
}
|