rust/tests/ui/inline_fn_without_body.rs
Ryan Cumming 5f3c340bfb Lint for trait methods without bodies
As discussed in rust-lang/rust#47475 the #[inline] attribute is
currently allowed on trait methods without bodies (i.e. without a
default implementation). This is misleading as it could be interpreted
as affecting the implementations of the trait method. Add a lint for any
use of #[inline] on a trait method without a body.

Fixes rust-lang/rust#47475
2018-01-18 20:01:24 +11:00

19 lines
216 B
Rust

#![warn(inline_fn_without_body)]
#![allow(inline_always)]
trait Foo {
#[inline]
fn default_inline();
#[inline(always)]
fn always_inline();
#[inline]
fn has_body() {
}
}
fn main() {}