rust/tests/rustdoc-ui/intra-doc/errors.rs

122 lines
2.9 KiB
Rust
Raw Normal View History

#![deny(rustdoc::broken_intra_doc_links)]
//~^ NOTE lint level is defined
// FIXME: this should say that it was skipped (maybe an allowed by default lint?)
/// [invalid intra-doc syntax!!]
/// [path::to::nonexistent::module]
//~^ ERROR unresolved link
2020-10-02 21:53:09 -05:00
//~| NOTE no item named `path` in scope
/// [path::to::nonexistent::macro!]
//~^ ERROR unresolved link
2020-10-02 21:53:09 -05:00
//~| NOTE no item named `path` in scope
/// [type@path::to::nonexistent::type]
//~^ ERROR unresolved link
2020-10-02 21:53:09 -05:00
//~| NOTE no item named `path` in scope
/// [std::io::not::here]
//~^ ERROR unresolved link
2020-10-02 21:53:09 -05:00
//~| NOTE no item named `not` in module `io`
/// [type@std::io::not::here]
//~^ ERROR unresolved link
2020-10-02 21:53:09 -05:00
//~| NOTE no item named `not` in module `io`
/// [std::io::Error::x]
//~^ ERROR unresolved link
//~| NOTE the struct `Error` has no field
/// [std::io::ErrorKind::x]
//~^ ERROR unresolved link
//~| NOTE the enum `ErrorKind` has no variant
/// [f::A]
//~^ ERROR unresolved link
//~| NOTE `f` is a function, not a module
/// [f::A!]
//~^ ERROR unresolved link
//~| NOTE `f` is a function, not a module
/// [S::A]
//~^ ERROR unresolved link
//~| NOTE struct `S` has no field or associated item
/// [S::fmt]
//~^ ERROR unresolved link
//~| NOTE struct `S` has no field or associated item
/// [E::D]
//~^ ERROR unresolved link
//~| NOTE enum `E` has no variant or associated item
/// [u8::not_found]
//~^ ERROR unresolved link
//~| NOTE the primitive type `u8` has no associated item named `not_found`
/// [std::primitive::u8::not_found]
//~^ ERROR unresolved link
//~| NOTE the primitive type `u8` has no associated item named `not_found`
/// [type@Vec::into_iter]
//~^ ERROR unresolved link
//~| HELP to link to the associated function, add parentheses
//~| NOTE this link resolves to the associated function `into_iter`
/// [S!]
//~^ ERROR unresolved link
//~| HELP to link to the struct, prefix with `struct@`
//~| NOTE this link resolves to the struct `S`
pub fn f() {}
#[derive(Debug)]
pub struct S;
pub enum E { A, B, C }
/// [type@S::h]
//~^ ERROR unresolved link
//~| HELP to link to the associated function
//~| NOTE not in the type namespace
impl S {
pub fn h() {}
}
/// [type@T::g]
//~^ ERROR unresolved link
//~| HELP to link to the associated function
//~| NOTE not in the type namespace
/// [T::h!]
//~^ ERROR unresolved link
//~| NOTE `T` has no macro named `h`
pub trait T {
fn g() {}
}
/// [m()]
//~^ ERROR unresolved link
//~| HELP to link to the macro
//~| NOTE not in the value namespace
#[macro_export]
macro_rules! m {
() => {};
}
///[`TestEnum::Variant1::field_name`]
//~^ ERROR unresolved link
//~| NOTE variant `Variant1` has no such field
pub enum TestEnum {
Variant1 {},
Variant2 { field_name: u64 },
}
///[`TestEnumNoFields::Variant1::field_name`]
//~^ ERROR unresolved link
//~| NOTE `Variant1` is a variant, not a module or type, and cannot have associated items
pub enum TestEnumNoFields {
Variant1 (),
Variant2 {},
}