Skip to content

Commit

Permalink
Rollup merge of rust-lang#98535 - GuillaumeGomez:regression-test-9285…
Browse files Browse the repository at this point in the history
…9, r=lcnr

Add regression test for generic const in rustdoc

Fixes rust-lang#92859.

r? ``@lcnr``
  • Loading branch information
matthiaskrgr authored Jun 26, 2022
2 parents 6960ad9 + 0398aa8 commit 300ad26
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 300ad26

Please sign in to comment.