Auto merge of #52585 - GuillaumeGomez:generic-impls, r=QuietMisdreavus

[rustdoc] Generic impls

Fixes #33772.

r? @QuietMisdreavus
This commit is contained in:
bors 2018-07-28 20:44:17 +00:00
commit dab71516f1
9 changed files with 246 additions and 69 deletions

View file

@ -0,0 +1,25 @@
// Copyright 2018 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.
#![crate_name = "foo"]
use std::fmt;
// @!has foo/struct.Bar.html '//h3[@id="impl-ToString"]//code' 'impl<T> ToString for T'
pub struct Bar;
// @has foo/struct.Foo.html '//h3[@id="impl-ToString"]//code' 'impl<T> ToString for T'
pub struct Foo;
impl fmt::Display for Foo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Foo")
}
}

View file

@ -56,7 +56,6 @@ impl T for S1 {
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
// @!has - '//*[@class="docblock"]' 'Read more'
pub struct S2(usize);
/// Docs associated with the S2 trait implementation.

View file

@ -31,11 +31,11 @@ pub trait Foo {
// @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields'
// @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f"]' 'f'
// @has - '//*[@class="sidebar-links"]/a[@href="#structfield.u"]' 'u'
// @!has - '//*[@class="sidebar-links"]/a' 'w'
// @!has - '//*[@class="sidebar-links"]/a' 'waza'
pub struct Bar {
pub f: u32,
pub u: u32,
w: u32,
waza: u32,
}
// @has foo/enum.En.html
@ -51,9 +51,9 @@ pub enum En {
// @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields'
// @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f1"]' 'f1'
// @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f2"]' 'f2'
// @!has - '//*[@class="sidebar-links"]/a' 'w'
// @!has - '//*[@class="sidebar-links"]/a' 'waza'
pub union MyUnion {
pub f1: u32,
pub f2: f32,
w: u32,
waza: u32,
}