Skip to content

Commit

Permalink
Rollup merge of #98535 - GuillaumeGomez:regression-test-92859, r=lcnr
Browse files Browse the repository at this point in the history
Add regression test for generic const in rustdoc

Fixes #92859.

r? `@lcnr`
  • Loading branch information
matthiaskrgr authored Jun 26, 2022
2 parents 14859a5 + 0398aa8 commit 45f9740
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/rustdoc/generic_const_exprs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Regression test for <https://github.com/rust-lang/rust/issues/92859>.

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

#![crate_name = "foo"]

// @has 'foo/trait.Foo.html'

pub trait Foo: Sized {
const WIDTH: usize;

fn arrayify(self) -> [Self; Self::WIDTH];
}

impl<T: Sized> Foo for T {
const WIDTH: usize = 1;

// @has - '//*[@id="tymethod.arrayify"]/*[@class="code-header"]' \
// 'fn arrayify(self) -> [Self; Self::WIDTH]'
fn arrayify(self) -> [Self; Self::WIDTH] {
[self]
}
}

0 comments on commit 45f9740

Please sign in to comment.