Suggest standalone doctest for non-local impl defs
This commit is contained in:
parent
8217b412a2
commit
ab0e72781f
6 changed files with 121 additions and 38 deletions
31
tests/rustdoc-ui/doctest/non-local-defs-impl.rs
Normal file
31
tests/rustdoc-ui/doctest/non-local-defs-impl.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
//@ check-fail
|
||||
//@ edition:2018
|
||||
//@ failure-status: 101
|
||||
//@ aux-build:pub_trait.rs
|
||||
//@ compile-flags: --test --test-args --test-threads=1
|
||||
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
||||
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
|
||||
#![doc(test(attr(deny(non_local_definitions))))]
|
||||
#![doc(test(attr(allow(dead_code))))]
|
||||
|
||||
/// This will produce a warning:
|
||||
/// ```rust,no_run
|
||||
/// # extern crate pub_trait;
|
||||
/// # use pub_trait::Trait;
|
||||
///
|
||||
/// struct Local;
|
||||
/// impl Trait for &Local {}
|
||||
/// ```
|
||||
///
|
||||
/// But this shoudln't produce a warning:
|
||||
/// ```rust,no_run
|
||||
/// # extern crate pub_trait;
|
||||
/// # use pub_trait::Trait;
|
||||
///
|
||||
/// struct Local;
|
||||
/// impl Trait for &Local {}
|
||||
///
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
pub fn doctest() {}
|
Loading…
Add table
Add a link
Reference in a new issue