2024-06-13 10:08:04 -05:00
|
|
|
//@ 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"
|
2024-06-21 00:15:36 -05:00
|
|
|
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
2024-06-13 10:08:04 -05:00
|
|
|
|
|
|
|
#![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;
|
2024-06-28 10:25:20 -05:00
|
|
|
///
|
|
|
|
/// fn foo() {
|
|
|
|
/// impl Trait for &Local {}
|
|
|
|
/// }
|
2024-06-13 10:08:04 -05:00
|
|
|
/// ```
|
|
|
|
///
|
|
|
|
/// 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() {}
|