// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(associated_consts)] pub trait Foo { // @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \ // 'const FOO: usize;' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' // @has - '//*[@class="docblock"]' 'FOO: usize = 12' const FOO: usize = 12; } pub struct Bar; impl Bar { // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \ // 'const BAR: usize' // @has - '//*[@class="docblock"]' 'BAR: usize = 3' pub const BAR: usize = 3; } 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>" // @has - '//*[@class="docblock"]' "BAZ: Baz<'static, u8, u32> = Baz(321, &[1, 2, 3])" 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"]' \ // "const F: fn(_: &(ToString + 'static))" // @has - '//*[@class="docblock"]' "F: fn(_: &(ToString + 'static)) = f" pub const F: fn(_: &(ToString + 'static)) = f; }