]>
Commit | Line | Data |
---|---|---|
5e7ed085 | 1 | // Test that we do not currently display `~const` in rustdoc |
04454e1e | 2 | // as that syntax is currently provisional; `~const Destruct` has |
5e7ed085 FG |
3 | // no effect on stable code so it should be hidden as well. |
4 | // | |
5 | // To future blessers: make sure that `const_trait_impl` is | |
6 | // stabilized when changing `@!has` to `@has`, and please do | |
7 | // not remove this test. | |
8 | #![feature(const_trait_impl)] | |
9 | #![crate_name = "foo"] | |
10 | ||
04454e1e FG |
11 | use std::marker::Destruct; |
12 | ||
5e7ed085 FG |
13 | pub struct S<T>(T); |
14 | ||
15 | // @!has foo/trait.Tr.html '//pre[@class="rust trait"]/code/a[@class="trait"]' '~const' | |
5e7ed085 FG |
16 | // @has - '//pre[@class="rust trait"]/code/a[@class="trait"]' 'Clone' |
17 | // @!has - '//pre[@class="rust trait"]/code/span[@class="where"]' '~const' | |
5e7ed085 | 18 | // @has - '//pre[@class="rust trait"]/code/span[@class="where"]' ': Clone' |
923072b8 | 19 | #[const_trait] |
5e7ed085 | 20 | pub trait Tr<T> { |
2b03887a FG |
21 | // @!has - '//section[@id="method.a"]/h4[@class="code-header"]' '~const' |
22 | // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' | |
23 | // @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' | |
24 | // @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' | |
04454e1e FG |
25 | fn a<A: ~const Clone + ~const Destruct>() |
26 | where | |
27 | Option<A>: ~const Clone + ~const Destruct, | |
28 | { | |
29 | } | |
5e7ed085 FG |
30 | } |
31 | ||
064997fb | 32 | // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]' '' |
2b03887a FG |
33 | // @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]' '~const' |
34 | // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Clone' | |
35 | // @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const' | |
36 | // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' | |
04454e1e FG |
37 | impl<T: ~const Clone + ~const Destruct> const Tr<T> for T |
38 | where | |
39 | Option<T>: ~const Clone + ~const Destruct, | |
40 | { | |
41 | fn a<A: ~const Clone + ~const Destruct>() | |
42 | where | |
43 | Option<A>: ~const Clone + ~const Destruct, | |
44 | { | |
45 | } | |
5e7ed085 FG |
46 | } |
47 | ||
48 | // @!has foo/fn.foo.html '//pre[@class="rust fn"]/code/a[@class="trait"]' '~const' | |
5e7ed085 FG |
49 | // @has - '//pre[@class="rust fn"]/code/a[@class="trait"]' 'Clone' |
50 | // @!has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' '~const' | |
5e7ed085 | 51 | // @has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' ': Clone' |
04454e1e FG |
52 | pub const fn foo<F: ~const Clone + ~const Destruct>() |
53 | where | |
54 | Option<F>: ~const Clone + ~const Destruct, | |
55 | { | |
5e7ed085 FG |
56 | F::a() |
57 | } | |
58 | ||
59 | impl<T> S<T> { | |
60 | // @!has foo/struct.S.html '//section[@id="method.foo"]/h4[@class="code-header"]' '~const' | |
5e7ed085 FG |
61 | // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' |
62 | // @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const' | |
5e7ed085 | 63 | // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' |
487cf647 | 64 | pub const fn foo<B, C: ~const Clone + ~const Destruct>() |
04454e1e FG |
65 | where |
66 | B: ~const Clone + ~const Destruct, | |
67 | { | |
5e7ed085 FG |
68 | B::a() |
69 | } | |
70 | } |