add doc_highlight feature flag and tests
This commit is contained in:
parent
cbe4ac3079
commit
831fd78341
6 changed files with 112 additions and 0 deletions
14
src/test/compile-fail/feature-gate-doc_spotlight.rs
Normal file
14
src/test/compile-fail/feature-gate-doc_spotlight.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2017 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental
|
||||
trait SomeTrait {}
|
||||
|
||||
fn main() {}
|
||||
46
src/test/rustdoc/doc-spotlight.rs
Normal file
46
src/test/rustdoc/doc-spotlight.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2017 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(doc_spotlight)]
|
||||
|
||||
pub struct Wrapper<T> {
|
||||
inner: T,
|
||||
}
|
||||
|
||||
impl<T: SomeTrait> SomeTrait for Wrapper<T> {}
|
||||
|
||||
#[doc(spotlight)]
|
||||
pub trait SomeTrait {
|
||||
// @has doc_spotlight/trait.SomeTrait.html
|
||||
// @has - '//code[@class="spotlight"]' 'impl<T: SomeTrait> SomeTrait for Wrapper<T>'
|
||||
fn wrap_me(self) -> Wrapper<Self> where Self: Sized {
|
||||
Wrapper {
|
||||
inner: self,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SomeStruct;
|
||||
impl SomeTrait for SomeStruct {}
|
||||
|
||||
impl SomeStruct {
|
||||
// @has doc_spotlight/struct.SomeStruct.html
|
||||
// @has - '//code[@class="spotlight"]' 'impl SomeTrait for SomeStruct'
|
||||
// @has - '//code[@class="spotlight"]' 'impl<T: SomeTrait> SomeTrait for Wrapper<T>'
|
||||
pub fn new() -> SomeStruct {
|
||||
SomeStruct
|
||||
}
|
||||
}
|
||||
|
||||
// @has doc_spotlight/fn.bare_fn.html
|
||||
// @has - '//code[@class="spotlight"]' 'impl SomeTrait for SomeStruct'
|
||||
pub fn bare_fn() -> SomeStruct {
|
||||
SomeStruct
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue