diff options
Diffstat (limited to 'tests')
108 files changed, 678 insertions, 272 deletions
diff --git a/tests/rustdoc-gui/code-tags.goml b/tests/rustdoc-gui/code-tags.goml index 94c1a6525aa..8561f537f3d 100644 --- a/tests/rustdoc-gui/code-tags.goml +++ b/tests/rustdoc-gui/code-tags.goml @@ -9,16 +9,16 @@ size: (1080, 600) // Check that their content is inside <pre><code> assert-count: (".example-wrap pre > code", 4) // Check that function signature is inside <pre><code> -assert: "pre.rust.fn > code" +assert: ".item-decl pre.rust > code" goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" -assert: "pre.rust.struct > code" +assert: ".item-decl pre.rust > code" goto: "file://" + |DOC_PATH| + "/test_docs/enum.AnEnum.html" -assert: "pre.rust.enum > code" +assert: ".item-decl pre.rust > code" goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html" -assert: "pre.rust.trait > code" +assert: ".item-decl pre.rust > code" goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html" -assert: "pre.rust.typedef > code" +assert: ".item-decl pre.rust > code" diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml index 8ba005b0c35..fafb1563178 100644 --- a/tests/rustdoc-gui/font-weight.goml +++ b/tests/rustdoc-gui/font-weight.goml @@ -20,7 +20,7 @@ goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // This is a complex selector, so here's how it works: // // * //*[@class='item-decl'] — selects element of any tag with classes docblock and item-decl -// * /pre[@class='rust trait'] — selects immediate child with tag pre and classes rust and trait +// * /pre[@class='rust'] — selects immediate child with tag pre and class rust // * /code — selects immediate child with tag code // * /a[@class='constant'] — selects immediate child with tag a and class constant // * //text() — selects child that is text node @@ -29,11 +29,11 @@ goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html" // This uses '/parent::*' as a proxy for the style of the text node. // We can't just select the '<a>' because intermediate tags could be added. assert-count: ( - "//*[@class='item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", + "//*[@class='item-decl']/pre[@class='rust']/code/a[@class='constant']//text()/parent::*", 1, ) assert-css: ( - "//*[@class='item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", + "//*[@class='item-decl']/pre[@class='rust']/code/a[@class='constant']//text()/parent::*", {"font-weight": "400"}, ) diff --git a/tests/rustdoc-gui/list_code_block.goml b/tests/rustdoc-gui/list_code_block.goml index 3423a449de4..c527cfbfcbc 100644 --- a/tests/rustdoc-gui/list_code_block.goml +++ b/tests/rustdoc-gui/list_code_block.goml @@ -1,4 +1,4 @@ // This test checks that code blocks in list are supported. goto: "file://" + |DOC_PATH| + "/test_docs/index.html" goto: "./fn.check_list_code_block.html" -assert: ("pre.rust.fn") +assert: (".item-decl pre.rust") diff --git a/tests/rustdoc/array-links.rs b/tests/rustdoc/array-links.rs index 07f92ac51b9..e7c0ee2de1a 100644 --- a/tests/rustdoc/array-links.rs +++ b/tests/rustdoc/array-links.rs @@ -4,25 +4,25 @@ pub struct MyBox<T: ?Sized>(*const T); // @has 'foo/fn.alpha.html' -// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code' +// @snapshot link_slice_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn alpha() -> &'static [u32; 1] { loop {} } // @has 'foo/fn.beta.html' -// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code' +// @snapshot link_slice_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn beta<T>() -> &'static [T; 1] { loop {} } // @has 'foo/fn.gamma.html' -// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code' +// @snapshot link_box_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn gamma() -> MyBox<[u32; 1]> { loop {} } // @has 'foo/fn.delta.html' -// @snapshot link_box_generic - '//pre[@class="rust fn"]/code' +// @snapshot link_box_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn delta<T>() -> MyBox<[T; 1]> { loop {} } diff --git a/tests/rustdoc/assoc-consts.rs b/tests/rustdoc/assoc-consts.rs index 3da19a13e53..77b139b644f 100644 --- a/tests/rustdoc/assoc-consts.rs +++ b/tests/rustdoc/assoc-consts.rs @@ -1,5 +1,5 @@ pub trait Foo { - // @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \ + // @has assoc_consts/trait.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'const FOO: usize = 13usize;' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' const FOO: usize = 12 + 1; diff --git a/tests/rustdoc/assoc-item-cast.rs b/tests/rustdoc/assoc-item-cast.rs index a409d64131a..ab9702a24f4 100644 --- a/tests/rustdoc/assoc-item-cast.rs +++ b/tests/rustdoc/assoc-item-cast.rs @@ -10,5 +10,5 @@ pub trait AsExpression<T> { } // @has foo/type.AsExprOf.html -// @has - '//pre[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression; diff --git a/tests/rustdoc/assoc-types.rs b/tests/rustdoc/assoc-types.rs index a9e5b8d0019..de36c8ffeff 100644 --- a/tests/rustdoc/assoc-types.rs +++ b/tests/rustdoc/assoc-types.rs @@ -12,8 +12,8 @@ pub trait Index<I: ?Sized> { } // @has assoc_types/fn.use_output.html -// @has - '//*[@class="rust fn"]' '-> &T::Output' -// @has - '//*[@class="rust fn"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' '-> &T::Output' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output' pub fn use_output<T: Index<usize>>(obj: &T, index: usize) -> &T::Output { obj.index(index) } @@ -23,13 +23,13 @@ pub trait Feed { } // @has assoc_types/fn.use_input.html -// @has - '//*[@class="rust fn"]' 'T::Input' -// @has - '//*[@class="rust fn"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'T::Input' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' pub fn use_input<T: Feed>(_feed: &T, _element: T::Input) { } // @has assoc_types/fn.cmp_input.html -// @has - '//*[@class="rust fn"]' 'where T::Input: PartialEq<U::Input>' -// @has - '//*[@class="rust fn"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where T::Input: PartialEq<U::Input>' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' pub fn cmp_input<T: Feed, U: Feed>(a: &T::Input, b: &U::Input) -> bool where T::Input: PartialEq<U::Input> { diff --git a/tests/rustdoc/async-fn.rs b/tests/rustdoc/async-fn.rs index af765c51ace..fb7ebb5f822 100644 --- a/tests/rustdoc/async-fn.rs +++ b/tests/rustdoc/async-fn.rs @@ -1,35 +1,35 @@ // edition:2018 -// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>' +// @has async_fn/fn.foo.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn foo() -> Option<Foo>' pub async fn foo() -> Option<Foo> { None } -// @has async_fn/fn.bar.html '//pre[@class="rust fn"]' 'pub async fn bar(a: i32, b: i32) -> i32' +// @has async_fn/fn.bar.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn bar(a: i32, b: i32) -> i32' pub async fn bar(a: i32, b: i32) -> i32 { 0 } -// @has async_fn/fn.baz.html '//pre[@class="rust fn"]' 'pub async fn baz<T>(a: T) -> T' +// @has async_fn/fn.baz.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn baz<T>(a: T) -> T' pub async fn baz<T>(a: T) -> T { a } -// @has async_fn/fn.qux.html '//pre[@class="rust fn"]' 'pub async unsafe fn qux() -> char' +// @has async_fn/fn.qux.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async unsafe fn qux() -> char' pub async unsafe fn qux() -> char { '⚠' } -// @has async_fn/fn.mut_args.html '//pre[@class="rust fn"]' 'pub async fn mut_args(a: usize)' +// @has async_fn/fn.mut_args.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn mut_args(a: usize)' pub async fn mut_args(mut a: usize) {} -// @has async_fn/fn.mut_ref.html '//pre[@class="rust fn"]' 'pub async fn mut_ref(x: i32)' +// @has async_fn/fn.mut_ref.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn mut_ref(x: i32)' pub async fn mut_ref(ref mut x: i32) {} trait Bar {} impl Bar for () {} -// @has async_fn/fn.quux.html '//pre[@class="rust fn"]' 'pub async fn quux() -> impl Bar' +// @has async_fn/fn.quux.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn quux() -> impl Bar' pub async fn quux() -> impl Bar { () } @@ -50,27 +50,27 @@ pub trait Pattern<'a> {} pub trait Trait<const N: usize> {} // @has async_fn/fn.const_generics.html -// @has - '//pre[@class="rust fn"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' pub async fn const_generics<const N: usize>(_: impl Trait<N>) {} // test that elided lifetimes are properly elided and not displayed as `'_` // regression test for #63037 // @has async_fn/fn.elided.html -// @has - '//pre[@class="rust fn"]' 'pub async fn elided(foo: &str) -> &str' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn elided(foo: &str) -> &str' pub async fn elided(foo: &str) -> &str {} // This should really be shown as written, but for implementation reasons it's difficult. // See `impl Clean for TyKind::Ref`. // @has async_fn/fn.user_elided.html -// @has - '//pre[@class="rust fn"]' 'pub async fn user_elided(foo: &str) -> &str' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn user_elided(foo: &str) -> &str' pub async fn user_elided(foo: &'_ str) -> &str {} // @has async_fn/fn.static_trait.html -// @has - '//pre[@class="rust fn"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' pub async fn static_trait(foo: &str) -> Box<dyn Bar> {} // @has async_fn/fn.lifetime_for_trait.html -// @has - '//pre[@class="rust fn"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_> {} // @has async_fn/fn.elided_in_input_trait.html -// @has - '//pre[@class="rust fn"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" pub async fn elided_in_input_trait(t: impl Pattern<'_>) {} struct AsyncFdReadyGuard<'a, T> { x: &'a T } @@ -88,8 +88,8 @@ impl Foo { // test named lifetimes, just in case // @has async_fn/fn.named.html -// @has - '//pre[@class="rust fn"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" pub async fn named<'a, 'b>(foo: &'a str) -> &'b str {} // @has async_fn/fn.named_trait.html -// @has - '//pre[@class="rust fn"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b> {} diff --git a/tests/rustdoc/attributes.rs b/tests/rustdoc/attributes.rs index a36dadced87..70e2e5c2950 100644 --- a/tests/rustdoc/attributes.rs +++ b/tests/rustdoc/attributes.rs @@ -1,13 +1,13 @@ #![crate_name = "foo"] -// @has foo/fn.f.html '//*[@class="rust fn"]' '#[no_mangle]' +// @has foo/fn.f.html '//div[@class="item-decl"]/pre[@class="rust"]' '#[no_mangle]' #[no_mangle] pub extern "C" fn f() {} -// @has foo/fn.g.html '//*[@class="rust fn"]' '#[export_name = "bar"]' +// @has foo/fn.g.html '//div[@class="item-decl"]/pre[@class="rust"]' '#[export_name = "bar"]' #[export_name = "bar"] pub extern "C" fn g() {} -// @has foo/struct.Repr.html '//*[@class="item-decl"]' '#[repr(C, align(8))]' +// @has foo/struct.Repr.html '//div[@class="item-decl"]' '#[repr(C, align(8))]' #[repr(C, align(8))] pub struct Repr; diff --git a/tests/rustdoc/auxiliary/issue-85454.rs b/tests/rustdoc/auxiliary/issue-85454.rs index 45664dfc382..5143968bbd4 100644 --- a/tests/rustdoc/auxiliary/issue-85454.rs +++ b/tests/rustdoc/auxiliary/issue-85454.rs @@ -1,5 +1,5 @@ // @has issue_85454/trait.FromResidual.html -// @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; } diff --git a/tests/rustdoc/const-fn.rs b/tests/rustdoc/const-fn.rs index 28eba849ace..4366ad4d0ad 100644 --- a/tests/rustdoc/const-fn.rs +++ b/tests/rustdoc/const-fn.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has foo/fn.bar.html -// @has - '//*[@class="rust fn"]' 'pub const fn bar() -> ' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const fn bar() -> ' /// foo pub const fn bar() -> usize { 2 diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs index 6cbae9abebb..b5226ad3f78 100644 --- a/tests/rustdoc/const-generics/add-impl.rs +++ b/tests/rustdoc/const-generics/add-impl.rs @@ -2,7 +2,7 @@ use std::ops::Add; -// @has foo/struct.Simd.html '//pre[@class="rust struct"]' 'pub struct Simd<T, const WIDTH: usize>' +// @has foo/struct.Simd.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Simd<T, const WIDTH: usize>' pub struct Simd<T, const WIDTH: usize> { inner: T, } diff --git a/tests/rustdoc/const-generics/const-generic-defaults.rs b/tests/rustdoc/const-generics/const-generic-defaults.rs index 2693d9b5969..acc3b853e56 100644 --- a/tests/rustdoc/const-generics/const-generic-defaults.rs +++ b/tests/rustdoc/const-generics/const-generic-defaults.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(_);' pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T); diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs index 5bf76e3c469..543332d2c32 100644 --- a/tests/rustdoc/const-generics/const-generics-docs.rs +++ b/tests/rustdoc/const-generics/const-generics-docs.rs @@ -3,21 +3,21 @@ #![crate_name = "foo"] extern crate extern_crate; -// @has foo/fn.extern_fn.html '//pre[@class="rust fn"]' \ +// @has foo/fn.extern_fn.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]>' pub use extern_crate::extern_fn; -// @has foo/struct.ExternTy.html '//pre[@class="rust struct"]' \ +// @has foo/struct.ExternTy.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct ExternTy<const N: usize> {' pub use extern_crate::ExternTy; -// @has foo/type.TyAlias.html '//pre[@class="rust typedef"]' \ +// @has foo/type.TyAlias.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type TyAlias<const N: usize> = ExternTy<N>;' pub use extern_crate::TyAlias; -// @has foo/trait.WTrait.html '//pre[@class="rust trait"]' \ +// @has foo/trait.WTrait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub trait WTrait<const N: usize, const M: usize>' -// @has - '//*[@class="rust trait"]' 'fn hey<const P: usize>() -> usize' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn hey<const P: usize>() -> usize' pub use extern_crate::WTrait; -// @has foo/trait.Trait.html '//pre[@class="rust trait"]' \ +// @has foo/trait.Trait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub trait Trait<const N: usize>' // @has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<1> for u8' // @has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<2> for u8' @@ -30,10 +30,10 @@ impl Trait<2> for u8 {} impl Trait<{1 + 2}> for u8 {} impl<const N: usize> Trait<N> for [u8; N] {} -// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foo<const N: usize>where u8: Trait<N>' pub struct Foo<const N: usize> where u8: Trait<N>; -// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)' +// @has foo/struct.Bar.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Bar<T, const N: usize>(_)' pub struct Bar<T, const N: usize>([T; N]); // @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>' @@ -56,32 +56,32 @@ impl<const M: usize> Bar<u8, M> { } } -// @has foo/fn.test.html '//pre[@class="rust fn"]' \ +// @has foo/fn.test.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>' pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> { 2u8 } -// @has foo/fn.a_sink.html '//pre[@class="rust fn"]' \ +// @has foo/fn.a_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N>' pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> { v } -// @has foo/fn.b_sink.html '//pre[@class="rust fn"]' \ +// @has foo/fn.b_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)' pub async fn b_sink<const N: usize>(_: impl Trait<N>) {} -// @has foo/fn.concrete.html '//pre[@class="rust fn"]' \ +// @has foo/fn.concrete.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn concrete() -> [u8; 22]' pub fn concrete() -> [u8; 3 + std::mem::size_of::<u64>() << 1] { Default::default() } -// @has foo/type.Faz.html '//pre[@class="rust typedef"]' \ +// @has foo/type.Faz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type Faz<const N: usize> = [u8; N];' pub type Faz<const N: usize> = [u8; N]; -// @has foo/type.Fiz.html '//pre[@class="rust typedef"]' \ +// @has foo/type.Fiz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type Fiz<const N: usize> = [[u8; N]; 48];' pub type Fiz<const N: usize> = [[u8; N]; 3 << 4]; @@ -91,7 +91,7 @@ macro_rules! define_me { } } -// @has foo/struct.Foz.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foz<const N: usize>(_);' define_me!(Foz<N>); @@ -103,13 +103,13 @@ impl<const N: usize> Q for [u8; N] { const ASSOC: usize = N; } -// @has foo/fn.q_user.html '//pre[@class="rust fn"]' \ +// @has foo/fn.q_user.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn q_user() -> [u8; 13]' pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] { [0; <[u8; 13] as Q>::ASSOC] } -// @has foo/union.Union.html '//pre[@class="rust union"]' \ +// @has foo/union.Union.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub union Union<const N: usize>' pub union Union<const N: usize> { // @has - //pre "pub arr: [u8; N]" @@ -118,7 +118,7 @@ pub union Union<const N: usize> { pub another_arr: [(); N], } -// @has foo/enum.Enum.html '//pre[@class="rust enum"]' \ +// @has foo/enum.Enum.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub enum Enum<const N: usize>' pub enum Enum<const N: usize> { // @has - //pre "Variant([u8; N])" diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs index 75ee84279be..726fb8f0c34 100644 --- a/tests/rustdoc/const-generics/const-impl.rs +++ b/tests/rustdoc/const-generics/const-impl.rs @@ -8,7 +8,7 @@ pub enum Order { Unsorted, } -// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>' +// @has foo/struct.VSet.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct VSet<T, const ORDER: Order>' // @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>' // @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>' pub struct VSet<T, const ORDER: Order> { diff --git a/tests/rustdoc/const-generics/generic_const_exprs.rs b/tests/rustdoc/const-generics/generic_const_exprs.rs index 215ee228eb8..c53cf6dcd05 100644 --- a/tests/rustdoc/const-generics/generic_const_exprs.rs +++ b/tests/rustdoc/const-generics/generic_const_exprs.rs @@ -2,6 +2,6 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] // make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647 -// @has foo/struct.Ice.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Ice.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Ice<const N: usize>;' pub struct Ice<const N: usize> where [(); N + 1]:; diff --git a/tests/rustdoc/const-generics/type-alias.rs b/tests/rustdoc/const-generics/type-alias.rs index ebda5b19404..72473a11244 100644 --- a/tests/rustdoc/const-generics/type-alias.rs +++ b/tests/rustdoc/const-generics/type-alias.rs @@ -1,4 +1,4 @@ #![crate_name = "foo"] -// @has foo/type.CellIndex.html '//pre[@class="rust typedef"]' 'type CellIndex<const D: usize> = [i64; D];' +// @has foo/type.CellIndex.html '//div[@class="item-decl"]/pre[@class="rust"]' 'type CellIndex<const D: usize> = [i64; D];' pub type CellIndex<const D: usize> = [i64; D]; diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs index 2fc486d01da..42f6ac7923b 100644 --- a/tests/rustdoc/const-intrinsic.rs +++ b/tests/rustdoc/const-intrinsic.rs @@ -6,20 +6,20 @@ extern "rust-intrinsic" { // @has 'foo/fn.transmute.html' - // @has - '//pre[@class="rust fn"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U' #[stable(since="1.0.0", feature="rust1")] #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")] pub fn transmute<T, U>(_: T) -> U; // @has 'foo/fn.unreachable.html' - // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' #[stable(since="1.0.0", feature="rust1")] pub fn unreachable() -> !; } extern "C" { // @has 'foo/fn.needs_drop.html' - // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "C" fn needs_drop() -> !' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn needs_drop() -> !' #[stable(since="1.0.0", feature="rust1")] pub fn needs_drop() -> !; } diff --git a/tests/rustdoc/fn-pointer-arg-name.rs b/tests/rustdoc/fn-pointer-arg-name.rs index 4293d849df5..96c64ac4e02 100644 --- a/tests/rustdoc/fn-pointer-arg-name.rs +++ b/tests/rustdoc/fn-pointer-arg-name.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.f.html -// @has - '//*[@class="rust fn"]' 'pub fn f(callback: fn(len: usize, foo: u32))' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f(callback: fn(len: usize, foo: u32))' pub fn f(callback: fn(len: usize, foo: u32)) {} diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs index 644a6e1cf33..406157ce26c 100644 --- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs +++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs @@ -63,7 +63,7 @@ impl<const S: Struct, St: Stage + ?Sized> Helper<S> for St { // this test as long as one can ensure that private fields are not leaked! // // @has hide_complex_unevaluated_const_arguments/trait.Sub.html \ -// '//*[@class="rust trait"]' \ +// '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub trait Sub: Sup<{ _ }, { _ }> { }' pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {} diff --git a/tests/rustdoc/inline-default-methods.rs b/tests/rustdoc/inline-default-methods.rs index c97644e7f87..a4ca928f333 100644 --- a/tests/rustdoc/inline-default-methods.rs +++ b/tests/rustdoc/inline-default-methods.rs @@ -4,6 +4,6 @@ extern crate inline_default_methods; // @has inline_default_methods/trait.Foo.html -// @has - '//*[@class="rust trait"]' 'fn bar(&self);' -// @has - '//*[@class="rust trait"]' 'fn foo(&mut self) { ... }' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn bar(&self);' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn foo(&mut self) { ... }' pub use inline_default_methods::Foo; diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs index fa760540e43..0da8bfc3a9a 100644 --- a/tests/rustdoc/inline_cross/dyn_trait.rs +++ b/tests/rustdoc/inline_cross/dyn_trait.rs @@ -22,10 +22,10 @@ pub use dyn_trait::Ty2; pub use dyn_trait::Ty3; // @has user/fn.func0.html -// @has - '//pre[@class="rust fn"]' "func0(_: &dyn Fn())" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func0(_: &dyn Fn())" // FIXME(fmease): Show placeholder-lifetime bound, render "func0(_: &(dyn Fn() + '_))" pub use dyn_trait::func0; // @has user/fn.func1.html -// @has - '//pre[@class="rust fn"]' "func1<'func>(_: &(dyn Fn() + 'func))" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func1<'func>(_: &(dyn Fn() + 'func))" pub use dyn_trait::func1; diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index 9c4f6465920..e8587209b61 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -4,37 +4,37 @@ extern crate impl_trait_aux; // @has impl_trait/fn.func.html -// @has - '//pre[@class="rust fn"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" -// @!has - '//pre[@class="rust fn"]' 'where' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' pub use impl_trait_aux::func; // @has impl_trait/fn.func2.html -// @has - '//pre[@class="rust fn"]' "func2<T>(" -// @has - '//pre[@class="rust fn"]' "_x: impl Deref<Target = Option<T>> + Iterator<Item = T>," -// @has - '//pre[@class="rust fn"]' "_y: impl Iterator<Item = u8>)" -// @!has - '//pre[@class="rust fn"]' 'where' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func2<T>(" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_x: impl Deref<Target = Option<T>> + Iterator<Item = T>," +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_y: impl Iterator<Item = u8>)" +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' pub use impl_trait_aux::func2; // @has impl_trait/fn.func3.html -// @has - '//pre[@class="rust fn"]' "func3(" -// @has - '//pre[@class="rust fn"]' "_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone)" -// @!has - '//pre[@class="rust fn"]' 'where' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func3(" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone)" +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' pub use impl_trait_aux::func3; // @has impl_trait/fn.func4.html -// @has - '//pre[@class="rust fn"]' "func4<T>(" -// @has - '//pre[@class="rust fn"]' "T: Iterator<Item = impl Clone>," +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func4<T>(" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "T: Iterator<Item = impl Clone>," pub use impl_trait_aux::func4; // @has impl_trait/fn.func5.html -// @has - '//pre[@class="rust fn"]' "func5(" -// @has - '//pre[@class="rust fn"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," -// @has - '//pre[@class="rust fn"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" -// @!has - '//pre[@class="rust fn"]' 'where' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func5(" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' pub use impl_trait_aux::func5; // @has impl_trait/fn.async_fn.html -// @has - '//pre[@class="rust fn"]' "pub async fn async_fn()" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn async_fn()" pub use impl_trait_aux::async_fn; // @has impl_trait/struct.Foo.html diff --git a/tests/rustdoc/issue-20646.rs b/tests/rustdoc/issue-20646.rs index 2589e27f215..a774b0ca7cd 100644 --- a/tests/rustdoc/issue-20646.rs +++ b/tests/rustdoc/issue-20646.rs @@ -13,7 +13,7 @@ pub trait Trait { } // @has issue_20646/fn.fun.html \ -// '//*[@class="rust fn"]' 'where T: Trait<Output = i32>' +// '//div[@class="item-decl"]/pre[@class="rust"]' 'where T: Trait<Output = i32>' pub fn fun<T>(_: T) where T: Trait<Output=i32> {} pub mod reexport { @@ -21,6 +21,6 @@ pub mod reexport { // '//*[@id="associatedtype.Output"]' \ // 'type Output' // @has issue_20646/reexport/fn.fun.html \ - // '//*[@class="rust fn"]' 'where T: Trait<Output = i32>' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'where T: Trait<Output = i32>' pub use issue_20646::{Trait, fun}; } diff --git a/tests/rustdoc/issue-20727-2.rs b/tests/rustdoc/issue-20727-2.rs index 022ff290e1a..026b4f5acc9 100644 --- a/tests/rustdoc/issue-20727-2.rs +++ b/tests/rustdoc/issue-20727-2.rs @@ -5,18 +5,18 @@ extern crate issue_20727; // @has issue_20727_2/trait.Add.html pub trait Add<RHS = Self> { - // @has - '//*[@class="rust trait"]' 'trait Add<RHS = Self> {' - // @has - '//*[@class="rust trait"]' 'type Output;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Add<RHS = Self> {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output;' type Output; - // @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn add(self, rhs: RHS) -> Self::Output;' fn add(self, rhs: RHS) -> Self::Output; } // @has issue_20727_2/reexport/trait.Add.html pub mod reexport { - // @has - '//*[@class="rust trait"]' 'trait Add<RHS = Self> {' - // @has - '//*[@class="rust trait"]' 'type Output;' - // @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Add<RHS = Self> {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn add(self, rhs: RHS) -> Self::Output;' pub use issue_20727::Add; } diff --git a/tests/rustdoc/issue-20727-3.rs b/tests/rustdoc/issue-20727-3.rs index 52032b75aea..741ce8023d7 100644 --- a/tests/rustdoc/issue-20727-3.rs +++ b/tests/rustdoc/issue-20727-3.rs @@ -7,18 +7,18 @@ pub trait Bar {} // @has issue_20727_3/trait.Deref2.html pub trait Deref2 { - // @has - '//*[@class="rust trait"]' 'trait Deref2 {' - // @has - '//*[@class="rust trait"]' 'type Target: Bar;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref2 {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: Bar;' type Target: Bar; - // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn deref(&self) -> Self::Target;' fn deref(&self) -> Self::Target; } // @has issue_20727_3/reexport/trait.Deref2.html pub mod reexport { - // @has - '//*[@class="rust trait"]' 'trait Deref2 {' - // @has - '//*[@class="rust trait"]' 'type Target: Bar;' - // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref2 {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: Bar;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn deref(&self) -> Self::Target;' pub use issue_20727::Deref2; } diff --git a/tests/rustdoc/issue-20727-4.rs b/tests/rustdoc/issue-20727-4.rs index 643f9387590..b8fac4da6ea 100644 --- a/tests/rustdoc/issue-20727-4.rs +++ b/tests/rustdoc/issue-20727-4.rs @@ -5,36 +5,36 @@ extern crate issue_20727; // @has issue_20727_4/trait.Index.html pub trait Index<Idx: ?Sized> { - // @has - '//*[@class="rust trait"]' 'trait Index<Idx: ?Sized> {' - // @has - '//*[@class="rust trait"]' 'type Output: ?Sized' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Index<Idx: ?Sized> {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'fn index(&self, index: Idx) -> &Self::Output' fn index(&self, index: Idx) -> &Self::Output; } // @has issue_20727_4/trait.IndexMut.html pub trait IndexMut<Idx: ?Sized>: Index<Idx> { - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'trait IndexMut<Idx: ?Sized>: Index<Idx> {' - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' fn index_mut(&mut self, index: Idx) -> &mut Self::Output; } pub mod reexport { // @has issue_20727_4/reexport/trait.Index.html - // @has - '//*[@class="rust trait"]' 'trait Index<Idx>where Idx: ?Sized,{' - // @has - '//*[@class="rust trait"]' 'type Output: ?Sized' - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Index<Idx>where Idx: ?Sized,{' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output: ?Sized' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'fn index(&self, index: Idx) -> &Self::Output' pub use issue_20727::Index; // @has issue_20727_4/reexport/trait.IndexMut.html - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'trait IndexMut<Idx>: Index<Idx>where Idx: ?Sized,{' - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' pub use issue_20727::IndexMut; } diff --git a/tests/rustdoc/issue-20727.rs b/tests/rustdoc/issue-20727.rs index c1a98cd57da..df334821ccc 100644 --- a/tests/rustdoc/issue-20727.rs +++ b/tests/rustdoc/issue-20727.rs @@ -5,20 +5,20 @@ extern crate issue_20727; // @has issue_20727/trait.Deref.html pub trait Deref { - // @has - '//*[@class="rust trait"]' 'trait Deref {' - // @has - '//*[@class="rust trait"]' 'type Target: ?Sized;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: ?Sized;' type Target: ?Sized; - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // "fn deref<'a>(&'a self) -> &'a Self::Target;" fn deref<'a>(&'a self) -> &'a Self::Target; } // @has issue_20727/reexport/trait.Deref.html pub mod reexport { - // @has - '//*[@class="rust trait"]' 'trait Deref {' - // @has - '//*[@class="rust trait"]' 'type Target: ?Sized;' - // @has - '//*[@class="rust trait"]' \ + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref {' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: ?Sized;' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ // "fn deref<'a>(&'a self) -> &'a Self::Target;" pub use issue_20727::Deref; } diff --git a/tests/rustdoc/issue-22038.rs b/tests/rustdoc/issue-22038.rs index ff5813dac80..19e626ba132 100644 --- a/tests/rustdoc/issue-22038.rs +++ b/tests/rustdoc/issue-22038.rs @@ -1,19 +1,19 @@ extern "C" { // @has issue_22038/fn.foo1.html \ - // '//*[@class="rust fn"]' 'pub unsafe extern "C" fn foo1()' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn foo1()' pub fn foo1(); } extern "system" { // @has issue_22038/fn.foo2.html \ - // '//*[@class="rust fn"]' 'pub unsafe extern "system" fn foo2()' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "system" fn foo2()' pub fn foo2(); } // @has issue_22038/fn.bar.html \ -// '//*[@class="rust fn"]' 'pub extern "C" fn bar()' +// '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "C" fn bar()' pub extern "C" fn bar() {} // @has issue_22038/fn.baz.html \ -// '//*[@class="rust fn"]' 'pub extern "system" fn baz()' +// '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "system" fn baz()' pub extern "system" fn baz() {} diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/issue-33302.rs index 1e4791e0125..b4c52e2f17a 100644 --- a/tests/rustdoc/issue-33302.rs +++ b/tests/rustdoc/issue-33302.rs @@ -6,17 +6,17 @@ macro_rules! make { pub struct S; // @has issue_33302/constant.CST.html \ - // '//pre[@class="rust const"]' 'pub const CST: i32' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const CST: i32' pub const CST: i32 = ($n * $n); // @has issue_33302/static.ST.html \ - // '//pre[@class="rust static"]' 'pub static ST: i32' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub static ST: i32' pub static ST: i32 = ($n * $n); pub trait T<X> { fn ignore(_: &X) {} const C: X; // @has issue_33302/trait.T.html \ - // '//*[@class="rust trait"]' 'const D: i32' + // '//div[@class="item-decl"]/pre[@class="rust"]' 'const D: i32' // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' const D: i32 = ($n * $n); } diff --git a/tests/rustdoc/issue-85454.rs b/tests/rustdoc/issue-85454.rs index 3351b5c8350..74fc22b31dc 100644 --- a/tests/rustdoc/issue-85454.rs +++ b/tests/rustdoc/issue-85454.rs @@ -5,7 +5,7 @@ extern crate issue_85454; // @has foo/trait.FromResidual.html -// @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; } @@ -24,6 +24,6 @@ pub enum ControlFlow<B, C = ()> { pub mod reexport { // @has foo/reexport/trait.FromResidual.html - // @has - '//pre[@class="rust trait"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' pub use issue_85454::*; } diff --git a/tests/rustdoc/issue-98697.rs b/tests/rustdoc/issue-98697.rs index d50268509b2..884b63ac97f 100644 --- a/tests/rustdoc/issue-98697.rs +++ b/tests/rustdoc/issue-98697.rs @@ -8,8 +8,8 @@ extern crate issue_98697_reexport_with_anonymous_lifetime; -// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>()where F: Fn(&str)' -// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<' +// @has issue_98697/fn.repro.html '//div[@class="item-decl"]/pre[@class="rust"]/code' 'fn repro<F>()where F: Fn(&str)' +// @!has issue_98697/fn.repro.html '//div[@class="item-decl"]/pre[@class="rust"]/code' 'for<' pub use issue_98697_reexport_with_anonymous_lifetime::repro; // @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra' diff --git a/tests/rustdoc/legacy-const-generic.rs b/tests/rustdoc/legacy-const-generic.rs index 46a50e2fc30..14533624e44 100644 --- a/tests/rustdoc/legacy-const-generic.rs +++ b/tests/rustdoc/legacy-const-generic.rs @@ -2,14 +2,14 @@ #![feature(rustc_attrs)] // @has 'foo/fn.foo.html' -// @has - '//*[@class="rust fn"]' 'fn foo(x: usize, const Y: usize, z: usize) -> [usize; 3]' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn foo(x: usize, const Y: usize, z: usize) -> [usize; 3]' #[rustc_legacy_const_generics(1)] pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] { [x, Y, z] } // @has 'foo/fn.bar.html' -// @has - '//*[@class="rust fn"]' 'fn bar(x: usize, const Y: usize, const Z: usize) -> [usize; 3]' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn bar(x: usize, const Y: usize, const Z: usize) -> [usize; 3]' #[rustc_legacy_const_generics(1, 2)] pub fn bar<const Y: usize, const Z: usize>(x: usize) -> [usize; 3] { [x, Y, z] diff --git a/tests/rustdoc/lifetime-name.rs b/tests/rustdoc/lifetime-name.rs index 5d30a745a61..0fb66059109 100644 --- a/tests/rustdoc/lifetime-name.rs +++ b/tests/rustdoc/lifetime-name.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has 'foo/type.Resolutions.html' -// @has - '//*[@class="rust typedef"]' "pub type Resolutions<'tcx> = &'tcx u8;" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub type Resolutions<'tcx> = &'tcx u8;" pub type Resolutions<'tcx> = &'tcx u8; diff --git a/tests/rustdoc/mut-params.rs b/tests/rustdoc/mut-params.rs index f3ea6995839..3b862e651c9 100644 --- a/tests/rustdoc/mut-params.rs +++ b/tests/rustdoc/mut-params.rs @@ -13,6 +13,6 @@ impl Foo { pub fn bar(mut bar: ()) {} } -// @count foo/fn.baz.html '//*[@class="rust fn"]' 1 -// @!has - '//*[@class="rust fn"]' 'mut' +// @count foo/fn.baz.html '//div[@class="item-decl"]/pre[@class="rust"]' 1 +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'mut' pub fn baz(mut foo: Foo) {} diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs index db56f68526b..659480479fd 100644 --- a/tests/rustdoc/normalize-assoc-item.rs +++ b/tests/rustdoc/normalize-assoc-item.rs @@ -19,12 +19,12 @@ impl Trait for isize { type X = <() as Trait>::X; } -// @has 'normalize_assoc_item/fn.f.html' '//pre[@class="rust fn"]' 'pub fn f() -> isize' +// @has 'normalize_assoc_item/fn.f.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f() -> isize' pub fn f() -> <usize as Trait>::X { 0 } -// @has 'normalize_assoc_item/fn.f2.html' '//pre[@class="rust fn"]' 'pub fn f2() -> fn() -> i32' +// @has 'normalize_assoc_item/fn.f2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f2() -> fn() -> i32' pub fn f2() -> <isize as Trait>::X { todo!() } @@ -49,10 +49,10 @@ impl<Inner: Trait> Trait for Generic<Inner> { // These can't be normalized because they depend on a generic parameter. // However the user can choose whether the text should be displayed as `Inner::X` or `<Inner as Trait>::X`. -// @has 'normalize_assoc_item/struct.Unknown.html' '//pre[@class="rust struct"]' 'pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X);' +// @has 'normalize_assoc_item/struct.Unknown.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X);' pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X); -// @has 'normalize_assoc_item/struct.Unknown2.html' '//pre[@class="rust struct"]' 'pub struct Unknown2<Inner: Trait>(pub Inner::X);' +// @has 'normalize_assoc_item/struct.Unknown2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Unknown2<Inner: Trait>(pub Inner::X);' pub struct Unknown2<Inner: Trait>(pub Inner::X); trait Lifetimes<'a> { @@ -63,20 +63,20 @@ impl<'a> Lifetimes<'a> for usize { type Y = &'a isize; } -// @has 'normalize_assoc_item/fn.g.html' '//pre[@class="rust fn"]' "pub fn g() -> &isize" +// @has 'normalize_assoc_item/fn.g.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn g() -> &isize" pub fn g() -> <usize as Lifetimes<'static>>::Y { &0 } -// @has 'normalize_assoc_item/constant.A.html' '//pre[@class="rust const"]' "pub const A: &isize" +// @has 'normalize_assoc_item/constant.A.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub const A: &isize" pub const A: <usize as Lifetimes<'static>>::Y = &0; // test cross-crate re-exports extern crate inner; -// @has 'normalize_assoc_item/fn.foo.html' '//pre[@class="rust fn"]' "pub fn foo() -> i32" +// @has 'normalize_assoc_item/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn foo() -> i32" pub use inner::foo; -// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust fn"]' "pub fn h<T>() -> IntoIter<T, Global>" +// @has 'normalize_assoc_item/fn.h.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn h<T>() -> IntoIter<T, Global>" pub fn h<T>() -> <Vec<T> as IntoIterator>::IntoIter { vec![].into_iter() } diff --git a/tests/rustdoc/pub-method.rs b/tests/rustdoc/pub-method.rs index fa7de0aff6a..0dca3f672cd 100644 --- a/tests/rustdoc/pub-method.rs +++ b/tests/rustdoc/pub-method.rs @@ -3,7 +3,7 @@ #![crate_name = "foo"] // @has foo/fn.bar.html -// @has - '//*[@class="rust fn"]' 'pub fn bar() -> ' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn bar() -> ' /// foo pub fn bar() -> usize { 2 diff --git a/tests/rustdoc/range-arg-pattern.rs b/tests/rustdoc/range-arg-pattern.rs index 756939ae377..bdbcc47c9f2 100644 --- a/tests/rustdoc/range-arg-pattern.rs +++ b/tests/rustdoc/range-arg-pattern.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.f.html -// @has - '//*[@class="rust fn"]' 'pub fn f(_: u8)' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f(_: u8)' pub fn f(0u8..=255: u8) {} diff --git a/tests/rustdoc/reexports-priv.rs b/tests/rustdoc/reexports-priv.rs index 11364e7f707..35c90ba5d7b 100644 --- a/tests/rustdoc/reexports-priv.rs +++ b/tests/rustdoc/reexports-priv.rs @@ -32,7 +32,7 @@ pub(self) use reexports::BarSelf; // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; -// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' +// @has 'foo/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -41,7 +41,7 @@ pub(self) use reexports::foo_self; // @!has 'foo/fn.foo_local.html' use reexports::foo_local; -// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' +// @has 'foo/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; @@ -94,22 +94,22 @@ pub mod outer { // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; - // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' + // @has 'foo/outer/inner/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' pub use reexports::foo; - // @has 'foo/outer/inner/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' + // @has 'foo/outer/inner/fn.foo_crate.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(crate) fn foo_crate()' pub(crate) use reexports::foo_crate; - // @has 'foo/outer/inner/fn.foo_super.html' '//*[@class="rust fn"]' 'pub(in outer) fn foo_super()' + // @has 'foo/outer/inner/fn.foo_super.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(in outer) fn foo_super()' pub(super) use::reexports::foo_super; // @!has 'foo/outer/inner/fn.foo_self.html' pub(self) use reexports::foo_self; // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; - // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' + // @has 'foo/outer/inner/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' pub use reexports::Type; - // @has 'foo/outer/inner/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' + // @has 'foo/outer/inner/type.TypeCrate.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(crate) type TypeCrate =' pub(crate) use reexports::TypeCrate; - // @has 'foo/outer/inner/type.TypeSuper.html' '//*[@class="rust typedef"]' 'pub(in outer) type TypeSuper =' + // @has 'foo/outer/inner/type.TypeSuper.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(in outer) type TypeSuper =' pub(super) use reexports::TypeSuper; // @!has 'foo/outer/inner/type.TypeSelf.html' pub(self) use reexports::TypeSelf; diff --git a/tests/rustdoc/reexports.rs b/tests/rustdoc/reexports.rs index 9aa6d7224ba..65d305c6d2c 100644 --- a/tests/rustdoc/reexports.rs +++ b/tests/rustdoc/reexports.rs @@ -31,7 +31,7 @@ pub(self) use reexports::BarSelf; // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; -// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' +// @has 'foo/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -40,7 +40,7 @@ pub(self) use reexports::foo_self; // @!has 'foo/fn.foo_local.html' use reexports::foo_local; -// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' +// @has 'foo/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; @@ -93,7 +93,7 @@ pub mod outer { // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; - // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' + // @has 'foo/outer/inner/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/outer/inner/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -104,7 +104,7 @@ pub mod outer { // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; - // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' + // @has 'foo/outer/inner/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/outer/inner/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs index 7ed9d6729b6..a229a4e29fe 100644 --- a/tests/rustdoc/rfc-2632-const-trait-impl.rs +++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs @@ -12,10 +12,10 @@ use std::marker::Destruct; pub struct S<T>(T); -// @!has foo/trait.Tr.html '//pre[@class="rust trait"]/code/a[@class="trait"]' '~const' -// @has - '//pre[@class="rust trait"]/code/a[@class="trait"]' 'Clone' -// @!has - '//pre[@class="rust trait"]/code/span[@class="where"]' '~const' -// @has - '//pre[@class="rust trait"]/code/span[@class="where"]' ': Clone' +// @!has foo/trait.Tr.html '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' '~const' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' 'Clone' +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where"]' '~const' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where"]' ': Clone' #[const_trait] pub trait Tr<T> { // @!has - '//section[@id="method.a"]/h4[@class="code-header"]' '~const' @@ -45,10 +45,10 @@ where } } -// @!has foo/fn.foo.html '//pre[@class="rust fn"]/code/a[@class="trait"]' '~const' -// @has - '//pre[@class="rust fn"]/code/a[@class="trait"]' 'Clone' -// @!has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' '~const' -// @has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' ': Clone' +// @!has foo/fn.foo.html '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' '~const' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' 'Clone' +// @!has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where fmt-newline"]' '~const' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where fmt-newline"]' ': Clone' pub const fn foo<F: ~const Clone + ~const Destruct>() where Option<F>: ~const Clone + ~const Destruct, diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs index d08abdaeb14..0b65bf1dfed 100644 --- a/tests/rustdoc/safe-intrinsic.rs +++ b/tests/rustdoc/safe-intrinsic.rs @@ -7,16 +7,16 @@ extern "rust-intrinsic" { // @has 'foo/fn.abort.html' - // @has - '//pre[@class="rust fn"]' 'pub extern "rust-intrinsic" fn abort() -> !' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "rust-intrinsic" fn abort() -> !' #[rustc_safe_intrinsic] pub fn abort() -> !; // @has 'foo/fn.unreachable.html' - // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' pub fn unreachable() -> !; } extern "C" { // @has 'foo/fn.needs_drop.html' - // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "C" fn needs_drop() -> !' + // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn needs_drop() -> !' pub fn needs_drop() -> !; } diff --git a/tests/rustdoc/slice-links.rs b/tests/rustdoc/slice-links.rs index 9a78e963e30..67137fdcab2 100644 --- a/tests/rustdoc/slice-links.rs +++ b/tests/rustdoc/slice-links.rs @@ -4,25 +4,25 @@ pub struct MyBox<T: ?Sized>(*const T); // @has 'foo/fn.alpha.html' -// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code' +// @snapshot link_slice_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn alpha() -> &'static [u32] { loop {} } // @has 'foo/fn.beta.html' -// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code' +// @snapshot link_slice_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn beta<T>() -> &'static [T] { loop {} } // @has 'foo/fn.gamma.html' -// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code' +// @snapshot link_box_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn gamma() -> MyBox<[u32]> { loop {} } // @has 'foo/fn.delta.html' -// @snapshot link_box_generic - '//pre[@class="rust fn"]/code' +// @snapshot link_box_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn delta<T>() -> MyBox<[T]> { loop {} } diff --git a/tests/rustdoc/struct-arg-pattern.rs b/tests/rustdoc/struct-arg-pattern.rs index 3c0369e3d34..3bfb43a0bef 100644 --- a/tests/rustdoc/struct-arg-pattern.rs +++ b/tests/rustdoc/struct-arg-pattern.rs @@ -4,7 +4,7 @@ struct BodyId { hir_id: usize, } -// @has 'foo/fn.body_owner.html' '//*[@class="rust fn"]' 'pub fn body_owner(_: BodyId)' +// @has 'foo/fn.body_owner.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn body_owner(_: BodyId)' pub fn body_owner(BodyId { hir_id }: BodyId) { // ... } diff --git a/tests/rustdoc/test-parens.rs b/tests/rustdoc/test-parens.rs index d9b9c7957d9..f5fdb1f52bf 100644 --- a/tests/rustdoc/test-parens.rs +++ b/tests/rustdoc/test-parens.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//*[@class="rust fn"]' "_: &(dyn ToString + 'static)" +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_: &(dyn ToString + 'static)" pub fn foo(_: &(ToString + 'static)) {} diff --git a/tests/rustdoc/toggle-item-contents.rs b/tests/rustdoc/toggle-item-contents.rs index 87240f233ff..5d34ec09b66 100644 --- a/tests/rustdoc/toggle-item-contents.rs +++ b/tests/rustdoc/toggle-item-contents.rs @@ -81,8 +81,8 @@ pub enum EnumStructVariant { } // @has 'toggle_item_contents/enum.LargeEnum.html' -// @count - '//*[@class="rust enum"]//details[@class="toggle type-contents-toggle"]' 1 -// @has - '//*[@class="rust enum"]//details[@class="toggle type-contents-toggle"]' 'Show 13 variants' +// @count - '//div[@class="item-decl"]/pre//details[@class="toggle type-contents-toggle"]' 1 +// @has - '//div[@class="item-decl"]/pre//details[@class="toggle type-contents-toggle"]' 'Show 13 variants' pub enum LargeEnum { A, B, C, D, E, F(u8), G, H, I, J, K, L, M } diff --git a/tests/rustdoc/tuple-struct-fields-doc.rs b/tests/rustdoc/tuple-struct-fields-doc.rs index 8ab1143d1f7..d72c10f2b25 100644 --- a/tests/rustdoc/tuple-struct-fields-doc.rs +++ b/tests/rustdoc/tuple-struct-fields-doc.rs @@ -19,7 +19,7 @@ pub struct Foo( ); // @has foo/enum.Bar.html -// @has - '//pre[@class="rust enum"]' 'BarVariant(String),' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'BarVariant(String),' // @matches - '//*[@id="variant.BarVariant.fields"]/h4' '^Tuple Fields$' // @has - '//*[@id="variant.BarVariant.field.0"]' '0: String' // @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs' diff --git a/tests/rustdoc/tuples.rs b/tests/rustdoc/tuples.rs index 62e2f9e7ef2..e716de8b55c 100644 --- a/tests/rustdoc/tuples.rs +++ b/tests/rustdoc/tuples.rs @@ -1,20 +1,20 @@ #![crate_name = "foo"] // @has foo/fn.tuple0.html //pre 'pub fn tuple0(x: ())' -// @snapshot link_unit - '//pre[@class="rust fn"]/code' +// @snapshot link_unit - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple0(x: ()) -> () { x } // @has foo/fn.tuple1.html //pre 'pub fn tuple1(x: (i32,)) -> (i32,)' -// @snapshot link1_i32 - '//pre[@class="rust fn"]/code' +// @snapshot link1_i32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple1(x: (i32,)) -> (i32,) { x } // @has foo/fn.tuple2.html //pre 'pub fn tuple2(x: (i32, i32)) -> (i32, i32)' -// @snapshot link2_i32 - '//pre[@class="rust fn"]/code' +// @snapshot link2_i32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple2(x: (i32, i32)) -> (i32, i32) { x } // @has foo/fn.tuple1_t.html //pre 'pub fn tuple1_t<T>(x: (T,)) -> (T,)' -// @snapshot link1_t - '//pre[@class="rust fn"]/code' +// @snapshot link1_t - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple1_t<T>(x: (T,)) -> (T,) { x } // @has foo/fn.tuple2_t.html //pre 'pub fn tuple2_t<T>(x: (T, T)) -> (T, T)' -// @snapshot link2_t - '//pre[@class="rust fn"]/code' +// @snapshot link2_t - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple2_t<T>(x: (T, T)) -> (T, T) { x } // @has foo/fn.tuple2_tu.html //pre 'pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U)' -// @snapshot link2_tu - '//pre[@class="rust fn"]/code' +// @snapshot link2_tu - '//div[@class="item-decl"]/pre[@class="rust"]/code' pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U) { x } diff --git a/tests/rustdoc/unit-return.rs b/tests/rustdoc/unit-return.rs index ae3a6031519..353cd1c4772 100644 --- a/tests/rustdoc/unit-return.rs +++ b/tests/rustdoc/unit-return.rs @@ -4,14 +4,14 @@ extern crate unit_return; -// @has 'foo/fn.f0.html' '//*[@class="rust fn"]' 'F: FnMut(u8) + Clone' +// @has 'foo/fn.f0.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u8) + Clone' pub fn f0<F: FnMut(u8) + Clone>(f: F) {} -// @has 'foo/fn.f1.html' '//*[@class="rust fn"]' 'F: FnMut(u16) + Clone' +// @has 'foo/fn.f1.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u16) + Clone' pub fn f1<F: FnMut(u16) -> () + Clone>(f: F) {} -// @has 'foo/fn.f2.html' '//*[@class="rust fn"]' 'F: FnMut(u32) + Clone' +// @has 'foo/fn.f2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u32) + Clone' pub use unit_return::f2; -// @has 'foo/fn.f3.html' '//*[@class="rust fn"]' 'F: FnMut(u64) + Clone' +// @has 'foo/fn.f3.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u64) + Clone' pub use unit_return::f3; diff --git a/tests/rustdoc/where-sized.rs b/tests/rustdoc/where-sized.rs index fe7cad8c3ef..c0c085e6ac7 100644 --- a/tests/rustdoc/where-sized.rs +++ b/tests/rustdoc/where-sized.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//*[@class="rust fn"]' 'pub fn foo<X, Y: ?Sized>(_: &X)' -// @has - '//*[@class="rust fn"]' 'where X: ?Sized,' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo<X, Y: ?Sized>(_: &X)' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where X: ?Sized,' pub fn foo<X, Y: ?Sized>(_: &X) where X: ?Sized {} diff --git a/tests/rustdoc/where.SWhere_Simd_item-decl.html b/tests/rustdoc/where.SWhere_Simd_item-decl.html index 6c1b5d31513..f84cb3753cb 100644 --- a/tests/rustdoc/where.SWhere_Simd_item-decl.html +++ b/tests/rustdoc/where.SWhere_Simd_item-decl.html @@ -1 +1 @@ -<div class="item-decl"><pre class="rust struct"><code>pub struct Simd<T>(_)<br /><span class="where">where<br />    T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre></div> \ No newline at end of file +<div class="item-decl"><pre class="rust"><code>pub struct Simd<T>(_)<br /><span class="where">where<br />    T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html b/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html index d5d6c556d80..85b62667427 100644 --- a/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html +++ b/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust trait"><code>pub trait TraitWhere { +<div class="item-decl"><pre class="rust"><code>pub trait TraitWhere { type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />    <span class="where">where<br />        Self: 'a</span>; fn <a href="#method.func" class="fn">func</a>(self)<br />    <span class="where">where<br />        Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>, diff --git a/tests/rustdoc/where.rs b/tests/rustdoc/where.rs index 8b5bce28f5a..3ac0c6872a8 100644 --- a/tests/rustdoc/where.rs +++ b/tests/rustdoc/where.rs @@ -57,6 +57,6 @@ pub enum Foxtrot<F> { Foxtrot1(F) } // "impl<F> MyTrait for Foxtrot<F>where F: MyTrait" impl<F> MyTrait for Foxtrot<F>where F: MyTrait {} -// @has foo/type.Golf.html '//pre[@class="rust typedef"]' \ +// @has foo/type.Golf.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // "type Golf<T>where T: Clone, = (T, T)" pub type Golf<T> where T: Clone = (T, T); diff --git a/tests/rustdoc/whitespace-after-where-clause.enum.html b/tests/rustdoc/whitespace-after-where-clause.enum.html index f7663e4616a..20bde549a03 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust enum"><code>pub enum Cow<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ +<div class="item-decl"><pre class="rust"><code>pub enum Cow<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html index ac7d7759821..d9fc0c22309 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum2.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust enum"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.struct.html b/tests/rustdoc/whitespace-after-where-clause.struct.html index fa3f224e7ad..f375265d7c1 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust struct"><code>pub struct Struct<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ +<div class="item-decl"><pre class="rust"><code>pub struct Struct<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html index fb06b0f77c5..1c59962eb1c 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct2.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust struct"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.trait.html b/tests/rustdoc/whitespace-after-where-clause.trait.html index 50cfe362328..a2df06e7736 100644 --- a/tests/rustdoc/whitespace-after-where-clause.trait.html +++ b/tests/rustdoc/whitespace-after-where-clause.trait.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust trait"><code>pub trait ToOwned<T><span class="where fmt-newline">where<br />    T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span>{ +<div class="item-decl"><pre class="rust"><code>pub trait ToOwned<T><span class="where fmt-newline">where<br />    T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span>{ type <a href="#associatedtype.Owned" class="associatedtype">Owned</a>; fn <a href="#tymethod.to_owned" class="fn">to_owned</a>(&self) -> Self::<a class="associatedtype" href="trait.ToOwned.html#associatedtype.Owned" title="type foo::ToOwned::Owned">Owned</a>; diff --git a/tests/rustdoc/whitespace-after-where-clause.trait2.html b/tests/rustdoc/whitespace-after-where-clause.trait2.html index 21eb89b7501..2bfd6f7685a 100644 --- a/tests/rustdoc/whitespace-after-where-clause.trait2.html +++ b/tests/rustdoc/whitespace-after-where-clause.trait2.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust trait"><code>pub trait ToOwned2<T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> { +<div class="item-decl"><pre class="rust"><code>pub trait ToOwned2<T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> { type <a href="#associatedtype.Owned" class="associatedtype">Owned</a>; fn <a href="#tymethod.to_owned" class="fn">to_owned</a>(&self) -> Self::<a class="associatedtype" href="trait.ToOwned2.html#associatedtype.Owned" title="type foo::ToOwned2::Owned">Owned</a>; diff --git a/tests/rustdoc/whitespace-after-where-clause.union.html b/tests/rustdoc/whitespace-after-where-clause.union.html index 7bb177debc3..066f8f87b16 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union.html +++ b/tests/rustdoc/whitespace-after-where-clause.union.html @@ -1,3 +1,3 @@ -<div class="item-decl"><pre class="rust union"><code>pub union Union<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ +<div class="item-decl"><pre class="rust"><code>pub union Union<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ /* private fields */ }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html index 0d237df53c7..6b48c5dbd3e 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union2.html +++ b/tests/rustdoc/whitespace-after-where-clause.union2.html @@ -1,3 +1,3 @@ -<div class="item-decl"><pre class="rust union"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { /* private fields */ }</code></pre></div> \ No newline at end of file diff --git a/tests/rustdoc/wrapping.rs b/tests/rustdoc/wrapping.rs index 8d8221bcdf2..178b8adc3f0 100644 --- a/tests/rustdoc/wrapping.rs +++ b/tests/rustdoc/wrapping.rs @@ -1,5 +1,5 @@ use std::fmt::Debug; -// @has 'wrapping/fn.foo.html' '//pre[@class="rust fn"]' 'pub fn foo() -> impl Debug' -// @count - '//pre[@class="rust fn"]/br' 0 +// @has 'wrapping/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo() -> impl Debug' +// @count - '//div[@class="item-decl"]/pre[@class="rust"]/br' 0 pub fn foo() -> impl Debug {} diff --git a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr index 041232e8690..1d10dfdf10c 100644 --- a/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr @@ -10,7 +10,7 @@ error: overly complex generic constant --> $DIR/array-size-in-generic-struct-param.rs:19:15 | LL | arr: [u8; CFG.arr_size], - | ^^^^^^^^^^^^ field access is not supported in generic constant + | ^^^^^^^^^^^^ field access is not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs new file mode 100644 index 00000000000..7332a8f03c0 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs @@ -0,0 +1,11 @@ +#![feature(inline_const, generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +fn foo<T>() { + let _ = [0u8; const { std::mem::size_of::<T>() }]; + //~^ ERROR: overly complex generic constant +} + +fn main() { + foo::<i32>(); +} diff --git a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr new file mode 100644 index 00000000000..f2625990840 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr @@ -0,0 +1,20 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/const-block-is-poly.rs:1:26 + | +LL | #![feature(inline_const, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: overly complex generic constant + --> $DIR/const-block-is-poly.rs:5:19 + | +LL | let _ = [0u8; const { std::mem::size_of::<T>() }]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ const blocks are not supported in generic constants + | + = help: consider moving this anonymous constant into a `const` function + = note: this operation may be supported in the future + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/const-generics/generic_const_exprs/let-bindings.stderr b/tests/ui/const-generics/generic_const_exprs/let-bindings.stderr index 5ebb4c3999c..823a4f8a185 100644 --- a/tests/ui/const-generics/generic_const_exprs/let-bindings.stderr +++ b/tests/ui/const-generics/generic_const_exprs/let-bindings.stderr @@ -2,7 +2,7 @@ error: overly complex generic constant --> $DIR/let-bindings.rs:6:68 | LL | fn test<const N: usize>() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default { - | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future @@ -11,7 +11,7 @@ error: overly complex generic constant --> $DIR/let-bindings.rs:6:35 | LL | fn test<const N: usize>() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default { - | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/generic_const_exprs/unused_expr.stderr b/tests/ui/const-generics/generic_const_exprs/unused_expr.stderr index df73acf53de..265a3b9d233 100644 --- a/tests/ui/const-generics/generic_const_exprs/unused_expr.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unused_expr.stderr @@ -2,7 +2,7 @@ error: overly complex generic constant --> $DIR/unused_expr.rs:4:34 | LL | fn add<const N: usize>() -> [u8; { N + 1; 5 }] { - | ^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future @@ -11,7 +11,7 @@ error: overly complex generic constant --> $DIR/unused_expr.rs:9:34 | LL | fn div<const N: usize>() -> [u8; { N / 1; 5 }] { - | ^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future @@ -20,7 +20,7 @@ error: overly complex generic constant --> $DIR/unused_expr.rs:16:38 | LL | fn fn_call<const N: usize>() -> [u8; { foo(N); 5 }] { - | ^^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/issues/issue-67945-2.full.stderr b/tests/ui/const-generics/issues/issue-67945-2.full.stderr index cce85772aa4..47429b7612f 100644 --- a/tests/ui/const-generics/issues/issue-67945-2.full.stderr +++ b/tests/ui/const-generics/issues/issue-67945-2.full.stderr @@ -8,7 +8,7 @@ LL | | let x: Option<Box<Self>> = None; LL | | LL | | 0 LL | | }], - | |_____^ blocks are not supported in generic constant + | |_____^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/issues/issue-67945-3.full.stderr b/tests/ui/const-generics/issues/issue-67945-3.full.stderr index d3d9452d316..98f9f83976a 100644 --- a/tests/ui/const-generics/issues/issue-67945-3.full.stderr +++ b/tests/ui/const-generics/issues/issue-67945-3.full.stderr @@ -7,7 +7,7 @@ LL | | let x: Option<S> = None; LL | | LL | | 0 LL | | }], - | |_____^ blocks are not supported in generic constant + | |_____^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/issues/issue-67945-4.full.stderr b/tests/ui/const-generics/issues/issue-67945-4.full.stderr index 9604eb35d02..c03d40a7bb8 100644 --- a/tests/ui/const-generics/issues/issue-67945-4.full.stderr +++ b/tests/ui/const-generics/issues/issue-67945-4.full.stderr @@ -7,7 +7,7 @@ LL | | let x: Option<Box<S>> = None; LL | | LL | | 0 LL | | }], - | |_____^ blocks are not supported in generic constant + | |_____^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/issues/issue-77357.stderr b/tests/ui/const-generics/issues/issue-77357.stderr index 804c0ae5175..68b35a38b0f 100644 --- a/tests/ui/const-generics/issues/issue-77357.stderr +++ b/tests/ui/const-generics/issues/issue-77357.stderr @@ -2,7 +2,7 @@ error: overly complex generic constant --> $DIR/issue-77357.rs:6:46 | LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constant + | ^^^^^^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/tests/ui/const-generics/issues/issue-90318.rs b/tests/ui/const-generics/issues/issue-90318.rs index d6c48e63bb3..909997340f3 100644 --- a/tests/ui/const-generics/issues/issue-90318.rs +++ b/tests/ui/const-generics/issues/issue-90318.rs @@ -12,14 +12,14 @@ impl True for If<true> {} fn consume<T: 'static>(_val: T) where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - //~^ ERROR: can't compare + //~^ overly complex generic constant { } fn test<T: 'static>() where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - //~^ ERROR: can't compare + //~^ overly complex generic constant { } diff --git a/tests/ui/const-generics/issues/issue-90318.stderr b/tests/ui/const-generics/issues/issue-90318.stderr index aba4b5c1a8d..f13fd795d7a 100644 --- a/tests/ui/const-generics/issues/issue-90318.stderr +++ b/tests/ui/const-generics/issues/issue-90318.stderr @@ -1,29 +1,24 @@ -error[E0277]: can't compare `TypeId` with `_` in const contexts - --> $DIR/issue-90318.rs:14:28 +error: overly complex generic constant + --> $DIR/issue-90318.rs:14:8 | LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - | ^^ no implementation for `TypeId == _` + | ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | borrowing is not supported in generic constants | - = help: the trait `~const PartialEq<_>` is not implemented for `TypeId` -note: the trait `PartialEq<_>` is implemented for `TypeId`, but that implementation is not `const` - --> $DIR/issue-90318.rs:14:28 - | -LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - | ^^ + = help: consider moving this anonymous constant into a `const` function + = note: this operation may be supported in the future -error[E0277]: can't compare `TypeId` with `_` in const contexts - --> $DIR/issue-90318.rs:21:28 +error: overly complex generic constant + --> $DIR/issue-90318.rs:21:8 | LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - | ^^ no implementation for `TypeId == _` + | ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | borrowing is not supported in generic constants | - = help: the trait `~const PartialEq<_>` is not implemented for `TypeId` -note: the trait `PartialEq<_>` is implemented for `TypeId`, but that implementation is not `const` - --> $DIR/issue-90318.rs:21:28 - | -LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - | ^^ + = help: consider moving this anonymous constant into a `const` function + = note: this operation may be supported in the future error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-match-check.eval1.stderr b/tests/ui/consts/const-match-check.eval1.stderr index 1caf1617e21..08fcd1deab1 100644 --- a/tests/ui/consts/const-match-check.eval1.stderr +++ b/tests/ui/consts/const-match-check.eval1.stderr @@ -11,6 +11,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | A = { if let 0 = 0 { todo!() } 0 }, | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | A = { let _0 = 0; 0 }, + | + error: aborting due to previous error diff --git a/tests/ui/consts/const-match-check.eval2.stderr b/tests/ui/consts/const-match-check.eval2.stderr index f038ba1c8ed..5d86ca4bfd1 100644 --- a/tests/ui/consts/const-match-check.eval2.stderr +++ b/tests/ui/consts/const-match-check.eval2.stderr @@ -11,6 +11,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | let x: [i32; { if let 0 = 0 { todo!() } 0 }] = []; | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | let x: [i32; { let _0 = 0; 0 }] = []; + | + error: aborting due to previous error diff --git a/tests/ui/consts/const-match-check.matchck.stderr b/tests/ui/consts/const-match-check.matchck.stderr index b1921f8a41e..c8f66bb0fc0 100644 --- a/tests/ui/consts/const-match-check.matchck.stderr +++ b/tests/ui/consts/const-match-check.matchck.stderr @@ -11,6 +11,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | const X: i32 = { let _0 = 0; 0 }; + | + error[E0005]: refutable pattern in local binding --> $DIR/const-match-check.rs:8:23 @@ -25,6 +29,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | static Y: i32 = { if let 0 = 0 { todo!() } 0 }; | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | static Y: i32 = { let _0 = 0; 0 }; + | + error[E0005]: refutable pattern in local binding --> $DIR/const-match-check.rs:13:26 @@ -39,6 +47,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | const X: i32 = { let _0 = 0; 0 }; + | + error[E0005]: refutable pattern in local binding --> $DIR/const-match-check.rs:19:26 @@ -53,6 +65,10 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | const X: i32 = { if let 0 = 0 { todo!() } 0 }; | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | const X: i32 = { let _0 = 0; 0 }; + | + error: aborting due to 4 previous errors diff --git a/tests/ui/consts/const_cmp_type_id.rs b/tests/ui/consts/const_cmp_type_id.rs new file mode 100644 index 00000000000..f10d1c24f7d --- /dev/null +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -0,0 +1,12 @@ +// run-pass +#![feature(const_type_id)] +#![feature(const_trait_impl)] + +use std::any::TypeId; + +const fn main() { + assert!(TypeId::of::<u8>() == TypeId::of::<u8>()); + assert!(TypeId::of::<()>() != TypeId::of::<u8>()); + const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>(); + // can't assert `_A` because it is not deterministic +} diff --git a/tests/ui/consts/issue-73976-monomorphic.rs b/tests/ui/consts/issue-73976-monomorphic.rs index 7706a97f23b..addcc1eaab6 100644 --- a/tests/ui/consts/issue-73976-monomorphic.rs +++ b/tests/ui/consts/issue-73976-monomorphic.rs @@ -7,6 +7,7 @@ #![feature(const_type_id)] #![feature(const_type_name)] +#![feature(const_trait_impl)] use std::any::{self, TypeId}; @@ -17,7 +18,7 @@ impl<T: 'static> GetTypeId<T> { } const fn check_type_id<T: 'static>() -> bool { - matches!(GetTypeId::<T>::VALUE, GetTypeId::<usize>::VALUE) + GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE } pub struct GetTypeNameLen<T>(T); diff --git a/tests/ui/empty/empty-macro-use.stderr b/tests/ui/empty/empty-macro-use.stderr index 700f6616af4..e0b3b8685d6 100644 --- a/tests/ui/empty/empty-macro-use.stderr +++ b/tests/ui/empty/empty-macro-use.stderr @@ -4,7 +4,7 @@ error: cannot find macro `macro_two` in this scope LL | macro_two!(); | ^^^^^^^^^ | - = note: consider importing this macro: + = help: consider importing this macro: two_macros::macro_two error: aborting due to previous error diff --git a/tests/ui/extenv/issue-55897.stderr b/tests/ui/extenv/issue-55897.stderr index 63797d4a71b..92e8a44b55f 100644 --- a/tests/ui/extenv/issue-55897.stderr +++ b/tests/ui/extenv/issue-55897.stderr @@ -30,7 +30,7 @@ LL | use env; help: consider importing this module instead | LL | use std::env; - | ~~~~~~~~~ + | ~~~~~~~~ error: cannot determine resolution for the macro `env` --> $DIR/issue-55897.rs:6:22 diff --git a/tests/ui/generics/issue-106694.rs b/tests/ui/generics/issue-106694.rs new file mode 100644 index 00000000000..c4b02ee81ec --- /dev/null +++ b/tests/ui/generics/issue-106694.rs @@ -0,0 +1,24 @@ +trait Trait {} + +fn foo(_: impl &Trait) {} +//~^ ERROR expected a trait, found type + +fn bar<T: &Trait>(_: T) {} +//~^ ERROR expected a trait, found type + +fn partially_correct_impl(_: impl &*const &Trait + Copy) {} +//~^ ERROR expected a trait, found type + +fn foo_bad(_: impl &BadTrait) {} +//~^ ERROR expected a trait, found type +//~^^ ERROR cannot find trait `BadTrait` in this scope + +fn bar_bad<T: &BadTrait>(_: T) {} +//~^ ERROR expected a trait, found type +//~^^ ERROR cannot find trait `BadTrait` in this scope + +fn partially_correct_impl_bad(_: impl &*const &BadTrait + Copy) {} +//~^ ERROR expected a trait, found type +//~^^ ERROR cannot find trait `BadTrait` in this scope + +fn main() {} diff --git a/tests/ui/generics/issue-106694.stderr b/tests/ui/generics/issue-106694.stderr new file mode 100644 index 00000000000..235b8982a99 --- /dev/null +++ b/tests/ui/generics/issue-106694.stderr @@ -0,0 +1,93 @@ +error: expected a trait, found type + --> $DIR/issue-106694.rs:3:16 + | +LL | fn foo(_: impl &Trait) {} + | ^^^^^^ + | +help: consider removing the indirection + | +LL - fn foo(_: impl &Trait) {} +LL + fn foo(_: impl Trait) {} + | + +error: expected a trait, found type + --> $DIR/issue-106694.rs:6:11 + | +LL | fn bar<T: &Trait>(_: T) {} + | ^^^^^^ + | +help: consider removing the indirection + | +LL - fn bar<T: &Trait>(_: T) {} +LL + fn bar<T: Trait>(_: T) {} + | + +error: expected a trait, found type + --> $DIR/issue-106694.rs:9:35 + | +LL | fn partially_correct_impl(_: impl &*const &Trait + Copy) {} + | ^^^^^^^^^^^^^^ + | +help: consider removing the indirection + | +LL - fn partially_correct_impl(_: impl &*const &Trait + Copy) {} +LL + fn partially_correct_impl(_: impl Trait + Copy) {} + | + +error: expected a trait, found type + --> $DIR/issue-106694.rs:12:20 + | +LL | fn foo_bad(_: impl &BadTrait) {} + | ^^^^^^^^^ + | +help: consider removing the indirection + | +LL - fn foo_bad(_: impl &BadTrait) {} +LL + fn foo_bad(_: impl BadTrait) {} + | + +error: expected a trait, found type + --> $DIR/issue-106694.rs:16:15 + | +LL | fn bar_bad<T: &BadTrait>(_: T) {} + | ^^^^^^^^^ + | +help: consider removing the indirection + | +LL - fn bar_bad<T: &BadTrait>(_: T) {} +LL + fn bar_bad<T: BadTrait>(_: T) {} + | + +error: expected a trait, found type + --> $DIR/issue-106694.rs:20:39 + | +LL | fn partially_correct_impl_bad(_: impl &*const &BadTrait + Copy) {} + | ^^^^^^^^^^^^^^^^^ + | +help: consider removing the indirection + | +LL - fn partially_correct_impl_bad(_: impl &*const &BadTrait + Copy) {} +LL + fn partially_correct_impl_bad(_: impl BadTrait + Copy) {} + | + +error[E0405]: cannot find trait `BadTrait` in this scope + --> $DIR/issue-106694.rs:12:21 + | +LL | fn foo_bad(_: impl &BadTrait) {} + | ^^^^^^^^ not found in this scope + +error[E0405]: cannot find trait `BadTrait` in this scope + --> $DIR/issue-106694.rs:16:16 + | +LL | fn bar_bad<T: &BadTrait>(_: T) {} + | ^^^^^^^^ not found in this scope + +error[E0405]: cannot find trait `BadTrait` in this scope + --> $DIR/issue-106694.rs:20:48 + | +LL | fn partially_correct_impl_bad(_: impl &*const &BadTrait + Copy) {} + | ^^^^^^^^ not found in this scope + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index 1f2a96a4c41..c01901be5fe 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -51,7 +51,7 @@ LL | n!(f); LL | n!(f); | ^ not found in this scope | - = note: consider importing this function: + = help: consider importing this function: foo::f = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -64,7 +64,7 @@ LL | n!(f); LL | f | ^ not found in this scope | - = note: consider importing this function: + = help: consider importing this function: foo::f = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/hygiene/no_implicit_prelude-2018.stderr b/tests/ui/hygiene/no_implicit_prelude-2018.stderr index 02ddc391f6e..3f31b041b62 100644 --- a/tests/ui/hygiene/no_implicit_prelude-2018.stderr +++ b/tests/ui/hygiene/no_implicit_prelude-2018.stderr @@ -4,7 +4,7 @@ error: cannot find macro `print` in this scope LL | print!(); | ^^^^^ | - = note: consider importing this macro: + = help: consider importing this macro: std::print error: aborting due to previous error diff --git a/tests/ui/imports/bad-import-in-nested.stderr b/tests/ui/imports/bad-import-in-nested.stderr index 855b1e637e9..b6b1bc5fccf 100644 --- a/tests/ui/imports/bad-import-in-nested.stderr +++ b/tests/ui/imports/bad-import-in-nested.stderr @@ -4,7 +4,7 @@ error[E0432]: unresolved import `super::super::C::D::AA` LL | use super::{super::C::D::AA, AA as _}; | ^^^^^^^^^^^^^^^ no `AA` in `C::D` | - = note: consider importing this type alias instead: + = help: consider importing this type alias instead: crate::A::AA error[E0432]: unresolved import `crate::C::AA` @@ -13,7 +13,7 @@ error[E0432]: unresolved import `crate::C::AA` LL | use crate::C::{self, AA}; | ^^ no `AA` in `C` | - = note: consider importing this type alias instead: + = help: consider importing this type alias instead: crate::A::AA error[E0432]: unresolved import `crate::C::BB` @@ -22,7 +22,7 @@ error[E0432]: unresolved import `crate::C::BB` LL | use crate::{A, C::BB}; | ^^^^^ no `BB` in `C` | - = note: consider importing this type alias instead: + = help: consider importing this type alias instead: crate::A::BB error: aborting due to 3 previous errors diff --git a/tests/ui/imports/bad-import-with-rename.stderr b/tests/ui/imports/bad-import-with-rename.stderr index cace2a7a51c..f9c5cf920e1 100644 --- a/tests/ui/imports/bad-import-with-rename.stderr +++ b/tests/ui/imports/bad-import-with-rename.stderr @@ -7,7 +7,7 @@ LL | use crate::D::B as _; help: consider importing this type alias instead | LL | use A::B as _; - | ~~~~~~~~~~ + | ~~~~~~~~~ error[E0432]: unresolved import `crate::D::B2` --> $DIR/bad-import-with-rename.rs:10:9 @@ -18,7 +18,7 @@ LL | use crate::D::B2; help: consider importing this type alias instead | LL | use A::B2; - | ~~~~~~ + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr index 059ca96808d..3448f311977 100644 --- a/tests/ui/imports/issue-56125.stderr +++ b/tests/ui/imports/issue-56125.stderr @@ -7,13 +7,13 @@ LL | use empty::issue_56125; help: consider importing one of these items instead | LL | use crate::m3::last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LL | use crate::m3::non_last_segment::non_last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LL | use issue_56125::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~ LL | use issue_56125::last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and 1 other candidate error[E0659]: `issue_56125` is ambiguous diff --git a/tests/ui/imports/issue-57015.stderr b/tests/ui/imports/issue-57015.stderr index 3b72d57fee4..5374ba3dc9e 100644 --- a/tests/ui/imports/issue-57015.stderr +++ b/tests/ui/imports/issue-57015.stderr @@ -7,7 +7,7 @@ LL | use single_err::something; help: consider importing this module instead | LL | use glob_ok::something; - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/lint/unused/issue-105061-array-lint.rs b/tests/ui/lint/unused/issue-105061-array-lint.rs new file mode 100644 index 00000000000..9b06a4fde04 --- /dev/null +++ b/tests/ui/lint/unused/issue-105061-array-lint.rs @@ -0,0 +1,11 @@ +#![warn(unused)] +#![deny(warnings)] + +fn main() { + let _x: ([u32; 3]); //~ ERROR unnecessary parentheses around type + let _y: [u8; (3)]; //~ ERROR unnecessary parentheses around const expression + let _z: ([u8; (3)]); + //~^ ERROR unnecessary parentheses around const expression + //~| ERROR unnecessary parentheses around type + +} diff --git a/tests/ui/lint/unused/issue-105061-array-lint.stderr b/tests/ui/lint/unused/issue-105061-array-lint.stderr new file mode 100644 index 00000000000..7eb761aee43 --- /dev/null +++ b/tests/ui/lint/unused/issue-105061-array-lint.stderr @@ -0,0 +1,56 @@ +error: unnecessary parentheses around type + --> $DIR/issue-105061-array-lint.rs:5:13 + | +LL | let _x: ([u32; 3]); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/issue-105061-array-lint.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]` +help: remove these parentheses + | +LL - let _x: ([u32; 3]); +LL + let _x: [u32; 3]; + | + +error: unnecessary parentheses around const expression + --> $DIR/issue-105061-array-lint.rs:6:18 + | +LL | let _y: [u8; (3)]; + | ^ ^ + | +help: remove these parentheses + | +LL - let _y: [u8; (3)]; +LL + let _y: [u8; 3]; + | + +error: unnecessary parentheses around type + --> $DIR/issue-105061-array-lint.rs:7:13 + | +LL | let _z: ([u8; (3)]); + | ^ ^ + | +help: remove these parentheses + | +LL - let _z: ([u8; (3)]); +LL + let _z: [u8; (3)]; + | + +error: unnecessary parentheses around const expression + --> $DIR/issue-105061-array-lint.rs:7:19 + | +LL | let _z: ([u8; (3)]); + | ^ ^ + | +help: remove these parentheses + | +LL - let _z: ([u8; (3)]); +LL + let _z: ([u8; 3]); + | + +error: aborting due to 4 previous errors + diff --git a/tests/ui/lint/unused/issue-105061-should-lint.rs b/tests/ui/lint/unused/issue-105061-should-lint.rs new file mode 100644 index 00000000000..7e4e0947349 --- /dev/null +++ b/tests/ui/lint/unused/issue-105061-should-lint.rs @@ -0,0 +1,23 @@ +#![warn(unused)] +#![deny(warnings)] + +struct Inv<'a>(&'a mut &'a ()); + +trait Trait<'a> {} +impl<'b> Trait<'b> for for<'a> fn(Inv<'a>) {} + +fn with_bound() +where + for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>, //~ ERROR unnecessary parentheses around type +{} + +trait Hello<T> {} +fn with_dyn_bound<T>() +where + (dyn Hello<(for<'b> fn(&'b ()))>): Hello<T> //~ ERROR unnecessary parentheses around type +{} + +fn main() { + with_bound(); + with_dyn_bound(); +} diff --git a/tests/ui/lint/unused/issue-105061-should-lint.stderr b/tests/ui/lint/unused/issue-105061-should-lint.stderr new file mode 100644 index 00000000000..e591f1ffb6b --- /dev/null +++ b/tests/ui/lint/unused/issue-105061-should-lint.stderr @@ -0,0 +1,32 @@ +error: unnecessary parentheses around type + --> $DIR/issue-105061-should-lint.rs:11:13 + | +LL | for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>, + | ^ ^ + | +note: the lint level is defined here + --> $DIR/issue-105061-should-lint.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]` +help: remove these parentheses + | +LL - for<'b> (for<'a> fn(Inv<'a>)): Trait<'b>, +LL + for<'b> for<'a> fn(Inv<'a>): Trait<'b>, + | + +error: unnecessary parentheses around type + --> $DIR/issue-105061-should-lint.rs:17:16 + | +LL | (dyn Hello<(for<'b> fn(&'b ()))>): Hello<T> + | ^ ^ + | +help: remove these parentheses + | +LL - (dyn Hello<(for<'b> fn(&'b ()))>): Hello<T> +LL + (dyn Hello<for<'b> fn(&'b ())>): Hello<T> + | + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/unused/issue-105061.rs b/tests/ui/lint/unused/issue-105061.rs new file mode 100644 index 00000000000..92d636d0ac6 --- /dev/null +++ b/tests/ui/lint/unused/issue-105061.rs @@ -0,0 +1,17 @@ +#![warn(unused)] +#![deny(warnings)] + +struct Inv<'a>(&'a mut &'a ()); + +trait Trait {} +impl Trait for (for<'a> fn(Inv<'a>),) {} + + +fn with_bound() +where + ((for<'a> fn(Inv<'a>)),): Trait, //~ ERROR unnecessary parentheses around type +{} + +fn main() { + with_bound(); +} diff --git a/tests/ui/lint/unused/issue-105061.stderr b/tests/ui/lint/unused/issue-105061.stderr new file mode 100644 index 00000000000..f07aa2012df --- /dev/null +++ b/tests/ui/lint/unused/issue-105061.stderr @@ -0,0 +1,20 @@ +error: unnecessary parentheses around type + --> $DIR/issue-105061.rs:12:6 + | +LL | ((for<'a> fn(Inv<'a>)),): Trait, + | ^ ^ + | +note: the lint level is defined here + --> $DIR/issue-105061.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(unused_parens)]` implied by `#[deny(warnings)]` +help: remove these parentheses + | +LL - ((for<'a> fn(Inv<'a>)),): Trait, +LL + (for<'a> fn(Inv<'a>),): Trait, + | + +error: aborting due to previous error + diff --git a/tests/ui/macros/issue-88228.rs b/tests/ui/macros/issue-88228.rs index cbdef5f0d40..60ba2eab7a7 100644 --- a/tests/ui/macros/issue-88228.rs +++ b/tests/ui/macros/issue-88228.rs @@ -8,7 +8,7 @@ mod hey { #[derive(Bla)] //~^ ERROR cannot find derive macro `Bla` -//~| NOTE consider importing this derive macro +//~| HELP consider importing this derive macro struct A; #[derive(println)] @@ -19,5 +19,5 @@ struct B; fn main() { bla!(); //~^ ERROR cannot find macro `bla` - //~| NOTE consider importing this macro + //~| HELP consider importing this macro } diff --git a/tests/ui/macros/issue-88228.stderr b/tests/ui/macros/issue-88228.stderr index 62afa67a783..fe8a1deaedd 100644 --- a/tests/ui/macros/issue-88228.stderr +++ b/tests/ui/macros/issue-88228.stderr @@ -4,7 +4,7 @@ error: cannot find macro `bla` in this scope LL | bla!(); | ^^^ | - = note: consider importing this macro: + = help: consider importing this macro: crate::hey::bla error: cannot find derive macro `println` in this scope @@ -21,7 +21,7 @@ error: cannot find derive macro `Bla` in this scope LL | #[derive(Bla)] | ^^^ | - = note: consider importing this derive macro: + = help: consider importing this derive macro: crate::hey::Bla error: aborting due to 3 previous errors diff --git a/tests/ui/macros/macro-use-wrong-name.stderr b/tests/ui/macros/macro-use-wrong-name.stderr index 326001fc15a..ca5f0f190e8 100644 --- a/tests/ui/macros/macro-use-wrong-name.stderr +++ b/tests/ui/macros/macro-use-wrong-name.stderr @@ -9,7 +9,7 @@ LL | macro_two!(); LL | macro_rules! macro_one { () => ("one") } | ---------------------- similarly named macro `macro_one` defined here | - = note: consider importing this macro: + = help: consider importing this macro: two_macros::macro_two error: aborting due to previous error diff --git a/tests/ui/missing/missing-macro-use.stderr b/tests/ui/missing/missing-macro-use.stderr index ced062269df..99e291cda03 100644 --- a/tests/ui/missing/missing-macro-use.stderr +++ b/tests/ui/missing/missing-macro-use.stderr @@ -4,7 +4,7 @@ error: cannot find macro `macro_two` in this scope LL | macro_two!(); | ^^^^^^^^^ | - = note: consider importing this macro: + = help: consider importing this macro: two_macros::macro_two error: aborting due to previous error diff --git a/tests/ui/pattern/issue-106552.rs b/tests/ui/pattern/issue-106552.rs new file mode 100644 index 00000000000..aa2c141e05e --- /dev/null +++ b/tests/ui/pattern/issue-106552.rs @@ -0,0 +1,7 @@ +fn main() { + let 5 = 6; + //~^ error refutable pattern in local binding [E0005] + + let x @ 5 = 6; + //~^ error refutable pattern in local binding [E0005] +} diff --git a/tests/ui/pattern/issue-106552.stderr b/tests/ui/pattern/issue-106552.stderr new file mode 100644 index 00000000000..ed5d40c0968 --- /dev/null +++ b/tests/ui/pattern/issue-106552.stderr @@ -0,0 +1,35 @@ +error[E0005]: refutable pattern in local binding + --> $DIR/issue-106552.rs:2:9 + | +LL | let 5 = 6; + | ^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `i32` +help: you might want to use `if let` to ignore the variants that aren't matched + | +LL | if let 5 = 6 { todo!() } + | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | let _5 = 6; + | + + +error[E0005]: refutable pattern in local binding + --> $DIR/issue-106552.rs:5:9 + | +LL | let x @ 5 = 6; + | ^^^^^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `i32` +help: you might want to use `let else` to handle the variants that aren't matched + | +LL | let x @ 5 = 6 else { todo!() }; + | ++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0005`. diff --git a/tests/ui/proc-macro/derive-helper-shadowing.stderr b/tests/ui/proc-macro/derive-helper-shadowing.stderr index 9c52ca42241..de2c27a878c 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.stderr @@ -16,7 +16,7 @@ error: cannot find attribute `empty_helper` in this scope LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ | - = note: consider importing this attribute macro: + = help: consider importing this attribute macro: empty_helper = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -29,7 +29,7 @@ LL | #[empty_helper] LL | gen_helper_use!(); | ----------------- in this macro invocation | - = note: consider importing this attribute macro: + = help: consider importing this attribute macro: crate::empty_helper = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/proc-macro/generate-mod.stderr b/tests/ui/proc-macro/generate-mod.stderr index 64042ca0ecd..2c55abf38c3 100644 --- a/tests/ui/proc-macro/generate-mod.stderr +++ b/tests/ui/proc-macro/generate-mod.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: FromOutside = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -14,7 +14,7 @@ error[E0412]: cannot find type `Outer` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: Outer = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -24,7 +24,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: FromOutside = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -34,7 +34,7 @@ error[E0412]: cannot find type `OuterAttr` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: OuterAttr = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -44,7 +44,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: FromOutside = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -54,7 +54,7 @@ error[E0412]: cannot find type `OuterDerive` in this scope LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: OuterDerive = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -64,7 +64,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: FromOutside = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -74,7 +74,7 @@ error[E0412]: cannot find type `OuterDerive` in this scope LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: OuterDerive = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -84,7 +84,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[derive(generate_mod::CheckDeriveLint)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: FromOutside = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -94,7 +94,7 @@ error[E0412]: cannot find type `OuterDeriveLint` in this scope LL | #[derive(generate_mod::CheckDeriveLint)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: consider importing this struct: + = help: consider importing this struct: OuterDeriveLint = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr index 761089cd387..122e8fd350c 100644 --- a/tests/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -7,9 +7,9 @@ LL | use alloc; help: consider importing one of these items instead | LL | use core::alloc; - | ~~~~~~~~~~~~ -LL | use std::alloc; | ~~~~~~~~~~~ +LL | use std::alloc; + | ~~~~~~~~~~ error: aborting due to previous error diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index 8881ede0dbc..f8b3e6d65af 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -15,7 +15,7 @@ LL | use std::simd::intrinsics; help: consider importing this module instead | LL | use std::intrinsics; - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/stability-attribute/issue-106589.rs b/tests/ui/stability-attribute/issue-106589.rs new file mode 100644 index 00000000000..3cad9a3d283 --- /dev/null +++ b/tests/ui/stability-attribute/issue-106589.rs @@ -0,0 +1,10 @@ +// #![feature(staged_api)] // note: `staged_api` not enabled + +#![stable(feature = "foo", since = "1.0.0")] +//~^ ERROR stability attributes may not be used outside of the standard library + +#[unstable(feature = "foo", issue = "none")] +//~^ ERROR stability attributes may not be used outside of the standard library +fn foo_unstable() {} + +fn main() {} diff --git a/tests/ui/stability-attribute/issue-106589.stderr b/tests/ui/stability-attribute/issue-106589.stderr new file mode 100644 index 00000000000..ccf3f7164e3 --- /dev/null +++ b/tests/ui/stability-attribute/issue-106589.stderr @@ -0,0 +1,15 @@ +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-106589.rs:6:1 + | +LL | #[unstable(feature = "foo", issue = "none")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-106589.rs:3:1 + | +LL | #![stable(feature = "foo", since = "1.0.0")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0734`. diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index a45c5bd4588..7635f579d66 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -13,7 +13,7 @@ LL | use test as y; help: consider importing this module instead | LL | use test::test as y; - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index bbd3eec2a54..ea737c567b9 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -7,7 +7,7 @@ LL | use Trait; help: consider importing this trait instead | LL | use a::Trait; - | ~~~~~~~~~ + | ~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 |
