Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tests/rustdoc-json/doc_hidden_failure.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98007>.

#![feature(no_core)]
#![no_core]

mod auto {
mod action_row {
pub struct ActionRowBuilder;
Expand Down
6 changes: 0 additions & 6 deletions tests/rustdoc-json/enums/field_hidden.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// 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=='UnexpectedEndTag')]"
// @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
Expand Down
6 changes: 0 additions & 6 deletions tests/rustdoc-json/enums/kind.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core, lang_items)]
#![no_core]

#[lang = "sized"]
trait Sized {}

pub enum Foo {
// @set Unit = "$.index[*][?(@.name=='Unit')].id"
// @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'
Expand Down
6 changes: 0 additions & 6 deletions tests/rustdoc-json/enums/tuple_fields_hidden.rs
Original file line number Diff line number Diff line change
@@ -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 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
// @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/enums/use_glob.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/104942>

#![feature(no_core)]
#![no_core]

// @set Color = "$.index[*][?(@.name == 'Color')].id"
pub enum Color {
Red,
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/enums/use_variant.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]

// @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id"
pub enum AlwaysNone {
// @set None = "$.index[*][?(@.name == 'None')].id"
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/fn_pointer/generics.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core)]
#![no_core]

// @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][1].borrowed_ref.lifetime" \"\'c\"
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/fns/extern_c_variadic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]

extern "C" {
// @is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false
pub fn not_variadic(_: i32);
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/fns/generic_args.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core)]
#![no_core]

// @set foo = "$.index[*][?(@.name=='Foo')].id"
pub trait Foo {}

Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/fns/generic_returns.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core)]
#![no_core]

// @count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2

// @set foo = "$.index[*][?(@.name=='Foo')].id"
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/fns/generics.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core)]
#![no_core]

// @set wham_id = "$.index[*][?(@.name=='Wham')].id"
pub trait Wham {}

Expand Down
9 changes: 0 additions & 9 deletions tests/rustdoc-json/generic-associated-types/gats.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// 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 LendingIterator {
Expand Down
3 changes: 0 additions & 3 deletions tests/rustdoc-json/glob_import.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// This is a regression test for <https://github.com/rust-lang/rust/issues/98003>.

#![feature(no_core)]
#![no_std]
#![no_core]

// @has "$.index[*][?(@.name=='glob')]"
// @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\"


mod m1 {
pub fn f() {}
}
Expand Down
7 changes: 1 addition & 6 deletions tests/rustdoc-json/impls/impl_item_visibility.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]

pub struct Foo;

/// impl Foo priv
Expand All @@ -9,18 +6,16 @@ impl Foo {
}
// @!has '$.index[*][?(@.docs=="impl Foo priv")]'


/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'


