Merge remote-tracking branch 'origin/master' into gen
This commit is contained in:
commit
b8aa595e6d
168 changed files with 2634 additions and 1443 deletions
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/block-must-not-have-result-res.rs:15:9
|
||||
|
|
||||
14 | fn drop(&mut self) {
|
||||
| - expected `()` because of default return type
|
||||
15 | true //~ ERROR mismatched types
|
||||
| ^^^^ expected (), found bool
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13624.rs:17:5
|
||||
|
|
||||
16 | pub fn get_enum_struct_variant() -> () {
|
||||
| -- expected `()` because of return type
|
||||
17 | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-22645.rs:25:3
|
||||
|
|
||||
23 | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
24 | let b = Bob + 3.5;
|
||||
25 | b + 3 //~ ERROR E0277
|
||||
| ^^^^^ expected (), found struct `Bob`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-5500.rs:12:5
|
||||
|
|
||||
11 | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
12 | &panic!()
|
||||
| ^^^^^^^^^ expected (), found reference
|
||||
|
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(exclusive_range_pattern)]
|
||||
#![warn(unreachable_patterns)]
|
||||
|
||||
fn main() {
|
||||
// These cases should generate no warning.
|
||||
|
|
@ -48,4 +49,4 @@ fn main() {
|
|||
9...9 => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,24 @@
|
|||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:36:9
|
||||
--> $DIR/issue-43253.rs:37:9
|
||||
|
|
||||
36 | 9 => {},
|
||||
37 | 9 => {},
|
||||
| ^
|
||||
|
|
||||
= note: #[warn(unreachable_patterns)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-43253.rs:12:9
|
||||
|
|
||||
12 | #![warn(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:42:9
|
||||
--> $DIR/issue-43253.rs:43:9
|
||||
|
|
||||
42 | 8...9 => {},
|
||||
43 | 8...9 => {},
|
||||
| ^^^^^
|
||||
|
||||
warning: unreachable pattern
|
||||
--> $DIR/issue-43253.rs:48:9
|
||||
--> $DIR/issue-43253.rs:49:9
|
||||
|
|
||||
48 | 9...9 => {},
|
||||
49 | 9...9 => {},
|
||||
| ^^^^^
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
error: impl has stricter requirements than trait
|
||||
--> $DIR/proj-outlives-region.rs:19:5
|
||||
|
|
||||
14 | fn foo() where T: 'a;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
error: impl has stricter requirements than trait
|
||||
--> $DIR/region-unrelated.rs:19:5
|
||||
|
|
||||
14 | fn foo() where T: 'a;
|
||||
|
|
|
|||
19
src/test/ui/extern-const.rs
Normal file
19
src/test/ui/extern-const.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
// compile-flags: -Z continue-parse-after-error
|
||||
|
||||
extern "C" {
|
||||
const C: u8; //~ ERROR extern items cannot be `const`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = C;
|
||||
}
|
||||
8
src/test/ui/extern-const.stderr
Normal file
8
src/test/ui/extern-const.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: extern items cannot be `const`
|
||||
--> $DIR/extern-const.rs:14:5
|
||||
|
|
||||
14 | const C: u8; //~ ERROR extern items cannot be `const`
|
||||
| ^^^^^ help: instead try using: `static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
34
src/test/ui/lint/fn_must_use.rs
Normal file
34
src/test/ui/lint/fn_must_use.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
#![warn(unused_must_use)]
|
||||
|
||||
struct MyStruct {
|
||||
n: usize
|
||||
}
|
||||
|
||||
impl MyStruct {
|
||||
#[must_use]
|
||||
fn need_to_use_this_method_value(&self) -> usize {
|
||||
self.n
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use="it's important"]
|
||||
fn need_to_use_this_value() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn main() {
|
||||
need_to_use_this_value();
|
||||
|
||||
let m = MyStruct { n: 2 };
|
||||
m.need_to_use_this_method_value();
|
||||
}
|
||||
18
src/test/ui/lint/fn_must_use.stderr
Normal file
18
src/test/ui/lint/fn_must_use.stderr
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
warning: unused return value of `need_to_use_this_value` which must be used: it's important
|
||||
--> $DIR/fn_must_use.rs:30:5
|
||||
|
|
||||
30 | need_to_use_this_value();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/fn_must_use.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used
|
||||
--> $DIR/fn_must_use.rs:33:5
|
||||
|
|
||||
33 | m.need_to_use_this_method_value();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
@ -16,7 +16,13 @@
|
|||
|
||||
#![forbid(unused, non_snake_case)]
|
||||
|
||||
#[allow(unused, unused_variables, bad_style)]
|
||||
#[allow(unused_variables)]
|
||||
fn foo() {}
|
||||
|
||||
#[allow(unused)]
|
||||
fn bar() {}
|
||||
|
||||
#[allow(bad_style)]
|
||||
fn main() {
|
||||
println!("hello forbidden world")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
error[E0453]: allow(unused) overruled by outer forbid(unused)
|
||||
error[E0453]: allow(unused_variables) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:19:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| ------ `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^ overruled by previous forbid
|
||||
19 | #[allow(unused_variables)]
|
||||
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error[E0453]: allow(unused_variables) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:19:17
|
||||
error[E0453]: allow(unused) overruled by outer forbid(unused)
|
||||
--> $DIR/outer-forbid.rs:22:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| ------ `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
|
||||
...
|
||||
22 | #[allow(unused)]
|
||||
| ^^^^^^ overruled by previous forbid
|
||||
|
||||
error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case)
|
||||
--> $DIR/outer-forbid.rs:19:35
|
||||
--> $DIR/outer-forbid.rs:25:9
|
||||
|
|
||||
17 | #![forbid(unused, non_snake_case)]
|
||||
| -------------- `forbid` level set here
|
||||
18 |
|
||||
19 | #[allow(unused, unused_variables, bad_style)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
...
|
||||
25 | #[allow(bad_style)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:26:5
|
||||
|
|
||||
25 | fn a() -> Foo {
|
||||
| --- expected `Foo` because of return type
|
||||
26 | Some(Foo { bar: 1 })
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option`
|
||||
|
|
||||
|
|
@ -10,6 +12,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:30:5
|
||||
|
|
||||
29 | fn a2() -> Foo {
|
||||
| --- expected `Foo` because of return type
|
||||
30 | Ok(Foo { bar: 1})
|
||||
| ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result`
|
||||
|
|
||||
|
|
@ -19,6 +23,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:34:5
|
||||
|
|
||||
33 | fn b() -> Option<Foo> {
|
||||
| ----------- expected `std::option::Option<Foo>` because of return type
|
||||
34 | Foo { bar: 1 }
|
||||
| ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo`
|
||||
|
|
||||
|
|
@ -28,6 +34,8 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:38:5
|
||||
|
|
||||
37 | fn c() -> Result<Foo, Bar> {
|
||||
| ---------------- expected `std::result::Result<Foo, Bar>` because of return type
|
||||
38 | Foo { bar: 1 }
|
||||
| ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo`
|
||||
|
|
||||
|
|
@ -37,6 +45,9 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:49:5
|
||||
|
|
||||
41 | fn d() -> X<X<String, String>, String> {
|
||||
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
|
||||
...
|
||||
49 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
|
|
@ -46,6 +57,9 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:60:5
|
||||
|
|
||||
52 | fn e() -> X<X<String, String>, String> {
|
||||
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
|
||||
...
|
||||
60 | x
|
||||
| ^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// run-pass
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
// Parser test for #37765
|
||||
|
||||
fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
|
|
|
|||
|
|
@ -1,26 +1,31 @@
|
|||
warning: unnecessary parentheses around `return` value
|
||||
--> $DIR/path-lookahead.rs:16:10
|
||||
--> $DIR/path-lookahead.rs:18:10
|
||||
|
|
||||
16 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
18 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_parens)] on by default
|
||||
|
||||
warning: function is never used: `with_parens`
|
||||
--> $DIR/path-lookahead.rs:15:1
|
||||
--> $DIR/path-lookahead.rs:17:1
|
||||
|
|
||||
15 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
16 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
17 | | }
|
||||
17 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
|
||||
18 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
|
||||
19 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: #[warn(dead_code)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/path-lookahead.rs:13:9
|
||||
|
|
||||
13 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(dead_code)] implied by #[warn(unused)]
|
||||
|
||||
warning: function is never used: `no_parens`
|
||||
--> $DIR/path-lookahead.rs:19:1
|
||||
--> $DIR/path-lookahead.rs:21:1
|
||||
|
|
||||
19 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
|
||||
20 | | return <T as ToString>::to_string(&arg);
|
||||
21 | | }
|
||||
21 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
|
||||
22 | | return <T as ToString>::to_string(&arg);
|
||||
23 | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
error: unreachable expression
|
||||
--> $DIR/expr_unary.rs:18:28
|
||||
|
|
||||
18 | let x: ! = ! { return; 22 };
|
||||
| ^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/expr_unary.rs:14:9
|
||||
|
|
||||
14 | #![deny(unreachable_code)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0600]: cannot apply unary operator `!` to type `!`
|
||||
--> $DIR/expr_unary.rs:18:16
|
||||
|
|
||||
18 | let x: ! = ! { return; 22 };
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,13 @@
|
|||
//! A test to ensure that helpful `note` messages aren't emitted more often
|
||||
//! than necessary.
|
||||
|
||||
// Although there are three errors, we should only get two "lint level defined
|
||||
// here" notes pointing at the `warnings` span, one for each error type.
|
||||
#![deny(warnings)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// Although there are three warnings, we should only get two "lint level defined
|
||||
// here" notes pointing at the `warnings` span, one for each error type.
|
||||
#![warn(unused)]
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
let theTwo = 2;
|
||||
let theOtherTwo = 2;
|
||||
|
|
|
|||
|
|
@ -1,34 +1,37 @@
|
|||
error: variable `theTwo` should have a snake case name such as `the_two`
|
||||
--> $DIR/issue-24690.rs:19:9
|
||||
warning: unused variable: `theOtherTwo`
|
||||
--> $DIR/issue-24690.rs:23:9
|
||||
|
|
||||
19 | let theTwo = 2;
|
||||
23 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:18:9
|
||||
|
|
||||
18 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(unused_variables)] implied by #[warn(unused)]
|
||||
|
||||
warning: variable `theTwo` should have a snake case name such as `the_two`
|
||||
--> $DIR/issue-24690.rs:22:9
|
||||
|
|
||||
22 | let theTwo = 2;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:16:9
|
||||
|
|
||||
16 | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: #[deny(non_snake_case)] implied by #[deny(warnings)]
|
||||
= note: #[warn(non_snake_case)] on by default
|
||||
|
||||
error: variable `theOtherTwo` should have a snake case name such as `the_other_two`
|
||||
--> $DIR/issue-24690.rs:20:9
|
||||
warning: variable `theOtherTwo` should have a snake case name such as `the_other_two`
|
||||
--> $DIR/issue-24690.rs:23:9
|
||||
|
|
||||
20 | let theOtherTwo = 2;
|
||||
23 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: unused variable: `theOtherTwo`
|
||||
--> $DIR/issue-24690.rs:20:9
|
||||
error: compilation successful
|
||||
--> $DIR/issue-24690.rs:21:1
|
||||
|
|
||||
20 | let theOtherTwo = 2;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-24690.rs:16:9
|
||||
|
|
||||
16 | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: #[deny(unused_variables)] implied by #[deny(warnings)]
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
21 | / fn main() {
|
||||
22 | | let theTwo = 2;
|
||||
23 | | let theOtherTwo = 2;
|
||||
24 | | println!("{}", theTwo);
|
||||
25 | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
macro_rules! m {
|
||||
($a:tt $b:tt) => {
|
||||
$b $a;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
warning: struct is never used: `S`
|
||||
--> $DIR/macro-span-replacement.rs:13:9
|
||||
--> $DIR/macro-span-replacement.rs:15:9
|
||||
|
|
||||
13 | $b $a;
|
||||
15 | $b $a;
|
||||
| ^^^^^^
|
||||
...
|
||||
18 | m!(S struct);
|
||||
20 | m!(S struct);
|
||||
| ------------- in this macro invocation
|
||||
|
|
||||
= note: #[warn(dead_code)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/macro-span-replacement.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(dead_code)] implied by #[warn(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`
|
||||
--> $DIR/multispan-import-lint.rs:11:16
|
||||
--> $DIR/multispan-import-lint.rs:13:16
|
||||
|
|
||||
11 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
13 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
|
||||
| ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^
|
||||
|
|
||||
= note: #[warn(unused_imports)] on by default
|
||||
note: lint level defined here
|
||||
--> $DIR/multispan-import-lint.rs:11:9
|
||||
|
|
||||
11 | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: #[warn(unused_imports)] implied by #[warn(unused)]
|
||||
|
||||
|
|
|
|||
30
src/test/ui/trait-method-private.rs
Normal file
30
src/test/ui/trait-method-private.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
mod inner {
|
||||
pub trait Bar {
|
||||
fn method(&self);
|
||||
}
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn method(&self) {}
|
||||
}
|
||||
|
||||
impl Bar for Foo {
|
||||
fn method(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = inner::Foo;
|
||||
foo.method();
|
||||
}
|
||||
12
src/test/ui/trait-method-private.stderr
Normal file
12
src/test/ui/trait-method-private.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0624]: method `method` is private
|
||||
--> $DIR/trait-method-private.rs:29:9
|
||||
|
|
||||
29 | foo.method();
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is in scope
|
||||
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
||||
candidate #1: `use inner::Bar;`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue