2022-11-26 01:40:08 +00:00
|
|
|
// Regression test for <https://github.com/rust-lang/rust/issues/104923>
|
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
|
|
|
#![feature(trait_alias)]
|
|
|
|
|
2024-07-19 14:50:47 +00:00
|
|
|
//@ set Orig = "$.index[*][?(@.name == 'Orig')].id"
|
|
|
|
//@ has "$.index[*][?(@.name == 'Orig')].inner.trait"
|
2022-11-26 01:40:08 +00:00
|
|
|
pub trait Orig<T> {}
|
|
|
|
|
2024-07-19 14:50:47 +00:00
|
|
|
//@ set Alias = "$.index[*][?(@.name == 'Alias')].id"
|
|
|
|
//@ has "$.index[*][?(@.name == 'Alias')].inner.trait_alias"
|
|
|
|
//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.generics" '{"params": [], "where_predicates": []}'
|
|
|
|
//@ count "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[*]" 1
|
|
|
|
//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.id" $Orig
|
|
|
|
//@ is "$.index[*][?(@.name == 'Alias')].inner.trait_alias.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.primitive" '"i32"'
|
2022-11-26 01:40:08 +00:00
|
|
|
pub trait Alias = Orig<i32>;
|
|
|
|
|
|
|
|
pub struct Struct;
|
|
|
|
|
|
|
|
impl Orig<i32> for Struct {}
|
|
|
|
|
2024-08-04 23:44:35 +00:00
|
|
|
//@ has "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
|
|
|
|
//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
|
2024-07-19 14:50:47 +00:00
|
|
|
//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
|
2022-11-26 01:40:08 +00:00
|
|
|
pub fn takes_alias(_: impl Alias) {}
|
|
|
|
// FIXME: Should the trait be mentioned in both the decl and generics?
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
takes_alias(Struct);
|
|
|
|
}
|