1
Fork 0

rustdoc: normalise type/field names in rustdoc-json-types/jsondoclint

This commit is contained in:
schvv31n 2024-08-05 00:44:35 +01:00
parent d571ae851d
commit f2696ab4d3
74 changed files with 382 additions and 375 deletions

View file

@ -156,7 +156,7 @@ impl FromWithTcx<clean::GenericArgs> for GenericArgs {
match args { match args {
AngleBracketed { args, constraints } => GenericArgs::AngleBracketed { AngleBracketed { args, constraints } => GenericArgs::AngleBracketed {
args: args.into_vec().into_tcx(tcx), args: args.into_vec().into_tcx(tcx),
bindings: constraints.into_tcx(tcx), constraints: constraints.into_tcx(tcx),
}, },
Parenthesized { inputs, output } => GenericArgs::Parenthesized { Parenthesized { inputs, output } => GenericArgs::Parenthesized {
inputs: inputs.into_vec().into_tcx(tcx), inputs: inputs.into_vec().into_tcx(tcx),
@ -198,9 +198,9 @@ impl FromWithTcx<clean::ConstantKind> for Constant {
} }
} }
impl FromWithTcx<clean::AssocItemConstraint> for TypeBinding { impl FromWithTcx<clean::AssocItemConstraint> for AssocItemConstraint {
fn from_tcx(constraint: clean::AssocItemConstraint, tcx: TyCtxt<'_>) -> Self { fn from_tcx(constraint: clean::AssocItemConstraint, tcx: TyCtxt<'_>) -> Self {
TypeBinding { AssocItemConstraint {
name: constraint.assoc.name.to_string(), name: constraint.assoc.name.to_string(),
args: constraint.assoc.args.into_tcx(tcx), args: constraint.assoc.args.into_tcx(tcx),
binding: constraint.kind.into_tcx(tcx), binding: constraint.kind.into_tcx(tcx),
@ -208,12 +208,12 @@ impl FromWithTcx<clean::AssocItemConstraint> for TypeBinding {
} }
} }
impl FromWithTcx<clean::AssocItemConstraintKind> for TypeBindingKind { impl FromWithTcx<clean::AssocItemConstraintKind> for AssocItemConstraintKind {
fn from_tcx(kind: clean::AssocItemConstraintKind, tcx: TyCtxt<'_>) -> Self { fn from_tcx(kind: clean::AssocItemConstraintKind, tcx: TyCtxt<'_>) -> Self {
use clean::AssocItemConstraintKind::*; use clean::AssocItemConstraintKind::*;
match kind { match kind {
Equality { term } => TypeBindingKind::Equality(term.into_tcx(tcx)), Equality { term } => AssocItemConstraintKind::Equality(term.into_tcx(tcx)),
Bound { bounds } => TypeBindingKind::Constraint(bounds.into_tcx(tcx)), Bound { bounds } => AssocItemConstraintKind::Constraint(bounds.into_tcx(tcx)),
} }
} }
} }
@ -314,7 +314,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
ModuleItem(m) => { ModuleItem(m) => {
ItemEnum::Module(Module { is_crate, items: ids(m.items, tcx), is_stripped: false }) ItemEnum::Module(Module { is_crate, items: ids(m.items, tcx), is_stripped: false })
} }
ImportItem(i) => ItemEnum::Import(i.into_tcx(tcx)), ImportItem(i) => ItemEnum::Use(i.into_tcx(tcx)),
StructItem(s) => ItemEnum::Struct(s.into_tcx(tcx)), StructItem(s) => ItemEnum::Struct(s.into_tcx(tcx)),
UnionItem(u) => ItemEnum::Union(u.into_tcx(tcx)), UnionItem(u) => ItemEnum::Union(u.into_tcx(tcx)),
StructFieldItem(f) => ItemEnum::StructField(f.into_tcx(tcx)), StructFieldItem(f) => ItemEnum::StructField(f.into_tcx(tcx)),
@ -331,7 +331,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
ImplItem(i) => ItemEnum::Impl((*i).into_tcx(tcx)), ImplItem(i) => ItemEnum::Impl((*i).into_tcx(tcx)),
StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)), StaticItem(s) => ItemEnum::Static(s.into_tcx(tcx)),
ForeignStaticItem(s, _) => ItemEnum::Static(s.into_tcx(tcx)), ForeignStaticItem(s, _) => ItemEnum::Static(s.into_tcx(tcx)),
ForeignTypeItem => ItemEnum::ForeignType, ForeignTypeItem => ItemEnum::ExternType,
TypeAliasItem(t) => ItemEnum::TypeAlias(t.into_tcx(tcx)), TypeAliasItem(t) => ItemEnum::TypeAlias(t.into_tcx(tcx)),
// FIXME(generic_const_items): Add support for generic free consts // FIXME(generic_const_items): Add support for generic free consts
ConstantItem(ci) => { ConstantItem(ci) => {
@ -347,21 +347,19 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
} }
// FIXME(generic_const_items): Add support for generic associated consts. // FIXME(generic_const_items): Add support for generic associated consts.
TyAssocConstItem(_generics, ty) => { TyAssocConstItem(_generics, ty) => {
ItemEnum::AssocConst { type_: (*ty).into_tcx(tcx), default: None } ItemEnum::AssocConst { type_: (*ty).into_tcx(tcx), value: None }
} }
// FIXME(generic_const_items): Add support for generic associated consts. // FIXME(generic_const_items): Add support for generic associated consts.
AssocConstItem(ci) => { AssocConstItem(ci) => {
ItemEnum::AssocConst { type_: ci.type_.into_tcx(tcx), default: Some(ci.kind.expr(tcx)) } ItemEnum::AssocConst { type_: ci.type_.into_tcx(tcx), value: Some(ci.kind.expr(tcx)) }
}
TyAssocTypeItem(g, b) => {
ItemEnum::AssocType { generics: g.into_tcx(tcx), bounds: b.into_tcx(tcx), type_: None }
} }
TyAssocTypeItem(g, b) => ItemEnum::AssocType {
generics: g.into_tcx(tcx),
bounds: b.into_tcx(tcx),
default: None,
},
AssocTypeItem(t, b) => ItemEnum::AssocType { AssocTypeItem(t, b) => ItemEnum::AssocType {
generics: t.generics.into_tcx(tcx), generics: t.generics.into_tcx(tcx),
bounds: b.into_tcx(tcx), bounds: b.into_tcx(tcx),
default: Some(t.item_type.unwrap_or(t.type_).into_tcx(tcx)), type_: Some(t.item_type.unwrap_or(t.type_).into_tcx(tcx)),
}, },
// `convert_item` early returns `None` for stripped items and keywords. // `convert_item` early returns `None` for stripped items and keywords.
KeywordItem => unreachable!(), KeywordItem => unreachable!(),
@ -385,7 +383,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
impl FromWithTcx<clean::Struct> for Struct { impl FromWithTcx<clean::Struct> for Struct {
fn from_tcx(struct_: clean::Struct, tcx: TyCtxt<'_>) -> Self { fn from_tcx(struct_: clean::Struct, tcx: TyCtxt<'_>) -> Self {
let fields_stripped = struct_.has_stripped_entries(); let has_stripped_fields = struct_.has_stripped_entries();
let clean::Struct { ctor_kind, generics, fields } = struct_; let clean::Struct { ctor_kind, generics, fields } = struct_;
let kind = match ctor_kind { let kind = match ctor_kind {
@ -394,7 +392,7 @@ impl FromWithTcx<clean::Struct> for Struct {
assert!(fields.is_empty()); assert!(fields.is_empty());
StructKind::Unit StructKind::Unit
} }
None => StructKind::Plain { fields: ids(fields, tcx), fields_stripped }, None => StructKind::Plain { fields: ids(fields, tcx), has_stripped_fields },
}; };
Struct { Struct {
@ -407,22 +405,22 @@ impl FromWithTcx<clean::Struct> for Struct {
impl FromWithTcx<clean::Union> for Union { impl FromWithTcx<clean::Union> for Union {
fn from_tcx(union_: clean::Union, tcx: TyCtxt<'_>) -> Self { fn from_tcx(union_: clean::Union, tcx: TyCtxt<'_>) -> Self {
let fields_stripped = union_.has_stripped_entries(); let has_stripped_fields = union_.has_stripped_entries();
let clean::Union { generics, fields } = union_; let clean::Union { generics, fields } = union_;
Union { Union {
generics: generics.into_tcx(tcx), generics: generics.into_tcx(tcx),
fields_stripped, has_stripped_fields,
fields: ids(fields, tcx), fields: ids(fields, tcx),
impls: Vec::new(), // Added in JsonRenderer::item impls: Vec::new(), // Added in JsonRenderer::item
} }
} }
} }
pub(crate) fn from_fn_header(header: &rustc_hir::FnHeader) -> Header { pub(crate) fn from_fn_header(header: &rustc_hir::FnHeader) -> FunctionHeader {
Header { FunctionHeader {
async_: header.is_async(), is_async: header.is_async(),
const_: header.is_const(), is_const: header.is_const(),
unsafe_: header.is_unsafe(), is_unsafe: header.is_unsafe(),
abi: convert_abi(header.abi), abi: convert_abi(header.abi),
} }
} }
@ -474,7 +472,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
Type { bounds, default, synthetic } => GenericParamDefKind::Type { Type { bounds, default, synthetic } => GenericParamDefKind::Type {
bounds: bounds.into_tcx(tcx), bounds: bounds.into_tcx(tcx),
default: default.map(|x| (*x).into_tcx(tcx)), default: default.map(|x| (*x).into_tcx(tcx)),
synthetic, is_synthetic: synthetic,
}, },
Const { ty, default, synthetic: _ } => GenericParamDefKind::Const { Const { ty, default, synthetic: _ } => GenericParamDefKind::Const {
type_: (*ty).into_tcx(tcx), type_: (*ty).into_tcx(tcx),
@ -508,7 +506,7 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
.map(|bound| bound.into_tcx(tcx)) .map(|bound| bound.into_tcx(tcx))
.collect(), .collect(),
default: default.map(|ty| (*ty).into_tcx(tcx)), default: default.map(|ty| (*ty).into_tcx(tcx)),
synthetic, is_synthetic: synthetic,
} }
} }
clean::GenericParamDefKind::Const { ty, default, synthetic: _ } => { clean::GenericParamDefKind::Const { ty, default, synthetic: _ } => {
@ -602,12 +600,12 @@ impl FromWithTcx<clean::Type> for Type {
ImplTrait(g) => Type::ImplTrait(g.into_tcx(tcx)), ImplTrait(g) => Type::ImplTrait(g.into_tcx(tcx)),
Infer => Type::Infer, Infer => Type::Infer,
RawPointer(mutability, type_) => Type::RawPointer { RawPointer(mutability, type_) => Type::RawPointer {
mutable: mutability == ast::Mutability::Mut, is_mutable: mutability == ast::Mutability::Mut,
type_: Box::new((*type_).into_tcx(tcx)), type_: Box::new((*type_).into_tcx(tcx)),
}, },
BorrowedRef { lifetime, mutability, type_ } => Type::BorrowedRef { BorrowedRef { lifetime, mutability, type_ } => Type::BorrowedRef {
lifetime: lifetime.map(convert_lifetime), lifetime: lifetime.map(convert_lifetime),
mutable: mutability == ast::Mutability::Mut, is_mutable: mutability == ast::Mutability::Mut,
type_: Box::new((*type_).into_tcx(tcx)), type_: Box::new((*type_).into_tcx(tcx)),
}, },
QPath(box clean::QPathData { assoc, self_type, trait_, .. }) => Type::QualifiedPath { QPath(box clean::QPathData { assoc, self_type, trait_, .. }) => Type::QualifiedPath {
@ -643,29 +641,29 @@ impl FromWithTcx<clean::BareFunctionDecl> for FunctionPointer {
fn from_tcx(bare_decl: clean::BareFunctionDecl, tcx: TyCtxt<'_>) -> Self { fn from_tcx(bare_decl: clean::BareFunctionDecl, tcx: TyCtxt<'_>) -> Self {
let clean::BareFunctionDecl { safety, generic_params, decl, abi } = bare_decl; let clean::BareFunctionDecl { safety, generic_params, decl, abi } = bare_decl;
FunctionPointer { FunctionPointer {
header: Header { header: FunctionHeader {
unsafe_: matches!(safety, rustc_hir::Safety::Unsafe), is_unsafe: matches!(safety, rustc_hir::Safety::Unsafe),
const_: false, is_const: false,
async_: false, is_async: false,
abi: convert_abi(abi), abi: convert_abi(abi),
}, },
generic_params: generic_params.into_tcx(tcx), generic_params: generic_params.into_tcx(tcx),
decl: decl.into_tcx(tcx), sig: decl.into_tcx(tcx),
} }
} }
} }
impl FromWithTcx<clean::FnDecl> for FnDecl { impl FromWithTcx<clean::FnDecl> for FunctionSignature {
fn from_tcx(decl: clean::FnDecl, tcx: TyCtxt<'_>) -> Self { fn from_tcx(decl: clean::FnDecl, tcx: TyCtxt<'_>) -> Self {
let clean::FnDecl { inputs, output, c_variadic } = decl; let clean::FnDecl { inputs, output, c_variadic } = decl;
FnDecl { FunctionSignature {
inputs: inputs inputs: inputs
.values .values
.into_iter() .into_iter()
.map(|arg| (arg.name.to_string(), arg.type_.into_tcx(tcx))) .map(|arg| (arg.name.to_string(), arg.type_.into_tcx(tcx)))
.collect(), .collect(),
output: if output.is_unit() { None } else { Some(output.into_tcx(tcx)) }, output: if output.is_unit() { None } else { Some(output.into_tcx(tcx)) },
c_variadic, is_c_variadic: c_variadic,
} }
} }
} }
@ -702,12 +700,12 @@ impl FromWithTcx<clean::Impl> for Impl {
let provided_trait_methods = impl_.provided_trait_methods(tcx); let provided_trait_methods = impl_.provided_trait_methods(tcx);
let clean::Impl { safety, generics, trait_, for_, items, polarity, kind } = impl_; let clean::Impl { safety, generics, trait_, for_, items, polarity, kind } = impl_;
// FIXME: use something like ImplKind in JSON? // FIXME: use something like ImplKind in JSON?
let (synthetic, blanket_impl) = match kind { let (is_synthetic, blanket_impl) = match kind {
clean::ImplKind::Normal | clean::ImplKind::FakeVariadic => (false, None), clean::ImplKind::Normal | clean::ImplKind::FakeVariadic => (false, None),
clean::ImplKind::Auto => (true, None), clean::ImplKind::Auto => (true, None),
clean::ImplKind::Blanket(ty) => (false, Some(*ty)), clean::ImplKind::Blanket(ty) => (false, Some(*ty)),
}; };
let negative_polarity = match polarity { let is_negative = match polarity {
ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => false, ty::ImplPolarity::Positive | ty::ImplPolarity::Reservation => false,
ty::ImplPolarity::Negative => true, ty::ImplPolarity::Negative => true,
}; };
@ -721,8 +719,8 @@ impl FromWithTcx<clean::Impl> for Impl {
trait_: trait_.map(|path| path.into_tcx(tcx)), trait_: trait_.map(|path| path.into_tcx(tcx)),
for_: for_.into_tcx(tcx), for_: for_.into_tcx(tcx),
items: ids(items, tcx), items: ids(items, tcx),
negative: negative_polarity, is_negative,
synthetic, is_synthetic,
blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)), blanket_impl: blanket_impl.map(|x| x.into_tcx(tcx)),
} }
} }
@ -736,7 +734,7 @@ pub(crate) fn from_function(
) -> Function { ) -> Function {
let clean::Function { decl, generics } = *function; let clean::Function { decl, generics } = *function;
Function { Function {
decl: decl.into_tcx(tcx), sig: decl.into_tcx(tcx),
generics: generics.into_tcx(tcx), generics: generics.into_tcx(tcx),
header: from_fn_header(&header), header: from_fn_header(&header),
has_body, has_body,
@ -745,11 +743,11 @@ pub(crate) fn from_function(
impl FromWithTcx<clean::Enum> for Enum { impl FromWithTcx<clean::Enum> for Enum {
fn from_tcx(enum_: clean::Enum, tcx: TyCtxt<'_>) -> Self { fn from_tcx(enum_: clean::Enum, tcx: TyCtxt<'_>) -> Self {
let variants_stripped = enum_.has_stripped_entries(); let has_stripped_variants = enum_.has_stripped_entries();
let clean::Enum { variants, generics } = enum_; let clean::Enum { variants, generics } = enum_;
Enum { Enum {
generics: generics.into_tcx(tcx), generics: generics.into_tcx(tcx),
variants_stripped, has_stripped_variants,
variants: ids(variants, tcx), variants: ids(variants, tcx),
impls: Vec::new(), // Added in JsonRenderer::item impls: Vec::new(), // Added in JsonRenderer::item
} }
@ -766,7 +764,7 @@ impl FromWithTcx<clean::Variant> for Variant {
CLike => VariantKind::Plain, CLike => VariantKind::Plain,
Tuple(fields) => VariantKind::Tuple(ids_keeping_stripped(fields, tcx)), Tuple(fields) => VariantKind::Tuple(ids_keeping_stripped(fields, tcx)),
Struct(s) => VariantKind::Struct { Struct(s) => VariantKind::Struct {
fields_stripped: s.has_stripped_entries(), has_stripped_fields: s.has_stripped_entries(),
fields: ids(s.fields, tcx), fields: ids(s.fields, tcx),
}, },
}; };
@ -787,21 +785,21 @@ impl FromWithTcx<clean::Discriminant> for Discriminant {
} }
} }
impl FromWithTcx<clean::Import> for Import { impl FromWithTcx<clean::Import> for Use {
fn from_tcx(import: clean::Import, tcx: TyCtxt<'_>) -> Self { fn from_tcx(import: clean::Import, tcx: TyCtxt<'_>) -> Self {
use clean::ImportKind::*; use clean::ImportKind::*;
let (name, glob) = match import.kind { let (name, is_glob) = match import.kind {
Simple(s) => (s.to_string(), false), Simple(s) => (s.to_string(), false),
Glob => ( Glob => (
import.source.path.last_opt().unwrap_or_else(|| Symbol::intern("*")).to_string(), import.source.path.last_opt().unwrap_or_else(|| Symbol::intern("*")).to_string(),
true, true,
), ),
}; };
Import { Use {
source: import.source.path.whole_name(), source: import.source.path.whole_name(),
name, name,
id: import.source.did.map(ItemId::from).map(|i| id_from_item_default(i, tcx)), id: import.source.did.map(ItemId::from).map(|i| id_from_item_default(i, tcx)),
glob, is_glob,
} }
} }
} }
@ -835,7 +833,7 @@ impl FromWithTcx<clean::Static> for Static {
fn from_tcx(stat: clean::Static, tcx: TyCtxt<'_>) -> Self { fn from_tcx(stat: clean::Static, tcx: TyCtxt<'_>) -> Self {
Static { Static {
type_: (*stat.type_).into_tcx(tcx), type_: (*stat.type_).into_tcx(tcx),
mutable: stat.mutability == ast::Mutability::Mut, is_mutable: stat.mutability == ast::Mutability::Mut,
expr: stat expr: stat
.expr .expr
.map(|e| rendered_const(tcx, tcx.hir().body(e), tcx.hir().body_owner_def_id(e))) .map(|e| rendered_const(tcx, tcx.hir().body(e), tcx.hir().body_owner_def_id(e)))
@ -856,7 +854,7 @@ impl FromWithTcx<ItemType> for ItemKind {
match kind { match kind {
Module => ItemKind::Module, Module => ItemKind::Module,
ExternCrate => ItemKind::ExternCrate, ExternCrate => ItemKind::ExternCrate,
Import => ItemKind::Import, Import => ItemKind::Use,
Struct => ItemKind::Struct, Struct => ItemKind::Struct,
Union => ItemKind::Union, Union => ItemKind::Union,
Enum => ItemKind::Enum, Enum => ItemKind::Enum,
@ -872,7 +870,7 @@ impl FromWithTcx<ItemType> for ItemKind {
Primitive => ItemKind::Primitive, Primitive => ItemKind::Primitive,
AssocConst => ItemKind::AssocConst, AssocConst => ItemKind::AssocConst,
AssocType => ItemKind::AssocType, AssocType => ItemKind::AssocType,
ForeignType => ItemKind::ForeignType, ForeignType => ItemKind::ExternType,
Keyword => ItemKind::Keyword, Keyword => ItemKind::Keyword,
TraitAlias => ItemKind::TraitAlias, TraitAlias => ItemKind::TraitAlias,
ProcAttribute => ItemKind::ProcAttribute, ProcAttribute => ItemKind::ProcAttribute,

View file

@ -197,7 +197,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
types::ItemEnum::Function(_) types::ItemEnum::Function(_)
| types::ItemEnum::Module(_) | types::ItemEnum::Module(_)
| types::ItemEnum::Import(_) | types::ItemEnum::Use(_)
| types::ItemEnum::AssocConst { .. } | types::ItemEnum::AssocConst { .. }
| types::ItemEnum::AssocType { .. } => true, | types::ItemEnum::AssocType { .. } => true,
types::ItemEnum::ExternCrate { .. } types::ItemEnum::ExternCrate { .. }
@ -208,7 +208,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
| types::ItemEnum::TypeAlias(_) | types::ItemEnum::TypeAlias(_)
| types::ItemEnum::Constant { .. } | types::ItemEnum::Constant { .. }
| types::ItemEnum::Static(_) | types::ItemEnum::Static(_)
| types::ItemEnum::ForeignType | types::ItemEnum::ExternType
| types::ItemEnum::Macro(_) | types::ItemEnum::Macro(_)
| types::ItemEnum::ProcMacro(_) => false, | types::ItemEnum::ProcMacro(_) => false,
}; };

View file

@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
/// This integer is incremented with every breaking change to the API, /// This integer is incremented with every breaking change to the API,
/// and is returned along with the JSON blob as [`Crate::format_version`]. /// and is returned along with the JSON blob as [`Crate::format_version`].
/// Consuming code should assert that this value matches the format version(s) that it supports. /// Consuming code should assert that this value matches the format version(s) that it supports.
pub const FORMAT_VERSION: u32 = 33; pub const FORMAT_VERSION: u32 = 34;
/// The root of the emitted JSON blob. /// The root of the emitted JSON blob.
/// ///
@ -194,7 +194,7 @@ pub enum GenericArgs {
/// ``` /// ```
args: Vec<GenericArg>, args: Vec<GenericArg>,
/// Associated type or constant bindings (e.g. `Item=i32` or `Item: Clone`) for this type. /// Associated type or constant bindings (e.g. `Item=i32` or `Item: Clone`) for this type.
bindings: Vec<TypeBinding>, constraints: Vec<AssocItemConstraint>,
}, },
/// `Fn(A, B) -> C` /// `Fn(A, B) -> C`
Parenthesized { Parenthesized {
@ -258,19 +258,19 @@ pub struct Constant {
/// ^^^^^^^^^^ ^^^^^^^^^^^^^^^ /// ^^^^^^^^^^ ^^^^^^^^^^^^^^^
/// ``` /// ```
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct TypeBinding { pub struct AssocItemConstraint {
/// The name of the associated type/constant. /// The name of the associated type/constant.
pub name: String, pub name: String,
/// Arguments provided to the associated type/constant. /// Arguments provided to the associated type/constant.
pub args: GenericArgs, pub args: GenericArgs,
/// The kind of bound applied to the associated type/constant. /// The kind of bound applied to the associated type/constant.
pub binding: TypeBindingKind, pub binding: AssocItemConstraintKind,
} }
/// The way in which an associate type/constant is bound. /// The way in which an associate type/constant is bound.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum TypeBindingKind { pub enum AssocItemConstraintKind {
/// The required value/type is specified exactly. e.g. /// The required value/type is specified exactly. e.g.
/// ```text /// ```text
/// Iterator<Item = u32, IntoIter: DoubleEndedIterator> /// Iterator<Item = u32, IntoIter: DoubleEndedIterator>
@ -311,7 +311,7 @@ pub enum ItemKind {
/// A crate imported via the `extern crate` syntax. /// A crate imported via the `extern crate` syntax.
ExternCrate, ExternCrate,
/// An import of 1 or more items into scope, using the `use` keyword. /// An import of 1 or more items into scope, using the `use` keyword.
Import, Use,
/// A `struct` declaration. /// A `struct` declaration.
Struct, Struct,
/// A field of a struct. /// A field of a struct.
@ -341,7 +341,7 @@ pub enum ItemKind {
/// `type`s from an `extern` block. /// `type`s from an `extern` block.
/// ///
/// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467) /// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467)
ForeignType, ExternType,
/// A macro declaration. /// A macro declaration.
/// ///
/// Corresponds to either `ItemEnum::Macro(_)` /// Corresponds to either `ItemEnum::Macro(_)`
@ -386,7 +386,7 @@ pub enum ItemEnum {
rename: Option<String>, rename: Option<String>,
}, },
/// An import of 1 or more items into scope, using the `use` keyword. /// An import of 1 or more items into scope, using the `use` keyword.
Import(Import), Use(Use),
/// A `union` declaration. /// A `union` declaration.
Union(Union), Union(Union),
@ -429,7 +429,7 @@ pub enum ItemEnum {
/// `type`s from an `extern` block. /// `type`s from an `extern` block.
/// ///
/// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467) /// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467)
ForeignType, ExternType,
/// A macro_rules! declarative macro. Contains a single string with the source /// A macro_rules! declarative macro. Contains a single string with the source
/// representation of the macro with the patterns stripped. /// representation of the macro with the patterns stripped.
@ -447,12 +447,19 @@ pub enum ItemEnum {
/// The type of the constant. /// The type of the constant.
#[serde(rename = "type")] #[serde(rename = "type")]
type_: Type, type_: Type,
/// The stringified expression for the default value, if provided, e.g. /// Inside a trait declaration, this is the default value for the associated constant,
/// if provided.
/// Inside an `impl` block, this is the value assigned to the associated constant,
/// and will always be present.
///
/// The representation is implementation-defined and not guaranteed to be representative of
/// either the resulting value or of the source code.
///
/// ```rust /// ```rust
/// const X: usize = 640 * 1024; /// const X: usize = 640 * 1024;
/// // ^^^^^^^^^^ /// // ^^^^^^^^^^
/// ``` /// ```
default: Option<String>, value: Option<String>,
}, },
/// An associated type of a trait or a type. /// An associated type of a trait or a type.
AssocType { AssocType {
@ -467,12 +474,16 @@ pub enum ItemEnum {
/// } /// }
/// ``` /// ```
bounds: Vec<GenericBound>, bounds: Vec<GenericBound>,
/// The default for this type, if provided, e.g. /// Inside a trait declaration, this is the default for the associated type, if provided.
/// Inside an impl block, this is the type assigned to the associated type, and will always
/// be present.
///
/// ```rust /// ```rust
/// type X = usize; /// type X = usize;
/// // ^^^^^ /// // ^^^^^
/// ``` /// ```
default: Option<Type>, #[serde(rename = "type")]
type_: Option<Type>,
}, },
} }
@ -497,7 +508,7 @@ pub struct Union {
/// The generic parameters and where clauses on this union. /// The generic parameters and where clauses on this union.
pub generics: Generics, pub generics: Generics,
/// Whether any fields have been removed from the result, due to being private or hidden. /// Whether any fields have been removed from the result, due to being private or hidden.
pub fields_stripped: bool, pub has_stripped_fields: bool,
/// The list of fields in the union. /// The list of fields in the union.
/// ///
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`]. /// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`].
@ -554,7 +565,7 @@ pub enum StructKind {
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`]. /// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`].
fields: Vec<Id>, fields: Vec<Id>,
/// Whether any fields have been removed from the result, due to being private or hidden. /// Whether any fields have been removed from the result, due to being private or hidden.
fields_stripped: bool, has_stripped_fields: bool,
}, },
} }
@ -564,7 +575,7 @@ pub struct Enum {
/// Information about the type parameters and `where` clauses of the enum. /// Information about the type parameters and `where` clauses of the enum.
pub generics: Generics, pub generics: Generics,
/// Whether any variants have been removed from the result, due to being private or hidden. /// Whether any variants have been removed from the result, due to being private or hidden.
pub variants_stripped: bool, pub has_stripped_variants: bool,
/// The list of variants in the enum. /// The list of variants in the enum.
/// ///
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`] /// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`]
@ -621,7 +632,7 @@ pub enum VariantKind {
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`]. /// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`].
fields: Vec<Id>, fields: Vec<Id>,
/// Whether any variants have been removed from the result, due to being private or hidden. /// Whether any variants have been removed from the result, due to being private or hidden.
fields_stripped: bool, has_stripped_fields: bool,
}, },
} }
@ -645,16 +656,13 @@ pub struct Discriminant {
/// A set of fundamental properties of a function. /// A set of fundamental properties of a function.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Header { pub struct FunctionHeader {
/// Is this function marked as `const`? /// Is this function marked as `const`?
#[serde(rename = "const")] pub is_const: bool,
pub const_: bool,
/// Is this function unsafe? /// Is this function unsafe?
#[serde(rename = "unsafe")] pub is_unsafe: bool,
pub unsafe_: bool,
/// Is this function async? /// Is this function async?
#[serde(rename = "async")] pub is_async: bool,
pub async_: bool,
/// The ABI used by the function. /// The ABI used by the function.
pub abi: Abi, pub abi: Abi,
} }
@ -697,11 +705,11 @@ pub enum Abi {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Function { pub struct Function {
/// Information about the function signature, or declaration. /// Information about the function signature, or declaration.
pub decl: FnDecl, pub sig: FunctionSignature,
/// Information about the functions type parameters and `where` clauses. /// Information about the functions type parameters and `where` clauses.
pub generics: Generics, pub generics: Generics,
/// Information about core properties of the function, e.g. whether it's `const`, its ABI, etc. /// Information about core properties of the function, e.g. whether it's `const`, its ABI, etc.
pub header: Header, pub header: FunctionHeader,
/// Whether the function has a body, i.e. an implementation. /// Whether the function has a body, i.e. an implementation.
pub has_body: bool, pub has_body: bool,
} }
@ -784,7 +792,7 @@ pub enum GenericParamDefKind {
/// In this example, the generic parameter named `impl Trait` (and which /// In this example, the generic parameter named `impl Trait` (and which
/// is bound by `Trait`) is synthetic, because it was not originally in /// is bound by `Trait`) is synthetic, because it was not originally in
/// the Rust source text. /// the Rust source text.
synthetic: bool, is_synthetic: bool,
}, },
/// Denotes a constant parameter. /// Denotes a constant parameter.
@ -894,7 +902,7 @@ pub enum TraitBoundModifier {
} }
/// Either a type or a constant, usually stored as the right-hand side of an equation in places like /// Either a type or a constant, usually stored as the right-hand side of an equation in places like
/// [`TypeBinding`] /// [`AssocItemConstraint`]
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum Term { pub enum Term {
@ -963,7 +971,7 @@ pub enum Type {
/// A raw pointer type, e.g. `*mut u32`, `*const u8`, etc. /// A raw pointer type, e.g. `*mut u32`, `*const u8`, etc.
RawPointer { RawPointer {
/// This is `true` for `*mut _` and `false` for `*const _`. /// This is `true` for `*mut _` and `false` for `*const _`.
mutable: bool, is_mutable: bool,
/// The type of the pointee. /// The type of the pointee.
#[serde(rename = "type")] #[serde(rename = "type")]
type_: Box<Type>, type_: Box<Type>,
@ -973,7 +981,7 @@ pub enum Type {
/// The name of the lifetime of the reference, if provided. /// The name of the lifetime of the reference, if provided.
lifetime: Option<String>, lifetime: Option<String>,
/// This is `true` for `&mut i32` and `false` for `&i32` /// This is `true` for `&mut i32` and `false` for `&i32`
mutable: bool, is_mutable: bool,
/// The type of the pointee, e.g. the `i32` in `&'a mut i32` /// The type of the pointee, e.g. the `i32` in `&'a mut i32`
#[serde(rename = "type")] #[serde(rename = "type")]
type_: Box<Type>, type_: Box<Type>,
@ -1036,7 +1044,7 @@ pub struct Path {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FunctionPointer { pub struct FunctionPointer {
/// The signature of the function. /// The signature of the function.
pub decl: FnDecl, pub sig: FunctionSignature,
/// Used for Higher-Rank Trait Bounds (HRTBs) /// Used for Higher-Rank Trait Bounds (HRTBs)
/// ///
/// ```ignore (incomplete expression) /// ```ignore (incomplete expression)
@ -1045,12 +1053,12 @@ pub struct FunctionPointer {
/// ``` /// ```
pub generic_params: Vec<GenericParamDef>, pub generic_params: Vec<GenericParamDef>,
/// The core properties of the function, such as the ABI it conforms to, whether it's unsafe, etc. /// The core properties of the function, such as the ABI it conforms to, whether it's unsafe, etc.
pub header: Header, pub header: FunctionHeader,
} }
/// The signature of a function. /// The signature of a function.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FnDecl { pub struct FunctionSignature {
/// List of argument names and their type. /// List of argument names and their type.
/// ///
/// Note that not all names will be valid identifiers, as some of /// Note that not all names will be valid identifiers, as some of
@ -1063,7 +1071,7 @@ pub struct FnDecl {
/// ```ignore (incomplete code) /// ```ignore (incomplete code)
/// fn printf(fmt: &str, ...); /// fn printf(fmt: &str, ...);
/// ``` /// ```
pub c_variadic: bool, pub is_c_variadic: bool,
} }
/// A `trait` declaration. /// A `trait` declaration.
@ -1127,10 +1135,10 @@ pub struct Impl {
/// The list of associated items contained in this impl block. /// The list of associated items contained in this impl block.
pub items: Vec<Id>, pub items: Vec<Id>,
/// Whether this is a negative impl (e.g. `!Sized` or `!Send`). /// Whether this is a negative impl (e.g. `!Sized` or `!Send`).
pub negative: bool, pub is_negative: bool,
/// Whether this is an impl thats implied by the compiler /// Whether this is an impl thats implied by the compiler
/// (for autotraits, e.g. `Send` or `Sync`). /// (for autotraits, e.g. `Send` or `Sync`).
pub synthetic: bool, pub is_synthetic: bool,
// FIXME: document this // FIXME: document this
pub blanket_impl: Option<Type>, pub blanket_impl: Option<Type>,
} }
@ -1138,7 +1146,7 @@ pub struct Impl {
/// A `use` statement. /// A `use` statement.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub struct Import { pub struct Use {
/// The full path being imported. /// The full path being imported.
pub source: String, pub source: String,
/// May be different from the last segment of `source` when renaming imports: /// May be different from the last segment of `source` when renaming imports:
@ -1150,7 +1158,7 @@ pub struct Import {
/// ``` /// ```
pub id: Option<Id>, pub id: Option<Id>,
/// Whether this statement is a wildcard `use`, e.g. `use source::*;` /// Whether this statement is a wildcard `use`, e.g. `use source::*;`
pub glob: bool, pub is_glob: bool,
} }
/// A procedural macro. /// A procedural macro.
@ -1205,7 +1213,7 @@ pub struct Static {
#[serde(rename = "type")] #[serde(rename = "type")]
pub type_: Type, pub type_: Type,
/// This is `true` for mutable statics, declared as `static mut X: T = f();` /// This is `true` for mutable statics, declared as `static mut X: T = f();`
pub mutable: bool, pub is_mutable: bool,
/// The stringified expression for the initial value. /// The stringified expression for the initial value.
/// ///
/// It's not guaranteed that it'll match the actual source code for the initial value. /// It's not guaranteed that it'll match the actual source code for the initial value.

View file

@ -4,7 +4,7 @@ use super::*;
fn test_struct_info_roundtrip() { fn test_struct_info_roundtrip() {
let s = ItemEnum::Struct(Struct { let s = ItemEnum::Struct(Struct {
generics: Generics { params: vec![], where_predicates: vec![] }, generics: Generics { params: vec![], where_predicates: vec![] },
kind: StructKind::Plain { fields: vec![], fields_stripped: false }, kind: StructKind::Plain { fields: vec![], has_stripped_fields: false },
impls: vec![], impls: vec![],
}); });
@ -23,7 +23,7 @@ fn test_struct_info_roundtrip() {
fn test_union_info_roundtrip() { fn test_union_info_roundtrip() {
let u = ItemEnum::Union(Union { let u = ItemEnum::Union(Union {
generics: Generics { params: vec![], where_predicates: vec![] }, generics: Generics { params: vec![], where_predicates: vec![] },
fields_stripped: false, has_stripped_fields: false,
fields: vec![], fields: vec![],
impls: vec![], impls: vec![],
}); });

View file

@ -5,7 +5,7 @@ use rustdoc_json_types::{Item, ItemEnum, ItemKind, ItemSummary};
pub(crate) enum Kind { pub(crate) enum Kind {
Module, Module,
ExternCrate, ExternCrate,
Import, Use,
Struct, Struct,
StructField, StructField,
Union, Union,
@ -18,7 +18,7 @@ pub(crate) enum Kind {
TraitAlias, TraitAlias,
Impl, Impl,
Static, Static,
ForeignType, ExternType,
Macro, Macro,
ProcAttribute, ProcAttribute,
ProcDerive, ProcDerive,
@ -36,7 +36,7 @@ impl Kind {
match self { match self {
Module => true, Module => true,
ExternCrate => true, ExternCrate => true,
Import => true, Use => true,
Union => true, Union => true,
Struct => true, Struct => true,
Enum => true, Enum => true,
@ -50,7 +50,7 @@ impl Kind {
Macro => true, Macro => true,
ProcMacro => true, ProcMacro => true,
Primitive => true, Primitive => true,
ForeignType => true, ExternType => true,
// FIXME(adotinthevoid): I'm not sure if these are correct // FIXME(adotinthevoid): I'm not sure if these are correct
Keyword => false, Keyword => false,
@ -69,7 +69,7 @@ impl Kind {
pub fn can_appear_in_import(self) -> bool { pub fn can_appear_in_import(self) -> bool {
match self { match self {
Kind::Variant => true, Kind::Variant => true,
Kind::Import => false, Kind::Use => false,
other => other.can_appear_in_mod(), other => other.can_appear_in_mod(),
} }
} }
@ -90,7 +90,7 @@ impl Kind {
Kind::Module => false, Kind::Module => false,
Kind::ExternCrate => false, Kind::ExternCrate => false,
Kind::Import => false, Kind::Use => false,
Kind::Struct => false, Kind::Struct => false,
Kind::StructField => false, Kind::StructField => false,
Kind::Union => false, Kind::Union => false,
@ -102,7 +102,7 @@ impl Kind {
Kind::TraitAlias => false, Kind::TraitAlias => false,
Kind::Impl => false, Kind::Impl => false,
Kind::Static => false, Kind::Static => false,
Kind::ForeignType => false, Kind::ExternType => false,
Kind::Macro => false, Kind::Macro => false,
Kind::ProcAttribute => false, Kind::ProcAttribute => false,
Kind::ProcDerive => false, Kind::ProcDerive => false,
@ -135,7 +135,7 @@ impl Kind {
use Kind::*; use Kind::*;
match i.inner { match i.inner {
ItemEnum::Module(_) => Module, ItemEnum::Module(_) => Module,
ItemEnum::Import(_) => Import, ItemEnum::Use(_) => Use,
ItemEnum::Union(_) => Union, ItemEnum::Union(_) => Union,
ItemEnum::Struct(_) => Struct, ItemEnum::Struct(_) => Struct,
ItemEnum::StructField(_) => StructField, ItemEnum::StructField(_) => StructField,
@ -151,7 +151,7 @@ impl Kind {
ItemEnum::Macro(_) => Macro, ItemEnum::Macro(_) => Macro,
ItemEnum::ProcMacro(_) => ProcMacro, ItemEnum::ProcMacro(_) => ProcMacro,
ItemEnum::Primitive(_) => Primitive, ItemEnum::Primitive(_) => Primitive,
ItemEnum::ForeignType => ForeignType, ItemEnum::ExternType => ExternType,
ItemEnum::ExternCrate { .. } => ExternCrate, ItemEnum::ExternCrate { .. } => ExternCrate,
ItemEnum::AssocConst { .. } => AssocConst, ItemEnum::AssocConst { .. } => AssocConst,
ItemEnum::AssocType { .. } => AssocType, ItemEnum::AssocType { .. } => AssocType,
@ -166,10 +166,10 @@ impl Kind {
ItemKind::Constant => Constant, ItemKind::Constant => Constant,
ItemKind::Enum => Enum, ItemKind::Enum => Enum,
ItemKind::ExternCrate => ExternCrate, ItemKind::ExternCrate => ExternCrate,
ItemKind::ForeignType => ForeignType, ItemKind::ExternType => ExternType,
ItemKind::Function => Function, ItemKind::Function => Function,
ItemKind::Impl => Impl, ItemKind::Impl => Impl,
ItemKind::Import => Import, ItemKind::Use => Use,
ItemKind::Keyword => Keyword, ItemKind::Keyword => Keyword,
ItemKind::Macro => Macro, ItemKind::Macro => Macro,
ItemKind::Module => Module, ItemKind::Module => Module,

View file

@ -2,10 +2,11 @@ use std::collections::HashSet;
use std::hash::Hash; use std::hash::Hash;
use rustdoc_json_types::{ use rustdoc_json_types::{
Constant, Crate, DynTrait, Enum, FnDecl, Function, FunctionPointer, GenericArg, GenericArgs, AssocItemConstraint, AssocItemConstraintKind, Constant, Crate, DynTrait, Enum, Function,
GenericBound, GenericParamDef, Generics, Id, Impl, Import, ItemEnum, ItemSummary, Module, Path, FunctionPointer, FunctionSignature, GenericArg, GenericArgs, GenericBound, GenericParamDef,
Primitive, ProcMacro, Static, Struct, StructKind, Term, Trait, TraitAlias, Type, TypeAlias, Generics, Id, Impl, ItemEnum, ItemSummary, Module, Path, Primitive, ProcMacro, Static, Struct,
TypeBinding, TypeBindingKind, Union, Variant, VariantKind, WherePredicate, StructKind, Term, Trait, TraitAlias, Type, TypeAlias, Union, Use, Variant, VariantKind,
WherePredicate,
}; };
use serde_json::Value; use serde_json::Value;
@ -90,7 +91,7 @@ impl<'a> Validator<'a> {
item.links.values().for_each(|id| self.add_any_id(id)); item.links.values().for_each(|id| self.add_any_id(id));
match &item.inner { match &item.inner {
ItemEnum::Import(x) => self.check_import(x), ItemEnum::Use(x) => self.check_use(x),
ItemEnum::Union(x) => self.check_union(x), ItemEnum::Union(x) => self.check_union(x),
ItemEnum::Struct(x) => self.check_struct(x), ItemEnum::Struct(x) => self.check_struct(x),
ItemEnum::StructField(x) => self.check_struct_field(x), ItemEnum::StructField(x) => self.check_struct_field(x),
@ -106,18 +107,18 @@ impl<'a> Validator<'a> {
self.check_constant(const_); self.check_constant(const_);
} }
ItemEnum::Static(x) => self.check_static(x), ItemEnum::Static(x) => self.check_static(x),
ItemEnum::ForeignType => {} // nop ItemEnum::ExternType => {} // nop
ItemEnum::Macro(x) => self.check_macro(x), ItemEnum::Macro(x) => self.check_macro(x),
ItemEnum::ProcMacro(x) => self.check_proc_macro(x), ItemEnum::ProcMacro(x) => self.check_proc_macro(x),
ItemEnum::Primitive(x) => self.check_primitive_type(x), ItemEnum::Primitive(x) => self.check_primitive_type(x),
ItemEnum::Module(x) => self.check_module(x, id), ItemEnum::Module(x) => self.check_module(x, id),
// FIXME: Why don't these have their own structs? // FIXME: Why don't these have their own structs?
ItemEnum::ExternCrate { .. } => {} ItemEnum::ExternCrate { .. } => {}
ItemEnum::AssocConst { type_, default: _ } => self.check_type(type_), ItemEnum::AssocConst { type_, value: _ } => self.check_type(type_),
ItemEnum::AssocType { generics, bounds, default } => { ItemEnum::AssocType { generics, bounds, type_ } => {
self.check_generics(generics); self.check_generics(generics);
bounds.iter().for_each(|b| self.check_generic_bound(b)); bounds.iter().for_each(|b| self.check_generic_bound(b));
if let Some(ty) = default { if let Some(ty) = type_ {
self.check_type(ty); self.check_type(ty);
} }
} }
@ -133,8 +134,8 @@ impl<'a> Validator<'a> {
module.items.iter().for_each(|i| self.add_mod_item_id(i)); module.items.iter().for_each(|i| self.add_mod_item_id(i));
} }
fn check_import(&mut self, x: &'a Import) { fn check_use(&mut self, x: &'a Use) {
if x.glob { if x.is_glob {
self.add_glob_import_item_id(x.id.as_ref().unwrap()); self.add_glob_import_item_id(x.id.as_ref().unwrap());
} else if let Some(id) = &x.id { } else if let Some(id) = &x.id {
self.add_import_item_id(id); self.add_import_item_id(id);
@ -152,7 +153,7 @@ impl<'a> Validator<'a> {
match &x.kind { match &x.kind {
StructKind::Unit => {} StructKind::Unit => {}
StructKind::Tuple(fields) => fields.iter().flatten().for_each(|f| self.add_field_id(f)), StructKind::Tuple(fields) => fields.iter().flatten().for_each(|f| self.add_field_id(f)),
StructKind::Plain { fields, fields_stripped: _ } => { StructKind::Plain { fields, has_stripped_fields: _ } => {
fields.iter().for_each(|f| self.add_field_id(f)) fields.iter().for_each(|f| self.add_field_id(f))
} }
} }
@ -187,7 +188,7 @@ impl<'a> Validator<'a> {
match kind { match kind {
VariantKind::Plain => {} VariantKind::Plain => {}
VariantKind::Tuple(tys) => tys.iter().flatten().for_each(|t| self.add_field_id(t)), VariantKind::Tuple(tys) => tys.iter().flatten().for_each(|t| self.add_field_id(t)),
VariantKind::Struct { fields, fields_stripped: _ } => { VariantKind::Struct { fields, has_stripped_fields: _ } => {
fields.iter().for_each(|f| self.add_field_id(f)) fields.iter().for_each(|f| self.add_field_id(f))
} }
} }
@ -195,7 +196,7 @@ impl<'a> Validator<'a> {
fn check_function(&mut self, x: &'a Function) { fn check_function(&mut self, x: &'a Function) {
self.check_generics(&x.generics); self.check_generics(&x.generics);
self.check_fn_decl(&x.decl); self.check_function_signature(&x.sig);
} }
fn check_trait(&mut self, x: &'a Trait, id: &Id) { fn check_trait(&mut self, x: &'a Trait, id: &Id) {
@ -267,8 +268,8 @@ impl<'a> Validator<'a> {
Type::Array { type_, len: _ } => self.check_type(&**type_), Type::Array { type_, len: _ } => self.check_type(&**type_),
Type::ImplTrait(bounds) => bounds.iter().for_each(|b| self.check_generic_bound(b)), Type::ImplTrait(bounds) => bounds.iter().for_each(|b| self.check_generic_bound(b)),
Type::Infer => {} Type::Infer => {}
Type::RawPointer { mutable: _, type_ } => self.check_type(&**type_), Type::RawPointer { is_mutable: _, type_ } => self.check_type(&**type_),
Type::BorrowedRef { lifetime: _, mutable: _, type_ } => self.check_type(&**type_), Type::BorrowedRef { lifetime: _, is_mutable: _, type_ } => self.check_type(&**type_),
Type::QualifiedPath { name: _, args, self_type, trait_ } => { Type::QualifiedPath { name: _, args, self_type, trait_ } => {
self.check_generic_args(&**args); self.check_generic_args(&**args);
self.check_type(&**self_type); self.check_type(&**self_type);
@ -279,7 +280,7 @@ impl<'a> Validator<'a> {
} }
} }
fn check_fn_decl(&mut self, x: &'a FnDecl) { fn check_function_signature(&mut self, x: &'a FunctionSignature) {
x.inputs.iter().for_each(|(_name, ty)| self.check_type(ty)); x.inputs.iter().for_each(|(_name, ty)| self.check_type(ty));
if let Some(output) = &x.output { if let Some(output) = &x.output {
self.check_type(output); self.check_type(output);
@ -309,9 +310,9 @@ impl<'a> Validator<'a> {
fn check_generic_args(&mut self, x: &'a GenericArgs) { fn check_generic_args(&mut self, x: &'a GenericArgs) {
match x { match x {
GenericArgs::AngleBracketed { args, bindings } => { GenericArgs::AngleBracketed { args, constraints } => {
args.iter().for_each(|arg| self.check_generic_arg(arg)); args.iter().for_each(|arg| self.check_generic_arg(arg));
bindings.iter().for_each(|bind| self.check_type_binding(bind)); constraints.iter().for_each(|bind| self.check_assoc_item_constraint(bind));
} }
GenericArgs::Parenthesized { inputs, output } => { GenericArgs::Parenthesized { inputs, output } => {
inputs.iter().for_each(|ty| self.check_type(ty)); inputs.iter().for_each(|ty| self.check_type(ty));
@ -325,7 +326,7 @@ impl<'a> Validator<'a> {
fn check_generic_param_def(&mut self, gpd: &'a GenericParamDef) { fn check_generic_param_def(&mut self, gpd: &'a GenericParamDef) {
match &gpd.kind { match &gpd.kind {
rustdoc_json_types::GenericParamDefKind::Lifetime { outlives: _ } => {} rustdoc_json_types::GenericParamDefKind::Lifetime { outlives: _ } => {}
rustdoc_json_types::GenericParamDefKind::Type { bounds, default, synthetic: _ } => { rustdoc_json_types::GenericParamDefKind::Type { bounds, default, is_synthetic: _ } => {
bounds.iter().for_each(|b| self.check_generic_bound(b)); bounds.iter().for_each(|b| self.check_generic_bound(b));
if let Some(ty) = default { if let Some(ty) = default {
self.check_type(ty); self.check_type(ty);
@ -346,11 +347,11 @@ impl<'a> Validator<'a> {
} }
} }
fn check_type_binding(&mut self, bind: &'a TypeBinding) { fn check_assoc_item_constraint(&mut self, bind: &'a AssocItemConstraint) {
self.check_generic_args(&bind.args); self.check_generic_args(&bind.args);
match &bind.binding { match &bind.binding {
TypeBindingKind::Equality(term) => self.check_term(term), AssocItemConstraintKind::Equality(term) => self.check_term(term),
TypeBindingKind::Constraint(bounds) => { AssocItemConstraintKind::Constraint(bounds) => {
bounds.iter().for_each(|b| self.check_generic_bound(b)) bounds.iter().for_each(|b| self.check_generic_bound(b))
} }
} }
@ -388,7 +389,7 @@ impl<'a> Validator<'a> {
} }
fn check_function_pointer(&mut self, fp: &'a FunctionPointer) { fn check_function_pointer(&mut self, fp: &'a FunctionPointer) {
self.check_fn_decl(&fp.decl); self.check_function_signature(&fp.sig);
fp.generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd)); fp.generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
} }

View file

@ -9,12 +9,12 @@ impl Simple {
pub trait EasyToImpl { pub trait EasyToImpl {
//@ has "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type" //@ has "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type"
//@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.default" null //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.type" null
//@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" [] //@ is "$.index[*][?(@.docs=='ToDeclare trait')].inner.assoc_type.bounds" []
/// ToDeclare trait /// ToDeclare trait
type ToDeclare; type ToDeclare;
//@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const" //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const"
//@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.default" null //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.value" null
//@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"' //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE trait')].inner.assoc_const.type.primitive" '"usize"'
/// AN_ATTRIBUTE trait /// AN_ATTRIBUTE trait
const AN_ATTRIBUTE: usize; const AN_ATTRIBUTE: usize;
@ -22,13 +22,13 @@ pub trait EasyToImpl {
impl EasyToImpl for Simple { impl EasyToImpl for Simple {
//@ has "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type" //@ has "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type"
//@ is "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type.default.primitive" \"usize\" //@ is "$.index[*][?(@.docs=='ToDeclare impl')].inner.assoc_type.type.primitive" \"usize\"
/// ToDeclare impl /// ToDeclare impl
type ToDeclare = usize; type ToDeclare = usize;
//@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const" //@ has "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const"
//@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\" //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.type.primitive" \"usize\"
//@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.default" \"12\" //@ is "$.index[*][?(@.docs=='AN_ATTRIBUTE impl')].inner.assoc_const.value" \"12\"
/// AN_ATTRIBUTE impl /// AN_ATTRIBUTE impl
const AN_ATTRIBUTE: usize = 12; const AN_ATTRIBUTE: usize = 12;
} }

View file

@ -3,6 +3,6 @@
#![no_std] #![no_std]
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type" //@ has "$.index[*][?(@.name=='Error')].inner.assoc_type"
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.default.resolved_path" //@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path"
//@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.default.resolved_path.name" \"Infallible\" //@ has "$.index[*][?(@.name=='Error')].inner.assoc_type.type.resolved_path.name" \"Infallible\"
pub struct ForBlanketTryFromImpl; pub struct ForBlanketTryFromImpl;

View file

@ -5,7 +5,7 @@ pub enum Foo {
//@ is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"' //@ is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'
Unit, Unit,
//@ set Named = "$.index[*][?(@.name=='Named')].id" //@ set Named = "$.index[*][?(@.name=='Named')].id"
//@ is "$.index[*][?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "fields_stripped": false}' //@ is "$.index[*][?(@.name=='Named')].inner.variant.kind.struct" '{"fields": [], "has_stripped_fields": false}'
Named {}, Named {},
//@ set Tuple = "$.index[*][?(@.name=='Tuple')].id" //@ set Tuple = "$.index[*][?(@.name=='Tuple')].id"
//@ is "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple" [] //@ is "$.index[*][?(@.name=='Tuple')].inner.variant.kind.tuple" []
@ -13,7 +13,7 @@ pub enum Foo {
//@ set NamedField = "$.index[*][?(@.name=='NamedField')].id" //@ set NamedField = "$.index[*][?(@.name=='NamedField')].id"
//@ set x = "$.index[*][?(@.name=='x' && @.inner.struct_field)].id" //@ set x = "$.index[*][?(@.name=='x' && @.inner.struct_field)].id"
//@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.fields[*]" $x
//@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.fields_stripped" false //@ is "$.index[*][?(@.name=='NamedField')].inner.variant.kind.struct.has_stripped_fields" false
NamedField { x: i32 }, NamedField { x: i32 },
//@ set TupleField = "$.index[*][?(@.name=='TupleField')].id" //@ set TupleField = "$.index[*][?(@.name=='TupleField')].id"
//@ set tup_field = "$.index[*][?(@.name=='0' && @.inner.struct_field)].id" //@ set tup_field = "$.index[*][?(@.name=='0' && @.inner.struct_field)].id"

View file

@ -9,7 +9,7 @@ pub enum Foo {
//@ set y = "$.index[*][?(@.name=='y')].id" //@ set y = "$.index[*][?(@.name=='y')].id"
y: i32, y: i32,
}, },
//@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields_stripped" true //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.has_stripped_fields" true
//@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[0]" $b
//@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y //@ is "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[1]" $y
//@ count "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2 //@ count "$.index[*][?(@.name=='Variant')].inner.variant.kind.struct.fields[*]" 2

View file

@ -7,9 +7,9 @@ pub enum Color {
Blue, Blue,
} }
//@ set use_Color = "$.index[*][?(@.inner.import)].id" //@ set use_Color = "$.index[*][?(@.inner.use)].id"
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $Color //@ is "$.index[*][?(@.inner.use)].inner.use.id" $Color
//@ is "$.index[*][?(@.inner.import)].inner.import.glob" true //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
pub use Color::*; pub use Color::*;
//@ ismany "$.index[*][?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color //@ ismany "$.index[*][?(@.name == 'use_glob')].inner.module.items[*]" $Color $use_Color

View file

@ -5,8 +5,8 @@ pub enum AlwaysNone {
} }
//@ is "$.index[*][?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None //@ is "$.index[*][?(@.name == 'AlwaysNone')].inner.enum.variants[*]" $None
//@ set use_None = "$.index[*][?(@.inner.import)].id" //@ set use_None = "$.index[*][?(@.inner.use)].id"
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $None //@ is "$.index[*][?(@.inner.use)].inner.use.id" $None
pub use AlwaysNone::None; pub use AlwaysNone::None;
//@ ismany "$.index[*][?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None //@ ismany "$.index[*][?(@.name == 'use_variant')].inner.module.items[*]" $AlwaysNone $use_None

View file

@ -2,7 +2,7 @@
extern crate color; extern crate color;
//@ has "$.index[*].inner.import[?(@.name == 'Red')]" //@ has "$.index[*].inner.use[?(@.name == 'Red')]"
pub use color::Color::Red; pub use color::Color::Red;
//@ !has "$.index[*][?(@.name == 'Red')]" //@ !has "$.index[*][?(@.name == 'Red')]"

View file

@ -1,9 +1,9 @@
// ignore-tidy-linelength // ignore-tidy-linelength
//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][0]" '"val"' //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][0]" '"val"'
//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\" //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.output.primitive" \"i32\" //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.sig.output.primitive" \"i32\"
//@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1 //@ count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[*]" 1
//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\" //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].name" \"\'c\"
//@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }' //@ is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'

View file

@ -1,11 +1,11 @@
// ignore-tidy-linelength // ignore-tidy-linelength
//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.unsafe" false //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_unsafe" false
//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.const" false //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_const" false
//@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.async" false //@ is "$.index[*][?(@.name=='FnPointer')].inner.type_alias.type.function_pointer.header.is_async" false
pub type FnPointer = fn(); pub type FnPointer = fn();
//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.unsafe" true //@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_unsafe" true
//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.const" false //@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_const" false
//@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.async" false //@ is "$.index[*][?(@.name=='UnsafePointer')].inner.type_alias.type.function_pointer.header.is_async" false
pub type UnsafePointer = unsafe fn(); pub type UnsafePointer = unsafe fn();

View file

@ -5,30 +5,30 @@
use std::future::Future; use std::future::Future;
//@ is "$.index[*][?(@.name=='get_int')].inner.function.decl.output.primitive" \"i32\" //@ is "$.index[*][?(@.name=='get_int')].inner.function.sig.output.primitive" \"i32\"
//@ is "$.index[*][?(@.name=='get_int')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='get_int')].inner.function.header.is_async" false
pub fn get_int() -> i32 { pub fn get_int() -> i32 {
42 42
} }
//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.decl.output.primitive" \"i32\" //@ is "$.index[*][?(@.name=='get_int_async')].inner.function.sig.output.primitive" \"i32\"
//@ is "$.index[*][?(@.name=='get_int_async')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='get_int_async')].inner.function.header.is_async" true
pub async fn get_int_async() -> i32 { pub async fn get_int_async() -> i32 {
42 42
} }
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.decl.output.impl_trait[0].trait_bound.trait.name" '"Future"' //@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.name" '"Future"'
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.decl.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].name" '"Output"' //@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.decl.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type.primitive" \"i32\" //@ is "$.index[*][?(@.name=='get_int_future')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
//@ is "$.index[*][?(@.name=='get_int_future')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='get_int_future')].inner.function.header.is_async" false
pub fn get_int_future() -> impl Future<Output = i32> { pub fn get_int_future() -> impl Future<Output = i32> {
async { 42 } async { 42 }
} }
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.decl.output.impl_trait[0].trait_bound.trait.name" '"Future"' //@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.name" '"Future"'
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.decl.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].name" '"Output"' //@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name" '"Output"'
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.decl.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type.primitive" \"i32\" //@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.sig.output.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive" \"i32\"
//@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='get_int_future_async')].inner.function.header.is_async" true
pub async fn get_int_future_async() -> impl Future<Output = i32> { pub async fn get_int_future_async() -> impl Future<Output = i32> {
async { 42 } async { 42 }
} }

View file

@ -1,6 +1,6 @@
extern "C" { extern "C" {
//@ is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false //@ is "$.index[*][?(@.name == 'not_variadic')].inner.function.sig.is_c_variadic" false
pub fn not_variadic(_: i32); pub fn not_variadic(_: i32);
//@ is "$.index[*][?(@.name == 'variadic')].inner.function.decl.c_variadic" true //@ is "$.index[*][?(@.name == 'variadic')].inner.function.sig.is_c_variadic" true
pub fn variadic(_: i32, ...); pub fn variadic(_: i32, ...);
} }

View file

@ -12,27 +12,27 @@ pub trait GenericFoo<'a> {}
//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null' //@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.default" 'null'
//@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1 //@ count "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[*]" 1
//@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo' //@ is "$.index[*][?(@.name=='generics')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" '$foo'
//@ count "$.index[*][?(@.name=='generics')].inner.function.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='generics')].inner.function.decl.inputs[0][0]" '"f"' //@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][0]" '"f"'
//@ is "$.index[*][?(@.name=='generics')].inner.function.decl.inputs[0][1].generic" '"F"' //@ is "$.index[*][?(@.name=='generics')].inner.function.sig.inputs[0][1].generic" '"F"'
pub fn generics<F: Foo>(f: F) {} pub fn generics<F: Foo>(f: F) {}
//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]" //@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.where_predicates" "[]"
//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[*]" 1 //@ count "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[*]" 1
//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"' //@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].name" '"impl Foo"'
//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo //@ is "$.index[*][?(@.name=='impl_trait')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $foo
//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.decl.inputs[0][0]" '"f"' //@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][0]" '"f"'
//@ count "$.index[*][?(@.name=='impl_trait')].inner.function.decl.inputs[0][1].impl_trait[*]" 1 //@ count "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[*]" 1
//@ is "$.index[*][?(@.name=='impl_trait')].inner.function.decl.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo //@ is "$.index[*][?(@.name=='impl_trait')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $foo
pub fn impl_trait(f: impl Foo) {} pub fn impl_trait(f: impl Foo) {}
//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[*]" 3 //@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[*]" 3
//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"' //@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].name" '"F"'
//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "synthetic": false}}' //@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "is_synthetic": false}}'
//@ count "$.index[*][?(@.name=='where_clase')].inner.function.decl.inputs[*]" 3 //@ count "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[*]" 3
//@ is "$.index[*][?(@.name=='where_clase')].inner.function.decl.inputs[0][0]" '"f"' //@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][0]" '"f"'
//@ is "$.index[*][?(@.name=='where_clase')].inner.function.decl.inputs[0][1].generic" '"F"' //@ is "$.index[*][?(@.name=='where_clase')].inner.function.sig.inputs[0][1].generic" '"F"'
//@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3 //@ count "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[*]" 3
//@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\" //@ is "$.index[*][?(@.name=='where_clase')].inner.function.generics.where_predicates[0].bound_predicate.type.generic" \"F\"

View file

@ -5,9 +5,9 @@
//@ set foo = "$.index[*][?(@.name=='Foo')].id" //@ set foo = "$.index[*][?(@.name=='Foo')].id"
pub trait Foo {} pub trait Foo {}
//@ is "$.index[*][?(@.name=='get_foo')].inner.function.decl.inputs" [] //@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.inputs" []
//@ count "$.index[*][?(@.name=='get_foo')].inner.function.decl.output.impl_trait[*]" 1 //@ count "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[*]" 1
//@ is "$.index[*][?(@.name=='get_foo')].inner.function.decl.output.impl_trait[0].trait_bound.trait.id" $foo //@ is "$.index[*][?(@.name=='get_foo')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $foo
pub fn get_foo() -> impl Foo { pub fn get_foo() -> impl Foo {
Fooer {} Fooer {}
} }

View file

@ -6,17 +6,17 @@ pub trait Wham {}
//@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" [] //@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.where_predicates" []
//@ count "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1 //@ count "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[*]" 1
//@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"' //@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].name" '"T"'
//@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.synthetic" false //@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" false
//@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id //@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
//@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.decl.inputs" '[["w", {"generic": "T"}]]' //@ is "$.index[*][?(@.name=='one_generic_param_fn')].inner.function.sig.inputs" '[["w", {"generic": "T"}]]'
pub fn one_generic_param_fn<T: Wham>(w: T) {} pub fn one_generic_param_fn<T: Wham>(w: T) {}
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" [] //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.where_predicates" []
//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1 //@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[*]" 1
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"' //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].name" '"impl Wham"'
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.synthetic" true //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.is_synthetic" true
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $wham_id
//@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.decl.inputs[0][0]" '"w"' //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][0]" '"w"'
//@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.decl.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id //@ is "$.index[*][?(@.name=='one_synthetic_generic_param_fn')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $wham_id
pub fn one_synthetic_generic_param_fn(w: impl Wham) {} pub fn one_synthetic_generic_param_fn(w: impl Wham) {}

View file

@ -1,7 +1,7 @@
//@ is "$.index[*][?(@.name=='fst')].inner.function.decl.inputs[0][0]" '"(x, _)"' //@ is "$.index[*][?(@.name=='fst')].inner.function.sig.inputs[0][0]" '"(x, _)"'
pub fn fst<X, Y>((x, _): (X, Y)) -> X { pub fn fst<X, Y>((x, _): (X, Y)) -> X {
x x
} }
//@ is "$.index[*][?(@.name=='drop_int')].inner.function.decl.inputs[0][0]" '"_"' //@ is "$.index[*][?(@.name=='drop_int')].inner.function.sig.inputs[0][0]" '"_"'
pub fn drop_int(_: i32) {} pub fn drop_int(_: i32) {}

View file

@ -1,33 +1,33 @@
//@ edition:2018 //@ edition:2018
//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='nothing_fn')].inner.function.header.is_unsafe" false
pub fn nothing_fn() {} pub fn nothing_fn() {}
//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='unsafe_fn')].inner.function.header.is_unsafe" true
pub unsafe fn unsafe_fn() {} pub unsafe fn unsafe_fn() {}
//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.const" true //@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_const" true
//@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='const_fn')].inner.function.header.is_unsafe" false
pub const fn const_fn() {} pub const fn const_fn() {}
//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_async" true
//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='async_fn')].inner.function.header.is_unsafe" false
pub async fn async_fn() {} pub async fn async_fn() {}
//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_async" true
//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='async_unsafe_fn')].inner.function.header.is_unsafe" true
pub async unsafe fn async_unsafe_fn() {} pub async unsafe fn async_unsafe_fn() {}
//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.const" true //@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_const" true
//@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='const_unsafe_fn')].inner.function.header.is_unsafe" true
pub const unsafe fn const_unsafe_fn() {} pub const unsafe fn const_unsafe_fn() {}
// It's impossible for a function to be both const and async, so no test for that // It's impossible for a function to be both const and async, so no test for that

View file

@ -3,7 +3,7 @@
///@ set foo = "$.index[*][?(@.name=='Foo')].id" ///@ set foo = "$.index[*][?(@.name=='Foo')].id"
pub type Foo = i32; pub type Foo = i32;
//@ is "$.index[*][?(@.name=='demo')].inner.function.decl.output.resolved_path.id" $foo //@ is "$.index[*][?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
pub fn demo() -> Foo { pub fn demo() -> Foo {
42 42
} }

View file

@ -13,10 +13,10 @@ pub trait LendingIterator {
where where
Self: 'a; Self: 'a;
//@ count "$.index[*][?(@.name=='lending_next')].inner.function.decl.output.qualified_path.args.angle_bracketed.args[*]" 1 //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 1
//@ count "$.index[*][?(@.name=='lending_next')].inner.function.decl.output.qualified_path.args.angle_bracketed.bindings[*]" 0 //@ count "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
//@ is "$.index[*][?(@.name=='lending_next')].inner.function.decl.output.qualified_path.self_type.generic" \"Self\" //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
//@ is "$.index[*][?(@.name=='lending_next')].inner.function.decl.output.qualified_path.name" \"LendingItem\" //@ is "$.index[*][?(@.name=='lending_next')].inner.function.sig.output.qualified_path.name" \"LendingItem\"
fn lending_next<'a>(&'a self) -> Self::LendingItem<'a>; fn lending_next<'a>(&'a self) -> Self::LendingItem<'a>;
} }
@ -26,9 +26,9 @@ pub trait Iterator {
//@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.bounds[*]" 1 //@ count "$.index[*][?(@.name=='Item')].inner.assoc_type.bounds[*]" 1
type Item: Display; type Item: Display;
//@ count "$.index[*][?(@.name=='next')].inner.function.decl.output.qualified_path.args.angle_bracketed.args[*]" 0 //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.args[*]" 0
//@ count "$.index[*][?(@.name=='next')].inner.function.decl.output.qualified_path.args.angle_bracketed.bindings[*]" 0 //@ count "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.args.angle_bracketed.bindings[*]" 0
//@ is "$.index[*][?(@.name=='next')].inner.function.decl.output.qualified_path.self_type.generic" \"Self\" //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.self_type.generic" \"Self\"
//@ is "$.index[*][?(@.name=='next')].inner.function.decl.output.qualified_path.name" \"Item\" //@ is "$.index[*][?(@.name=='next')].inner.function.sig.output.qualified_path.name" \"Item\"
fn next<'a>(&'a self) -> Self::Item; fn next<'a>(&'a self) -> Self::Item;
} }

View file

@ -3,7 +3,7 @@
#![no_std] #![no_std]
//@ has "$.index[*][?(@.name=='glob')]" //@ has "$.index[*][?(@.name=='glob')]"
//@ has "$.index[*][?(@.inner.import)].inner.import.name" \"*\" //@ has "$.index[*][?(@.inner.use)].inner.use.name" \"*\"
mod m1 { mod m1 {
pub fn f() {} pub fn f() {}

View file

@ -9,11 +9,11 @@ impl IntoIterator for AlwaysTrue {
/// type Item /// type Item
type Item = bool; type Item = bool;
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[*]' 1 //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[*]' 1
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.name' '"Iterator"' //@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.name' '"Iterator"'
//@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[*]' 1 //@ count '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[*]' 1
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].name' '"Item"' //@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].name' '"Item"'
//@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.default.impl_trait[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type.primitive' '"bool"' //@ is '$.index[*][?(@.docs=="type IntoIter")].inner.assoc_type.type.impl_trait[0].trait_bound.trait.args.angle_bracketed.constraints[0].binding.equality.type.primitive' '"bool"'
//@ set IntoIter = '$.index[*][?(@.docs=="type IntoIter")].id' //@ set IntoIter = '$.index[*][?(@.docs=="type IntoIter")].id'
/// type IntoIter /// type IntoIter

View file

@ -1,4 +1,4 @@
//@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[0]" \"\'a\" //@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[0]" \"\'a\"
//@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[1]" \"T\" //@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[1]" \"T\"
//@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[2]" \"N\" //@ is "$.index[*][?(@.name=='hello')].inner.function.sig.output.impl_trait[1].use[2]" \"N\"
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}

View file

@ -18,5 +18,5 @@ impl Foo {
//@ is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]" //@ is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
//@ is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]" //@ is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
// is "$.index[*][?(@.inner.impl.synthetic==true)].span" null // is "$.index[*][?(@.inner.impl.is_synthetic==true)].span" null
pub struct Foo; pub struct Foo;

View file

@ -3,7 +3,7 @@ extern crate foreign_trait;
/// ForeignTrait id hack /// ForeignTrait id hack
pub use foreign_trait::ForeignTrait as _; pub use foreign_trait::ForeignTrait as _;
//@ set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.import.id" //@ set ForeignTrait = "$.index[*][?(@.docs=='ForeignTrait id hack')].inner.use.id"
pub struct LocalStruct; pub struct LocalStruct;
//@ set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id" //@ set LocalStruct = "$.index[*][?(@.name=='LocalStruct')].id"

View file

@ -11,10 +11,10 @@ mod bar {
} }
} }
//@ set import = "$.index[*][?(@.inner.import)].id" //@ set import = "$.index[*][?(@.inner.use)].id"
pub use bar::Baz; pub use bar::Baz;
//@ is "$.index[*].inner.module.items[*]" $import //@ is "$.index[*].inner.module.items[*]" $import
//@ is "$.index[*].inner.import.id" $baz //@ is "$.index[*].inner.use.id" $baz
//@ has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl //@ has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
//@ is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit //@ is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit

View file

@ -3,7 +3,7 @@ extern crate foreign_struct;
/// ForeignStruct id hack /// ForeignStruct id hack
pub use foreign_struct::ForeignStruct as _; pub use foreign_struct::ForeignStruct as _;
//@ set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.import.id" //@ set ForeignStruct = "$.index[*][?(@.docs=='ForeignStruct id hack')].inner.use.id"
pub trait LocalTrait {} pub trait LocalTrait {}
//@ set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id" //@ set LocalTrait = "$.index[*][?(@.name=='LocalTrait')].id"

View file

@ -6,21 +6,21 @@
//@ count "$.index[*][?(@.name=='longest')].inner.function.generics.params[*]" 1 //@ count "$.index[*][?(@.name=='longest')].inner.function.generics.params[*]" 1
//@ is "$.index[*][?(@.name=='longest')].inner.function.generics.where_predicates" [] //@ is "$.index[*][?(@.name=='longest')].inner.function.generics.where_predicates" []
//@ count "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[*]" 2 //@ count "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[*]" 2
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[0][0]" '"l"' //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][0]" '"l"'
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[1][0]" '"r"' //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][0]" '"r"'
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[0][1].borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[0][1].borrowed_ref.mutable" false //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[0][1].borrowed_ref.type.primitive" \"str\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[0][1].borrowed_ref.type.primitive" \"str\"
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[1][1].borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[1][1].borrowed_ref.mutable" false //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.is_mutable" false
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.inputs[1][1].borrowed_ref.type.primitive" \"str\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.inputs[1][1].borrowed_ref.type.primitive" \"str\"
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.mutable" false //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.is_mutable" false
//@ is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\" //@ is "$.index[*][?(@.name=='longest')].inner.function.sig.output.borrowed_ref.type.primitive" \"str\"
pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str { pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
if l.len() > r.len() { l } else { r } if l.len() > r.len() { l } else { r }

View file

@ -10,9 +10,9 @@
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.default" null
//@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1 //@ count "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[*]" 1
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\" //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.params[2].kind.type.bounds[0].outlives" \"\'b\"
//@ is "$.index[*][?(@.name=='foo')].inner.function.decl.inputs[0][1].borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='foo')].inner.function.decl.inputs[0][1].borrowed_ref.mutable" false //@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable" false
//@ is "$.index[*][?(@.name=='foo')].inner.function.decl.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\" //@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.lifetime" \"\'b\"
//@ is "$.index[*][?(@.name=='foo')].inner.function.decl.inputs[0][1].borrowed_ref.type.borrowed_ref.mutable" false //@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.is_mutable" false
//@ is "$.index[*][?(@.name=='foo')].inner.function.decl.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\" //@ is "$.index[*][?(@.name=='foo')].inner.function.sig.inputs[0][1].borrowed_ref.type.borrowed_ref.type.generic" \"T\"
pub fn foo<'a, 'b: 'a, T: 'b>(_: &'a &'b T) {} pub fn foo<'a, 'b: 'a, T: 'b>(_: &'a &'b T) {}

View file

@ -3,34 +3,34 @@
pub struct Foo; pub struct Foo;
impl Foo { impl Foo {
//@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.const" true //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_const" true
//@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='const_meth')].inner.function.header.is_unsafe" false
pub const fn const_meth() {} pub const fn const_meth() {}
//@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='nothing_meth')].inner.function.header.is_unsafe" false
pub fn nothing_meth() {} pub fn nothing_meth() {}
//@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='unsafe_meth')].inner.function.header.is_unsafe" true
pub unsafe fn unsafe_meth() {} pub unsafe fn unsafe_meth() {}
//@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_async" true
//@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.unsafe" false //@ is "$.index[*][?(@.name=='async_meth')].inner.function.header.is_unsafe" false
pub async fn async_meth() {} pub async fn async_meth() {}
//@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.async" true //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_async" true
//@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.const" false //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_const" false
//@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='async_unsafe_meth')].inner.function.header.is_unsafe" true
pub async unsafe fn async_unsafe_meth() {} pub async unsafe fn async_unsafe_meth() {}
//@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.async" false //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_async" false
//@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.const" true //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_const" true
//@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.unsafe" true //@ is "$.index[*][?(@.name=='const_unsafe_meth')].inner.function.header.is_unsafe" true
pub const unsafe fn const_unsafe_meth() {} pub const unsafe fn const_unsafe_meth() {}
// It's impossible for a method to be both const and async, so no test for that // It's impossible for a method to be both const and async, so no test for that

View file

@ -22,11 +22,11 @@ pub mod l1 {
//@ ismany "$.index[*][?(@.name=='l3')].inner.module.items[*]" $l4_id //@ ismany "$.index[*][?(@.name=='l3')].inner.module.items[*]" $l4_id
pub struct L4; pub struct L4;
} }
//@ is "$.index[*][?(@.inner.import)].inner.import.glob" false //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
//@ is "$.index[*][?(@.inner.import)].inner.import.source" '"l3::L4"' //@ is "$.index[*][?(@.inner.use)].inner.use.source" '"l3::L4"'
//@ is "$.index[*][?(@.inner.import)].inner.import.glob" false //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" false
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $l4_id //@ is "$.index[*][?(@.inner.use)].inner.use.id" $l4_id
//@ set l4_use_id = "$.index[*][?(@.inner.import)].id" //@ set l4_use_id = "$.index[*][?(@.inner.use)].id"
pub use l3::L4; pub use l3::L4;
} }
//@ ismany "$.index[*][?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id //@ ismany "$.index[*][?(@.name=='l1')].inner.module.items[*]" $l3_id $l4_use_id

View file

@ -11,7 +11,7 @@ pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\" //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }' //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\" //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
//@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "synthetic": false } }' //@ is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "is_synthetic": false } }'
pub fn foo() pub fn foo()
where where
for<'a, T> &'a Wrapper<T>: Trait, for<'a, T> &'a Wrapper<T>: Trait,

View file

@ -13,7 +13,7 @@ mod usize {}
//@ !is "$.index[*][?(@.name=='checked_add')]" $local_crate_id //@ !is "$.index[*][?(@.name=='checked_add')]" $local_crate_id
//@ !has "$.index[*][?(@.name=='is_ascii_uppercase')]" //@ !has "$.index[*][?(@.name=='is_ascii_uppercase')]"
//@ is "$.index[*].inner.import[?(@.name=='my_i32')].id" null //@ is "$.index[*].inner.use[?(@.name=='my_i32')].id" null
pub use i32 as my_i32; pub use i32 as my_i32;
//@ is "$.index[*].inner.import[?(@.name=='u32')].id" null //@ is "$.index[*].inner.use[?(@.name=='u32')].id" null
pub use u32; pub use u32;

View file

@ -6,6 +6,6 @@ extern crate enum_with_discriminant;
pub use enum_with_discriminant::*; pub use enum_with_discriminant::*;
//@ !has '$.index[*][?(@.docs == "Should not be inlined")]' //@ !has '$.index[*][?(@.docs == "Should not be inlined")]'
//@ is '$.index[*][?(@.inner.import)].inner.import.name' \"enum_with_discriminant\" //@ is '$.index[*][?(@.inner.use)].inner.use.name' \"enum_with_discriminant\"
//@ set use = '$.index[*][?(@.inner.import)].id' //@ set use = '$.index[*][?(@.inner.use)].id'
//@ is '$.index[*][?(@.name == "extern_crate_glob")].inner.module.items[*]' $use //@ is '$.index[*][?(@.name == "extern_crate_glob")].inner.module.items[*]' $use

View file

@ -14,13 +14,13 @@ mod m2 {
} }
//@ set m1_use = "$.index[*][?(@.docs=='m1 re-export')].id" //@ set m1_use = "$.index[*][?(@.docs=='m1 re-export')].id"
//@ is "$.index[*].inner.import[?(@.name=='m1')].id" $m1 //@ is "$.index[*].inner.use[?(@.name=='m1')].id" $m1
//@ is "$.index[*].inner.import[?(@.name=='m1')].glob" true //@ is "$.index[*].inner.use[?(@.name=='m1')].is_glob" true
/// m1 re-export /// m1 re-export
pub use m1::*; pub use m1::*;
//@ set m2_use = "$.index[*][?(@.docs=='m2 re-export')].id" //@ set m2_use = "$.index[*][?(@.docs=='m2 re-export')].id"
//@ is "$.index[*].inner.import[?(@.name=='m2')].id" $m2 //@ is "$.index[*].inner.use[?(@.name=='m2')].id" $m2
//@ is "$.index[*].inner.import[?(@.name=='m2')].glob" true //@ is "$.index[*].inner.use[?(@.name=='m2')].is_glob" true
/// m2 re-export /// m2 re-export
pub use m2::*; pub use m2::*;

View file

@ -4,5 +4,5 @@
//@ set m1 = "$.index[*][?(@.name=='m1')].id" //@ set m1 = "$.index[*][?(@.name=='m1')].id"
mod m1 {} mod m1 {}
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $m1 //@ is "$.index[*][?(@.inner.use)].inner.use.id" $m1
pub use m1::*; pub use m1::*;

View file

@ -12,8 +12,8 @@ mod mod1 {
//@ set mod1_id = "$.index[*][?(@.name=='mod1')].id" //@ set mod1_id = "$.index[*][?(@.name=='mod1')].id"
} }
//@ is "$.index[*][?(@.inner.import)].inner.import.glob" true //@ is "$.index[*][?(@.inner.use)].inner.use.is_glob" true
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $mod1_id //@ is "$.index[*][?(@.inner.use)].inner.use.id" $mod1_id
//@ set use_id = "$.index[*][?(@.inner.import)].id" //@ set use_id = "$.index[*][?(@.inner.use)].id"
//@ ismany "$.index[*][?(@.name=='glob_extern')].inner.module.items[*]" $use_id //@ ismany "$.index[*][?(@.name=='glob_extern')].inner.module.items[*]" $use_id
pub use mod1::*; pub use mod1::*;

View file

@ -12,7 +12,7 @@ mod mod1 {
} }
//@ set mod2_use_id = "$.index[*][?(@.docs=='Mod2 re-export')].id" //@ set mod2_use_id = "$.index[*][?(@.docs=='Mod2 re-export')].id"
//@ is "$.index[*][?(@.docs=='Mod2 re-export')].inner.import.name" \"mod2\" //@ is "$.index[*][?(@.docs=='Mod2 re-export')].inner.use.name" \"mod2\"
/// Mod2 re-export /// Mod2 re-export
pub use self::mod2::*; pub use self::mod2::*;
@ -23,7 +23,7 @@ mod mod1 {
} }
//@ set mod1_use_id = "$.index[*][?(@.docs=='Mod1 re-export')].id" //@ set mod1_use_id = "$.index[*][?(@.docs=='Mod1 re-export')].id"
//@ is "$.index[*][?(@.docs=='Mod1 re-export')].inner.import.name" \"mod1\" //@ is "$.index[*][?(@.docs=='Mod1 re-export')].inner.use.name" \"mod1\"
/// Mod1 re-export /// Mod1 re-export
pub use mod1::*; pub use mod1::*;

View file

@ -4,10 +4,10 @@ mod foo {
pub struct Foo; pub struct Foo;
} }
//@ has "$.index[*].inner[?(@.import.source=='foo::Foo')]" //@ has "$.index[*].inner[?(@.use.source=='foo::Foo')]"
pub use foo::Foo; pub use foo::Foo;
pub mod bar { pub mod bar {
//@ has "$.index[*].inner[?(@.import.source=='crate::foo::Foo')]" //@ has "$.index[*].inner[?(@.use.source=='crate::foo::Foo')]"
pub use crate::foo::Foo; pub use crate::foo::Foo;
} }

View file

@ -5,14 +5,14 @@ pub mod foo {
} }
//@ set root_import_id = "$.index[*][?(@.docs=='Outer re-export')].id" //@ set root_import_id = "$.index[*][?(@.docs=='Outer re-export')].id"
//@ is "$.index[*].inner[?(@.import.source=='foo::Bar')].import.id" $bar_id //@ is "$.index[*].inner[?(@.use.source=='foo::Bar')].use.id" $bar_id
//@ has "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id //@ has "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
/// Outer re-export /// Outer re-export
pub use foo::Bar; pub use foo::Bar;
pub mod baz { pub mod baz {
//@ set baz_import_id = "$.index[*][?(@.docs=='Inner re-export')].id" //@ set baz_import_id = "$.index[*][?(@.docs=='Inner re-export')].id"
//@ is "$.index[*].inner[?(@.import.source=='crate::foo::Bar')].import.id" $bar_id //@ is "$.index[*].inner[?(@.use.source=='crate::foo::Bar')].use.id" $bar_id
//@ ismany "$.index[*][?(@.name=='baz')].inner.module.items[*]" $baz_import_id //@ ismany "$.index[*][?(@.name=='baz')].inner.module.items[*]" $baz_import_id
/// Inner re-export /// Inner re-export
pub use crate::foo::Bar; pub use crate::foo::Bar;

View file

@ -7,5 +7,5 @@ mod m1 {
pub use m1::x; pub use m1::x;
//@ has "$.index[*][?(@.name=='x' && @.inner.function)]" //@ has "$.index[*][?(@.name=='x' && @.inner.function)]"
//@ has "$.index[*].inner[?(@.import.name=='x')].import.source" '"m1::x"' //@ has "$.index[*].inner[?(@.use.name=='x')].use.source" '"m1::x"'
//@ !has "$.index[*][?(@.name=='m1')]" //@ !has "$.index[*][?(@.name=='m1')]"

View file

@ -7,18 +7,18 @@
extern crate pub_struct as foo; extern crate pub_struct as foo;
#[doc(inline)] #[doc(inline)]
//@ set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id" //@ set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id"
//@ set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.import.id" //@ set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.use.id"
/// Hack A /// Hack A
pub use foo::Foo; pub use foo::Foo;
//@ set bar_id = "$.index[*][?(@.name=='bar')].id" //@ set bar_id = "$.index[*][?(@.name=='bar')].id"
pub mod bar { pub mod bar {
//@ is "$.index[*][?(@.docs=='Hack B')].inner.import.id" $foo_id //@ is "$.index[*][?(@.docs=='Hack B')].inner.use.id" $foo_id
//@ set bar_use_id = "$.index[*][?(@.docs=='Hack B')].id" //@ set bar_use_id = "$.index[*][?(@.docs=='Hack B')].id"
//@ ismany "$.index[*][?(@.name=='bar')].inner.module.items[*]" $bar_use_id //@ ismany "$.index[*][?(@.name=='bar')].inner.module.items[*]" $bar_use_id
/// Hack B /// Hack B
pub use foo::Foo; pub use foo::Foo;
} }
//@ ismany "$.index[*][?(@.inner.import)].id" $crate_use_id $bar_use_id //@ ismany "$.index[*][?(@.inner.use)].id" $crate_use_id $bar_use_id
//@ ismany "$.index[*][?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id //@ ismany "$.index[*][?(@.name=='private_twice_one_inline')].inner.module.items[*]" $bar_id $crate_use_id

View file

@ -9,13 +9,13 @@ mod style {
pub struct Color; pub struct Color;
} }
//@ is "$.index[*][?(@.docs=='First re-export')].inner.import.id" $color_struct_id //@ is "$.index[*][?(@.docs=='First re-export')].inner.use.id" $color_struct_id
//@ is "$.index[*][?(@.docs=='First re-export')].inner.import.name" \"Color\" //@ is "$.index[*][?(@.docs=='First re-export')].inner.use.name" \"Color\"
//@ set color_export_id = "$.index[*][?(@.docs=='First re-export')].id" //@ set color_export_id = "$.index[*][?(@.docs=='First re-export')].id"
/// First re-export /// First re-export
pub use style::Color; pub use style::Color;
//@ is "$.index[*][?(@.docs=='Second re-export')].inner.import.id" $color_struct_id //@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.id" $color_struct_id
//@ is "$.index[*][?(@.docs=='Second re-export')].inner.import.name" \"Colour\" //@ is "$.index[*][?(@.docs=='Second re-export')].inner.use.name" \"Colour\"
//@ set colour_export_id = "$.index[*][?(@.docs=='Second re-export')].id" //@ set colour_export_id = "$.index[*][?(@.docs=='Second re-export')].id"
/// Second re-export /// Second re-export
pub use style::Color as Colour; pub use style::Color as Colour;

View file

@ -1,6 +1,6 @@
//@ compile-flags: --document-hidden-items //@ compile-flags: --document-hidden-items
//@ has "$.index[*].inner[?(@.import.name=='UsedHidden')]" //@ has "$.index[*].inner[?(@.use.name=='UsedHidden')]"
//@ has "$.index[*][?(@.name=='Hidden')]" //@ has "$.index[*][?(@.name=='Hidden')]"
pub mod submodule { pub mod submodule {
#[doc(hidden)] #[doc(hidden)]

View file

@ -6,5 +6,5 @@ mod inner {
pub struct Public; pub struct Public;
} }
//@ is "$.index[*][?(@.inner.import)].inner.import.name" \"NewName\" //@ is "$.index[*][?(@.inner.use)].inner.use.name" \"NewName\"
pub use inner::Public as NewName; pub use inner::Public as NewName;

View file

@ -7,8 +7,8 @@ pub mod inner {
pub struct Public; pub struct Public;
} }
//@ set import_id = "$.index[*][?(@.docs=='Re-export')].id" //@ set import_id = "$.index[*][?(@.docs=='Re-export')].id"
//@ !has "$.index[*].inner[?(@.import.name=='Public')]" //@ !has "$.index[*].inner[?(@.use.name=='Public')]"
//@ is "$.index[*].inner[?(@.import.name=='NewName')].import.source" \"inner::Public\" //@ is "$.index[*].inner[?(@.use.name=='NewName')].use.source" \"inner::Public\"
/// Re-export /// Re-export
pub use inner::Public as NewName; pub use inner::Public as NewName;

View file

@ -13,10 +13,10 @@ pub mod nested {
pub fn Foo() {} pub fn Foo() {}
} }
//@ ismany "$.index[*].inner[?(@.import.name == 'Foo')].import.id" $foo_fn $foo_struct //@ ismany "$.index[*].inner[?(@.use.name == 'Foo')].use.id" $foo_fn $foo_struct
//@ ismany "$.index[*].inner[?(@.import.name == 'Bar')].import.id" $foo_fn $foo_struct //@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
//@ count "$.index[*].inner[?(@.import.name == 'Foo')]" 2 //@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
pub use nested::Foo; pub use nested::Foo;
//@ count "$.index[*].inner[?(@.import.name == 'Bar')]" 2 //@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
pub use Foo as Bar; pub use Foo as Bar;

View file

@ -10,11 +10,11 @@ mod inner {
} }
//@ set export_id = "$.index[*][?(@.docs=='First re-export')].id" //@ set export_id = "$.index[*][?(@.docs=='First re-export')].id"
//@ is "$.index[*].inner[?(@.import.name=='Trait')].import.id" $trait_id //@ is "$.index[*].inner[?(@.use.name=='Trait')].use.id" $trait_id
/// First re-export /// First re-export
pub use inner::Trait; pub use inner::Trait;
//@ set reexport_id = "$.index[*][?(@.docs=='Second re-export')].id" //@ set reexport_id = "$.index[*][?(@.docs=='Second re-export')].id"
//@ is "$.index[*].inner[?(@.import.name=='Reexport')].import.id" $trait_id //@ is "$.index[*].inner[?(@.use.name=='Reexport')].use.id" $trait_id
/// Second re-export /// Second re-export
pub use inner::Trait as Reexport; pub use inner::Trait as Reexport;

View file

@ -6,9 +6,9 @@ mod inner {
pub struct Public; pub struct Public;
} }
//@ is "$.index[*][?(@.inner.import)].inner.import.name" \"Public\" //@ is "$.index[*][?(@.inner.use)].inner.use.name" \"Public\"
//@ is "$.index[*][?(@.inner.import)].inner.import.id" $pub_id //@ is "$.index[*][?(@.inner.use)].inner.use.id" $pub_id
//@ set use_id = "$.index[*][?(@.inner.import)].id" //@ set use_id = "$.index[*][?(@.inner.use)].id"
pub use inner::Public; pub use inner::Public;
//@ ismany "$.index[*][?(@.name=='simple_private')].inner.module.items[*]" $use_id //@ ismany "$.index[*][?(@.name=='simple_private')].inner.module.items[*]" $use_id

View file

@ -9,7 +9,7 @@ pub mod inner {
} }
//@ set import_id = "$.index[*][?(@.docs=='Outer')].id" //@ set import_id = "$.index[*][?(@.docs=='Outer')].id"
//@ is "$.index[*][?(@.docs=='Outer')].inner.import.source" \"inner::Public\" //@ is "$.index[*][?(@.docs=='Outer')].inner.use.source" \"inner::Public\"
/// Outer /// Outer
pub use inner::Public; pub use inner::Public;

View file

@ -6,7 +6,7 @@ mod secret {
} }
//@ has "$.index[*][?(@.name=='get_secret')].inner.function" //@ has "$.index[*][?(@.name=='get_secret')].inner.function"
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.decl.output.resolved_path.name" \"secret::Secret\" //@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.name" \"secret::Secret\"
pub fn get_secret() -> secret::Secret { pub fn get_secret() -> secret::Secret {
secret::Secret secret::Secret
} }

View file

@ -8,4 +8,4 @@ pub struct Demo {
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[1]" $y
//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2 //@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 2
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields_stripped" false //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" false

View file

@ -8,4 +8,4 @@ pub struct Demo {
//@ !has "$.index[*][?(@.name=='y')].id" //@ !has "$.index[*][?(@.name=='y')].id"
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1 //@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields_stripped" true //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true

View file

@ -1,5 +1,5 @@
//@ is "$.index[*][?(@.name=='PlainEmpty')].visibility" \"public\" //@ is "$.index[*][?(@.name=='PlainEmpty')].visibility" \"public\"
//@ has "$.index[*][?(@.name=='PlainEmpty')].inner.struct" //@ has "$.index[*][?(@.name=='PlainEmpty')].inner.struct"
//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields_stripped" false //@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.has_stripped_fields" false
//@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" [] //@ is "$.index[*][?(@.name=='PlainEmpty')].inner.struct.kind.plain.fields" []
pub struct PlainEmpty {} pub struct PlainEmpty {}

View file

@ -6,4 +6,4 @@ pub struct Demo {
//@ set x = "$.index[*][?(@.name=='x')].id" //@ set x = "$.index[*][?(@.name=='x')].id"
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[0]" $x
//@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1 //@ count "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields[*]" 1
//@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.fields_stripped" true //@ is "$.index[*][?(@.name=='Demo')].inner.struct.kind.plain.has_stripped_fields" true

View file

@ -6,7 +6,7 @@ use std::collections::HashMap;
//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" [] //@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[0].kind.type.bounds" []
//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\" //@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].name" \"U\"
//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" [] //@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.generics.params[1].kind.type.bounds" []
//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.fields_stripped" true //@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.has_stripped_fields" true
//@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" [] //@ is "$.index[*][?(@.name=='WithGenerics')].inner.struct.kind.plain.fields" []
pub struct WithGenerics<T, U> { pub struct WithGenerics<T, U> {
stuff: Vec<T>, stuff: Vec<T>,

View file

@ -4,7 +4,7 @@
//@ has "$.index[*][?(@.name=='WithPrimitives')].inner.struct" //@ has "$.index[*][?(@.name=='WithPrimitives')].inner.struct"
//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\" //@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].name" \"\'a\"
//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" [] //@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.generics.params[0].kind.lifetime.outlives" []
//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields_stripped" true //@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.has_stripped_fields" true
//@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" [] //@ is "$.index[*][?(@.name=='WithPrimitives')].inner.struct.kind.plain.fields" []
pub struct WithPrimitives<'a> { pub struct WithPrimitives<'a> {
num: u32, num: u32,

View file

@ -7,12 +7,12 @@
//@ is "$.index[*][?(@.name=='StrLike')].span.filename" $FILE //@ is "$.index[*][?(@.name=='StrLike')].span.filename" $FILE
pub trait StrLike = AsRef<str>; pub trait StrLike = AsRef<str>;
//@ is "$.index[*][?(@.name=='f')].inner.function.decl.output.impl_trait[0].trait_bound.trait.id" $StrLike //@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
pub fn f() -> impl StrLike { pub fn f() -> impl StrLike {
"heya" "heya"
} }
//@ !is "$.index[*][?(@.name=='g')].inner.function.decl.output.impl_trait[0].trait_bound.trait.id" $StrLike //@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.impl_trait[0].trait_bound.trait.id" $StrLike
pub fn g() -> impl AsRef<str> { pub fn g() -> impl AsRef<str> {
"heya" "heya"
} }

View file

@ -9,29 +9,29 @@ pub struct Foo;
// Each assertion matches 3 times, and should be the same each time. // Each assertion matches 3 times, and should be the same each time.
impl Foo { impl Foo {
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"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.decl.inputs[0][1].borrowed_ref.lifetime' null null null //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' null null null
//@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][1].borrowed_ref.mutable' false false false //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
pub fn by_ref(&self) {} pub fn by_ref(&self) {}
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
//@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"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.decl.inputs[0][1].borrowed_ref.lifetime' null null null //@ 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.decl.inputs[0][1].borrowed_ref.mutable' true true true //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' true true true
pub fn by_exclusive_ref(&mut self) {} pub fn by_exclusive_ref(&mut self) {}
//@ ismany '$.index[*][?(@.name=="by_value")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
//@ ismany '$.index[*][?(@.name=="by_value")].inner.function.decl.inputs[0][1].generic' '"Self"' '"Self"' '"Self"' //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.sig.inputs[0][1].generic' '"Self"' '"Self"' '"Self"'
pub fn by_value(self) {} pub fn by_value(self) {}
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][0]' '"self"' '"self"' '"self"'
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"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.decl.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\" //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\"
//@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][1].borrowed_ref.mutable' false false false //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.sig.inputs[0][1].borrowed_ref.is_mutable' false false false
pub fn with_lifetime<'a>(&'a self) {} pub fn with_lifetime<'a>(&'a self) {}
//@ ismany '$.index[*][?(@.name=="build")].inner.function.decl.output.generic' '"Self"' '"Self"' '"Self"' //@ ismany '$.index[*][?(@.name=="build")].inner.function.sig.output.generic' '"Self"' '"Self"' '"Self"'
pub fn build() -> Self { pub fn build() -> Self {
Self Self
} }

View file

@ -19,8 +19,8 @@ pub struct Struct;
impl Orig<i32> for Struct {} impl Orig<i32> for Struct {}
//@ has "$.index[*][?(@.name=='takes_alias')].inner.function.decl.inputs[0][1].impl_trait" //@ has "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait"
//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.decl.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias //@ is "$.index[*][?(@.name=='takes_alias')].inner.function.sig.inputs[0][1].impl_trait[0].trait_bound.trait.id" $Alias
//@ is "$.index[*][?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias //@ is "$.index[*][?(@.name=='takes_alias')].inner.function.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias
pub fn takes_alias(_: impl Alias) {} pub fn takes_alias(_: impl Alias) {}
// FIXME: Should the trait be mentioned in both the decl and generics? // FIXME: Should the trait be mentioned in both the decl and generics?

View file

@ -11,7 +11,7 @@ use std::fmt::Debug;
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}' //@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.generics" '{"params": [], "where_predicates": []}'
//@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path" //@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path"
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.name" \"Box\" //@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.name" \"Box\"
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.bindings" [] //@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
//@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1 //@ count "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args" 1
//@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait" //@ has "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait"
//@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\" //@ is "$.index[*][?(@.name=='SyncIntGen')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.dyn_trait.lifetime" \"\'static\"
@ -28,7 +28,7 @@ pub type SyncIntGen = Box<dyn Fn() -> i32 + Send + Sync + 'static>;
//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias" //@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias"
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}' //@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.generics" '{"params": [{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"}],"where_predicates": []}'
//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref" //@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref"
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.mutable" 'false' //@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.is_mutable" 'false'
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\"" //@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.lifetime" "\"'a\""
//@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait" //@ has "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait"
//@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null //@ is "$.index[*][?(@.name=='RefFn')].inner.type_alias.type.borrowed_ref.type.dyn_trait.lifetime" null

View file

@ -6,4 +6,4 @@ extern "C" {
} }
//@ is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"' //@ is "$.index[*][?(@.docs=='No inner information')].name" '"Foo"'
//@ is "$.index[*][?(@.docs=='No inner information')].inner" \"foreign_type\" //@ is "$.index[*][?(@.docs=='No inner information')].inner" \"extern_type\"

View file

@ -7,9 +7,9 @@
//@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0 //@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.params[*].kind.lifetime.outlives[*]" 0
//@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0 //@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.generics.where_predicates[*]" 0
//@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0 //@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.generic_params[*]" 0
//@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='GenericFn')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
pub type GenericFn<'a> = fn(&'a i32) -> &'a i32; pub type GenericFn<'a> = fn(&'a i32) -> &'a i32;
@ -20,7 +20,7 @@ pub type GenericFn<'a> = fn(&'a i32) -> &'a i32;
//@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\" //@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].name" \"\'a\"
//@ has "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime" //@ has "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime"
//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0 //@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.generic_params[*].kind.lifetime.outlives[*]" 0
//@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.inputs[*][1].borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.inputs[*][1].borrowed_ref.lifetime" \"\'a\"
//@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.decl.output.borrowed_ref.lifetime" \"\'a\" //@ is "$.index[*][?(@.name=='ForAll')].inner.type_alias.type.function_pointer.sig.output.borrowed_ref.lifetime" \"\'a\"
pub type ForAll = for<'a> fn(&'a i32) -> &'a i32; pub type ForAll = for<'a> fn(&'a i32) -> &'a i32;

View file

@ -25,7 +25,7 @@ pub struct MyError {}
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path" //@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path"
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result //@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.id" $result
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.name" \"Result\" //@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.name" \"Result\"
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.bindings" [] //@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.constraints" []
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" //@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic"
//@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic" //@ has "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[1].type.generic"
//@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\" //@ is "$.index[*][?(@.name=='MyResult')].inner.type_alias.type.resolved_path.args.angle_bracketed.args[0].type.generic" \"T\"

View file

@ -12,10 +12,10 @@ where
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}' //@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}' //@ is "$.index[*][?(@.name=='dynfn')].inner.function.generics" '{"params": [], "where_predicates": []}'
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.decl.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null //@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.lifetime" null
//@ count "$.index[*][?(@.name=='dynfn')].inner.function.decl.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1 //@ count "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[*]" 1
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.decl.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]' //@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].generic_params" '[{"kind": {"lifetime": {"outlives": []}},"name": "'\''a"},{"kind": {"lifetime": {"outlives": []}},"name": "'\''b"}]'
//@ is "$.index[*][?(@.name=='dynfn')].inner.function.decl.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"' //@ is "$.index[*][?(@.name=='dynfn')].inner.function.sig.inputs[0][1].borrowed_ref.type.dyn_trait.traits[0].trait.name" '"Fn"'
pub fn dynfn(f: &dyn for<'a, 'b> Fn(&'a i32, &'b i32)) { pub fn dynfn(f: &dyn for<'a, 'b> Fn(&'a i32, &'b i32)) {
let zero = 0; let zero = 0;
f(&zero, &zero); f(&zero, &zero);

View file

@ -10,9 +10,9 @@ pub struct Owner;
pub fn create() -> Owner::Metadata { pub fn create() -> Owner::Metadata {
OwnerMetadata OwnerMetadata
} }
//@ is '$.index[*][?(@.name=="create")].inner.function.decl.output.qualified_path.name' '"Metadata"' //@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.name' '"Metadata"'
//@ is '$.index[*][?(@.name=="create")].inner.function.decl.output.qualified_path.trait' null //@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.trait' null
//@ is '$.index[*][?(@.name=="create")].inner.function.decl.output.qualified_path.self_type.resolved_path.id' $Owner //@ is '$.index[*][?(@.name=="create")].inner.function.sig.output.qualified_path.self_type.resolved_path.id' $Owner
/// impl /// impl
impl Owner { impl Owner {
@ -21,4 +21,4 @@ impl Owner {
} }
//@ set iat = '$.index[*][?(@.docs=="iat")].id' //@ set iat = '$.index[*][?(@.docs=="iat")].id'
//@ is '$.index[*][?(@.docs=="impl")].inner.impl.items[*]' $iat //@ is '$.index[*][?(@.docs=="impl")].inner.impl.items[*]' $iat
//@ is '$.index[*][?(@.docs=="iat")].inner.assoc_type.default.resolved_path.id' $OwnerMetadata //@ is '$.index[*][?(@.docs=="iat")].inner.assoc_type.type.resolved_path.id' $OwnerMetadata

View file

@ -5,14 +5,14 @@
//@ set Carrier = '$.index[*][?(@.name=="Carrier")].id' //@ set Carrier = '$.index[*][?(@.name=="Carrier")].id'
pub struct Carrier<'a>(&'a ()); pub struct Carrier<'a>(&'a ());
//@ count "$.index[*][?(@.name=='user')].inner.function.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='user')].inner.function.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='user')].inner.function.decl.inputs[0][0]" '"_"' //@ is "$.index[*][?(@.name=='user')].inner.function.sig.inputs[0][0]" '"_"'
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\" //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.generic_params[*].name' \""'b"\"
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.decl.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Carrier
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.decl.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\" //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].lifetime' \""'b"\"
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.decl.inputs[0][1].qualified_path.name' '"Focus"' //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.name' '"Focus"'
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.decl.inputs[0][1].qualified_path.trait' null //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.trait' null
//@ is '$.index[*][?(@.name=="user")].inner.function.decl.inputs[0][1].function_pointer.decl.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"' //@ is '$.index[*][?(@.name=="user")].inner.function.sig.inputs[0][1].function_pointer.sig.inputs[0][1].qualified_path.args.angle_bracketed.args[0].type.primitive' '"i32"'
pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {} pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
impl<'a> Carrier<'a> { impl<'a> Carrier<'a> {

View file

@ -5,12 +5,12 @@
//@ set Parametrized = '$.index[*][?(@.name=="Parametrized")].id' //@ set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
pub struct Parametrized<T>(T); pub struct Parametrized<T>(T);
//@ count "$.index[*][?(@.name=='test')].inner.function.decl.inputs[*]" 1 //@ count "$.index[*][?(@.name=='test')].inner.function.sig.inputs[*]" 1
//@ is "$.index[*][?(@.name=='test')].inner.function.decl.inputs[0][0]" '"_"' //@ is "$.index[*][?(@.name=='test')].inner.function.sig.inputs[0][0]" '"_"'
//@ is '$.index[*][?(@.name=="test")].inner.function.decl.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized //@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.id' $Parametrized
//@ is '$.index[*][?(@.name=="test")].inner.function.decl.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\" //@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.self_type.resolved_path.args.angle_bracketed.args[0].type.primitive' \"i32\"
//@ is '$.index[*][?(@.name=="test")].inner.function.decl.inputs[0][1].qualified_path.name' '"Proj"' //@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.name' '"Proj"'
//@ is '$.index[*][?(@.name=="test")].inner.function.decl.inputs[0][1].qualified_path.trait' null //@ is '$.index[*][?(@.name=="test")].inner.function.sig.inputs[0][1].qualified_path.trait' null
pub fn test(_: Parametrized<i32>::Proj) {} pub fn test(_: Parametrized<i32>::Proj) {}
/// param_bool /// param_bool

View file

@ -4,12 +4,12 @@
//@ is "$.index[*][?(@.name=='IntVec')].span.filename" $FILE //@ is "$.index[*][?(@.name=='IntVec')].span.filename" $FILE
pub type IntVec = Vec<u32>; pub type IntVec = Vec<u32>;
//@ is "$.index[*][?(@.name=='f')].inner.function.decl.output.resolved_path.id" $IntVec //@ is "$.index[*][?(@.name=='f')].inner.function.sig.output.resolved_path.id" $IntVec
pub fn f() -> IntVec { pub fn f() -> IntVec {
vec![0; 32] vec![0; 32]
} }
//@ !is "$.index[*][?(@.name=='g')].inner.function.decl.output.resolved_path.id" $IntVec //@ !is "$.index[*][?(@.name=='g')].inner.function.sig.output.resolved_path.id" $IntVec
pub fn g() -> Vec<u32> { pub fn g() -> Vec<u32> {
vec![0; 32] vec![0; 32]
} }

View file

@ -7,8 +7,8 @@ pub union Union {
float: f32, float: f32,
} }
//@ has "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path" //@ has "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path"
//@ is "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path.id" $Union //@ is "$.index[*][?(@.name=='make_int_union')].inner.function.sig.output.resolved_path.id" $Union
pub fn make_int_union(int: i32) -> Union { pub fn make_int_union(int: i32) -> Union {
Union { int } Union { int }
} }