rustdoc-json: Add tests for #![feature(inherent_associated_types)]

This commit is contained in:
Alona Enraght-Moony 2023-05-13 13:07:23 +00:00
parent 69fef92ab2
commit c271c708e2
3 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// ignore-tidy-linelength
#![feature(inherent_associated_types)]
#![feature(no_core)]
#![allow(incomplete_features)]
#![no_core]
// @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
pub struct OwnerMetadata;
// @set Owner = '$.index[*][?(@.name=="Owner")].id'
pub struct Owner;
pub fn create() -> Owner::Metadata {
OwnerMetadata
}
// @is '$.index[*][?(@.name=="create")].inner.decl.output.kind' '"qualified_path"'
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.name' '"Metadata"'
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.trait' null
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.kind' '"resolved_path"'
// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.inner.id' $Owner
/// impl
impl Owner {
/// iat
pub type Metadata = OwnerMetadata;
}
// @set iat = '$.index[*][?(@.docs=="iat")].id'
// @is '$.index[*][?(@.docs=="impl")].inner.items[*]' $iat
// @is '$.index[*][?(@.docs=="iat")].kind' '"assoc_type"'
// @is '$.index[*][?(@.docs=="iat")].inner.default.inner.id' $OwnerMetadata

View File

@ -0,0 +1,21 @@
// ignore-tidy-linelength
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
// @set Carrier = '$.index[*][?(@.name=="Carrier")].id'
pub struct Carrier<'a>(&'a ());
// @is '$.index[*][?(@.name=="User")].inner.type.kind' '"function_pointer"'
// @is '$.index[*][?(@.name=="User")].inner.type.inner.generic_params[*].name' \""'b"\"
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].kind' '"qualified_path"'
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.id' $Carrier
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.args.angle_bracketed.args[0].lifetime' \""'b"\"
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.name' '"Focus"'
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.trait' null
// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.args.angle_bracketed.args[0].type.inner' '"i32"'
pub type User = for<'b> fn(Carrier<'b>::Focus<i32>);
impl<'a> Carrier<'a> {
pub type Focus<T> = &'a mut T;
}

View File

@ -0,0 +1,33 @@
// ignore-tidy-linelength
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
// @set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
pub struct Parametrized<T>(T);
// @is '$.index[*][?(@.name=="Test")].inner.type.kind' '"qualified_path"'
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.id' $Parametrized
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.args.angle_bracketed.args[0].type' '{"inner": "i32", "kind": "primitive"}'
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.name' '"Proj"'
// @is '$.index[*][?(@.name=="Test")].inner.type.inner.trait' null
pub type Test = Parametrized<i32>::Proj;
/// param_bool
impl Parametrized<bool> {
/// param_bool_proj
pub type Proj = ();
}
/// param_i32
impl Parametrized<i32> {
/// param_i32_proj
pub type Proj = String;
}
// @set param_bool = '$.index[*][?(@.docs=="param_bool")].id'
// @set param_i32 = '$.index[*][?(@.docs=="param_i32")].id'
// @set param_bool_proj = '$.index[*][?(@.docs=="param_bool_proj")].id'
// @set param_i32_proj = '$.index[*][?(@.docs=="param_i32_proj")].id'
// @is '$.index[*][?(@.docs=="param_bool")].inner.items[*]' $param_bool_proj
// @is '$.index[*][?(@.docs=="param_i32")].inner.items[*]' $param_i32_proj