2015-04-30 16:37:13 +00:00
|
|
|
pub trait Foo {
|
2024-06-21 12:03:08 +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;'
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
|
2022-03-29 17:30:54 +00:00
|
|
|
const FOO: usize = 12 + 1;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
|
2017-06-23 17:39:27 +00:00
|
|
|
const FOO_NO_DEFAULT: bool;
|
2024-06-21 12:03:08 +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 {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Foo for Bar'
|
|
|
|
//@ has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
|
2017-06-23 17:39:27 +00:00
|
|
|
const FOO: usize = 12;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool'
|
2017-06-23 17:39:27 +00:00
|
|
|
const FOO_NO_DEFAULT: bool = false;
|
2024-06-21 12:03:08 +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 {
|
2024-06-21 12:03:08 +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
|
|
|
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.BAR_ESCAPED"]' \
|
2022-06-23 15:19:56 +00:00
|
|
|
// "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 {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAZ"]' \
|
2017-05-31 17:02:35 +00:00
|
|
|
// "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 {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \
|
2018-10-14 23:48:57 +00:00
|
|
|
// "const F: fn(_: &(dyn ToString + 'static))"
|
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 {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ !hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE'
|
2017-06-23 17:39:27 +00:00
|
|
|
const BAR_PRIVATE: char = 'a';
|
2024-06-21 12:03:08 +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";
|
|
|
|
}
|
|
|
|
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has assoc_consts/trait.Qux.html
|
2017-06-23 17:39:27 +00:00
|
|
|
pub trait Qux {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX0 in trait.
|
|
|
|
const QUX0: u8;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX1 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX1 in trait.
|
|
|
|
const QUX1: i8;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
|
2018-10-21 17:22:37 +00:00
|
|
|
/// Docs for QUX_DEFAULT12 in trait.
|
2017-06-23 17:39:27 +00:00
|
|
|
const QUX_DEFAULT0: u16 = 1;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX_DEFAULT1 in trait.
|
|
|
|
const QUX_DEFAULT1: i16 = 2;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX_DEFAULT2 in trait.
|
|
|
|
const QUX_DEFAULT2: u32 = 3;
|
|
|
|
}
|
|
|
|
|
2024-06-21 12:03:08 +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 {
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX0 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX0 in trait.
|
|
|
|
const QUX0: u8 = 4;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX1"]' 'const QUX1: i8'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX1 in impl."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX1 in impl.
|
|
|
|
const QUX1: i8 = 5;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
|
|
|
|
//@ 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;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
|
|
|
|
//@ has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in impl."
|
2017-06-23 17:39:27 +00:00
|
|
|
/// Docs for QUX_DEFAULT1 in impl.
|
|
|
|
const QUX_DEFAULT1: i16 = 7;
|
2024-06-21 12:03:08 +00:00
|
|
|
//@ has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
|
|
|
|
//@ has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
|
2017-06-23 17:39:27 +00:00
|
|
|
}
|