Auto merge of #46116 - oli-obk:json_ui, r=nikomatsakis
Check //~ERROR comments in ui tests r? @nikomatsakis cc #44844 @Phlosioneer @estebank @petrochenkov this depends on https://github.com/rust-lang/rust/pull/46052 getting merged first (the commits are included in here) The relevant changes of this PR are c2f0af7 and 979269b
This commit is contained in:
commit
71da1c21eb
|
@ -355,12 +355,15 @@ impl Session {
|
|||
|
||||
/// Analogous to calling methods on the given `DiagnosticBuilder`, but
|
||||
/// deduplicates on lint ID, span (if any), and message for this `Session`
|
||||
/// if we're not outputting in JSON mode.
|
||||
fn diag_once<'a, 'b>(&'a self,
|
||||
diag_builder: &'b mut DiagnosticBuilder<'a>,
|
||||
method: DiagnosticBuilderMethod,
|
||||
lint: &'static lint::Lint, message: &str, span: Option<Span>) {
|
||||
let mut do_method = || {
|
||||
|
||||
let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
|
||||
let id_span_message = (lint_id, span, message.to_owned());
|
||||
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
|
||||
if fresh {
|
||||
match method {
|
||||
DiagnosticBuilderMethod::Note => {
|
||||
diag_builder.note(message);
|
||||
|
@ -369,22 +372,6 @@ impl Session {
|
|||
diag_builder.span_note(span.expect("span_note expects a span"), message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
match self.opts.error_format {
|
||||
// when outputting JSON for tool consumption, the tool might want
|
||||
// the duplicates
|
||||
config::ErrorOutputType::Json(_) => {
|
||||
do_method()
|
||||
},
|
||||
_ => {
|
||||
let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
|
||||
let id_span_message = (lint_id, span, message.to_owned());
|
||||
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
|
||||
if fresh {
|
||||
do_method()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#![allow(non_snake_case)]
|
||||
#![deny(unreachable_patterns)]
|
||||
//~^ NOTE lint level defined here
|
||||
//~^^ NOTE lint level defined here
|
||||
//~^^^ NOTE lint level defined here
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum Enum {
|
||||
|
|
|
@ -25,6 +25,5 @@ use lint_output_format::{foo, bar};
|
|||
fn main() { //~ ERROR: compilation successful
|
||||
let _x = foo();
|
||||
//~^ WARNING use of deprecated item 'lint_output_format::foo': text
|
||||
//~| NOTE #[warn(deprecated)] on by default
|
||||
let _y = bar();
|
||||
}
|
||||
|
|
|
@ -10,19 +10,7 @@
|
|||
|
||||
#![deny(unconditional_recursion)]
|
||||
//~^ NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
//~| NOTE lint level defined here
|
||||
|
||||
#![allow(dead_code)]
|
||||
fn foo() { //~ ERROR function cannot return without recurring
|
||||
foo(); //~ NOTE recursive call site
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#[macro_use] extern crate plugin;
|
||||
|
||||
#[derive(Foo, Bar)]
|
||||
#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
|
||||
struct Baz {
|
||||
a: i32,
|
||||
b: i32,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: proc-macro derive panicked
|
||||
--> $DIR/issue-36935.rs:18:15
|
||||
|
|
||||
18 | #[derive(Foo, Bar)]
|
||||
18 | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
|
||||
| ^^^
|
||||
|
|
||||
= help: message: lolnope
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![feature(proc_macro)]
|
||||
#![allow(unused_macros)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate log; //~ ERROR use of unstable library feature
|
||||
|
||||
pub fn main() {
|
||||
info!("This is a log message.");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
|
||||
--> $DIR/issue-44953.rs:16:14
|
||||
|
|
||||
16 | #[macro_use] extern crate log;
|
||||
16 | #[macro_use] extern crate log; //~ ERROR use of unstable library feature
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(rustc_private)] to the crate attributes to enable
|
||||
|
|
|
@ -22,17 +22,17 @@ fn main() {
|
|||
three_equals!(===);
|
||||
|
||||
// Need exactly three equals.
|
||||
three_equals!(==);
|
||||
three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3
|
||||
|
||||
// Need exactly three equals.
|
||||
three_equals!(=====);
|
||||
three_equals!(=====); //~ ERROR expected EOF
|
||||
|
||||
// Only equals accepted.
|
||||
three_equals!(abc);
|
||||
three_equals!(abc); //~ ERROR expected `=`
|
||||
|
||||
// Only equals accepted.
|
||||
three_equals!(!!);
|
||||
three_equals!(!!); //~ ERROR expected `=`
|
||||
|
||||
// Only three characters expected.
|
||||
three_equals!(===a);
|
||||
three_equals!(===a); //~ ERROR expected EOF
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: found 2 equal signs, need exactly 3
|
||||
--> $DIR/three-equals.rs:25:5
|
||||
|
|
||||
25 | three_equals!(==);
|
||||
25 | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: input must be: `===`
|
||||
|
@ -9,38 +9,38 @@ error: found 2 equal signs, need exactly 3
|
|||
error: expected EOF, found `=`.
|
||||
--> $DIR/three-equals.rs:28:21
|
||||
|
|
||||
28 | three_equals!(=====);
|
||||
28 | three_equals!(=====); //~ ERROR expected EOF
|
||||
| ^^
|
||||
|
|
||||
note: last good input was here
|
||||
--> $DIR/three-equals.rs:28:21
|
||||
|
|
||||
28 | three_equals!(=====);
|
||||
28 | three_equals!(=====); //~ ERROR expected EOF
|
||||
| ^^
|
||||
= help: input must be: `===`
|
||||
|
||||
error: expected `=`, found `abc`.
|
||||
--> $DIR/three-equals.rs:31:19
|
||||
|
|
||||
31 | three_equals!(abc);
|
||||
31 | three_equals!(abc); //~ ERROR expected `=`
|
||||
| ^^^
|
||||
|
||||
error: expected `=`, found `!`.
|
||||
--> $DIR/three-equals.rs:34:19
|
||||
|
|
||||
34 | three_equals!(!!);
|
||||
34 | three_equals!(!!); //~ ERROR expected `=`
|
||||
| ^
|
||||
|
||||
error: expected EOF, found `a`.
|
||||
--> $DIR/three-equals.rs:37:22
|
||||
|
|
||||
37 | three_equals!(===a);
|
||||
37 | three_equals!(===a); //~ ERROR expected EOF
|
||||
| ^
|
||||
|
|
||||
note: last good input was here
|
||||
--> $DIR/three-equals.rs:37:21
|
||||
|
|
||||
37 | three_equals!(===a);
|
||||
37 | three_equals!(===a); //~ ERROR expected EOF
|
||||
| ^
|
||||
= help: input must be: `===`
|
||||
|
||||
|
|
|
@ -35,29 +35,39 @@ macro_rules! attr_proc_mac {
|
|||
}
|
||||
|
||||
#[derive(FooWithLongNan)]
|
||||
//~^ ERROR cannot find
|
||||
struct Foo;
|
||||
|
||||
#[attr_proc_macra]
|
||||
//~^ ERROR cannot find
|
||||
struct Bar;
|
||||
|
||||
#[FooWithLongNan]
|
||||
//~^ ERROR cannot find
|
||||
struct Asdf;
|
||||
|
||||
#[derive(Dlone)]
|
||||
//~^ ERROR cannot find
|
||||
struct A;
|
||||
|
||||
#[derive(Dlona)]
|
||||
//~^ ERROR cannot find
|
||||
struct B;
|
||||
|
||||
#[derive(attr_proc_macra)]
|
||||
//~^ ERROR cannot find
|
||||
struct C;
|
||||
|
||||
fn main() {
|
||||
FooWithLongNama!();
|
||||
//~^ ERROR cannot find
|
||||
|
||||
attr_proc_macra!();
|
||||
//~^ ERROR cannot find
|
||||
|
||||
Dlona!();
|
||||
//~^ ERROR cannot find
|
||||
|
||||
bang_proc_macrp!();
|
||||
//~^ ERROR cannot find
|
||||
}
|
||||
|
|
|
@ -5,57 +5,57 @@ error: cannot find derive macro `FooWithLongNan` in this scope
|
|||
| ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
|
||||
|
||||
error: cannot find attribute macro `attr_proc_macra` in this scope
|
||||
--> $DIR/resolve-error.rs:40:3
|
||||
--> $DIR/resolve-error.rs:41:3
|
||||
|
|
||||
40 | #[attr_proc_macra]
|
||||
41 | #[attr_proc_macra]
|
||||
| ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
|
||||
|
||||
error: cannot find attribute macro `FooWithLongNan` in this scope
|
||||
--> $DIR/resolve-error.rs:43:3
|
||||
--> $DIR/resolve-error.rs:45:3
|
||||
|
|
||||
43 | #[FooWithLongNan]
|
||||
45 | #[FooWithLongNan]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find derive macro `Dlone` in this scope
|
||||
--> $DIR/resolve-error.rs:46:10
|
||||
--> $DIR/resolve-error.rs:49:10
|
||||
|
|
||||
46 | #[derive(Dlone)]
|
||||
49 | #[derive(Dlone)]
|
||||
| ^^^^^ help: try: `Clone`
|
||||
|
||||
error: cannot find derive macro `Dlona` in this scope
|
||||
--> $DIR/resolve-error.rs:49:10
|
||||
--> $DIR/resolve-error.rs:53:10
|
||||
|
|
||||
49 | #[derive(Dlona)]
|
||||
53 | #[derive(Dlona)]
|
||||
| ^^^^^ help: try: `Clona`
|
||||
|
||||
error: cannot find derive macro `attr_proc_macra` in this scope
|
||||
--> $DIR/resolve-error.rs:52:10
|
||||
--> $DIR/resolve-error.rs:57:10
|
||||
|
|
||||
52 | #[derive(attr_proc_macra)]
|
||||
57 | #[derive(attr_proc_macra)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find macro `FooWithLongNama!` in this scope
|
||||
--> $DIR/resolve-error.rs:56:5
|
||||
--> $DIR/resolve-error.rs:62:5
|
||||
|
|
||||
56 | FooWithLongNama!();
|
||||
62 | FooWithLongNama!();
|
||||
| ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`
|
||||
|
||||
error: cannot find macro `attr_proc_macra!` in this scope
|
||||
--> $DIR/resolve-error.rs:58:5
|
||||
--> $DIR/resolve-error.rs:65:5
|
||||
|
|
||||
58 | attr_proc_macra!();
|
||||
65 | attr_proc_macra!();
|
||||
| ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`
|
||||
|
||||
error: cannot find macro `Dlona!` in this scope
|
||||
--> $DIR/resolve-error.rs:60:5
|
||||
--> $DIR/resolve-error.rs:68:5
|
||||
|
|
||||
60 | Dlona!();
|
||||
68 | Dlona!();
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find macro `bang_proc_macrp!` in this scope
|
||||
--> $DIR/resolve-error.rs:62:5
|
||||
--> $DIR/resolve-error.rs:71:5
|
||||
|
|
||||
62 | bang_proc_macrp!();
|
||||
71 | bang_proc_macrp!();
|
||||
| ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
f1(|_: (), _: ()| {});
|
||||
f2(|_: (), _: ()| {});
|
||||
f3(|_: (), _: ()| {});
|
||||
f4(|_: (), _: ()| {});
|
||||
f5(|_: (), _: ()| {});
|
||||
g1(|_: (), _: ()| {});
|
||||
g2(|_: (), _: ()| {});
|
||||
g3(|_: (), _: ()| {});
|
||||
g4(|_: (), _: ()| {});
|
||||
h1(|_: (), _: (), _: (), _: ()| {});
|
||||
h2(|_: (), _: (), _: (), _: ()| {});
|
||||
f1(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
f2(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
f3(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
f4(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
f5(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
g1(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
g2(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
g3(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
g4(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
|
||||
h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
|
||||
}
|
||||
|
||||
// Basic
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
|
||||
|
|
||||
12 | f1(|_: (), _: ()| {});
|
||||
12 | f1(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _`
|
||||
|
@ -11,7 +11,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:13:5
|
||||
|
|
||||
13 | f2(|_: (), _: ()| {});
|
||||
13 | f2(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _`
|
||||
|
@ -21,7 +21,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
|
||||
|
|
||||
14 | f3(|_: (), _: ()| {});
|
||||
14 | f3(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r> fn(&(), &'r ()) -> _`
|
||||
|
@ -31,7 +31,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:15:5
|
||||
|
|
||||
15 | f4(|_: (), _: ()| {});
|
||||
15 | f4(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _`
|
||||
|
@ -41,7 +41,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
|
||||
|
|
||||
16 | f5(|_: (), _: ()| {});
|
||||
16 | f5(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r> fn(&'r (), &'r ()) -> _`
|
||||
|
@ -51,7 +51,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:17:5
|
||||
|
|
||||
17 | g1(|_: (), _: ()| {});
|
||||
17 | g1(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`
|
||||
|
@ -61,7 +61,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
|
||||
|
|
||||
18 | g2(|_: (), _: ()| {});
|
||||
18 | g2(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _`
|
||||
|
@ -71,7 +71,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:19:5
|
||||
|
|
||||
19 | g3(|_: (), _: ()| {});
|
||||
19 | g3(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`
|
||||
|
@ -81,7 +81,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:20:5
|
||||
|
|
||||
20 | g4(|_: (), _: ()| {});
|
||||
20 | g4(|_: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ----------------- found signature of `fn((), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _`
|
||||
|
@ -91,7 +91,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:21:5
|
||||
|
|
||||
21 | h1(|_: (), _: (), _: (), _: ()| {});
|
||||
21 | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ------------------------------- found signature of `fn((), (), (), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
|
||||
|
@ -101,7 +101,7 @@ error[E0631]: type mismatch in closure arguments
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/anonymous-higher-ranked-lifetime.rs:22:5
|
||||
|
|
||||
22 | h2(|_: (), _: (), _: (), _: ()| {});
|
||||
22 | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
|
||||
| ^^ ------------------------------- found signature of `fn((), (), (), ()) -> _`
|
||||
| |
|
||||
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
fn blah() -> i32 { //~ ERROR mismatched types
|
||||
1
|
||||
|
||||
; //~ HELP consider removing this semicolon:
|
||||
; //~ HELP consider removing this semicolon
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -5,7 +5,7 @@ error[E0308]: mismatched types
|
|||
| __________________^
|
||||
12 | | 1
|
||||
13 | |
|
||||
14 | | ; //~ HELP consider removing this semicolon:
|
||||
14 | | ; //~ HELP consider removing this semicolon
|
||||
| | - help: consider removing this semicolon
|
||||
15 | | }
|
||||
| |_^ expected i32, found ()
|
||||
|
|
|
@ -12,7 +12,6 @@ trait A {
|
|||
fn a(&self) {
|
||||
|| self.b()
|
||||
//~^ ERROR no method named `b` found for type `&Self` in the current scope
|
||||
//~| ERROR mismatched types
|
||||
}
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
@ -16,7 +16,7 @@ fn foo() -> usize {
|
|||
}
|
||||
|
||||
fn bar() {
|
||||
foo()
|
||||
foo() //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/unexpected-return-on-unit.rs:19:5
|
||||
|
|
||||
19 | foo()
|
||||
19 | foo() //~ ERROR mismatched types
|
||||
| ^^^^^ expected (), found usize
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `usize`
|
||||
help: try adding a semicolon
|
||||
|
|
||||
19 | foo();
|
||||
19 | foo(); //~ ERROR mismatched types
|
||||
| ^
|
||||
help: try adding a return type
|
||||
|
|
||||
|
|
|
@ -22,6 +22,7 @@ fn a() {
|
|||
let mut x = 3;
|
||||
let c1 = to_fn_mut(|| x = 4);
|
||||
let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn set(x: &mut isize) {
|
||||
|
@ -32,12 +33,14 @@ fn b() {
|
|||
let mut x = 3;
|
||||
let c1 = to_fn_mut(|| set(&mut x));
|
||||
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn c() {
|
||||
let mut x = 3;
|
||||
let c1 = to_fn_mut(|| x = 5);
|
||||
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn d() {
|
||||
|
@ -45,6 +48,7 @@ fn d() {
|
|||
let c1 = to_fn_mut(|| x = 5);
|
||||
let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn g() {
|
||||
|
@ -56,6 +60,7 @@ fn g() {
|
|||
let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -9,65 +9,68 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
|||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
25 | }
|
||||
25 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
26 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:35:24
|
||||
|
|
||||
33 | let c1 = to_fn_mut(|| set(&mut x));
|
||||
34 | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
34 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
35 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
35 | }
|
||||
36 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
37 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:40:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
|
|
||||
39 | let c1 = to_fn_mut(|| x = 5);
|
||||
41 | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
40 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
42 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
41 | }
|
||||
43 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
44 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:46:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
||||
|
|
||||
45 | let c1 = to_fn_mut(|| x = 5);
|
||||
48 | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
46 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
49 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
47 | //~^ ERROR cannot borrow `x` as mutable more than once
|
||||
48 | }
|
||||
...
|
||||
52 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:57:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:61:24
|
||||
|
|
||||
56 | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
60 | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
57 | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
61 | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
58 | //~^ ERROR cannot borrow `x` as mutable more than once
|
||||
59 | }
|
||||
...
|
||||
64 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
|
@ -81,65 +84,68 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
|||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
25 | }
|
||||
25 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
26 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:35:24
|
||||
|
|
||||
33 | let c1 = to_fn_mut(|| set(&mut x));
|
||||
34 | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
34 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
35 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
35 | }
|
||||
36 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
37 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:40:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
|
|
||||
39 | let c1 = to_fn_mut(|| x = 5);
|
||||
41 | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
40 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
42 | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
41 | }
|
||||
43 | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
44 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:46:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
||||
|
|
||||
45 | let c1 = to_fn_mut(|| x = 5);
|
||||
48 | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
46 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
49 | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
47 | //~^ ERROR cannot borrow `x` as mutable more than once
|
||||
48 | }
|
||||
...
|
||||
52 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:57:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:61:24
|
||||
|
|
||||
56 | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
60 | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
57 | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
61 | let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
58 | //~^ ERROR cannot borrow `x` as mutable more than once
|
||||
59 | }
|
||||
...
|
||||
64 | }
|
||||
| - first borrow ends here
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
// check that borrowck looks inside consts/statics
|
||||
|
||||
static FN : &'static (Fn() -> (Box<Fn()->Box<i32>>) + Sync) = &|| {
|
||||
let x = Box::new(0); //~ NOTE moved
|
||||
let x = Box::new(0); //~ NOTE captured outer variable
|
||||
Box::new(|| x) //~ ERROR cannot move out of captured outer variable
|
||||
//~^ NOTE cannot move out of captured outer variable
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0507]: cannot move out of captured outer variable in an `Fn` closure
|
||||
--> $DIR/borrowck-in-static.rs:15:17
|
||||
|
|
||||
14 | let x = Box::new(0); //~ NOTE moved
|
||||
14 | let x = Box::new(0); //~ NOTE captured outer variable
|
||||
| - captured outer variable
|
||||
15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
|
||||
| ^ cannot move out of captured outer variable in an `Fn` closure
|
||||
|
|
|
@ -15,5 +15,6 @@ fn main() {
|
|||
let _u = x; // error shouldn't note this move
|
||||
x = Box::new(1);
|
||||
drop(x);
|
||||
let _ = (1,x);
|
||||
let _ = (1,x); //~ ERROR use of moved value: `x` (Ast)
|
||||
//~^ ERROR use of moved value: `x` (Mir)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` (Ast)
|
|||
|
|
||||
17 | drop(x);
|
||||
| - value moved here
|
||||
18 | let _ = (1,x);
|
||||
18 | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast)
|
||||
| ^ value used here after move
|
||||
|
|
||||
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
|
||||
|
@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` (Mir)
|
|||
|
|
||||
17 | drop(x);
|
||||
| - value moved here
|
||||
18 | let _ = (1,x);
|
||||
18 | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast)
|
||||
| ^ value use here after move
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -17,20 +17,20 @@ struct FuncWrapper<'a, T : 'a> {
|
|||
impl<'a, T : 'a> FuncWrapper<'a, T> {
|
||||
fn in_loop(self, arg : &'a mut T) {
|
||||
loop {
|
||||
(self.func)(arg)
|
||||
(self.func)(arg) //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
|
||||
fn in_while(self, arg : &'a mut T) {
|
||||
while true {
|
||||
(self.func)(arg)
|
||||
(self.func)(arg) //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
|
||||
fn in_for(self, arg : &'a mut T) {
|
||||
let v : Vec<()> = vec![];
|
||||
for _ in v.iter() {
|
||||
(self.func)(arg)
|
||||
(self.func)(arg) //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
|
||||
--> $DIR/mut-borrow-in-loop.rs:20:25
|
||||
|
|
||||
20 | (self.func)(arg)
|
||||
20 | (self.func)(arg) //~ ERROR cannot borrow
|
||||
| ^^^ mutable borrow starts here in previous iteration of loop
|
||||
21 | }
|
||||
22 | }
|
||||
|
@ -10,7 +10,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time
|
|||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
|
||||
--> $DIR/mut-borrow-in-loop.rs:26:25
|
||||
|
|
||||
26 | (self.func)(arg)
|
||||
26 | (self.func)(arg) //~ ERROR cannot borrow
|
||||
| ^^^ mutable borrow starts here in previous iteration of loop
|
||||
27 | }
|
||||
28 | }
|
||||
|
@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time
|
|||
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
|
||||
--> $DIR/mut-borrow-in-loop.rs:33:25
|
||||
|
|
||||
33 | (self.func)(arg)
|
||||
33 | (self.func)(arg) //~ ERROR cannot borrow
|
||||
| ^^^ mutable borrow starts here in previous iteration of loop
|
||||
34 | }
|
||||
35 | }
|
||||
|
|
|
@ -14,13 +14,13 @@ fn main() {
|
|||
let mut void = ();
|
||||
|
||||
let first = &mut void;
|
||||
let second = &mut void;
|
||||
let second = &mut void; //~ ERROR cannot borrow
|
||||
|
||||
loop {
|
||||
let mut inner_void = ();
|
||||
|
||||
let inner_first = &mut inner_void;
|
||||
let inner_second = &mut inner_void;
|
||||
let inner_second = &mut inner_void; //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time
|
|||
|
|
||||
16 | let first = &mut void;
|
||||
| ---- first mutable borrow occurs here
|
||||
17 | let second = &mut void;
|
||||
17 | let second = &mut void; //~ ERROR cannot borrow
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
25 | }
|
||||
|
@ -14,7 +14,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
|
|||
|
|
||||
22 | let inner_first = &mut inner_void;
|
||||
| ---------- first mutable borrow occurs here
|
||||
23 | let inner_second = &mut inner_void;
|
||||
23 | let inner_second = &mut inner_void; //~ ERROR cannot borrow
|
||||
| ^^^^^^^^^^ second mutable borrow occurs here
|
||||
24 | }
|
||||
| - first borrow ends here
|
||||
|
|
|
@ -16,9 +16,10 @@ fn call<F>(f: F) where F : Fn() {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let y = vec![format!("World")]; //~ NOTE moved
|
||||
let y = vec![format!("World")]; //~ NOTE captured outer variable
|
||||
call(|| {
|
||||
y.into_iter();
|
||||
//~^ ERROR cannot move out of captured outer variable in an `Fn` closure
|
||||
//~| NOTE cannot move out of
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0507]: cannot move out of captured outer variable in an `Fn` closure
|
||||
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
|
||||
|
|
||||
19 | let y = vec![format!("World")]; //~ NOTE moved
|
||||
19 | let y = vec![format!("World")]; //~ NOTE captured outer variable
|
||||
| - captured outer variable
|
||||
20 | call(|| {
|
||||
21 | y.into_iter();
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
&1 as Send;
|
||||
Box::new(1) as Send;
|
||||
&1 as Send; //~ ERROR cast to unsized
|
||||
Box::new(1) as Send; //~ ERROR cast to unsized
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send`
|
||||
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
|
||||
|
|
||||
12 | &1 as Send;
|
||||
12 | &1 as Send; //~ ERROR cast to unsized
|
||||
| ^^^^^^----
|
||||
| |
|
||||
| help: try casting to a reference instead: `&Send`
|
||||
|
@ -9,7 +9,7 @@ error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send`
|
|||
error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
|
||||
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
|
||||
|
|
||||
13 | Box::new(1) as Send;
|
||||
13 | Box::new(1) as Send; //~ ERROR cast to unsized
|
||||
| ^^^^^^^^^^^^^^^----
|
||||
| |
|
||||
| help: try casting to a `Box` instead: `Box<Send>`
|
||||
|
|
|
@ -17,36 +17,36 @@ struct S(Enum, ());
|
|||
struct Sd { x: Enum, y: () }
|
||||
|
||||
fn main() {
|
||||
match (A, ()) {
|
||||
match (A, ()) { //~ ERROR non-exhaustive
|
||||
(A, _) => {}
|
||||
}
|
||||
|
||||
match (A, A) {
|
||||
match (A, A) { //~ ERROR non-exhaustive
|
||||
(_, A) => {}
|
||||
}
|
||||
|
||||
match ((A, ()), ()) {
|
||||
match ((A, ()), ()) { //~ ERROR non-exhaustive
|
||||
((A, ()), _) => {}
|
||||
}
|
||||
|
||||
match ((A, ()), A) {
|
||||
match ((A, ()), A) { //~ ERROR non-exhaustive
|
||||
((A, ()), _) => {}
|
||||
}
|
||||
|
||||
match ((A, ()), ()) {
|
||||
match ((A, ()), ()) { //~ ERROR non-exhaustive
|
||||
((A, _), _) => {}
|
||||
}
|
||||
|
||||
|
||||
match S(A, ()) {
|
||||
match S(A, ()) { //~ ERROR non-exhaustive
|
||||
S(A, _) => {}
|
||||
}
|
||||
|
||||
match (Sd { x: A, y: () }) {
|
||||
match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive
|
||||
Sd { x: A, y: _ } => {}
|
||||
}
|
||||
|
||||
match Some(A) {
|
||||
match Some(A) { //~ ERROR non-exhaustive
|
||||
Some(A) => (),
|
||||
None => ()
|
||||
}
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:20:11
|
||||
|
|
||||
20 | match (A, ()) {
|
||||
20 | match (A, ()) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:24:11
|
||||
|
|
||||
24 | match (A, A) {
|
||||
24 | match (A, A) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:28:11
|
||||
|
|
||||
28 | match ((A, ()), ()) {
|
||||
28 | match ((A, ()), ()) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:32:11
|
||||
|
|
||||
32 | match ((A, ()), A) {
|
||||
32 | match ((A, ()), A) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:36:11
|
||||
|
|
||||
36 | match ((A, ()), ()) {
|
||||
36 | match ((A, ()), ()) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:41:11
|
||||
|
|
||||
41 | match S(A, ()) {
|
||||
41 | match S(A, ()) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:45:11
|
||||
|
|
||||
45 | match (Sd { x: A, y: () }) {
|
||||
45 | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
|
||||
--> $DIR/issue-35609.rs:49:11
|
||||
|
|
||||
49 | match Some(A) {
|
||||
49 | match Some(A) { //~ ERROR non-exhaustive
|
||||
| ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
fn foo() -> Box<Fn()> {
|
||||
let num = 5;
|
||||
|
||||
let closure = || {
|
||||
let closure = || { //~ ERROR expected a closure that
|
||||
num += 1;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
|
||||
--> $DIR/issue-26046-fn-mut.rs:14:19
|
||||
|
|
||||
14 | let closure = || {
|
||||
14 | let closure = || { //~ ERROR expected a closure that
|
||||
| ___________________^
|
||||
15 | | num += 1;
|
||||
16 | | };
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
fn get_closure() -> Box<Fn() -> Vec<u8>> {
|
||||
let vec = vec![1u8, 2u8];
|
||||
|
||||
let closure = move || {
|
||||
let closure = move || { //~ ERROR expected a closure
|
||||
vec
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
|
||||
--> $DIR/issue-26046-fn-once.rs:14:19
|
||||
|
|
||||
14 | let closure = move || {
|
||||
14 | let closure = move || { //~ ERROR expected a closure
|
||||
| ___________________^
|
||||
15 | | vec
|
||||
16 | | };
|
||||
|
|
|
@ -14,12 +14,13 @@ fn main() {
|
|||
let dict: HashMap<i32, i32> = HashMap::new();
|
||||
let debug_dump_dict = || {
|
||||
for (key, value) in dict {
|
||||
//~^ NOTE closure cannot be invoked more than once
|
||||
println!("{:?} - {:?}", key, value);
|
||||
}
|
||||
};
|
||||
debug_dump_dict();
|
||||
//~^ NOTE: value moved here
|
||||
debug_dump_dict();
|
||||
//~^ ERROR use of moved value: `debug_dump_dict`
|
||||
//~| NOTE closure cannot be invoked more than once because it moves the
|
||||
//~| variable `dict` out of its environment
|
||||
//~| NOTE value used here after move
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
error[E0382]: use of moved value: `debug_dump_dict`
|
||||
--> $DIR/issue-42065.rs:21:5
|
||||
--> $DIR/issue-42065.rs:23:5
|
||||
|
|
||||
20 | debug_dump_dict();
|
||||
| --------------- value moved here
|
||||
21 | debug_dump_dict();
|
||||
| --------------- value moved here
|
||||
22 | //~^ NOTE: value moved here
|
||||
23 | debug_dump_dict();
|
||||
| ^^^^^^^^^^^^^^^ value used here after move
|
||||
|
|
||||
note: closure cannot be invoked more than once because it moves the variable `dict` out of its environment
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
trait C {}
|
||||
impl C { fn f() {} }
|
||||
impl C { fn f() {} } //~ ERROR duplicate
|
||||
impl C { fn f() {} }
|
||||
fn main() { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0592]: duplicate definitions with name `f`
|
||||
--> $DIR/coherence-overlapping-inherent-impl-trait.rs:14:10
|
||||
|
|
||||
14 | impl C { fn f() {} }
|
||||
14 | impl C { fn f() {} } //~ ERROR duplicate
|
||||
| ^^^^^^^^^ duplicate definitions for `f`
|
||||
15 | impl C { fn f() {} }
|
||||
| --------- other definition for `f`
|
||||
|
|
|
@ -14,5 +14,5 @@ fn main() {
|
|||
|
||||
impl !Sync for Foo {}
|
||||
|
||||
unsafe impl Send for &'static Foo { }
|
||||
unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo`
|
||||
--> $DIR/empty_span.rs:17:5
|
||||
|
|
||||
17 | unsafe impl Send for &'static Foo { }
|
||||
17 | unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -97,5 +97,5 @@ fn main() {
|
|||
|
||||
|
||||
|
||||
let y = &mut x;
|
||||
let y = &mut x; //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
|
|||
12 | let x = "foo";
|
||||
| - consider changing this to `mut x`
|
||||
...
|
||||
100 | let y = &mut x;
|
||||
100 | let y = &mut x; //~ ERROR cannot borrow
|
||||
| ^ cannot borrow mutably
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -97,5 +97,5 @@
|
|||
fn main() {
|
||||
let mut x = "foo";
|
||||
let y = &mut x;
|
||||
let z = &mut x;
|
||||
let z = &mut x; //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
|
|||
|
|
||||
99 | let y = &mut x;
|
||||
| - first mutable borrow occurs here
|
||||
100 | let z = &mut x;
|
||||
100 | let z = &mut x; //~ ERROR cannot borrow
|
||||
| ^ second mutable borrow occurs here
|
||||
101 | }
|
||||
| - first borrow ends here
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let mut v = vec![Some("foo"), Some("bar")];
|
||||
v.push(v.pop().unwrap());
|
||||
v.push(v.pop().unwrap()); //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0499]: cannot borrow `v` as mutable more than once at a time
|
||||
--> $DIR/one_line.rs:13:12
|
||||
|
|
||||
13 | v.push(v.pop().unwrap());
|
||||
13 | v.push(v.pop().unwrap()); //~ ERROR cannot borrow
|
||||
| - ^ - first borrow ends here
|
||||
| | |
|
||||
| | second mutable borrow occurs here
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn id() {}
|
||||
fn id() {} //~ ERROR duplicate definitions
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
@ -26,7 +26,7 @@ impl Foo {
|
|||
struct Bar<T>(T);
|
||||
|
||||
impl<T> Bar<T> {
|
||||
fn bar(&self) {}
|
||||
fn bar(&self) {} //~ ERROR duplicate definitions
|
||||
}
|
||||
|
||||
impl Bar<u32> {
|
||||
|
@ -36,7 +36,7 @@ impl Bar<u32> {
|
|||
struct Baz<T>(T);
|
||||
|
||||
impl<T: Copy> Baz<T> {
|
||||
fn baz(&self) {}
|
||||
fn baz(&self) {} //~ ERROR duplicate definitions
|
||||
}
|
||||
|
||||
impl<T> Baz<Vec<T>> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0592]: duplicate definitions with name `id`
|
||||
--> $DIR/overlapping_inherent_impls.rs:19:5
|
||||
|
|
||||
19 | fn id() {}
|
||||
19 | fn id() {} //~ ERROR duplicate definitions
|
||||
| ^^^^^^^^^^ duplicate definitions for `id`
|
||||
...
|
||||
23 | fn id() {}
|
||||
|
@ -10,7 +10,7 @@ error[E0592]: duplicate definitions with name `id`
|
|||
error[E0592]: duplicate definitions with name `bar`
|
||||
--> $DIR/overlapping_inherent_impls.rs:29:5
|
||||
|
|
||||
29 | fn bar(&self) {}
|
||||
29 | fn bar(&self) {} //~ ERROR duplicate definitions
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definitions for `bar`
|
||||
...
|
||||
33 | fn bar(&self) {}
|
||||
|
@ -19,7 +19,7 @@ error[E0592]: duplicate definitions with name `bar`
|
|||
error[E0592]: duplicate definitions with name `baz`
|
||||
--> $DIR/overlapping_inherent_impls.rs:39:5
|
||||
|
|
||||
39 | fn baz(&self) {}
|
||||
39 | fn baz(&self) {} //~ ERROR duplicate definitions
|
||||
| ^^^^^^^^^^^^^^^^ duplicate definitions for `baz`
|
||||
...
|
||||
43 | fn baz(&self) {}
|
||||
|
|
|
@ -18,6 +18,6 @@ impl Drop for S {
|
|||
|
||||
fn main() {
|
||||
match (S {f:"foo".to_string()}) {
|
||||
S {f:_s} => {}
|
||||
S {f:_s} => {} //~ ERROR cannot move out
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
|
||||
--> $DIR/overlapping_spans.rs:21:9
|
||||
|
|
||||
21 | S {f:_s} => {}
|
||||
21 | S {f:_s} => {} //~ ERROR cannot move out
|
||||
| ^^^^^--^
|
||||
| | |
|
||||
| | hint: to prevent move, use `ref _s` or `ref mut _s`
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
// ignore-tidy-tab
|
||||
|
||||
fn main() {
|
||||
bar;
|
||||
bar; //~ ERROR cannot find value `bar`
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
"bar boo"
|
||||
"bar boo" //~ ERROR mismatched types
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0425]: cannot find value `bar` in this scope
|
||||
--> $DIR/tab.rs:14:2
|
||||
|
|
||||
14 | bar;
|
||||
14 | bar; //~ ERROR cannot find value `bar`
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0308]: mismatched types
|
||||
|
@ -9,7 +9,7 @@ error[E0308]: mismatched types
|
|||
|
|
||||
17 | fn foo() {
|
||||
| - help: try adding a return type: `-> &'static str `
|
||||
18 | "bar boo"
|
||||
18 | "bar boo" //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^ expected (), found reference
|
||||
|
|
||||
= note: expected type `()`
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
// ignore-tidy-tab
|
||||
|
||||
fn main() {
|
||||
""";
|
||||
"""; //~ ERROR unterminated double quote
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: unterminated double quote string
|
||||
--> $DIR/tab_2.rs:14:7
|
||||
|
|
||||
14 | """;
|
||||
14 | """; //~ ERROR unterminated double quote
|
||||
| _______^
|
||||
15 | | }
|
||||
| |__^
|
||||
|
|
|
@ -14,6 +14,6 @@ fn main() {
|
|||
let some_vec = vec!["hi"];
|
||||
some_vec.into_iter();
|
||||
{
|
||||
println!("{:?}", some_vec);
|
||||
println!("{:?}", some_vec); //~ ERROR use of moved
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0382]: use of moved value: `some_vec`
|
|||
15 | some_vec.into_iter();
|
||||
| -------- value moved here
|
||||
16 | {
|
||||
17 | println!("{:?}", some_vec);
|
||||
17 | println!("{:?}", some_vec); //~ ERROR use of moved
|
||||
| ^^^^^^^^ value used here after move
|
||||
|
|
||||
= note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
|
||||
|
|
|
@ -12,6 +12,6 @@ include!("two_files_data.rs");
|
|||
|
||||
struct Baz { }
|
||||
|
||||
impl Bar for Baz { }
|
||||
impl Bar for Baz { } //~ ERROR expected trait, found type alias
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0404]: expected trait, found type alias `Bar`
|
||||
--> $DIR/two_files.rs:15:6
|
||||
|
|
||||
15 | impl Bar for Baz { }
|
||||
15 | impl Bar for Baz { } //~ ERROR expected trait, found type alias
|
||||
| ^^^ type aliases cannot be used for traits
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern "路濫狼á́́" fn foo() {}
|
||||
extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: invalid ABI: expected one of [cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted], found `路濫狼á́́`
|
||||
--> $DIR/unicode.rs:11:8
|
||||
|
|
||||
11 | extern "路濫狼á́́" fn foo() {}
|
||||
11 | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#![feature(non_ascii_idents)]
|
||||
|
||||
fn main() {
|
||||
let _ = ("a̐éö̲", 0u7);
|
||||
let _ = ("아あ", 1i42);
|
||||
let _ = a̐é;
|
||||
let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width
|
||||
let _ = ("아あ", 1i42); //~ ERROR invalid width
|
||||
let _ = a̐é; //~ ERROR cannot find
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: invalid width `7` for integer literal
|
||||
--> $DIR/unicode_2.rs:14:25
|
||||
|
|
||||
14 | let _ = ("a̐éö̲", 0u7);
|
||||
14 | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width
|
||||
| ^^^
|
||||
|
|
||||
= help: valid widths are 8, 16, 32, 64 and 128
|
||||
|
@ -9,7 +9,7 @@ error: invalid width `7` for integer literal
|
|||
error: invalid width `42` for integer literal
|
||||
--> $DIR/unicode_2.rs:15:20
|
||||
|
|
||||
15 | let _ = ("아あ", 1i42);
|
||||
15 | let _ = ("아あ", 1i42); //~ ERROR invalid width
|
||||
| ^^^^
|
||||
|
|
||||
= help: valid widths are 8, 16, 32, 64 and 128
|
||||
|
@ -17,7 +17,7 @@ error: invalid width `42` for integer literal
|
|||
error[E0425]: cannot find value `a̐é` in this scope
|
||||
--> $DIR/unicode_2.rs:16:13
|
||||
|
|
||||
16 | let _ = a̐é;
|
||||
16 | let _ = a̐é; //~ ERROR cannot find
|
||||
| ^^ not found in this scope
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
// #41425 -- error message "mismatched types" has wrong types
|
||||
|
||||
fn plus_one(x: i32) -> i32 {
|
||||
fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types
|
||||
x + 1;
|
||||
}
|
||||
|
||||
fn foo() -> Result<u8, u64> {
|
||||
fn foo() -> Result<u8, u64> { //~ ERROR mismatched types
|
||||
Ok(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:13:28
|
||||
|
|
||||
13 | fn plus_one(x: i32) -> i32 {
|
||||
13 | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types
|
||||
| ____________________________^
|
||||
14 | | x + 1;
|
||||
| | - help: consider removing this semicolon
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:17:29
|
||||
|
|
||||
17 | fn foo() -> Result<u8, u64> {
|
||||
17 | fn foo() -> Result<u8, u64> { //~ ERROR mismatched types
|
||||
| _____________________________^
|
||||
18 | | Ok(1);
|
||||
| | - help: consider removing this semicolon
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// 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.
|
||||
|
||||
// This test checks the output format without the intermediate json representation
|
||||
// compile-flags: --error-format=human
|
||||
|
||||
pub fn main() {
|
||||
let x = 42;
|
||||
x = 43;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/command-line-diagnostics.rs:16:5
|
||||
|
|
||||
15 | let x = 42;
|
||||
| - first assignment to `x`
|
||||
16 | x = 43;
|
||||
| ^^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -16,7 +16,7 @@ trait Master<'a, 'b> {
|
|||
}
|
||||
|
||||
impl<'a, 'b> Master<'a, 'b> for () {
|
||||
fn foo() where 'a: 'b { }
|
||||
fn foo() where 'a: 'b { } //~ ERROR impl has stricter
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait
|
|||
15 | fn foo();
|
||||
| --------- definition of `foo` from trait
|
||||
...
|
||||
19 | fn foo() where 'a: 'b { }
|
||||
19 | fn foo() where 'a: 'b { } //~ ERROR impl has stricter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -17,7 +17,7 @@ trait Master<'a, T: ?Sized, U> {
|
|||
// `U: 'a` does not imply `V: 'a`
|
||||
impl<'a, U, V> Master<'a, U, V> for () {
|
||||
fn foo() where V: 'a { }
|
||||
//~^ ERROR parameter type `V` may not live long enough
|
||||
//~^ ERROR impl has stricter requirements than trait
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -15,7 +15,9 @@ const fn foo(x: u32) -> u32 {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
const X: u32 = 0-1;
|
||||
const Y: u32 = foo(0-1);
|
||||
const X: u32 = 0-1; //~ ERROR constant evaluation error
|
||||
//~^ WARN constant evaluation error
|
||||
const Y: u32 = foo(0-1); //~ ERROR constant evaluation error
|
||||
//~^ WARN constant evaluation error
|
||||
println!("{} {}", X, Y);
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
warning: constant evaluation error: attempt to subtract with overflow
|
||||
--> $DIR/issue-43197.rs:18:20
|
||||
|
|
||||
18 | const X: u32 = 0-1;
|
||||
18 | const X: u32 = 0-1; //~ ERROR constant evaluation error
|
||||
| ^^^
|
||||
|
|
||||
= note: #[warn(const_err)] on by default
|
||||
|
||||
warning: constant evaluation error: attempt to subtract with overflow
|
||||
--> $DIR/issue-43197.rs:19:20
|
||||
--> $DIR/issue-43197.rs:20:20
|
||||
|
|
||||
19 | const Y: u32 = foo(0-1);
|
||||
20 | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0080]: constant evaluation error
|
||||
--> $DIR/issue-43197.rs:18:20
|
||||
|
|
||||
18 | const X: u32 = 0-1;
|
||||
18 | const X: u32 = 0-1; //~ ERROR constant evaluation error
|
||||
| ^^^ attempt to subtract with overflow
|
||||
|
||||
error[E0080]: constant evaluation error
|
||||
--> $DIR/issue-43197.rs:19:24
|
||||
--> $DIR/issue-43197.rs:20:24
|
||||
|
|
||||
19 | const Y: u32 = foo(0-1);
|
||||
20 | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error
|
||||
| ^^^ attempt to subtract with overflow
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
pub fn main() {
|
||||
// Constant of generic type (int)
|
||||
const X: &'static u32 = &22;
|
||||
const X: &'static u32 = &22; //~ ERROR constant evaluation error
|
||||
assert_eq!(0, match &22 {
|
||||
X => 0,
|
||||
_ => 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0080]: constant evaluation error
|
||||
--> $DIR/const-expr-addr-operator.rs:15:29
|
||||
|
|
||||
15 | const X: &'static u32 = &22;
|
||||
15 | const X: &'static u32 = &22; //~ ERROR constant evaluation error
|
||||
| ^^^ unimplemented constant expression: address operator
|
||||
|
|
||||
note: for pattern here
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: in format string
|
||||
|
||||
// aux-build:extern_macro_crate.rs
|
||||
#[macro_use(myprintln, myprint)]
|
||||
extern crate extern_macro_crate;
|
||||
|
||||
fn main() {
|
||||
myprintln!("{}"); //~ ERROR in this macro
|
||||
myprintln!("{}");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: 1 positional argument in format string, but no arguments were given
|
||||
--> $DIR/main.rs:16:5
|
||||
--> $DIR/main.rs:18:5
|
||||
|
|
||||
16 | myprintln!("{}"); //~ ERROR in this macro
|
||||
18 | myprintln!("{}");
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
// except according to those terms.
|
||||
|
||||
macro_rules! borrow {
|
||||
($x:expr) => { &$x }
|
||||
($x:expr) => { &$x } //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn foo(_: String) {}
|
||||
|
||||
fn foo2(s: &String) {
|
||||
foo(s);
|
||||
foo(s); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn foo3(_: u32) {}
|
||||
fn foo4(u: &u32) {
|
||||
foo3(u);
|
||||
foo3(u); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = String::new();
|
||||
let r_s = &s;
|
||||
foo2(r_s);
|
||||
foo(&"aaa".to_owned());
|
||||
foo(&mut "aaa".to_owned());
|
||||
foo(&"aaa".to_owned()); //~ ERROR mismatched types
|
||||
foo(&mut "aaa".to_owned()); //~ ERROR mismatched types
|
||||
foo3(borrow!(0));
|
||||
foo4(&0);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:18:9
|
||||
|
|
||||
18 | foo(s);
|
||||
18 | foo(s); //~ ERROR mismatched types
|
||||
| ^ expected struct `std::string::String`, found reference
|
||||
|
|
||||
= note: expected type `std::string::String`
|
||||
|
@ -16,7 +16,7 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:23:10
|
||||
|
|
||||
23 | foo3(u);
|
||||
23 | foo3(u); //~ ERROR mismatched types
|
||||
| ^ expected u32, found &u32
|
||||
|
|
||||
= note: expected type `u32`
|
||||
|
@ -26,7 +26,7 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:30:9
|
||||
|
|
||||
30 | foo(&"aaa".to_owned());
|
||||
30 | foo(&"aaa".to_owned()); //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found reference
|
||||
|
|
||||
= note: expected type `std::string::String`
|
||||
|
@ -36,7 +36,7 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:31:9
|
||||
|
|
||||
31 | foo(&mut "aaa".to_owned());
|
||||
31 | foo(&mut "aaa".to_owned()); //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found mutable reference
|
||||
|
|
||||
= note: expected type `std::string::String`
|
||||
|
@ -46,7 +46,7 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:12:20
|
||||
|
|
||||
12 | ($x:expr) => { &$x }
|
||||
12 | ($x:expr) => { &$x } //~ ERROR mismatched types
|
||||
| ^^^ expected u32, found &{integer}
|
||||
...
|
||||
32 | foo3(borrow!(0));
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
trait Foo {}
|
||||
|
||||
struct Bar<'a> {
|
||||
w: &'a Foo + Copy,
|
||||
x: &'a Foo + 'a,
|
||||
y: &'a mut Foo + 'a,
|
||||
z: fn() -> Foo + 'a,
|
||||
w: &'a Foo + Copy, //~ ERROR expected a path
|
||||
x: &'a Foo + 'a, //~ ERROR expected a path
|
||||
y: &'a mut Foo + 'a, //~ ERROR expected a path
|
||||
z: fn() -> Foo + 'a, //~ ERROR expected a path
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`
|
||||
--> $DIR/E0178.rs:14:8
|
||||
|
|
||||
14 | w: &'a Foo + Copy,
|
||||
14 | w: &'a Foo + Copy, //~ ERROR expected a path
|
||||
| ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)`
|
||||
|
||||
error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`
|
||||
--> $DIR/E0178.rs:15:8
|
||||
|
|
||||
15 | x: &'a Foo + 'a,
|
||||
15 | x: &'a Foo + 'a, //~ ERROR expected a path
|
||||
| ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)`
|
||||
|
||||
error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo`
|
||||
--> $DIR/E0178.rs:16:8
|
||||
|
|
||||
16 | y: &'a mut Foo + 'a,
|
||||
16 | y: &'a mut Foo + 'a, //~ ERROR expected a path
|
||||
| ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)`
|
||||
|
||||
error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo`
|
||||
--> $DIR/E0178.rs:17:8
|
||||
|
|
||||
17 | z: fn() -> Foo + 'a,
|
||||
17 | z: fn() -> Foo + 'a, //~ ERROR expected a path
|
||||
| ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses?
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
|
@ -33,7 +33,4 @@ fn main() {
|
|||
|
||||
f1.foo(1usize);
|
||||
//~^ error: the trait bound `Bar: Foo<usize>` is not satisfied
|
||||
//~| help: the following implementations were found:
|
||||
//~| help: <Bar as Foo<i32>>
|
||||
//~| help: <Bar as Foo<u8>>
|
||||
}
|
||||
|
|
|
@ -37,10 +37,4 @@ fn main() {
|
|||
|
||||
f1.foo(1usize);
|
||||
//~^ error: the trait bound `Bar: Foo<usize>` is not satisfied
|
||||
//~| help: the following implementations were found:
|
||||
//~| help: <Bar as Foo<i8>>
|
||||
//~| help: <Bar as Foo<i16>>
|
||||
//~| help: <Bar as Foo<i32>>
|
||||
//~| help: <Bar as Foo<u8>>
|
||||
//~| help: and 2 others
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ struct Struct;
|
|||
|
||||
impl Struct {
|
||||
fn foo(&mut self) {
|
||||
(&mut self).bar();
|
||||
(&mut self).bar(); //~ ERROR cannot borrow
|
||||
}
|
||||
|
||||
// In this case we could keep the suggestion, but to distinguish the
|
||||
// two cases is pretty hard. It's an obscure case anyway.
|
||||
fn bar(self: &mut Self) {
|
||||
(&mut self).bar();
|
||||
(&mut self).bar(); //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0596]: cannot borrow immutable argument `self` as mutable
|
||||
--> $DIR/issue-31424.rs:17:15
|
||||
|
|
||||
17 | (&mut self).bar();
|
||||
17 | (&mut self).bar(); //~ ERROR cannot borrow
|
||||
| ^^^^
|
||||
| |
|
||||
| cannot reborrow mutably
|
||||
|
@ -12,7 +12,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable
|
|||
|
|
||||
22 | fn bar(self: &mut Self) {
|
||||
| --------------- consider changing this to `mut self: &mut Self`
|
||||
23 | (&mut self).bar();
|
||||
23 | (&mut self).bar(); //~ ERROR cannot borrow
|
||||
| ^^^^ cannot borrow mutably
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Z { }
|
|||
impl Z {
|
||||
fn run(&self, z: &mut Z) { }
|
||||
fn start(&mut self) {
|
||||
self.run(&mut self);
|
||||
self.run(&mut self); //~ ERROR cannot borrow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0596]: cannot borrow immutable argument `self` as mutable
|
||||
--> $DIR/issue-34126.rs:16:23
|
||||
|
|
||||
16 | self.run(&mut self);
|
||||
16 | self.run(&mut self); //~ ERROR cannot borrow
|
||||
| ^^^^
|
||||
| |
|
||||
| cannot reborrow mutably
|
||||
|
|
|
@ -13,5 +13,5 @@ fn get(key: &mut String) { }
|
|||
fn main() {
|
||||
let mut v: Vec<String> = Vec::new();
|
||||
let ref mut key = v[0];
|
||||
get(&mut key);
|
||||
get(&mut key); //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0596]: cannot borrow immutable local variable `key` as mutable
|
||||
--> $DIR/issue-34337.rs:16:14
|
||||
|
|
||||
16 | get(&mut key);
|
||||
16 | get(&mut key); //~ ERROR cannot borrow
|
||||
| ^^^
|
||||
| |
|
||||
| cannot reborrow mutably
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
|
||||
fn main() {
|
||||
let f = Foo { v: Vec::new() };
|
||||
f.v.push("cat".to_string());
|
||||
f.v.push("cat".to_string()); //~ ERROR cannot borrow
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,9 +23,9 @@ struct S {
|
|||
}
|
||||
fn foo() {
|
||||
let s = S { x: 42 };
|
||||
s.x += 1;
|
||||
s.x += 1; //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
fn bar(s: S) {
|
||||
s.x += 1;
|
||||
s.x += 1; //~ ERROR cannot assign
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable field `f.v` as mutable
|
|||
|
|
||||
16 | let f = Foo { v: Vec::new() };
|
||||
| - consider changing this to `mut f`
|
||||
17 | f.v.push("cat".to_string());
|
||||
17 | f.v.push("cat".to_string()); //~ ERROR cannot borrow
|
||||
| ^^^ cannot mutably borrow immutable field
|
||||
|
||||
error[E0594]: cannot assign to immutable field `s.x`
|
||||
|
@ -11,7 +11,7 @@ error[E0594]: cannot assign to immutable field `s.x`
|
|||
|
|
||||
25 | let s = S { x: 42 };
|
||||
| - consider changing this to `mut s`
|
||||
26 | s.x += 1;
|
||||
26 | s.x += 1; //~ ERROR cannot assign
|
||||
| ^^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error[E0594]: cannot assign to immutable field `s.x`
|
||||
|
@ -19,7 +19,7 @@ error[E0594]: cannot assign to immutable field `s.x`
|
|||
|
|
||||
29 | fn bar(s: S) {
|
||||
| - consider changing this to `mut s`
|
||||
30 | s.x += 1;
|
||||
30 | s.x += 1; //~ ERROR cannot assign
|
||||
| ^^^^^^^^ cannot mutably borrow immutable field
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
|
@ -14,5 +14,5 @@ struct Foo {
|
|||
|
||||
fn main() {
|
||||
let f = Foo { bar: 22 };
|
||||
f.baz;
|
||||
f.baz; //~ ERROR no field
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0609]: no field `baz` on type `Foo`
|
||||
--> $DIR/issue-36798.rs:17:7
|
||||
|
|
||||
17 | f.baz;
|
||||
17 | f.baz; //~ ERROR no field
|
||||
| ^^^ did you mean `bar`?
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -14,5 +14,5 @@ struct Foo {
|
|||
|
||||
fn main() {
|
||||
let f = Foo { bar: 22 };
|
||||
f.zz;
|
||||
f.zz; //~ ERROR no field
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0609]: no field `zz` on type `Foo`
|
||||
--> $DIR/issue-36798_unknown_field.rs:17:7
|
||||
|
|
||||
17 | f.zz;
|
||||
17 | f.zz; //~ ERROR no field
|
||||
| ^^ unknown field
|
||||
|
|
||||
= note: available fields are: `bar`
|
||||
|
|
|
@ -19,7 +19,7 @@ fn main() {
|
|||
let mut x = TestEnum::Item(10);
|
||||
match x {
|
||||
TestEnum::Item(ref mut x) => {
|
||||
test(&mut x);
|
||||
test(&mut x); //~ ERROR cannot borrow immutable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error[E0596]: cannot borrow immutable local variable `x` as mutable
|
||||
--> $DIR/issue-37139.rs:22:23
|
||||
|
|
||||
22 | test(&mut x);
|
||||
22 | test(&mut x); //~ ERROR cannot borrow immutable
|
||||
| ^
|
||||
| |
|
||||
| cannot reborrow mutably
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue