2015-04-30 11:37:13 -05:00
|
|
|
pub trait Foo {
|
2023-01-30 12:05:12 -06:00
|
|
|
// @has assoc_consts/trait.Foo.html '//pre[@class="rust item-decl"]' \
|
2022-03-29 12:30:54 -05:00
|
|
|
// 'const FOO: usize = 13usize;'
|
2017-02-27 17:27:29 -06:00
|
|
|
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
|
2022-03-29 12:30:54 -05:00
|
|
|
const FOO: usize = 12 + 1;
|
2017-06-23 12:39:27 -05:00
|
|
|
// @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
|
|
|
|
const FOO_NO_DEFAULT: bool;
|
2022-08-11 23:44:07 -05:00
|
|
|
// @!hasraw - FOO_HIDDEN
|
2017-06-23 12:39:27 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
const FOO_HIDDEN: u8 = 0;
|
2015-04-30 11:37:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Bar;
|
|
|
|
|
2017-06-23 12:39:27 -05:00
|
|
|
impl Foo for Bar {
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Foo for Bar'
|
2017-06-23 12:39:27 -05:00
|
|
|
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
|
|
|
|
const FOO: usize = 12;
|
|
|
|
// @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
|
|
|
|
const FOO_NO_DEFAULT: bool = false;
|
2022-08-11 23:44:07 -05:00
|
|
|
// @!hasraw - FOO_HIDDEN
|
2017-06-23 12:39:27 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
const FOO_HIDDEN: u8 = 0;
|
|
|
|
}
|
|
|
|
|
2015-04-30 11:37:13 -05:00
|
|
|
impl Bar {
|
2016-02-12 02:43:33 -06:00
|
|
|
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
|
2017-02-27 17:27:29 -06:00
|
|
|
// 'const BAR: usize'
|
2015-04-30 11:37:13 -05:00
|
|
|
pub const BAR: usize = 3;
|
2022-06-23 10:19:56 -05:00
|
|
|
|
|
|
|
// @has - '//*[@id="associatedconstant.BAR_ESCAPED"]' \
|
|
|
|
// "const BAR_ESCAPED: &'static str = \"<em>markup</em>\""
|
|
|
|
pub const BAR_ESCAPED: &'static str = "<em>markup</em>";
|
2015-04-30 11:37:13 -05:00
|
|
|
}
|
2017-05-31 12:02:35 -05:00
|
|
|
|
|
|
|
pub struct Baz<'a, U: 'a, T>(T, &'a [U]);
|
|
|
|
|
|
|
|
impl Bar {
|
|
|
|
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAZ"]' \
|
|
|
|
// "const BAZ: Baz<'static, u8, u32>"
|
|
|
|
pub const BAZ: Baz<'static, u8, u32> = Baz(321, &[1, 2, 3]);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn f(_: &(ToString + 'static)) {}
|
|
|
|
|
|
|
|
impl Bar {
|
|
|
|
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \
|
2018-10-14 18:48:57 -05:00
|
|
|
// "const F: fn(_: &(dyn ToString + 'static))"
|
2022-11-02 09:25:04 -05:00
|
|
|
// FIXME(fmease): Hide default lifetime, render "const F: fn(_: &dyn ToString)"
|
2017-05-31 12:02:35 -05:00
|
|
|
pub const F: fn(_: &(ToString + 'static)) = f;
|
|
|
|
}
|
2017-06-23 12:39:27 -05:00
|
|
|
|
|
|
|
impl Bar {
|
2022-08-11 23:44:07 -05:00
|
|
|
// @!hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE'
|
2017-06-23 12:39:27 -05:00
|
|
|
const BAR_PRIVATE: char = 'a';
|
2022-08-11 23:44:07 -05:00
|
|
|
// @!hasraw assoc_consts/struct.Bar.html 'BAR_HIDDEN'
|
2017-06-23 12:39:27 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
pub const BAR_HIDDEN: &'static str = "a";
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has assoc_consts/trait.Qux.html
|
|
|
|
pub trait Qux {
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
|
|
|
|
/// Docs for QUX0 in trait.
|
|
|
|
const QUX0: u8;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX1 in trait."
|
|
|
|
/// Docs for QUX1 in trait.
|
|
|
|
const QUX1: i8;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
|
2018-10-21 12:22:37 -05:00
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
|
|
|
|
/// Docs for QUX_DEFAULT12 in trait.
|
2017-06-23 12:39:27 -05:00
|
|
|
const QUX_DEFAULT0: u16 = 1;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in trait."
|
|
|
|
/// Docs for QUX_DEFAULT1 in trait.
|
|
|
|
const QUX_DEFAULT1: i16 = 2;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
|
|
|
|
/// Docs for QUX_DEFAULT2 in trait.
|
|
|
|
const QUX_DEFAULT2: u32 = 3;
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar'
|
2017-06-23 12:39:27 -05:00
|
|
|
impl Qux for Bar {
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
|
|
|
|
/// Docs for QUX0 in trait.
|
|
|
|
const QUX0: u8 = 4;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX1 in impl."
|
|
|
|
/// Docs for QUX1 in impl.
|
|
|
|
const QUX1: i8 = 5;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
|
2021-05-23 10:09:39 -05:00
|
|
|
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
|
2017-06-23 12:39:27 -05:00
|
|
|
const QUX_DEFAULT0: u16 = 6;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
|
|
|
|
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in impl."
|
|
|
|
/// Docs for QUX_DEFAULT1 in impl.
|
|
|
|
const QUX_DEFAULT1: i16 = 7;
|
|
|
|
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
|
2021-05-23 10:09:39 -05:00
|
|
|
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
|
2017-06-23 12:39:27 -05:00
|
|
|
}
|