]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/intra-link-in-bodies.rs
Auto merge of #54265 - arielb1:civilize-proc-macros, r=alexcrichton
[rust.git] / src / test / rustdoc / intra-link-in-bodies.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // we need to make sure that intra-doc links on trait impls get resolved in the right scope
12
13 #![deny(intra_doc_link_resolution_failure)]
14
15 pub mod inner {
16     pub struct SomethingOutOfScope;
17 }
18
19 pub mod other {
20     use inner::SomethingOutOfScope;
21     use SomeTrait;
22
23     pub struct OtherStruct;
24
25     /// Let's link to [SomethingOutOfScope] while we're at it.
26     impl SomeTrait for OtherStruct {}
27 }
28
29 pub trait SomeTrait {}
30
31 pub struct SomeStruct;
32
33 fn __implementation_details() {
34     use inner::SomethingOutOfScope;
35
36     // FIXME: intra-links resolve in their nearest module scope, not their actual scope in cases
37     // like this
38     // Let's link to [SomethingOutOfScope] while we're at it.
39     impl SomeTrait for SomeStruct {}
40 }