From f784fa7bd980916c235f5bd9bdbcf9389ea261f4 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Tue, 7 Nov 2023 16:36:55 +0000 Subject: [PATCH 1/3] tests/rustdoc-json: Remove some needless uses of `#![no_core]`. Done by removing all uses of `#![no_core]`, and the reverting the ones that failed. More involved ones are in a later commit. --- tests/rustdoc-json/doc_hidden_failure.rs | 3 --- tests/rustdoc-json/enums/use_glob.rs | 3 --- tests/rustdoc-json/enums/use_variant.rs | 3 --- tests/rustdoc-json/fn_pointer/generics.rs | 3 --- tests/rustdoc-json/fns/extern_c_variadic.rs | 3 --- tests/rustdoc-json/fns/generic_args.rs | 3 --- tests/rustdoc-json/fns/generic_returns.rs | 3 --- tests/rustdoc-json/fns/generics.rs | 3 --- tests/rustdoc-json/glob_import.rs | 3 --- tests/rustdoc-json/impls/impl_item_visibility.rs | 7 +------ .../impls/impl_item_visibility_show_hidden.rs | 6 +----- .../impls/impl_item_visibility_show_private.rs | 6 +----- .../impls/issue-112852-dangling-trait-impl-id-3.rs | 3 --- tests/rustdoc-json/impls/local_for_local_primitive.rs | 2 -- tests/rustdoc-json/lifetime/longest.rs | 9 +++++---- tests/rustdoc-json/lifetime/outlives.rs | 3 --- tests/rustdoc-json/methods/abi.rs | 2 -- tests/rustdoc-json/primitives/primitive_overloading.rs | 6 +----- .../rustdoc-json/reexport/export_extern_crate_as_self.rs | 3 --- tests/rustdoc-json/reexport/glob_collision.rs | 3 --- tests/rustdoc-json/reexport/glob_extern.rs | 3 --- tests/rustdoc-json/reexport/glob_private.rs | 3 --- tests/rustdoc-json/reexport/in_root_and_mod.rs | 3 --- tests/rustdoc-json/reexport/in_root_and_mod_pub.rs | 3 --- tests/rustdoc-json/reexport/macro.rs | 3 --- tests/rustdoc-json/reexport/mod_not_included.rs | 3 --- tests/rustdoc-json/reexport/private_twice_one_inline.rs | 4 ---- tests/rustdoc-json/reexport/private_two_names.rs | 3 --- tests/rustdoc-json/reexport/pub_use_doc_hidden.rs | 3 --- tests/rustdoc-json/reexport/rename_private.rs | 3 --- tests/rustdoc-json/reexport/rename_public.rs | 3 --- tests/rustdoc-json/reexport/same_name_different_types.rs | 3 --- .../reexport/same_type_reexported_more_than_once.rs | 2 -- tests/rustdoc-json/reexport/simple_private.rs | 2 -- tests/rustdoc-json/reexport/simple_public.rs | 3 --- tests/rustdoc-json/return_private.rs | 3 --- tests/rustdoc-json/stripped_modules.rs | 3 --- tests/rustdoc-json/traits/private_supertrait.rs | 4 ---- tests/rustdoc-json/traits/supertrait.rs | 2 -- tests/rustdoc-json/type/inherent_associated_type.rs | 2 -- 40 files changed, 9 insertions(+), 126 deletions(-) diff --git a/tests/rustdoc-json/doc_hidden_failure.rs b/tests/rustdoc-json/doc_hidden_failure.rs index 0d2c6b2209bd1..e2ce66c99e4c7 100644 --- a/tests/rustdoc-json/doc_hidden_failure.rs +++ b/tests/rustdoc-json/doc_hidden_failure.rs @@ -1,8 +1,5 @@ // Regression test for . -#![feature(no_core)] -#![no_core] - mod auto { mod action_row { pub struct ActionRowBuilder; diff --git a/tests/rustdoc-json/enums/use_glob.rs b/tests/rustdoc-json/enums/use_glob.rs index 49990ec53315f..bec89530b0524 100644 --- a/tests/rustdoc-json/enums/use_glob.rs +++ b/tests/rustdoc-json/enums/use_glob.rs @@ -1,8 +1,5 @@ // Regression test for -#![feature(no_core)] -#![no_core] - // @set Color = "$.index[*][?(@.name == 'Color')].id" pub enum Color { Red, diff --git a/tests/rustdoc-json/enums/use_variant.rs b/tests/rustdoc-json/enums/use_variant.rs index 8190e1cbe81d3..c7e0c21f1ef49 100644 --- a/tests/rustdoc-json/enums/use_variant.rs +++ b/tests/rustdoc-json/enums/use_variant.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id" pub enum AlwaysNone { // @set None = "$.index[*][?(@.name == 'None')].id" diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs index 3b82561ec7df2..8b3a8c0a74eb6 100644 --- a/tests/rustdoc-json/fn_pointer/generics.rs +++ b/tests/rustdoc-json/fn_pointer/generics.rs @@ -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\" diff --git a/tests/rustdoc-json/fns/extern_c_variadic.rs b/tests/rustdoc-json/fns/extern_c_variadic.rs index d6ea343b9911a..eef9ae99eb023 100644 --- a/tests/rustdoc-json/fns/extern_c_variadic.rs +++ b/tests/rustdoc-json/fns/extern_c_variadic.rs @@ -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); diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs index 539d17f831ebf..2f6cf3bf65a1d 100644 --- a/tests/rustdoc-json/fns/generic_args.rs +++ b/tests/rustdoc-json/fns/generic_args.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @set foo = "$.index[*][?(@.name=='Foo')].id" pub trait Foo {} diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs index 27d842066f4e2..8e82efef4beb1 100644 --- a/tests/rustdoc-json/fns/generic_returns.rs +++ b/tests/rustdoc-json/fns/generic_returns.rs @@ -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" diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs index 5239a6f21f534..44dc6d854aa3d 100644 --- a/tests/rustdoc-json/fns/generics.rs +++ b/tests/rustdoc-json/fns/generics.rs @@ -1,8 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - // @set wham_id = "$.index[*][?(@.name=='Wham')].id" pub trait Wham {} diff --git a/tests/rustdoc-json/glob_import.rs b/tests/rustdoc-json/glob_import.rs index f37ce0abb4144..7de1ed78f2ff0 100644 --- a/tests/rustdoc-json/glob_import.rs +++ b/tests/rustdoc-json/glob_import.rs @@ -1,13 +1,10 @@ // This is a regression test for . -#![feature(no_core)] #![no_std] -#![no_core] // @has "$.index[*][?(@.name=='glob')]" // @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\" - mod m1 { pub fn f() {} } diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs index efa54d91dcaac..d3c15cd23e448 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - pub struct Foo; /// impl Foo priv @@ -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"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs index 3c6fefc4ca29f..fa3a36df8563b 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs @@ -1,6 +1,4 @@ // compile-flags: --document-hidden-items -#![feature(no_core)] -#![no_core] pub struct Foo; @@ -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"' diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs index b98d1e4167ced..7c68a2412f36a 100644 --- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs +++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs @@ -1,6 +1,4 @@ // compile-flags: --document-private-items -#![feature(no_core)] -#![no_core] pub struct Foo; @@ -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"' diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs index fcd27ca4b7c57..836f1fe87da33 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs @@ -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')]" diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs index 769dd3f0a2c02..acc3a879fe1c9 100644 --- a/tests/rustdoc-json/impls/local_for_local_primitive.rs +++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs @@ -1,6 +1,4 @@ -#![feature(no_core)] #![feature(rustc_attrs)] -#![no_core] // @set Local = "$.index[*][?(@.name=='Local')].id" pub trait Local {} diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs index dc28258a8b674..419b0b4fcab11 100644 --- a/tests/rustdoc-json/lifetime/longest.rs +++ b/tests/rustdoc-json/lifetime/longest.rs @@ -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": []}}' @@ -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 + } } diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs index 6e105b382b001..549e4c200dca7 100644 --- a/tests/rustdoc-json/lifetime/outlives.rs +++ b/tests/rustdoc-json/lifetime/outlives.rs @@ -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\" diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs index b8279298c1e71..917e9e0790c9c 100644 --- a/tests/rustdoc-json/methods/abi.rs +++ b/tests/rustdoc-json/methods/abi.rs @@ -1,8 +1,6 @@ // ignore-tidy-linelength #![feature(abi_vectorcall)] -#![feature(no_core)] -#![no_core] // @has "$.index[*][?(@.name=='Foo')]" pub struct Foo; diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs index 81e0acdc6e93e..50e23fc06d3ea 100644 --- a/tests/rustdoc-json/primitives/primitive_overloading.rs +++ b/tests/rustdoc-json/primitives/primitive_overloading.rs @@ -3,14 +3,10 @@ // Regression test for . #![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 {} diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs index 37ca279b352ca..a8f5500d6297e 100644 --- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs +++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs @@ -1,8 +1,5 @@ //! Regression test for -#![feature(no_core)] -#![no_core] - #![crate_name = "export_extern_crate_as_self"] // ignore-tidy-linelength diff --git a/tests/rustdoc-json/reexport/glob_collision.rs b/tests/rustdoc-json/reexport/glob_collision.rs index dee35ba78dc45..9a75f4c0cf38f 100644 --- a/tests/rustdoc-json/reexport/glob_collision.rs +++ b/tests/rustdoc-json/reexport/glob_collision.rs @@ -1,8 +1,5 @@ // Regression test for https://github.com/rust-lang/rust/issues/100973 -#![feature(no_core)] -#![no_core] - // @set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id" // @is "$.index[*][?(@.name == 'm1')].inner.module.items" [] // @is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs index 78edfaf0aa8d7..ed0c4a420d489 100644 --- a/tests/rustdoc-json/reexport/glob_extern.rs +++ b/tests/rustdoc-json/reexport/glob_extern.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { extern "C" { diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs index ae4e87d23bc54..11ea5aa3522b2 100644 --- a/tests/rustdoc-json/reexport/glob_private.rs +++ b/tests/rustdoc-json/reexport/glob_private.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true" mod mod1 { // @is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true" diff --git a/tests/rustdoc-json/reexport/in_root_and_mod.rs b/tests/rustdoc-json/reexport/in_root_and_mod.rs index f81445bd48da8..a4133e2f0c7d6 100644 --- a/tests/rustdoc-json/reexport/in_root_and_mod.rs +++ b/tests/rustdoc-json/reexport/in_root_and_mod.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @!has "$.index[*][?(@.name=='foo')]" mod foo { // @has "$.index[*][?(@.name=='Foo')]" diff --git a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs index c5c41b25f7ec0..37f7b26fc8595 100644 --- a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs +++ b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - pub mod foo { // @set bar_id = "$.index[*][?(@.name=='Bar')].id" // @ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs index ac0632b98a95a..be09cb47629dc 100644 --- a/tests/rustdoc-json/reexport/macro.rs +++ b/tests/rustdoc-json/reexport/macro.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set repro_id = "$.index[*][?(@.name=='repro')].id" #[macro_export] macro_rules! repro { diff --git a/tests/rustdoc-json/reexport/mod_not_included.rs b/tests/rustdoc-json/reexport/mod_not_included.rs index 1c49f213d1a71..bc072be81a311 100644 --- a/tests/rustdoc-json/reexport/mod_not_included.rs +++ b/tests/rustdoc-json/reexport/mod_not_included.rs @@ -1,8 +1,5 @@ // Regression test for https://github.com/rust-lang/rust/issues/101103 -#![feature(no_core)] -#![no_core] - mod m1 { pub fn x() {} } diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs index 8c8152bd16c3b..d7b7662355784 100644 --- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs +++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs @@ -4,12 +4,8 @@ // 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 -#![no_core] -#![feature(no_core)] - extern crate pub_struct as foo; #[doc(inline)] - // @set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id" // @set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.import.id" /// Hack A diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs index cdcbf2a2bc86c..e6f037eb4b38e 100644 --- a/tests/rustdoc-json/reexport/private_two_names.rs +++ b/tests/rustdoc-json/reexport/private_two_names.rs @@ -3,9 +3,6 @@ // 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 -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='style')]" mod style { // @set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id" diff --git a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs index a2a25d08448a3..46c3da4c15b35 100644 --- a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs +++ b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs @@ -1,8 +1,5 @@ // Regression test for -#![feature(no_core)] -#![no_core] - mod repeat_n { #[doc(hidden)] pub struct RepeatN {} diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs index 9114460231dc8..3924282a49e5e 100644 --- a/tests/rustdoc-json/reexport/rename_private.rs +++ b/tests/rustdoc-json/reexport/rename_private.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='inner')]" mod inner { // @has "$.index[*][?(@.name=='Public')]" diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs index d0fd314bd8c99..636937874483a 100644 --- a/tests/rustdoc-json/reexport/rename_public.rs +++ b/tests/rustdoc-json/reexport/rename_public.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { // @set public_id = "$.index[*][?(@.name=='Public')].id" diff --git a/tests/rustdoc-json/reexport/same_name_different_types.rs b/tests/rustdoc-json/reexport/same_name_different_types.rs index 6a765b733016e..42ba6c40019a6 100644 --- a/tests/rustdoc-json/reexport/same_name_different_types.rs +++ b/tests/rustdoc-json/reexport/same_name_different_types.rs @@ -1,8 +1,5 @@ // Regression test for . -#![feature(no_core)] -#![no_core] - pub mod nested { // @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id" diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs index a00547dc34811..1e1710e1c0865 100644 --- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs +++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs @@ -2,9 +2,7 @@ // Regression test for . -#![feature(no_core)] #![no_std] -#![no_core] mod inner { // @set trait_id = "$.index[*][?(@.name=='Trait')].id" diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs index 462efee51bf40..2ca8c7fa6be6c 100644 --- a/tests/rustdoc-json/reexport/simple_private.rs +++ b/tests/rustdoc-json/reexport/simple_private.rs @@ -1,6 +1,4 @@ // edition:2018 -#![no_core] -#![feature(no_core)] // @!has "$.index[*][?(@.name=='inner')]" mod inner { diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs index 1373f96f87f07..04611eeb95cae 100644 --- a/tests/rustdoc-json/reexport/simple_public.rs +++ b/tests/rustdoc-json/reexport/simple_public.rs @@ -1,8 +1,5 @@ // edition:2018 -#![no_core] -#![feature(no_core)] - // @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs index 0ce81b5e59fa6..a9301b3fe4f30 100644 --- a/tests/rustdoc-json/return_private.rs +++ b/tests/rustdoc-json/return_private.rs @@ -1,9 +1,6 @@ // Regression test for . // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - mod secret { pub struct Secret; } diff --git a/tests/rustdoc-json/stripped_modules.rs b/tests/rustdoc-json/stripped_modules.rs index d2664b49e9c29..d5ab1173d9248 100644 --- a/tests/rustdoc-json/stripped_modules.rs +++ b/tests/rustdoc-json/stripped_modules.rs @@ -1,6 +1,3 @@ -#![no_core] -#![feature(no_core)] - // @!has "$.index[*][?(@.name=='no_pub_inner')]" mod no_pub_inner { fn priv_inner() {} diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs index 49238e5e88be4..67b5a858ab76f 100644 --- a/tests/rustdoc-json/traits/private_supertrait.rs +++ b/tests/rustdoc-json/traits/private_supertrait.rs @@ -1,9 +1,5 @@ // ignore-tidy-linelength -#![feature(no_core)] -#![no_core] - - // @!has "$.index[*][?(@.name == 'sealed')]" mod sealed { // @set sealed_id = "$.index[*][?(@.name=='Sealed')].id" diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs index 2123ac40427ea..6504467291d14 100644 --- a/tests/rustdoc-json/traits/supertrait.rs +++ b/tests/rustdoc-json/traits/supertrait.rs @@ -1,8 +1,6 @@ // ignore-tidy-linelength -#![feature(no_core)] #![feature(lang_items)] -#![no_core] // @set loud_id = "$.index[*][?(@.name=='Loud')].id" pub trait Loud {} diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs index 64c6c53ce4721..f860314795193 100644 --- a/tests/rustdoc-json/type/inherent_associated_type.rs +++ b/tests/rustdoc-json/type/inherent_associated_type.rs @@ -1,8 +1,6 @@ // ignore-tidy-linelength #![feature(inherent_associated_types)] -#![feature(no_core)] #![allow(incomplete_features)] -#![no_core] // @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id' pub struct OwnerMetadata; From 0875f456f1081929db5aabf67ee7713dd77cd303 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Tue, 7 Nov 2023 16:40:32 +0000 Subject: [PATCH 2/3] tests/rustdoc-json: Remove more needless uses of `#![no_core]`. These were'nt done with regex, but don't require changes to assertions. --- tests/rustdoc-json/enums/field_hidden.rs | 6 ------ tests/rustdoc-json/enums/kind.rs | 6 ------ tests/rustdoc-json/enums/tuple_fields_hidden.rs | 6 ------ tests/rustdoc-json/generic-associated-types/gats.rs | 9 --------- tests/rustdoc-json/non_lifetime_binders.rs | 11 +---------- tests/rustdoc-json/traits/supertrait.rs | 2 -- 6 files changed, 1 insertion(+), 39 deletions(-) diff --git a/tests/rustdoc-json/enums/field_hidden.rs b/tests/rustdoc-json/enums/field_hidden.rs index f240985805790..74d96248d5c7f 100644 --- a/tests/rustdoc-json/enums/field_hidden.rs +++ b/tests/rustdoc-json/enums/field_hidden.rs @@ -1,11 +1,5 @@ // Regression test for . -#![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] diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs index 777161c4e4ba2..68483683464bf 100644 --- a/tests/rustdoc-json/enums/kind.rs +++ b/tests/rustdoc-json/enums/kind.rs @@ -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"' diff --git a/tests/rustdoc-json/enums/tuple_fields_hidden.rs b/tests/rustdoc-json/enums/tuple_fields_hidden.rs index 34a4f4aec5384..53cdf83ffa687 100644 --- a/tests/rustdoc-json/enums/tuple_fields_hidden.rs +++ b/tests/rustdoc-json/enums/tuple_fields_hidden.rs @@ -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" diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs index 9cfe649243f82..56d6e7a49dbd3 100644 --- a/tests/rustdoc-json/generic-associated-types/gats.rs +++ b/tests/rustdoc-json/generic-associated-types/gats.rs @@ -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 { diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs index cabee0b1caa5a..d925fcd522150 100644 --- a/tests/rustdoc-json/non_lifetime_binders.rs +++ b/tests/rustdoc-json/non_lifetime_binders.rs @@ -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; - -pub struct Wrapper(PhantomData); +pub struct Wrapper(std::marker::PhantomData); // @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\" diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs index 6504467291d14..bbae3557cf9cf 100644 --- a/tests/rustdoc-json/traits/supertrait.rs +++ b/tests/rustdoc-json/traits/supertrait.rs @@ -1,7 +1,5 @@ // ignore-tidy-linelength -#![feature(lang_items)] - // @set loud_id = "$.index[*][?(@.name=='Loud')].id" pub trait Loud {} From 434b69a1d670fb0b18a4dd121db0a445d74d34d4 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Tue, 7 Nov 2023 16:56:03 +0000 Subject: [PATCH 3/3] tests/rustdoc-json: Rewrite tests no not use `#![no_core]`. --- .../rustdoc-json/impls/import_from_private.rs | 14 ++++----- .../issue-112852-dangling-trait-impl-id-2.rs | 8 ++--- .../issue-112852-dangling-trait-impl-id.rs | 12 ++++---- tests/rustdoc-json/impls/local_for_local.rs | 5 +--- tests/rustdoc-json/traits/implementors.rs | 29 +++++++++---------- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs index d2b0665dcafac..3da03df2546ca 100644 --- a/tests/rustdoc-json/impls/import_from_private.rs +++ b/tests/rustdoc-json/impls/import_from_private.rs @@ -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() {} } } @@ -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 diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs index d2ac316d47d4d..7857626d66ed0 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs @@ -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')]" @@ -11,5 +9,7 @@ pub trait PubTrait {} pub struct HiddenPubStruct; pub struct NotHiddenPubStruct; +/// Not Here impl PubTrait for HiddenPubStruct {} +/// Here impl PubTrait for NotHiddenPubStruct {} diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs index 141c54a57dd11..97db9c93a0f22 100644 --- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs +++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs @@ -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 {} } diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs index 37a720003295a..015e89c228109 100644 --- a/tests/rustdoc-json/impls/local_for_local.rs +++ b/tests/rustdoc-json/impls/local_for_local.rs @@ -1,6 +1,3 @@ -#![feature(no_core)] -#![no_core] - // @set struct = "$.index[*][?(@.name=='Struct')].id" pub struct Struct; // @set trait = "$.index[*][?(@.name=='Trait')].id" @@ -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 diff --git a/tests/rustdoc-json/traits/implementors.rs b/tests/rustdoc-json/traits/implementors.rs index 7d351ad61be24..c27553c754488 100644 --- a/tests/rustdoc-json/traits/implementors.rs +++ b/tests/rustdoc-json/traits/implementors.rs @@ -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 {} - -// @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 {} +/// Wham for George Michael 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