diff options
| author | bors <bors@rust-lang.org> | 2018-03-28 05:29:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-03-28 05:29:57 +0000 |
| commit | e58df0d8c5221fa5743587740eb50e4db42c3d1e (patch) | |
| tree | d7996f34294c11ec8b49e61725c0529119530c46 /src/test/rustdoc | |
| parent | 59ec9bfc66b86f04b50f00bb32839315f59252ec (diff) | |
| parent | 4800afa5f5982b06d9cf27ae6003b058ca8855c8 (diff) | |
| download | rust-e58df0d8c5221fa5743587740eb50e4db42c3d1e.tar.gz rust-e58df0d8c5221fa5743587740eb50e4db42c3d1e.zip | |
Auto merge of #49304 - sinkuu:impl_trait_rustdoc, r=QuietMisdreavus
Rustdoc support for universal_impl_trait Hides type parameters synthesized by `impl Trait`-in-argument-position, and enables links to trait names. <img alt="before" src="https://user-images.githubusercontent.com/7091080/37831646-a61413c6-2ee9-11e8-8ec2-a6137956d922.png" width="450"/> ↓ <img alt="after" src="https://user-images.githubusercontent.com/7091080/37831657-b2ff0ae6-2ee9-11e8-8797-fdad904782bf.png" width="450"/> Fixes #49309
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/universal-impl-trait.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/rustdoc/universal-impl-trait.rs b/src/test/rustdoc/universal-impl-trait.rs new file mode 100644 index 00000000000..4cf99562c52 --- /dev/null +++ b/src/test/rustdoc/universal-impl-trait.rs @@ -0,0 +1,46 @@ +// 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. + +#![feature(universal_impl_trait)] +#![crate_name = "foo"] + +// @has foo/fn.foo.html +// @has - //pre 'foo(' +// @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Clone\.html"' +// @matches - '_z: .+impl.+trait\.Copy\.html.+, impl.+trait\.Clone\.html' +pub fn foo(_x: impl Clone, _y: i32, _z: (impl Copy, impl Clone)) { +} + +pub trait Trait { + // @has foo/trait.Trait.html + // @has - 'method</a>(' + // @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' + fn method(&self, _x: impl std::fmt::Debug) { + } +} + +pub struct S<T>(T); + +impl<T> S<T> { + // @has foo/struct.S.html + // @has - 'bar</a>(' + // @matches - '_bar: impl <a class="trait" href="[^"]+/trait\.Copy\.html"' + pub fn bar(_bar: impl Copy) { + } + + // @has - 'baz</a>(' + // @matches - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' + pub fn baz(_baz: S<impl Clone>) { + } +} + +// @has - 'method</a>(' +// @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' +impl<T> Trait for S<T> {} |
