Rollup merge of #117679 - aDotInTheVoid:yes-core, r=GuillaumeGomez

tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`

See #117487 for motivation.

I've split it into three commits, depending on how much work it was to remove `#![no_core]`. The first is entirely mechanical, the second makes no logical changes but couldn't be done with find+replace, and the third required rewriting assertions no not depend on having `#![no_core]`. All of the interesting changes for review are in the third commit, so I recommend reviewing commit-by-commit.

After this, 3 tests still use `#![no_core]`:

- `./tests/rustdoc-json/primitives/primitive_impls.rs`. Uses impls on primitives, so needs to simulate core
- `./tests/rustdoc-json/primitives/local_primitive.rs`: Uses `rustc_doc_primitive`, so needs to simulate core
- `./tests/rustdoc-json/impls/auto.rs`: Uses auto traits, so needs to simulate core

But after this change, we only rely on the core-rustc boundary in tests that deliberately test those interactions.

r? ``@GuillaumeGomez``

Fixes #117487
This commit is contained in:
Guillaume Gomez 2023-11-08 17:14:36 +01:00 committed by GitHub
commit 5d00a5d936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 41 additions and 202 deletions

View File

@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98007>. // Regression test for <https://github.com/rust-lang/rust/issues/98007>.
#![feature(no_core)]
#![no_core]
mod auto { mod auto {
mod action_row { mod action_row {
pub struct ActionRowBuilder; pub struct ActionRowBuilder;

View File

@ -1,11 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/100529>. // Regression test for <https://github.com/rust-lang/rust/issues/100529>.
#![no_core]
#![feature(no_core, lang_items)]
#[lang = "sized"]
trait Sized {}
// @has "$.index[*][?(@.name=='ParseError')]" // @has "$.index[*][?(@.name=='ParseError')]"
// @has "$.index[*][?(@.name=='UnexpectedEndTag')]" // @has "$.index[*][?(@.name=='UnexpectedEndTag')]"
// @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null] // @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]

View File

@ -1,11 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core, lang_items)]
#![no_core]
#[lang = "sized"]
trait Sized {}
pub enum Foo { pub enum Foo {
// @set Unit = "$.index[*][?(@.name=='Unit')].id" // @set Unit = "$.index[*][?(@.name=='Unit')].id"
// @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"' // @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'

View File

@ -1,9 +1,3 @@
#![feature(no_core, lang_items)]
#![no_core]
#[lang = "sized"]
trait Sized {}
// @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id" // @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
// @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id" // @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
// @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id" // @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"

View File

@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/104942> // Regression test for <https://github.com/rust-lang/rust/issues/104942>
#![feature(no_core)]
#![no_core]
// @set Color = "$.index[*][?(@.name == 'Color')].id" // @set Color = "$.index[*][?(@.name == 'Color')].id"
pub enum Color { pub enum Color {
Red, Red,

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
// @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id" // @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id"
pub enum AlwaysNone { pub enum AlwaysNone {
// @set None = "$.index[*][?(@.name == 'None')].id" // @set None = "$.index[*][?(@.name == 'None')].id"

View File

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1 // @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.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.decl.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.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\"

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
extern "C" { extern "C" {
// @is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false // @is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false
pub fn not_variadic(_: i32); pub fn not_variadic(_: i32);

View File

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @set foo = "$.index[*][?(@.name=='Foo')].id" // @set foo = "$.index[*][?(@.name=='Foo')].id"
pub trait Foo {} pub trait Foo {}

View File

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2 // @count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2
// @set foo = "$.index[*][?(@.name=='Foo')].id" // @set foo = "$.index[*][?(@.name=='Foo')].id"

View File

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @set wham_id = "$.index[*][?(@.name=='Wham')].id" // @set wham_id = "$.index[*][?(@.name=='Wham')].id"
pub trait Wham {} pub trait Wham {}

View File

@ -1,14 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![no_core]
#![feature(lang_items, no_core, arbitrary_self_types)]
#[lang = "sized"]
pub trait Sized {}
#[lang = "receiver"]
pub trait Receiver {}
pub trait Display {} pub trait Display {}
pub trait LendingIterator { pub trait LendingIterator {

View File

@ -1,13 +1,10 @@
// This is a regression test for <https://github.com/rust-lang/rust/issues/98003>. // This is a regression test for <https://github.com/rust-lang/rust/issues/98003>.
#![feature(no_core)]
#![no_std] #![no_std]
#![no_core]
// @has "$.index[*][?(@.name=='glob')]" // @has "$.index[*][?(@.name=='glob')]"
// @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\" // @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\"
mod m1 { mod m1 {
pub fn f() {} pub fn f() {}
} }

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
pub struct Foo; pub struct Foo;
/// impl Foo priv /// impl Foo priv
@ -9,18 +6,16 @@ impl Foo {
} }
// @!has '$.index[*][?(@.docs=="impl Foo priv")]' // @!has '$.index[*][?(@.docs=="impl Foo priv")]'
/// impl Foo pub /// impl Foo pub
impl Foo { impl Foo {
pub fn qux() {} pub fn qux() {}
} }
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
/// impl Foo hidden /// impl Foo hidden
impl Foo { impl Foo {
#[doc(hidden)] #[doc(hidden)]
pub fn __quazl(){} pub fn __quazl() {}
} }
// FIXME(#111564): Is this the right behaviour? // FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'

View File

@ -1,6 +1,4 @@
// compile-flags: --document-hidden-items // compile-flags: --document-hidden-items
#![feature(no_core)]
#![no_core]
pub struct Foo; pub struct Foo;
@ -11,18 +9,16 @@ impl Foo {
// FIXME(#111564): Is this the right behaviour? // FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
/// impl Foo pub /// impl Foo pub
impl Foo { impl Foo {
pub fn qux() {} pub fn qux() {}
} }
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
/// impl Foo hidden /// impl Foo hidden
impl Foo { impl Foo {
#[doc(hidden)] #[doc(hidden)]
pub fn __quazl(){} pub fn __quazl() {}
} }
// FIXME(#111564): Is this the right behaviour? // FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'

View File

@ -1,6 +1,4 @@
// compile-flags: --document-private-items // compile-flags: --document-private-items
#![feature(no_core)]
#![no_core]
pub struct Foo; pub struct Foo;
@ -10,18 +8,16 @@ impl Foo {
} }
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
/// impl Foo pub /// impl Foo pub
impl Foo { impl Foo {
pub fn qux() {} pub fn qux() {}
} }
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
/// impl Foo hidden /// impl Foo hidden
impl Foo { impl Foo {
#[doc(hidden)] #[doc(hidden)]
pub fn __quazl(){} pub fn __quazl() {}
} }
// FIXME(#111564): Is this the right behaviour? // FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"' // @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'

View File

@ -1,14 +1,12 @@
// https://github.com/rust-lang/rust/issues/100252 // https://github.com/rust-lang/rust/issues/100252
#![feature(no_core)]
#![no_core]
mod bar { mod bar {
// @set baz = "$.index[*][?(@.inner.struct)].id" // @set baz = "$.index[*][?(@.name == 'Baz')].id"
pub struct Baz; pub struct Baz;
// @set impl = "$.index[*][?(@.inner.impl)].id" // @set impl = "$.index[*][?(@.docs == 'impl')].id"
/// impl
impl Baz { impl Baz {
// @set doit = "$.index[*][?(@.inner.function)].id" // @set doit = "$.index[*][?(@.name == 'doit')].id"
pub fn doit() {} pub fn doit() {}
} }
} }
@ -18,5 +16,5 @@ 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.import.id" $baz
// @is "$.index[*].inner.struct.impls[*]" $impl // @has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
// @is "$.index[*].inner.impl.items[*]" $doit // @is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit

View File

@ -1,7 +1,5 @@
#![feature(no_core)] // @has "$.index[*][?(@.docs=='Here')]"
#![no_core] // @!has "$.index[*][?(@.docs=='Not Here')]"
// @count "$.index[*][?(@.inner.impl)]" 1
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]" // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]" // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
// @has "$.index[*][?(@.name=='PubTrait')]" // @has "$.index[*][?(@.name=='PubTrait')]"
@ -11,5 +9,7 @@ pub trait PubTrait {}
pub struct HiddenPubStruct; pub struct HiddenPubStruct;
pub struct NotHiddenPubStruct; pub struct NotHiddenPubStruct;
/// Not Here
impl PubTrait for HiddenPubStruct {} impl PubTrait for HiddenPubStruct {}
/// Here
impl PubTrait for NotHiddenPubStruct {} impl PubTrait for NotHiddenPubStruct {}

View File

@ -1,8 +1,5 @@
// compile-flags: --document-hidden-items // compile-flags: --document-hidden-items
#![feature(no_core)]
#![no_core]
// @has "$.index[*][?(@.name == 'HiddenPubStruct')]" // @has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.inner.impl)]" // @has "$.index[*][?(@.inner.impl)]"
// @has "$.index[*][?(@.name=='PubTrait')]" // @has "$.index[*][?(@.name=='PubTrait')]"

View File

@ -1,21 +1,21 @@
#![feature(no_core)]
#![no_core]
// @count "$.index[*][?(@.inner.impl)]" 1
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
// @has "$.index[*][?(@.name=='PubTrait')]" // @has "$.index[*][?(@.name=='PubTrait')]"
pub trait PubTrait {} pub trait PubTrait {}
#[doc(hidden)] #[doc(hidden)]
pub mod hidden { pub mod hidden {
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
pub struct HiddenPubStruct; pub struct HiddenPubStruct;
// @!has "$.index[*][?(@.docs == 'Not Here')]"
/// Not Here
impl crate::PubTrait for HiddenPubStruct {} impl crate::PubTrait for HiddenPubStruct {}
} }
pub mod not_hidden { pub mod not_hidden {
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
pub struct NotHiddenPubStruct; pub struct NotHiddenPubStruct;
// @has "$.index[*][?(@.docs == 'Here')]"
/// Here
impl crate::PubTrait for NotHiddenPubStruct {} impl crate::PubTrait for NotHiddenPubStruct {}
} }

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
// @set struct = "$.index[*][?(@.name=='Struct')].id" // @set struct = "$.index[*][?(@.name=='Struct')].id"
pub struct Struct; pub struct Struct;
// @set trait = "$.index[*][?(@.name=='Trait')].id" // @set trait = "$.index[*][?(@.name=='Trait')].id"
@ -9,7 +6,7 @@ pub trait Trait {}
/// impl /// impl
impl Trait for Struct {} impl Trait for Struct {}
// @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl // @has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
// @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl // @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
// @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait // @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
// @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct // @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct

View File

@ -1,6 +1,4 @@
#![feature(no_core)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![no_core]
// @set Local = "$.index[*][?(@.name=='Local')].id" // @set Local = "$.index[*][?(@.name=='Local')].id"
pub trait Local {} pub trait Local {}

View File

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name" \"\'a\" // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name" \"\'a\"
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}' // @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
@ -26,5 +23,9 @@
// @is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\" // @is "$.index[*][?(@.name=='longest')].inner.function.decl.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

@ -1,8 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3 // @count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" [] // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" []
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\" // @is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"

View File

@ -1,8 +1,6 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(abi_vectorcall)] #![feature(abi_vectorcall)]
#![feature(no_core)]
#![no_core]
// @has "$.index[*][?(@.name=='Foo')]" // @has "$.index[*][?(@.name=='Foo')]"
pub struct Foo; pub struct Foo;

View File

@ -3,18 +3,9 @@
#![feature(non_lifetime_binders)] #![feature(non_lifetime_binders)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![no_core]
#![feature(lang_items, no_core)]
#[lang = "sized"]
pub trait Sized {}
pub trait Trait {} pub trait Trait {}
#[lang = "phantom_data"] pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
struct PhantomData<T_>;
pub struct Wrapper<T_>(PhantomData<T_>);
// @count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2 // @count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
// @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\"

View File

@ -3,14 +3,10 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98006>. // Regression test for <https://github.com/rust-lang/rust/issues/98006>.
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(no_core)]
#![no_core]
// @has "$.index[*][?(@.name=='usize')]" // @has "$.index[*][?(@.name=='usize')]"
// @has "$.index[*][?(@.name=='prim')]" // @has "$.index[*][?(@.name=='prim')]"
#[rustc_doc_primitive = "usize"] #[rustc_doc_primitive = "usize"]
/// This is the built-in type `usize`. /// This is the built-in type `usize`.
mod prim { mod prim {}
}

View File

@ -1,8 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/100531> //! Regression test for <https://github.com/rust-lang/rust/issues/100531>
#![feature(no_core)]
#![no_core]
#![crate_name = "export_extern_crate_as_self"] #![crate_name = "export_extern_crate_as_self"]
// ignore-tidy-linelength // ignore-tidy-linelength

View File

@ -1,8 +1,5 @@
// Regression test for https://github.com/rust-lang/rust/issues/100973 // Regression test for https://github.com/rust-lang/rust/issues/100973
#![feature(no_core)]
#![no_core]
// @set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id" // @set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id"
// @is "$.index[*][?(@.name == 'm1')].inner.module.items" [] // @is "$.index[*][?(@.name == 'm1')].inner.module.items" []
// @is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true // @is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
mod mod1 { mod mod1 {
extern "C" { extern "C" {

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
mod mod1 { mod mod1 {
// @is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true" // @is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true"

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
// @!has "$.index[*][?(@.name=='foo')]" // @!has "$.index[*][?(@.name=='foo')]"
mod foo { mod foo {
// @has "$.index[*][?(@.name=='Foo')]" // @has "$.index[*][?(@.name=='Foo')]"

View File

@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]
pub mod foo { pub mod foo {
// @set bar_id = "$.index[*][?(@.name=='Bar')].id" // @set bar_id = "$.index[*][?(@.name=='Bar')].id"
// @ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id // @ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @set repro_id = "$.index[*][?(@.name=='repro')].id" // @set repro_id = "$.index[*][?(@.name=='repro')].id"
#[macro_export] #[macro_export]
macro_rules! repro { macro_rules! repro {

View File

@ -1,8 +1,5 @@
// Regression test for https://github.com/rust-lang/rust/issues/101103 // Regression test for https://github.com/rust-lang/rust/issues/101103
#![feature(no_core)]
#![no_core]
mod m1 { mod m1 {
pub fn x() {} pub fn x() {}
} }

View File

@ -4,12 +4,8 @@
// Test for the ICE in https://github.com/rust-lang/rust/issues/83057 // Test for the ICE in https://github.com/rust-lang/rust/issues/83057
// An external type re-exported with different attributes shouldn't cause an error // An external type re-exported with different attributes shouldn't cause an error
#![no_core]
#![feature(no_core)]
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.import.id"
/// Hack A /// Hack A

View File

@ -3,9 +3,6 @@
// Test for the ICE in https://github.com/rust-lang/rust/issues/83720 // Test for the ICE in https://github.com/rust-lang/rust/issues/83720
// A pub-in-private type re-exported under two different names shouldn't cause an error // A pub-in-private type re-exported under two different names shouldn't cause an error
#![no_core]
#![feature(no_core)]
// @!has "$.index[*][?(@.name=='style')]" // @!has "$.index[*][?(@.name=='style')]"
mod style { mod style {
// @set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id" // @set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id"

View File

@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/106379> // Regression test for <https://github.com/rust-lang/rust/issues/106379>
#![feature(no_core)]
#![no_core]
mod repeat_n { mod repeat_n {
#[doc(hidden)] #[doc(hidden)]
pub struct RepeatN {} pub struct RepeatN {}

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @!has "$.index[*][?(@.name=='inner')]" // @!has "$.index[*][?(@.name=='inner')]"
mod inner { mod inner {
// @has "$.index[*][?(@.name=='Public')]" // @has "$.index[*][?(@.name=='Public')]"

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @set inner_id = "$.index[*][?(@.name=='inner')].id" // @set inner_id = "$.index[*][?(@.name=='inner')].id"
pub mod inner { pub mod inner {
// @set public_id = "$.index[*][?(@.name=='Public')].id" // @set public_id = "$.index[*][?(@.name=='Public')].id"

View File

@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/107677>. // Regression test for <https://github.com/rust-lang/rust/issues/107677>.
#![feature(no_core)]
#![no_core]
pub mod nested { pub mod nested {
// @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id" // @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id"

View File

@ -2,9 +2,7 @@
// Regression test for <https://github.com/rust-lang/rust/issues/97432>. // Regression test for <https://github.com/rust-lang/rust/issues/97432>.
#![feature(no_core)]
#![no_std] #![no_std]
#![no_core]
mod inner { mod inner {
// @set trait_id = "$.index[*][?(@.name=='Trait')].id" // @set trait_id = "$.index[*][?(@.name=='Trait')].id"

View File

@ -1,6 +1,4 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @!has "$.index[*][?(@.name=='inner')]" // @!has "$.index[*][?(@.name=='inner')]"
mod inner { mod inner {

View File

@ -1,8 +1,5 @@
// edition:2018 // edition:2018
#![no_core]
#![feature(no_core)]
// @set inner_id = "$.index[*][?(@.name=='inner')].id" // @set inner_id = "$.index[*][?(@.name=='inner')].id"
pub mod inner { pub mod inner {

View File

@ -1,9 +1,6 @@
// Regression test for <https://github.com/rust-lang/rust/issues/96161>. // Regression test for <https://github.com/rust-lang/rust/issues/96161>.
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
mod secret { mod secret {
pub struct Secret; pub struct Secret;
} }

View File

@ -1,6 +1,3 @@
#![no_core]
#![feature(no_core)]
// @!has "$.index[*][?(@.name=='no_pub_inner')]" // @!has "$.index[*][?(@.name=='no_pub_inner')]"
mod no_pub_inner { mod no_pub_inner {
fn priv_inner() {} fn priv_inner() {}

View File

@ -1,19 +1,18 @@
#![feature(no_core)]
#![no_core]
// @set wham = "$.index[*][?(@.name=='Wham')].id"
// @count "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" 1
// @set gmWham = "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]"
pub trait Wham {} pub trait Wham {}
// @count "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" 1
// @is "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[0]" $gmWham
// @set gm = "$.index[*][?(@.name=='Wham')].id"
// jsonpath_lib isnt expressive enough (for now) to get the "impl" item, so we
// just check it isn't pointing to the type, but when you port to jsondocck-ng
// check what the impl item is
// @!is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]" $gm
pub struct GeorgeMichael {} pub struct GeorgeMichael {}
/// Wham for George Michael
impl Wham for GeorgeMichael {} impl Wham for GeorgeMichael {}
// Find IDs.
// @set wham = "$.index[*][?(@.name=='Wham')].id"
// @set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id"
// @set gm = "$.index[*][?(@.name=='GeorgeMichael')].id"
// Both struct and trait point to impl.
// @has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
// @is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
// Impl points to both struct and trait.
// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm

View File

@ -1,9 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![no_core]
// @!has "$.index[*][?(@.name == 'sealed')]" // @!has "$.index[*][?(@.name == 'sealed')]"
mod sealed { mod sealed {
// @set sealed_id = "$.index[*][?(@.name=='Sealed')].id" // @set sealed_id = "$.index[*][?(@.name=='Sealed')].id"

View File

@ -1,9 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(no_core)]
#![feature(lang_items)]
#![no_core]
// @set loud_id = "$.index[*][?(@.name=='Loud')].id" // @set loud_id = "$.index[*][?(@.name=='Loud')].id"
pub trait Loud {} pub trait Loud {}

View File

@ -1,8 +1,6 @@
// ignore-tidy-linelength // ignore-tidy-linelength
#![feature(inherent_associated_types)] #![feature(inherent_associated_types)]
#![feature(no_core)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![no_core]
// @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id' // @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
pub struct OwnerMetadata; pub struct OwnerMetadata;