1 // Ensure that rustdoc gives errors for trait impls inside function bodies that don't resolve.
2 // See https://github.com/rust-lang/rust/pull/73566
4 pub trait ValidTrait {}
10 /// This function has docs
11 pub fn f
<B
: UnknownBound
>(a
: UnknownType
, b
: B
) {
12 //~^ ERROR cannot find trait `UnknownBound` in this scope
13 //~| ERROR cannot find type `UnknownType` in this scope
14 impl UnknownTrait
for ValidType {}
//~ ERROR cannot find trait `UnknownTrait`
15 impl<T
: UnknownBound
> UnknownTrait
for T {}
16 //~^ ERROR cannot find trait `UnknownBound` in this scope
17 //~| ERROR cannot find trait `UnknownTrait` in this scope
18 impl ValidTrait
for UnknownType {}
19 //~^ ERROR cannot find type `UnknownType` in this scope
20 impl ValidTrait
for ValidType
where ValidTrait
: UnknownBound {}
21 //~^ ERROR cannot find trait `UnknownBound` in this scope
23 /// This impl has documentation
24 impl NeedsBody
for ValidType
{
25 type Item
= UnknownType
;
26 //~^ ERROR cannot find type `UnknownType` in this scope
28 /// This function has documentation
30 <UnknownTypeShouldBeIgnored
>::a();
31 content
::shouldnt
::matter();
33 //~^ ERROR cannot find macro `unknown_macro` in this scope
35 /// This is documentation for a macro
36 macro_rules
! can_define_macros_here_too
{
38 this
::content
::should
::also
::be
::ignored()
41 can_define_macros_here_too
!();
43 /// This also is documented.
44 pub fn doubly_nested(c
: UnknownType
) {
45 //~^ ERROR cannot find type `UnknownType` in this scope