Skip to content

Commit

Permalink
tidy check fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zeegomo committed Nov 17, 2018
1 parent 2b7c3fb commit 8e13e43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
24 changes: 17 additions & 7 deletions src/test/ui/test-attr-non-associated-functions.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// #[test] attribute is not allowed on associated functions or methods
// reworded error message
// reworded error message
// compile-flags:--test

struct A {}

impl A {
#[test]
fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions
A {}
}
#[test]
fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions
A {}
}
}

#[test]
fn test() {
let _ = A::new();
let _ = A::new();
}

fn main() {}
fn main() {}
5 changes: 2 additions & 3 deletions src/test/ui/test-attr-non-associated-functions.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
error: #[test] attribute is only allowed on non associated functions
--> $DIR/test-attr-non-associated-functions.rs:9:2
--> $DIR/test-attr-non-associated-functions.rs:19:5
|
LL | fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions
| _____^
LL | / fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions
LL | | A {}
LL | | }
| |_____^
Expand Down

0 comments on commit 8e13e43

Please sign in to comment.