/// impl Foo hidden
impl Foo {
#[doc(hidden)]
pub fn __quazl(){}
pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
6 changes: 1 addition & 5 deletions tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// compile-flags: --document-hidden-items
#![feature(no_core)]
#![no_core]

pub struct Foo;

Expand All @@ -11,18 +9,16 @@ impl Foo {
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'


/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'


/// impl Foo hidden
impl Foo {
#[doc(hidden)]
pub fn __quazl(){}
pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// compile-flags: --document-private-items
#![feature(no_core)]
#![no_core]

pub struct Foo;

Expand All @@ -10,18 +8,16 @@ impl Foo {
}
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'


/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'


/// impl Foo hidden
impl Foo {
#[doc(hidden)]
pub fn __quazl(){}
pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
14 changes: 6 additions & 8 deletions tests/rustdoc-json/impls/import_from_private.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// https://github.com/rust-lang/rust/issues/100252

#![feature(no_core)]
#![no_core]

mod bar {
// @set baz = "$.index[*][?(@.inner.struct)].id"
// @set baz = "$.index[*][?(@.name == 'Baz')].id"
pub struct Baz;
// @set impl = "$.index[*][?(@.inner.impl)].id"
// @set impl = "$.index[*][?(@.docs == 'impl')].id"
/// impl
impl Baz {
// @set doit = "$.index[*][?(@.inner.function)].id"
// @set doit = "$.index[*][?(@.name == 'doit')].id"
pub fn doit() {}
}
}
Expand All @@ -18,5 +16,5 @@ pub use bar::Baz;

// @is "$.index[*].inner.module.items[*]" $import
// @is "$.index[*].inner.import.id" $baz
// @is "$.index[*].inner.struct.impls[*]" $impl
// @is "$.index[*].inner.impl.items[*]" $doit
// @has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
// @is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![feature(no_core)]
#![no_core]

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

/// Not Here
impl PubTrait for HiddenPubStruct {}
/// Here
impl PubTrait for NotHiddenPubStruct {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// compile-flags: --document-hidden-items

#![feature(no_core)]
#![no_core]

// @has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.inner.impl)]"
// @has "$.index[*][?(@.name=='PubTrait')]"
Expand Down
12 changes: 6 additions & 6 deletions tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
Original file line number Diff line number Diff line change
@@ -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')]"
pub trait PubTrait {}

#[doc(hidden)]
pub mod hidden {
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
pub struct HiddenPubStruct;

// @!has "$.index[*][?(@.docs == 'Not Here')]"
/// Not Here
impl crate::PubTrait for HiddenPubStruct {}
}

pub mod not_hidden {
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
pub struct NotHiddenPubStruct;

// @has "$.index[*][?(@.docs == 'Here')]"
/// Here
impl crate::PubTrait for NotHiddenPubStruct {}
}
5 changes: 1 addition & 4 deletions tests/rustdoc-json/impls/local_for_local.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![feature(no_core)]
#![no_core]

// @set struct = "$.index[*][?(@.name=='Struct')].id"
pub struct Struct;
// @set trait = "$.index[*][?(@.name=='Trait')].id"
Expand All @@ -9,7 +6,7 @@ pub trait Trait {}
/// impl
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[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
// @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
2 changes: 0 additions & 2 deletions tests/rustdoc-json/impls/local_for_local_primitive.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![feature(no_core)]
#![feature(rustc_attrs)]
#![no_core]

// @set Local = "$.index[*][?(@.name=='Local')].id"
pub trait Local {}
Expand Down
9 changes: 5 additions & 4 deletions tests/rustdoc-json/lifetime/longest.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// 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].kind" '{"lifetime": {"outlives": []}}'
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
Expand All @@ -26,5 +23,9 @@
// @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 {
if l.len() > r.len() { l } else { r }
if l.len() > r.len() {
l
} else {
r
}
}
3 changes: 0 additions & 3 deletions tests/rustdoc-json/lifetime/outlives.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// ignore-tidy-linelength

#![feature(no_core)]
#![no_core]

// @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.params[0].name" \"\'a\"
Expand Down
2 changes: 0 additions & 2 deletions tests/rustdoc-json/methods/abi.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// ignore-tidy-linelength

#![feature(abi_vectorcall)]
#![feature(no_core)]
#![no_core]

// @has "$.index[*][?(@.name=='Foo')]"
pub struct Foo;
Expand Down
11 changes: 1 addition & 10 deletions tests/rustdoc-json/non_lifetime_binders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
#![feature(non_lifetime_binders)]
#![allow(incomplete_features)]

#![no_core]
#![feature(lang_items, no_core)]

#[lang = "sized"]
pub trait Sized {}

pub trait Trait {}

#[lang = "phantom_data"]
struct PhantomData<T_>;

pub struct Wrapper<T_>(PhantomData<T_>);
pub struct Wrapper<T_>(std::marker::PhantomData<T_>);

// @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\"
Expand Down
6 changes: 1 addition & 5 deletions tests/rustdoc-json/primitives/primitive_overloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98006>.

#![feature(rustc_attrs)]
#![feature(no_core)]

#![no_core]

// @has "$.index[*][?(@.name=='usize')]"
// @has "$.index[*][?(@.name=='prim')]"

#[rustc_doc_primitive = "usize"]
/// This is the built-in type `usize`.
mod prim {
}
mod prim {}
3 changes: 0 additions & 3 deletions tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/100531>

#![feature(no_core)]
#![no_core]

#![crate_name = "export_extern_crate_as_self"]

// ignore-tidy-linelength
Expand Down
Loading
Loading