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