fix rustdoc tests

This commit is contained in:
Deadbeef 2023-09-20 01:57:06 +00:00
parent a3b5f1ad85
commit 7446012c1e
2 changed files with 13 additions and 11 deletions

View File

@ -960,7 +960,7 @@ marker_impls! {
#[lang = "destruct"]
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
#[rustc_deny_explicit_impl(implement_via_object = false)]
// FIXME(effects) #[const_trait]
#[const_trait]
pub trait Destruct {}
/// A marker for tuple types.

View File

@ -5,6 +5,8 @@
// To future blessers: make sure that `const_trait_impl` is
// stabilized when changing `@!has` to `@has`, and please do
// not remove this test.
//
// FIXME(effects) add `const_trait` to `Fn` so we use `~const`
#![feature(const_trait_impl)]
#![crate_name = "foo"]
@ -22,9 +24,9 @@ pub trait Tr<T> {
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
fn a<A: ~const Fn() + ~const Destruct>()
fn a<A: /* ~const */ Fn() + ~const Destruct>()
where
Option<A>: ~const Fn() + ~const Destruct,
Option<A>: /* ~const */ Fn() + ~const Destruct,
{
}
}
@ -34,13 +36,13 @@ pub trait Tr<T> {
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
impl<T: ~const Fn() + ~const Destruct> const Tr<T> for T
impl<T: /* ~const */ Fn() + ~const Destruct> const Tr<T> for T
where
Option<T>: ~const Fn() + ~const Destruct,
Option<T>: /* ~const */ Fn() + ~const Destruct,
{
fn a<A: ~const Fn() + ~const Destruct>()
fn a<A: /* ~const */ Fn() + ~const Destruct>()
where
Option<A>: ~const Fn() + ~const Destruct,
Option<A>: /* ~const */ Fn() + ~const Destruct,
{
}
}
@ -49,9 +51,9 @@ where
// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Fn'
// @!has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' '~const'
// @has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' ': Fn'
pub const fn foo<F: ~const Fn() + ~const Destruct>()
pub const fn foo<F: /* ~const */ Fn() + ~const Destruct>()
where
Option<F>: ~const Fn() + ~const Destruct,
Option<F>: /* ~const */ Fn() + ~const Destruct,
{
F::a()
}
@ -61,9 +63,9 @@ impl<T> S<T> {
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
pub const fn foo<B, C: ~const Fn() + ~const Destruct>()
pub const fn foo<B, C: /* ~const */ Fn() + ~const Destruct>()
where
B: ~const Fn() + ~const Destruct,
B: /* ~const */ Fn() + ~const Destruct,
{
B::a()
}