rust/tests/rustdoc-ui/doctest/non-local-defs-impl.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
790 B
Rust
Raw Normal View History

//@ 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;
///
/// fn foo() {
/// 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() {}