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);
diag_builder.span_note(span.expect("span_note expects a span"), message);
}
}
- };
-
- 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()
}
}
#![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 {
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();
}
#![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
#[macro_use] extern crate plugin;
-#[derive(Foo, Bar)]
+#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
struct Baz {
a: i32,
b: i32,
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
#![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.");
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
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
}
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: `===`
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: `===`
}
#[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
}
| ^^^^^^^^^^^^^^ 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
// 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
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 ()) -> _`
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 ()) -> _`
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 ()) -> _`
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 ()) -> _`
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 ()) -> _`
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>) -> _`
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 ())) -> _`
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>) -> _`
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 ())) -> _`
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 ())) -> _`
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 ())) -> _`
fn blah() -> i32 { //~ ERROR mismatched types
1
- ; //~ HELP consider removing this semicolon:
+ ; //~ HELP consider removing this semicolon
}
fn main() { }
| __________________^
12 | | 1
13 | |
-14 | | ; //~ HELP consider removing this semicolon:
+14 | | ; //~ HELP consider removing this semicolon
| | - help: consider removing this semicolon
15 | | }
| |_^ expected i32, found ()
fn a(&self) {
|| self.b()
//~^ ERROR no method named `b` found for type `&Self` in the current scope
- //~| ERROR mismatched types
}
}
fn main() {}
}
fn bar() {
- foo()
+ foo() //~ ERROR mismatched types
}
fn main() {
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
|
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) {
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() {
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() {
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() {
| ^^ - 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)
| ^^ - 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
// 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() {
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
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)
}
|
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
|
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
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
}
}
}
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 | }
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 | }
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 | }
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
}
}
|
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 | }
|
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
}
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
});
}
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();
// 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
}
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`
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>`
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 => ()
}
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
fn foo() -> Box<Fn()> {
let num = 5;
- let closure = || {
+ let closure = || { //~ ERROR expected a closure that
num += 1;
};
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 | | };
fn get_closure() -> Box<Fn() -> Vec<u8>> {
let vec = vec![1u8, 2u8];
- let closure = move || {
+ let closure = move || { //~ ERROR expected a closure
vec
};
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 | | };
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
}
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
#![allow(dead_code)]
trait C {}
-impl C { fn f() {} }
+impl C { fn f() {} } //~ ERROR duplicate
impl C { fn f() {} }
fn main() { }
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`
impl !Sync for Foo {}
- unsafe impl Send for &'static Foo { }
+ unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl
}
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
- let y = &mut x;
+ let y = &mut x; //~ ERROR cannot borrow
}
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
fn main() {
let mut x = "foo";
let y = &mut x;
- let z = &mut x;
+ let z = &mut x; //~ ERROR cannot borrow
}
|
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
fn main() {
let mut v = vec![Some("foo"), Some("bar")];
- v.push(v.pop().unwrap());
+ v.push(v.pop().unwrap()); //~ ERROR cannot borrow
}
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
struct Foo;
impl Foo {
- fn id() {}
+ fn id() {} //~ ERROR duplicate definitions
}
impl Foo {
struct Bar<T>(T);
impl<T> Bar<T> {
- fn bar(&self) {}
+ fn bar(&self) {} //~ ERROR duplicate definitions
}
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>> {
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() {}
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) {}
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) {}
fn main() {
match (S {f:"foo".to_string()}) {
- S {f:_s} => {}
+ S {f:_s} => {} //~ ERROR cannot move out
}
}
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`
// ignore-tidy-tab
fn main() {
- bar;
+ bar; //~ ERROR cannot find value `bar`
}
fn foo() {
- "bar boo"
+ "bar boo" //~ ERROR mismatched types
}
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
|
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 `()`
// ignore-tidy-tab
fn main() {
- """;
+ """; //~ ERROR unterminated double quote
}
error: unterminated double quote string
--> $DIR/tab_2.rs:14:7
|
-14 | """;
+14 | """; //~ ERROR unterminated double quote
| _______^
15 | | }
| |__^
let some_vec = vec!["hi"];
some_vec.into_iter();
{
- println!("{:?}", some_vec);
+ println!("{:?}", some_vec); //~ ERROR use of moved
}
}
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
struct Baz { }
-impl Bar for Baz { }
+impl Bar for Baz { } //~ ERROR expected trait, found type alias
fn main() { }
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
// 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() { }
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
#![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
}
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
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
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
// #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);
}
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
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
--- /dev/null
+// 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;
+}
--- /dev/null
+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
+
}
impl<'a, 'b> Master<'a, 'b> for () {
- fn foo() where 'a: 'b { }
+ fn foo() where 'a: 'b { } //~ ERROR impl has stricter
}
fn main() {
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
// `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() {
}
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);
}
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
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,
});
-}
\ No newline at end of file
+}
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
// 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!("{}");
}
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)
// 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);
}
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`
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`
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`
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`
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));
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() {
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
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>>
}
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
}
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
}
}
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
|
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
impl Z {
fn run(&self, z: &mut Z) { }
fn start(&mut self) {
- self.run(&mut self);
+ self.run(&mut self); //~ ERROR cannot borrow
}
}
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
fn main() {
let mut v: Vec<String> = Vec::new();
let ref mut key = v[0];
- get(&mut key);
+ get(&mut key); //~ ERROR cannot borrow
}
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
fn main() {
let f = Foo { v: Vec::new() };
- f.v.push("cat".to_string());
+ f.v.push("cat".to_string()); //~ ERROR cannot borrow
}
}
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
}
|
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`
|
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`
|
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
fn main() {
let f = Foo { bar: 22 };
- f.baz;
+ f.baz; //~ ERROR no field
}
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
fn main() {
let f = Foo { bar: 22 };
- f.zz;
+ f.zz; //~ ERROR no field
}
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`
let mut x = TestEnum::Item(10);
match x {
TestEnum::Item(ref mut x) => {
- test(&mut x);
+ test(&mut x); //~ ERROR cannot borrow immutable
}
}
}
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
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use Foo;
+use Foo; //~ ERROR unresolved
-use Foo1;
+use Foo1; //~ ERROR unresolved
fn main() {}
error[E0432]: unresolved import `Foo`
--> $DIR/issue-38054-do-not-show-unresolved-names.rs:11:5
|
-11 | use Foo;
+11 | use Foo; //~ ERROR unresolved
| ^^^ no `Foo` in the root
error[E0432]: unresolved import `Foo1`
--> $DIR/issue-38054-do-not-show-unresolved-names.rs:13:5
|
-13 | use Foo1;
+13 | use Foo1; //~ ERROR unresolved
| ^^^^ no `Foo1` in the root
error: aborting due to 2 previous errors
impl<'a> Foo<'a> {
fn f(&self) {
- self.s.push('x');
+ self.s.push('x'); //~ ERROR cannot borrow data mutably
}
}
|
26 | fn f(&self) {
| ----- use `&mut self` here to make mutable
-27 | self.s.push('x');
+27 | self.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^^^^ assignment into an immutable reference
error: aborting due to previous error
impl<'a> Bar<'a> {
fn f(&mut self) {
- self.s.push('x');
+ self.s.push('x'); //~ ERROR cannot borrow immutable borrowed
}
}
12 | s: &'a String
| ---------- use `&'a mut String` here to make mutable
...
-17 | self.s.push('x');
+17 | self.s.push('x'); //~ ERROR cannot borrow immutable borrowed
| ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
impl<'a> Qux<'a> {
fn f(&self) {
- self.s.push('x');
+ self.s.push('x'); //~ ERROR cannot borrow immutable borrowed
}
}
12 | s: &'a String
| ---------- use `&'a mut String` here to make mutable
...
-17 | self.s.push('x');
+17 | self.s.push('x'); //~ ERROR cannot borrow immutable borrowed
| ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
}
fn f(x: usize, f: &Foo) {
- f.s.push('x');
+ f.s.push('x'); //~ ERROR cannot borrow data mutably
}
fn main() {}
|
15 | fn f(x: usize, f: &Foo) {
| ---- use `&mut Foo` here to make mutable
-16 | f.s.push('x');
+16 | f.s.push('x'); //~ ERROR cannot borrow data mutably
| ^^^ assignment into an immutable reference
error: aborting due to previous error
fn main() {
let z = Z { x: X::Y };
- let _ = &mut z.x;
+ let _ = &mut z.x; //~ ERROR cannot borrow
}
impl Z {
fn foo<'z>(&'z self) {
- let _ = &mut self.x;
+ let _ = &mut self.x; //~ ERROR cannot borrow
}
fn foo1(&self, other: &Z) {
- let _ = &mut self.x;
- let _ = &mut other.x;
+ let _ = &mut self.x; //~ ERROR cannot borrow
+ let _ = &mut other.x; //~ ERROR cannot borrow
}
fn foo2<'a>(&'a self, other: &Z) {
- let _ = &mut self.x;
- let _ = &mut other.x;
+ let _ = &mut self.x; //~ ERROR cannot borrow
+ let _ = &mut other.x; //~ ERROR cannot borrow
}
fn foo3<'a>(self: &'a Self, other: &Z) {
- let _ = &mut self.x;
- let _ = &mut other.x;
+ let _ = &mut self.x; //~ ERROR cannot borrow
+ let _ = &mut other.x; //~ ERROR cannot borrow
}
fn foo4(other: &Z) {
- let _ = &mut other.x;
+ let _ = &mut other.x; //~ ERROR cannot borrow
}
}
pub fn with_arg(z: Z, w: &Z) {
- let _ = &mut z.x;
- let _ = &mut w.x;
+ let _ = &mut z.x; //~ ERROR cannot borrow
+ let _ = &mut w.x; //~ ERROR cannot borrow
}
pub fn with_tuple() {
let mut y = 0;
let x = (&y,);
- *x.0 = 1;
+ *x.0 = 1; //~ ERROR cannot assign to immutable borrowed content
}
|
20 | let z = Z { x: X::Y };
| - consider changing this to `mut z`
-21 | let _ = &mut z.x;
+21 | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
25 | fn foo<'z>(&'z self) {
| -------- use `&'z mut self` here to make mutable
-26 | let _ = &mut self.x;
+26 | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
29 | fn foo1(&self, other: &Z) {
| ----- use `&mut self` here to make mutable
-30 | let _ = &mut self.x;
+30 | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
29 | fn foo1(&self, other: &Z) {
| -- use `&mut Z` here to make mutable
-30 | let _ = &mut self.x;
-31 | let _ = &mut other.x;
+30 | let _ = &mut self.x; //~ ERROR cannot borrow
+31 | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
34 | fn foo2<'a>(&'a self, other: &Z) {
| -------- use `&'a mut self` here to make mutable
-35 | let _ = &mut self.x;
+35 | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
34 | fn foo2<'a>(&'a self, other: &Z) {
| -- use `&mut Z` here to make mutable
-35 | let _ = &mut self.x;
-36 | let _ = &mut other.x;
+35 | let _ = &mut self.x; //~ ERROR cannot borrow
+36 | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `self.x` as mutable
|
39 | fn foo3<'a>(self: &'a Self, other: &Z) {
| -------- use `&'a mut Self` here to make mutable
-40 | let _ = &mut self.x;
+40 | let _ = &mut self.x; //~ ERROR cannot borrow
| ^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
39 | fn foo3<'a>(self: &'a Self, other: &Z) {
| -- use `&mut Z` here to make mutable
-40 | let _ = &mut self.x;
-41 | let _ = &mut other.x;
+40 | let _ = &mut self.x; //~ ERROR cannot borrow
+41 | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `other.x` as mutable
|
44 | fn foo4(other: &Z) {
| -- use `&mut Z` here to make mutable
-45 | let _ = &mut other.x;
+45 | let _ = &mut other.x; //~ ERROR cannot borrow
| ^^^^^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `z.x` as mutable
|
50 | pub fn with_arg(z: Z, w: &Z) {
| - consider changing this to `mut z`
-51 | let _ = &mut z.x;
+51 | let _ = &mut z.x; //~ ERROR cannot borrow
| ^^^ cannot mutably borrow immutable field
error[E0596]: cannot borrow immutable field `w.x` as mutable
|
50 | pub fn with_arg(z: Z, w: &Z) {
| -- use `&mut Z` here to make mutable
-51 | let _ = &mut z.x;
-52 | let _ = &mut w.x;
+51 | let _ = &mut z.x; //~ ERROR cannot borrow
+52 | let _ = &mut w.x; //~ ERROR cannot borrow
| ^^^ cannot mutably borrow immutable field
error[E0594]: cannot assign to immutable borrowed content `*x.0`
--> $DIR/issue-39544.rs:58:5
|
-58 | *x.0 = 1;
+58 | *x.0 = 1; //~ ERROR cannot assign to immutable borrowed content
| ^^^^^^^^ cannot borrow as mutable
error: aborting due to 12 previous errors
impl Foo<i8> for bool {}
fn main() {
- Foo::<i32>::bar(&1i8);
- Foo::<i32>::bar(&1u8);
- Foo::<i32>::bar(&true);
+ Foo::<i32>::bar(&1i8); //~ ERROR is not satisfied
+ Foo::<i32>::bar(&1u8); //~ ERROR is not satisfied
+ Foo::<i32>::bar(&true); //~ ERROR is not satisfied
}
error[E0277]: the trait bound `i8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:34:5
|
-34 | Foo::<i32>::bar(&1i8);
+34 | Foo::<i32>::bar(&1i8); //~ ERROR is not satisfied
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `i8`
|
= help: the following implementations were found:
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:35:5
|
-35 | Foo::<i32>::bar(&1u8);
+35 | Foo::<i32>::bar(&1u8); //~ ERROR is not satisfied
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `u8`
|
= help: the following implementations were found:
error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:36:5
|
-36 | Foo::<i32>::bar(&true);
+36 | Foo::<i32>::bar(&true); //~ ERROR is not satisfied
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `bool`
|
= help: the following implementations were found:
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-impl X {
+impl X { //~ ERROR cannot be made into an object
+//~^ ERROR missing
Y
}
struct S;
-trait X {
+trait X { //~ ERROR missing
X() {}
- fn xxx() { ### }
- L = M;
- Z = { 2 + 3 };
- ::Y ();
+ fn xxx() { ### } //~ ERROR missing
+ //~^ ERROR expected
+ L = M; //~ ERROR missing
+ Z = { 2 + 3 }; //~ ERROR expected one of
+ ::Y (); //~ ERROR expected one of
}
impl S {
- pub hello_method(&self) {
+ pub hello_method(&self) { //~ ERROR missing
println!("Hello");
}
}
error: missing `fn`, `type`, or `const` for impl-item declaration
--> $DIR/issue-40006.rs:11:9
|
-11 | impl X {
+11 | impl X { //~ ERROR cannot be made into an object
| _________^
-12 | | Y
+12 | | //~^ ERROR missing
+13 | | Y
| |____^ missing `fn`, `type`, or `const`
error: missing `fn`, `type`, or `const` for trait-item declaration
- --> $DIR/issue-40006.rs:17:10
+ --> $DIR/issue-40006.rs:18:10
|
-17 | trait X {
+18 | trait X { //~ ERROR missing
| __________^
-18 | | X() {}
+19 | | X() {}
| |____^ missing `fn`, `type`, or `const`
error: expected `[`, found `#`
- --> $DIR/issue-40006.rs:19:17
+ --> $DIR/issue-40006.rs:20:17
|
-19 | fn xxx() { ### }
+20 | fn xxx() { ### } //~ ERROR missing
| ^
error: missing `fn`, `type`, or `const` for trait-item declaration
- --> $DIR/issue-40006.rs:19:21
+ --> $DIR/issue-40006.rs:20:21
|
-19 | fn xxx() { ### }
+20 | fn xxx() { ### } //~ ERROR missing
| _____________________^
-20 | | L = M;
+21 | | //~^ ERROR expected
+22 | | L = M; //~ ERROR missing
| |____^ missing `fn`, `type`, or `const`
error: missing `fn`, `type`, or `const` for trait-item declaration
- --> $DIR/issue-40006.rs:20:11
+ --> $DIR/issue-40006.rs:22:11
|
-20 | L = M;
+22 | L = M; //~ ERROR missing
| ___________^
-21 | | Z = { 2 + 3 };
+23 | | Z = { 2 + 3 }; //~ ERROR expected one of
| |____^ missing `fn`, `type`, or `const`
error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
- --> $DIR/issue-40006.rs:21:18
+ --> $DIR/issue-40006.rs:23:18
|
-21 | Z = { 2 + 3 };
+23 | Z = { 2 + 3 }; //~ ERROR expected one of
| ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here
error: expected one of `!` or `::`, found `(`
- --> $DIR/issue-40006.rs:22:9
+ --> $DIR/issue-40006.rs:24:9
|
-22 | ::Y ();
+24 | ::Y (); //~ ERROR expected one of
| -^ unexpected token
| |
| expected one of `!` or `::` here
error: missing `fn`, `type`, or `const` for impl-item declaration
- --> $DIR/issue-40006.rs:26:8
+ --> $DIR/issue-40006.rs:28:8
|
-26 | pub hello_method(&self) {
+28 | pub hello_method(&self) { //~ ERROR missing
| ^ missing `fn`, `type`, or `const`
error[E0038]: the trait `X` cannot be made into an object
--> $DIR/issue-40006.rs:11:6
|
-11 | impl X {
+11 | impl X { //~ ERROR cannot be made into an object
| ^ the trait `X` cannot be made into an object
|
= note: method `xxx` has no receiver
// except according to those terms.
fn foo() {
- println!("{:?}", (0..13).collect<Vec<i32>>());
+ println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
}
fn bar() {
- println!("{:?}", Vec<i32>::new());
+ println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
}
fn qux() {
- println!("{:?}", (0..13).collect<Vec<i32>());
+ println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
+ //~^ ERROR chained comparison
}
fn main() {}
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:12:37
|
-12 | println!("{:?}", (0..13).collect<Vec<i32>>());
+12 | println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
| ^^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:16:25
|
-16 | println!("{:?}", Vec<i32>::new());
+16 | println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
| ^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:20:37
|
-20 | println!("{:?}", (0..13).collect<Vec<i32>());
+20 | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
| ^^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:20:41
|
-20 | println!("{:?}", (0..13).collect<Vec<i32>());
+20 | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
| ^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
fn main() {
let mut buf = &[1, 2, 3, 4];
- buf.iter_mut();
+ buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content
}
error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable
--> $DIR/issue-40823.rs:13:5
|
-13 | buf.iter_mut();
+13 | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content
| ^^^ cannot borrow as mutable
error: aborting due to previous error
// except according to those terms.
fn main() {
- let x = ~1;
+ let x = ~1; //~ ERROR can not be used as a unary operator
}
error: `~` can not be used as a unary operator
--> $DIR/issue-41679.rs:12:13
|
-12 | let x = ~1;
+12 | let x = ~1; //~ ERROR can not be used as a unary operator
| ^ did you mean `!`?
|
= help: use `!` instead of `~` if you meant to perform bitwise negation
impl Demo {
fn new_with_secret_two() -> Self {
Self { secret_integer: 2, inocently_mispellable: () }
+ //~^ ERROR no field
}
fn new_with_secret_three() -> Self {
Self { secret_integer: 3, egregiously_nonexistent_field: () }
+ //~^ ERROR no field
}
}
let demo = Demo::default();
let innocent_field_misaccess = demo.inocently_mispellable;
+ //~^ ERROR no field
// note shouldn't suggest private fields
let egregious_field_misaccess = demo.egregiously_nonexistent_field;
+ //~^ ERROR no field
}
| ^^^^^^^^^^^^^^^^^^^^^^ field does not exist - did you mean `innocently_misspellable`?
error[E0560]: struct `submodule::Demo` has no field named `egregiously_nonexistent_field`
- --> $DIR/issue-42599_available_fields_note.rs:30:39
+ --> $DIR/issue-42599_available_fields_note.rs:31:39
|
-30 | Self { secret_integer: 3, egregiously_nonexistent_field: () }
+31 | Self { secret_integer: 3, egregiously_nonexistent_field: () }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `submodule::Demo` does not have this field
|
= note: available fields are: `favorite_integer`, `secret_integer`, `innocently_misspellable`, `another_field`, `yet_another_field` ... and 2 others
error[E0609]: no field `inocently_mispellable` on type `submodule::Demo`
- --> $DIR/issue-42599_available_fields_note.rs:40:41
+ --> $DIR/issue-42599_available_fields_note.rs:42:41
|
-40 | let innocent_field_misaccess = demo.inocently_mispellable;
+42 | let innocent_field_misaccess = demo.inocently_mispellable;
| ^^^^^^^^^^^^^^^^^^^^^ did you mean `innocently_misspellable`?
error[E0609]: no field `egregiously_nonexistent_field` on type `submodule::Demo`
- --> $DIR/issue-42599_available_fields_note.rs:42:42
+ --> $DIR/issue-42599_available_fields_note.rs:45:42
|
-42 | let egregious_field_misaccess = demo.egregiously_nonexistent_field;
+45 | let egregious_field_misaccess = demo.egregiously_nonexistent_field;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `favorite_integer`, `innocently_misspellable`
fn main() {
let n: usize = 42;
this_function_expects_a_double_option(n);
+ //~^ ERROR mismatched types
}
enum Example { Ex(String), NotEx }
fn result_test() {
- let x = Option(1);
+ let x = Option(1); //~ ERROR expected function, found enum
- if let Option(_) = x {
+ if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum
println!("It is OK.");
}
let y = Example::Ex(String::from("test"));
- if let Example(_) = y {
+ if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum
println!("It is OK.");
}
}
error[E0423]: expected function, found enum `Option`
--> $DIR/issue-43871-enum-instead-of-variant.rs:14:13
|
-14 | let x = Option(1);
+14 | let x = Option(1); //~ ERROR expected function, found enum
| ^^^^^^
|
= note: did you mean to use one of the following variants?
error[E0532]: expected tuple struct/variant, found enum `Option`
--> $DIR/issue-43871-enum-instead-of-variant.rs:16:12
|
-16 | if let Option(_) = x {
+16 | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum
| ^^^^^^
|
= note: did you mean to use one of the following variants?
error[E0532]: expected tuple struct/variant, found enum `Example`
--> $DIR/issue-43871-enum-instead-of-variant.rs:22:12
|
-22 | if let Example(_) = y {
+22 | if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum
| ^^^^^^^
|
= note: did you mean to use one of the following variants?
fn is_send<T:Send>() { }
fn main() {
- is_send::<A>();
+ is_send::<A>(); //~ ERROR overflow evaluating the requirement
}
error[E0275]: overflow evaluating the requirement `K: std::marker::Send`
--> $DIR/recursion_limit.rs:44:5
|
-44 | is_send::<A>();
+44 | is_send::<A>(); //~ ERROR overflow evaluating the requirement
| ^^^^^^^^^^^^
|
= help: consider adding a `#![recursion_limit="20"]` attribute to your crate
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+//~^^^^^^^^^^ ERROR reached the recursion limit
+
// Test that the recursion limit can be changed and that the compiler
// suggests a fix. In this case, we have a long chain of Deref impls
// which will cause an overflow during the autoderef loop.
fn main() {
let t = Top::new();
- let x: &Bottom = &t;
+ let x: &Bottom = &t; //~ ERROR mismatched types
+ //~^ error recursion limit
}
error[E0055]: reached the recursion limit while auto-dereferencing I
- --> $DIR/recursion_limit_deref.rs:60:22
+ --> $DIR/recursion_limit_deref.rs:62:22
|
-60 | let x: &Bottom = &t;
+62 | let x: &Bottom = &t; //~ ERROR mismatched types
| ^^ deref recursion limit reached
|
= help: consider adding a `#[recursion_limit="20"]` attribute to your crate
= help: consider adding a `#[recursion_limit="20"]` attribute to your crate
error[E0308]: mismatched types
- --> $DIR/recursion_limit_deref.rs:60:22
+ --> $DIR/recursion_limit_deref.rs:62:22
|
-60 | let x: &Bottom = &t;
+62 | let x: &Bottom = &t; //~ ERROR mismatched types
| ^^ expected struct `Bottom`, found struct `Top`
|
= note: expected type `&Bottom`
macro_rules! recurse {
() => { };
- ($t:tt $($tail:tt)*) => { recurse!($($tail)*) };
+ ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit
}
fn main() {
error: recursion limit reached while expanding the macro `recurse`
--> $DIR/recursion_limit_macro.rs:20:31
|
-20 | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) };
+20 | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit
| ^^^^^^^^^^^^^^^^^^^
...
24 | recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9);
// except according to those terms.
fn main() {
- let _: &Copy + 'static;
- let _: &'static Copy + 'static;
+ let _: &Copy + 'static; //~ ERROR expected a path
+ //~^ ERROR cannot be made into an object
+ let _: &'static Copy + 'static; //~ ERROR expected a path
}
error[E0178]: expected a path on the left-hand side of `+`, not `&Copy`
--> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12
|
-12 | let _: &Copy + 'static;
+12 | let _: &Copy + 'static; //~ ERROR expected a path
| ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)`
error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy`
- --> $DIR/trait-object-reference-without-parens-suggestion.rs:13:12
+ --> $DIR/trait-object-reference-without-parens-suggestion.rs:14:12
|
-13 | let _: &'static Copy + 'static;
+14 | let _: &'static Copy + 'static; //~ ERROR expected a path
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)`
error[E0038]: the trait `std::marker::Copy` cannot be made into an object
--> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12
|
-12 | let _: &Copy + 'static;
+12 | let _: &Copy + 'static; //~ ERROR expected a path
| ^^^^^ the trait `std::marker::Copy` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`
dt = Dt("dt", &c_long);
dr = Dr("dr", &c_long);
// Error: destructor order imprecisely modelled
- dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
- dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
// No error: Drop impl asserts .1 (A and &'a _) are not accessed
pt = Pt("pt", &c, &c_long);
pr = Pr("pr", &c, &c_long);
// Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
- pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+ pt = Pt("pt", &c_long, &c);
+ pr = Pr("pr", &c_long, &c);
// No error: St and Sr have no destructor.
st = St("st", &c);
sr = Sr("sr", &c);
println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
-}
+}//~ ERROR `c` does not live long enough
+//~^ ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
-39 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
+39 | dt = Dt("dt", &c);
| - borrow occurs here
...
-55 | }
+55 | }//~ ERROR `c` does not live long enough
| ^ `c` dropped here while still borrowed
|
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
-40 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+40 | dr = Dr("dr", &c);
| - borrow occurs here
...
-55 | }
+55 | }//~ ERROR `c` does not live long enough
| ^ `c` dropped here while still borrowed
|
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
-47 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
+47 | pt = Pt("pt", &c_long, &c);
| - borrow occurs here
...
-55 | }
+55 | }//~ ERROR `c` does not live long enough
| ^ `c` dropped here while still borrowed
|
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-extern-crate.rs:55:1
|
-48 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+48 | pr = Pr("pr", &c_long, &c);
| - borrow occurs here
...
-55 | }
+55 | }//~ ERROR `c` does not live long enough
| ^ `c` dropped here while still borrowed
|
= note: values in a scope are dropped in the opposite order they are created
dt = Dt("dt", &c_long);
dr = Dr("dr", &c_long);
// Error: destructor order imprecisely modelled
- dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
- dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
// No error: Drop impl asserts .1 (A and &'a _) are not accessed
pt = Pt("pt", &c, &c_long);
pr = Pr("pr", &c, &c_long);
// Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
- pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+ pt = Pt("pt", &c_long, &c);
+ pr = Pr("pr", &c_long, &c);
// No error: St and Sr have no destructor.
st = St("st", &c);
println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
}
+//~^ ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
-57 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
+57 | dt = Dt("dt", &c);
| - borrow occurs here
...
73 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
-58 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+58 | dr = Dr("dr", &c);
| - borrow occurs here
...
73 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
-65 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
+65 | pt = Pt("pt", &c_long, &c);
| - borrow occurs here
...
73 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:73:1
|
-66 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+66 | pr = Pr("pr", &c_long, &c);
| - borrow occurs here
...
73 | }
dt = Dt("dt", &c_long);
dr = Dr("dr", &c_long);
// Error: destructor order imprecisely modelled
- dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
- dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+ dt = Dt("dt", &c);
+ dr = Dr("dr", &c);
// No error: Drop impl asserts .1 (A and &'a _) are not accessed
pt = Pt("pt", &c, &c_long);
pr = Pr("pr", &c, &c_long);
// Error: Drop impl's assertion does not apply to `B` nor `&'b _`
- pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
- pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+ pt = Pt("pt", &c_long, &c);
+ pr = Pr("pr", &c_long, &c);
// No error: St and Sr have no destructor.
st = St("st", &c);
println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
}
+//~^ ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
+//~| ERROR `c` does not live long enough
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:96:1
|
-80 | dt = Dt("dt", &c); //~ ERROR `c` does not live long enough
+80 | dt = Dt("dt", &c);
| - borrow occurs here
...
96 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:96:1
|
-81 | dr = Dr("dr", &c); //~ ERROR `c` does not live long enough
+81 | dr = Dr("dr", &c);
| - borrow occurs here
...
96 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:96:1
|
-88 | pt = Pt("pt", &c_long, &c); //~ ERROR `c` does not live long enough
+88 | pt = Pt("pt", &c_long, &c);
| - borrow occurs here
...
96 | }
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:96:1
|
-89 | pr = Pr("pr", &c_long, &c); //~ ERROR `c` does not live long enough
+89 | pr = Pr("pr", &c_long, &c);
| - borrow occurs here
...
96 | }
struct Q;
-impl<R> External for (Q, R) {}
+impl<R> External for (Q, R) {} //~ ERROR must be used
+//~^ ERROR conflicting implementations of trait
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`:
--> $DIR/complex-impl.rs:19:1
|
-19 | impl<R> External for (Q, R) {}
+19 | impl<R> External for (Q, R) {} //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `complex_impl_support`:
error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter
--> $DIR/complex-impl.rs:19:1
|
-19 | impl<R> External for (Q, R) {}
+19 | impl<R> External for (Q, R) {} //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
use std::convert::{TryFrom, AsRef};
struct Q;
-impl AsRef<Q> for Box<Q> {
+impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
fn as_ref(&self) -> &Q {
&**self
}
}
struct S;
-impl From<S> for S {
+impl From<S> for S { //~ ERROR conflicting implementations
fn from(s: S) -> S {
s
}
}
struct X;
-impl TryFrom<X> for X {
+impl TryFrom<X> for X { //~ ERROR conflicting implementations
type Error = ();
fn try_from(u: X) -> Result<X, ()> {
Ok(u)
}
}
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
--> $DIR/conflict-with-std.rs:17:1
|
-17 | / impl AsRef<Q> for Box<Q> {
+17 | / impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
18 | | fn as_ref(&self) -> &Q {
19 | | &**self
20 | | }
error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
--> $DIR/conflict-with-std.rs:24:1
|
-24 | / impl From<S> for S {
+24 | / impl From<S> for S { //~ ERROR conflicting implementations
25 | | fn from(s: S) -> S {
26 | | s
27 | | }
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
--> $DIR/conflict-with-std.rs:31:1
|
-31 | / impl TryFrom<X> for X {
+31 | / impl TryFrom<X> for X { //~ ERROR conflicting implementations
32 | | type Error = ();
33 | | fn try_from(u: X) -> Result<X, ()> {
34 | | Ok(u)
struct LocalType<T>(Option<T>);
-impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {
+impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
}
}
}
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`:
--> $DIR/issue-23563.rs:23:1
|
-23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {
+23 | / impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { //~ ERROR conflicting implementations of trait
24 | | fn from(_: &'a [T]) -> LocalType<T> { LocalType(None) }
25 | | }
| |_^
inner: S,
}
-impl<S> Into<S> for GenX<S> {
+impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
fn into(self) -> S {
self.inner
}
}
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`:
--> $DIR/issue-27403.rs:15:1
|
-15 | / impl<S> Into<S> for GenX<S> {
+15 | / impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
16 | | fn into(self) -> S {
17 | | self.inner
18 | | }
struct Foo;
-impl<Foo> Deref for Foo { }
+impl<Foo> Deref for Foo { } //~ ERROR must be used
+//~^ ERROR conflicting implementations
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`:
--> $DIR/issue-28981.rs:15:1
|
-15 | impl<Foo> Deref for Foo { }
+15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter
--> $DIR/issue-28981.rs:15:1
|
-15 | impl<Foo> Deref for Foo { }
+15 | impl<Foo> Deref for Foo { } //~ ERROR must be used
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
StorageProblem(S::Error),
}
-impl<S: Storage> From<S::Error> for MyError<S> {
+impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
fn from(error: S::Error) -> MyError<S> {
MyError::StorageProblem(error)
}
}
-fn main() {}
\ No newline at end of file
+fn main() {}
error[E0119]: conflicting implementations of trait `std::convert::From<MyError<_>>` for type `MyError<_>`:
--> $DIR/so-37347311.rs:21:1
|
-21 | / impl<S: Storage> From<S::Error> for MyError<S> {
+21 | / impl<S: Storage> From<S::Error> for MyError<S> { //~ ERROR conflicting implementations
22 | | fn from(error: S::Error) -> MyError<S> {
23 | | MyError::StorageProblem(error)
24 | | }
// `Cell` is not `Sync`, so `&Cell` is neither `Sync` nor `Send`,
// `std::fmt::Arguments` used to forget this...
let c = std::cell::Cell::new(42);
- send(format_args!("{:?}", c));
- sync(format_args!("{:?}", c));
+ send(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied
+ sync(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied
}
error[E0277]: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `[std::fmt::ArgumentV1<'_>]`
--> $DIR/send-sync.rs:18:5
|
-18 | send(format_args!("{:?}", c));
+18 | send(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied
| ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely
|
= help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static`
error[E0277]: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `std::fmt::Arguments<'_>`
--> $DIR/send-sync.rs:19:5
|
-19 | sync(format_args!("{:?}", c));
+19 | sync(format_args!("{:?}", c)); //~ ERROR Sync` is not satisfied
| ^^^^ `*mut std::ops::Fn() + 'static` cannot be shared between threads safely
|
= help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut std::ops::Fn() + 'static`
let mut b = move || {
yield();
let b = 5;
- a = &b; //~ ERROR
- };
+ a = &b;
+ }; //~ ERROR
}
fn main() { }
error[E0597]: `b` does not live long enough
--> $DIR/ref-escapes-but-not-over-yield.rs:25:5
|
-24 | a = &b; //~ ERROR
+24 | a = &b;
| - borrow occurs here
-25 | };
+25 | }; //~ ERROR
| ^ `b` dropped here while still borrowed
26 | }
| - borrowed value needs to live until here
// (This error occurs because the region shows up in the type of
// `b` and gets extended by region inference.)
let mut b = move || {
- let a = &3; //~ ERROR
+ let a = &3;
yield();
println!("{}", a);
};
0
} else {
n + sum_to(n - 1)
- //~^ ERROR no implementation for `u32 + impl Foo`
+ //~^ ERROR the trait bound `u32: std::ops::Add<impl Foo>` is not satisfied
}
}
f1.foo(1usize);
//~^ error: method named `foo` found for type `Bar` in the current scope
//~| help: items from traits can only be used if the trait is implemented and in scope
- //~| help: candidate #1: `Foo`
}
fn main() {
foo(|s| s.is_empty());
//~^ ERROR no method named `is_empty` found
- //~^^ HELP #1: `std::iter::ExactSizeIterator`
- //~^^^ HELP #2: `core::slice::SliceExt`
- //~^^^^ HELP #3: `core::str::StrExt`
- //~^^^^^ HELP items from traits can only be used if the trait is implemented and in scope; the following traits define an item `is_empty`, perhaps you need to implement one of them:
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
}
// aux-build:no_method_suggested_traits.rs
extern crate no_method_suggested_traits;
-struct Foo;
+struct Foo; //~ HELP perhaps add a `use` for it
+//~^ HELP perhaps add a `use` for it
+//~| HELP perhaps add a `use` for it
+//~| HELP perhaps add a `use` for it
+//~| HELP perhaps add a `use` for one of them
+//~| HELP perhaps add a `use` for one of them
enum Bar { X }
mod foo {
1u32.method();
- //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
- //~| ERROR no method named
- //~| HELP `use foo::Bar;`
- //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+ //~^ ERROR no method named
+ //~|items from traits can only be used if the trait is in scope
std::rc::Rc::new(&mut Box::new(&1u32)).method();
- //~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
- //~| ERROR no method named
- //~| HELP `use foo::Bar;`
- //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+ //~^items from traits can only be used if the trait is in scope
+ //~| ERROR no method named `method` found for type
'a'.method();
//~^ ERROR no method named
- //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
- //~| HELP `use foo::Bar;`
+ //~| HELP items from traits can only be used if the trait is in scope
std::rc::Rc::new(&mut Box::new(&'a')).method();
//~^ ERROR no method named
- //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
- //~| HELP `use foo::Bar;`
+ //~| HELP items from traits can only be used if the trait is in scope
1i32.method();
//~^ ERROR no method named
- //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
- //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+ //~| HELP items from traits can only be used if the trait is in scope
std::rc::Rc::new(&mut Box::new(&1i32)).method();
//~^ ERROR no method named
- //~| HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
- //~| HELP `use no_method_suggested_traits::foo::PubPub;`
+ //~| HELP items from traits can only be used if the trait is in scope
Foo.method();
//~^ ERROR no method named
- //~| HELP following traits define an item `method`, perhaps you need to implement one of them
- //~| HELP `foo::Bar`
- //~| HELP `no_method_suggested_traits::foo::PubPub`
- //~| HELP `no_method_suggested_traits::Reexported`
- //~| HELP `no_method_suggested_traits::bar::PubPriv`
- //~| HELP `no_method_suggested_traits::qux::PrivPub`
- //~| HELP `no_method_suggested_traits::quz::PrivPriv`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&Foo)).method();
//~^ ERROR no method named
- //~| HELP following traits define an item `method`, perhaps you need to implement one of them
- //~| HELP `foo::Bar`
- //~| HELP `no_method_suggested_traits::foo::PubPub`
- //~| HELP `no_method_suggested_traits::Reexported`
- //~| HELP `no_method_suggested_traits::bar::PubPriv`
- //~| HELP `no_method_suggested_traits::qux::PrivPub`
- //~| HELP `no_method_suggested_traits::quz::PrivPriv`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
1u64.method2();
//~^ ERROR no method named
- //~| HELP the following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&1u64)).method2();
//~^ ERROR no method named
- //~| HELP the following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
no_method_suggested_traits::Foo.method2();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
no_method_suggested_traits::Bar::X.method2();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method2`, perhaps you need to implement it
- //~| HELP `foo::Bar`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
Foo.method3();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method3`, perhaps you need to implement it
- //~| HELP `no_method_suggested_traits::foo::PubPub`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&Foo)).method3();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method3`, perhaps you need to implement it
- //~| HELP `no_method_suggested_traits::foo::PubPub`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
Bar::X.method3();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method3`, perhaps you need to implement it
- //~| HELP `no_method_suggested_traits::foo::PubPub`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
//~^ ERROR no method named
- //~| HELP following trait defines an item `method3`, perhaps you need to implement it
- //~| HELP `no_method_suggested_traits::foo::PubPub`
+ //~| HELP items from traits can only be used if the trait is implemented and in scope
// should have no help:
1_usize.method3(); //~ ERROR no method named
error[E0599]: no method named `method` found for type `u32` in the current scope
- --> $DIR/no-method-suggested-traits.rs:33:10
+ --> $DIR/no-method-suggested-traits.rs:38:10
|
-33 | 1u32.method();
+38 | 1u32.method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
|
error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&u32>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:38:44
+ --> $DIR/no-method-suggested-traits.rs:41:44
|
-38 | std::rc::Rc::new(&mut Box::new(&1u32)).method();
+41 | std::rc::Rc::new(&mut Box::new(&1u32)).method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
|
error[E0599]: no method named `method` found for type `char` in the current scope
- --> $DIR/no-method-suggested-traits.rs:44:9
+ --> $DIR/no-method-suggested-traits.rs:45:9
|
-44 | 'a'.method();
+45 | 'a'.method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
|
error[E0599]: no method named `method` found for type `i32` in the current scope
- --> $DIR/no-method-suggested-traits.rs:53:10
+ --> $DIR/no-method-suggested-traits.rs:52:10
|
-53 | 1i32.method();
+52 | 1i32.method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
|
error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&i32>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:57:44
+ --> $DIR/no-method-suggested-traits.rs:55:44
|
-57 | std::rc::Rc::new(&mut Box::new(&1i32)).method();
+55 | std::rc::Rc::new(&mut Box::new(&1i32)).method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
|
error[E0599]: no method named `method` found for type `Foo` in the current scope
- --> $DIR/no-method-suggested-traits.rs:62:9
+ --> $DIR/no-method-suggested-traits.rs:59:9
|
-14 | struct Foo;
+14 | struct Foo; //~ HELP perhaps add a `use` for it
| ----------- method `method` not found for this
...
-62 | Foo.method();
+59 | Foo.method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #6: `no_method_suggested_traits::Reexported`
error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:71:43
+ --> $DIR/no-method-suggested-traits.rs:62:43
|
-71 | std::rc::Rc::new(&mut Box::new(&Foo)).method();
+62 | std::rc::Rc::new(&mut Box::new(&Foo)).method();
| ^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #6: `no_method_suggested_traits::Reexported`
error[E0599]: no method named `method2` found for type `u64` in the current scope
- --> $DIR/no-method-suggested-traits.rs:81:10
+ --> $DIR/no-method-suggested-traits.rs:66:10
|
-81 | 1u64.method2();
+66 | 1u64.method2();
| ^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #1: `foo::Bar`
error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:85:44
+ --> $DIR/no-method-suggested-traits.rs:69:44
|
-85 | std::rc::Rc::new(&mut Box::new(&1u64)).method2();
+69 | std::rc::Rc::new(&mut Box::new(&1u64)).method2();
| ^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #1: `foo::Bar`
error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Foo` in the current scope
- --> $DIR/no-method-suggested-traits.rs:90:37
+ --> $DIR/no-method-suggested-traits.rs:73:37
|
-90 | no_method_suggested_traits::Foo.method2();
+73 | no_method_suggested_traits::Foo.method2();
| ^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #1: `foo::Bar`
error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:94:71
+ --> $DIR/no-method-suggested-traits.rs:76:71
|
-94 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
+76 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
| ^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #1: `foo::Bar`
error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Bar` in the current scope
- --> $DIR/no-method-suggested-traits.rs:98:40
+ --> $DIR/no-method-suggested-traits.rs:79:40
|
-98 | no_method_suggested_traits::Bar::X.method2();
+79 | no_method_suggested_traits::Bar::X.method2();
| ^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
candidate #1: `foo::Bar`
error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:102:74
- |
-102 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
- | ^^^^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `method2`, perhaps you need to implement it:
- candidate #1: `foo::Bar`
+ --> $DIR/no-method-suggested-traits.rs:82:74
+ |
+82 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
+ | ^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `method2`, perhaps you need to implement it:
+ candidate #1: `foo::Bar`
error[E0599]: no method named `method3` found for type `Foo` in the current scope
- --> $DIR/no-method-suggested-traits.rs:107:9
- |
-14 | struct Foo;
- | ----------- method `method3` not found for this
+ --> $DIR/no-method-suggested-traits.rs:86:9
+ |
+14 | struct Foo; //~ HELP perhaps add a `use` for it
+ | ----------- method `method3` not found for this
...
-107 | Foo.method3();
- | ^^^^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `method3`, perhaps you need to implement it:
- candidate #1: `no_method_suggested_traits::foo::PubPub`
+86 | Foo.method3();
+ | ^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `method3`, perhaps you need to implement it:
+ candidate #1: `no_method_suggested_traits::foo::PubPub`
error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:111:43
- |
-111 | std::rc::Rc::new(&mut Box::new(&Foo)).method3();
- | ^^^^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `method3`, perhaps you need to implement it:
- candidate #1: `no_method_suggested_traits::foo::PubPub`
+ --> $DIR/no-method-suggested-traits.rs:89:43
+ |
+89 | std::rc::Rc::new(&mut Box::new(&Foo)).method3();
+ | ^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `method3`, perhaps you need to implement it:
+ candidate #1: `no_method_suggested_traits::foo::PubPub`
error[E0599]: no method named `method3` found for type `Bar` in the current scope
- --> $DIR/no-method-suggested-traits.rs:115:12
- |
-15 | enum Bar { X }
- | -------- method `method3` not found for this
+ --> $DIR/no-method-suggested-traits.rs:92:12
+ |
+20 | enum Bar { X }
+ | -------- method `method3` not found for this
...
-115 | Bar::X.method3();
- | ^^^^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `method3`, perhaps you need to implement it:
- candidate #1: `no_method_suggested_traits::foo::PubPub`
+92 | Bar::X.method3();
+ | ^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `method3`, perhaps you need to implement it:
+ candidate #1: `no_method_suggested_traits::foo::PubPub`
error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Bar>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:119:46
- |
-119 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
- | ^^^^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `method3`, perhaps you need to implement it:
- candidate #1: `no_method_suggested_traits::foo::PubPub`
+ --> $DIR/no-method-suggested-traits.rs:95:46
+ |
+95 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
+ | ^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `method3`, perhaps you need to implement it:
+ candidate #1: `no_method_suggested_traits::foo::PubPub`
error[E0599]: no method named `method3` found for type `usize` in the current scope
- --> $DIR/no-method-suggested-traits.rs:125:13
+ --> $DIR/no-method-suggested-traits.rs:100:13
|
-125 | 1_usize.method3(); //~ ERROR no method named
+100 | 1_usize.method3(); //~ ERROR no method named
| ^^^^^^^
error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:126:47
+ --> $DIR/no-method-suggested-traits.rs:101:47
|
-126 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
+101 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
| ^^^^^^^
error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope
- --> $DIR/no-method-suggested-traits.rs:127:37
+ --> $DIR/no-method-suggested-traits.rs:102:37
|
-127 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named
+102 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named
| ^^^^^^^
error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:128:71
+ --> $DIR/no-method-suggested-traits.rs:103:71
|
-128 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
+103 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
| ^^^^^^^
error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope
- --> $DIR/no-method-suggested-traits.rs:130:40
+ --> $DIR/no-method-suggested-traits.rs:105:40
|
-130 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named
+105 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named
| ^^^^^^^
error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope
- --> $DIR/no-method-suggested-traits.rs:131:74
+ --> $DIR/no-method-suggested-traits.rs:106:74
|
-131 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
+106 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
| ^^^^^^^
error: aborting due to 24 previous errors
impl std::fmt::Display for MyType {
fn fmt(&self, x: &str) -> () { }
+ //~^ ERROR method `fmt` has an incompatible type
}
impl std::fmt::Display for MyType2 {
fn fmt(&self) -> () { }
+ //~^ ERROR method `fmt` has 1 parameter
}
impl std::fmt::Display for MyType3 {
fn fmt() -> () { }
+ //~^ ERROR method `fmt` has a `&self` declaration in the trait
}
impl std::fmt::Display for MyType4 {}
+//~^ ERROR not all trait items
fn main() {}
found type `fn(&MyType, &str)`
error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2
- --> $DIR/trait_type.rs:21:11
+ --> $DIR/trait_type.rs:22:11
|
-21 | fn fmt(&self) -> () { }
+22 | fn fmt(&self) -> () { }
| ^^^^^ expected 2 parameters, found 1
|
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/trait_type.rs:25:4
+ --> $DIR/trait_type.rs:27:4
|
-25 | fn fmt() -> () { }
+27 | fn fmt() -> () { }
| ^^^^^^^^^^^^^^^^^^ expected `&self` in impl
|
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
error[E0046]: not all trait items implemented, missing: `fmt`
- --> $DIR/trait_type.rs:28:1
+ --> $DIR/trait_type.rs:31:1
|
-28 | impl std::fmt::Display for MyType4 {}
+31 | impl std::fmt::Display for MyType4 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
|
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
use std::fmt::Debug;
fn foo(x: impl Debug) -> String {
- x
+ x //~ ERROR mismatched types
}
fn main() { }
|
15 | fn foo(x: impl Debug) -> String {
| ------ expected `std::string::String` because of return type
-16 | x
+16 | x //~ ERROR mismatched types
| ^ expected struct `std::string::String`, found type parameter
|
= note: expected type `std::string::String`
fn foo(x: impl Debug, y: impl Debug) -> String {
let mut a = x;
- a = y;
+ a = y; //~ ERROR mismatched
format!("{:?}", a)
}
error[E0308]: mismatched types
--> $DIR/universal-two-impl-traits.rs:17:9
|
-17 | a = y;
+17 | a = y; //~ ERROR mismatched
| ^ expected type parameter, found a different type parameter
|
= note: expected type `impl Debug` (type parameter)
fn foo(f: impl Display + Clone) -> String {
wants_debug(f);
wants_display(f);
- wants_clone(f);
+ wants_clone(f); //~ ERROR cannot find
}
-fn wants_debug(g: impl Debug) { }
-fn wants_display(g: impl Debug) { }
+fn wants_debug(g: impl Debug) { } //~ ERROR cannot find
+fn wants_display(g: impl Debug) { } //~ ERROR cannot find
fn wants_cone(g: impl Clone) { }
fn main() {
error[E0425]: cannot find function `wants_clone` in this scope
--> $DIR/universal_wrong_bounds.rs:18:5
|
-18 | wants_clone(f);
+18 | wants_clone(f); //~ ERROR cannot find
| ^^^^^^^^^^^ did you mean `wants_cone`?
error[E0405]: cannot find trait `Debug` in this scope
--> $DIR/universal_wrong_bounds.rs:21:24
|
-21 | fn wants_debug(g: impl Debug) { }
+21 | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find
| ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
error[E0405]: cannot find trait `Debug` in this scope
--> $DIR/universal_wrong_bounds.rs:22:26
|
-22 | fn wants_display(g: impl Debug) { }
+22 | fn wants_display(g: impl Debug) { } //~ ERROR cannot find
| ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
#![allow(warnings)]
#![feature(in_band_lifetimes)]
-fn foo(x: fn(&'a u32)) {}
+fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly
-fn bar(x: &Fn(&'a u32)) {}
+fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly
-fn baz(x: fn(&'a u32), y: &'a u32) {}
+fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly
struct Foo<'a> { x: &'a u32 }
impl Foo<'a> {
- fn bar(&self, x: fn(&'a u32)) {}
+ fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly
}
fn main() {}
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687.rs:14:15
|
-14 | fn foo(x: fn(&'a u32)) {}
+14 | fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687.rs:16:16
|
-16 | fn bar(x: &Fn(&'a u32)) {}
+16 | fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687.rs:18:15
|
-18 | fn baz(x: fn(&'a u32), y: &'a u32) {}
+18 | fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687.rs:23:26
|
-23 | fn bar(&self, x: fn(&'a u32)) {}
+23 | fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error: aborting due to 4 previous errors
#![allow(warnings)]
#![feature(in_band_lifetimes, universal_impl_trait)]
-fn bar<F>(x: &F) where F: Fn(&'a u32) {}
+fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly
-fn baz(x: &impl Fn(&'a u32)) {}
+fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly
fn main() {}
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687_where.rs:14:31
|
-14 | fn bar<F>(x: &F) where F: Fn(&'a u32) {}
+14 | fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders
--> $DIR/E0687_where.rs:16:21
|
-16 | fn baz(x: &impl Fn(&'a u32)) {}
+16 | fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly
| ^^ in-band lifetime definition
error: aborting due to 2 previous errors
#![allow(warnings)]
#![feature(in_band_lifetimes)]
-fn foo<'a>(x: &'a u32, y: &'b u32) {}
+fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix
struct Foo<'a> { x: &'a u32 }
impl Foo<'a> {
- fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {}
+ fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix
}
-impl<'b> Foo<'a> {
+impl<'b> Foo<'a> { //~ ERROR cannot mix
fn baz() {}
}
error[E0688]: cannot mix in-band and explicit lifetime definitions
--> $DIR/E0688.rs:14:28
|
-14 | fn foo<'a>(x: &'a u32, y: &'b u32) {}
+14 | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix
| -- ^^ in-band lifetime definition here
| |
| explicit lifetime definition here
error[E0688]: cannot mix in-band and explicit lifetime definitions
--> $DIR/E0688.rs:19:44
|
-19 | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {}
+19 | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix
| -- ^^ in-band lifetime definition here
| |
| explicit lifetime definition here
error[E0688]: cannot mix in-band and explicit lifetime definitions
--> $DIR/E0688.rs:22:14
|
-22 | impl<'b> Foo<'a> {
+22 | impl<'b> Foo<'a> { //~ ERROR cannot mix
| -- ^^ in-band lifetime definition here
| |
| explicit lifetime definition here
#![allow(warnings)]
#![feature(in_band_lifetimes)]
-fn foo(x: &'a u32, y: &u32) -> &'a u32 { y }
+fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required
-fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
+fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
fn main() {}
error[E0621]: explicit lifetime required in the type of `y`
--> $DIR/mismatched.rs:14:42
|
-14 | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y }
+14 | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required
| - ^ lifetime `'a` required
| |
| consider changing the type of `y` to `&'a u32`
error[E0623]: lifetime mismatch
--> $DIR/mismatched.rs:16:46
|
-16 | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y }
+16 | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
| ------- ------- ^ ...but data from `y` is returned here
| |
| this parameter and the return type are declared with different lifetimes...
trait Get {
fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 {
- y
+ y //~ ERROR explicit lifetime required
}
}
|
15 | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 {
| - consider changing the type of `y` to `&'a u32`
-16 | y
+16 | y //~ ERROR explicit lifetime required
| ^ lifetime `'a` required
error: aborting due to previous error
}
impl Get for i32 {
- fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+ fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
x
}
}
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
--> $DIR/mismatched_trait_impl.rs:19:5
|
-19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
20 | | x
21 | | }
| |_____^
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 19:5...
--> $DIR/mismatched_trait_impl.rs:19:5
|
-19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
20 | | x
21 | | }
| |_____^
note: ...so that method type is compatible with trait (expected fn(&i32, &'a u32, &u32) -> &'a u32, found fn(&i32, &u32, &u32) -> &u32)
--> $DIR/mismatched_trait_impl.rs:19:5
|
-19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
20 | | x
21 | | }
| |_____^
note: but, the lifetime must be valid for the lifetime 'a as defined on the method body at 19:5...
--> $DIR/mismatched_trait_impl.rs:19:5
|
-19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
20 | | x
21 | | }
| |_____^
note: ...so that method type is compatible with trait (expected fn(&i32, &'a u32, &u32) -> &'a u32, found fn(&i32, &u32, &u32) -> &u32)
--> $DIR/mismatched_trait_impl.rs:19:5
|
-19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
+19 | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
20 | | x
21 | | }
| |_____^
fn main() {
let mut p = 3;
let r = foo(&p);
- p += 1;
+ p += 1; //~ ERROR cannot assign to `p` because it is borrowed
println!("{}", r);
}
|
18 | let r = foo(&p);
| - borrow of `p` occurs here
-19 | p += 1;
+19 | p += 1; //~ ERROR cannot assign to `p` because it is borrowed
| ^^^^^^ assignment to borrowed `p` occurs here
error: aborting due to previous error
#![feature(in_band_lifetimes)]
struct Foo {
- x: &'test u32,
+ x: &'test u32, //~ ERROR undeclared lifetime
}
enum Bar {
- Baz(&'test u32),
+ Baz(&'test u32), //~ ERROR undeclared lifetime
}
fn main() {}
error[E0261]: use of undeclared lifetime name `'test`
--> $DIR/no_in_band_in_struct.rs:15:9
|
-15 | x: &'test u32,
+15 | x: &'test u32, //~ ERROR undeclared lifetime
| ^^^^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'test`
--> $DIR/no_in_band_in_struct.rs:19:10
|
-19 | Baz(&'test u32),
+19 | Baz(&'test u32), //~ ERROR undeclared lifetime
| ^^^^^ undeclared lifetime
error: aborting due to 2 previous errors
#![feature(in_band_lifetimes)]
fn foo(x: &u32) {
- let y: &'test u32 = x;
+ let y: &'test u32 = x; //~ ERROR use of undeclared lifetime
}
fn foo2(x: &u32) {}
fn bar() {
- let y: fn(&'test u32) = foo2;
+ let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime
}
fn main() {}
error[E0261]: use of undeclared lifetime name `'test`
--> $DIR/no_introducing_in_band_in_locals.rs:15:13
|
-15 | let y: &'test u32 = x;
+15 | let y: &'test u32 = x; //~ ERROR use of undeclared lifetime
| ^^^^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'test`
--> $DIR/no_introducing_in_band_in_locals.rs:20:16
|
-20 | let y: fn(&'test u32) = foo2;
+20 | let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime
| ^^^^^ undeclared lifetime
error: aborting due to 2 previous errors
struct Foo<T>(T);
impl Foo<&'s u8> {
- fn bar<'s>(&self, x: &'s u8) {}
- fn baz(x: for<'s> fn(&'s u32)) {}
+ fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name
+ fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name
}
fn main() {}
|
16 | impl Foo<&'s u8> {
| -- first declared here
-17 | fn bar<'s>(&self, x: &'s u8) {}
+17 | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name
| ^^ lifetime 's already in scope
error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope
|
16 | impl Foo<&'s u8> {
| -- first declared here
-17 | fn bar<'s>(&self, x: &'s u8) {}
-18 | fn baz(x: for<'s> fn(&'s u32)) {}
+17 | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name
+18 | fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name
| ^^ lifetime 's already in scope
error: aborting due to 2 previous errors
use std::panic::catch_unwind;
fn main() {
let mut x = Cell::new(22);
- catch_unwind(|| { x.set(23); });
+ catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound
}
error[E0277]: the trait bound `std::cell::UnsafeCell<i32>: std::panic::RefUnwindSafe` is not satisfied in `std::cell::Cell<i32>`
--> $DIR/interior-mutability.rs:15:5
|
-15 | catch_unwind(|| { x.set(23); });
+15 | catch_unwind(|| { x.set(23); }); //~ ERROR the trait bound
| ^^^^^^^^^^^^ the type std::cell::UnsafeCell<i32> may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
|
= help: within `std::cell::Cell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
fn main() {
if true {
- } else if {
+ } else if { //~ ERROR missing condition
} else {
}
}
fn foo() {
if true {
- } else if {
+ } else if { //~ ERROR missing condition
}
bar();
}
error: missing condition for `if` statemement
--> $DIR/issue-13483.rs:13:14
|
-13 | } else if {
+13 | } else if { //~ ERROR missing condition
| ^ expected if condition here
error: missing condition for `if` statemement
--> $DIR/issue-13483.rs:20:14
|
-20 | } else if {
+20 | } else if { //~ ERROR missing condition
| ^ expected if condition here
error: aborting due to 2 previous errors
let long_name : usize = 0;
println!("{}", a as usize > long_name);
- println!("{}", a as usize < long_name);
+ println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic
println!("{}{}", a as usize < long_name, long_name);
- println!("{}", a as usize < 4);
+ //~^ ERROR `<` is interpreted as a start of generic
+ println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic
println!("{}", a: usize > long_name);
println!("{}{}", a: usize < long_name, long_name);
- println!("{}", a: usize < 4);
+ //~^ ERROR `<` is interpreted as a start of generic
+ println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic
println!("{}", a
as
usize
- <
+ < //~ ERROR `<` is interpreted as a start of generic
4);
println!("{}", a
usize
- <
+ < //~ ERROR `<` is interpreted as a start of generic
5);
- println!("{}", a as usize << long_name);
+ println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic
- println!("{}", a: &mut 4);
+ println!("{}", a: &mut 4); //~ ERROR expected type, found `4`
}
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:16:31
|
-16 | println!("{}", a as usize < long_name);
+16 | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^ --------- interpreted as generic arguments
| | |
| | not interpreted as comparison
| help: try comparing the casted value: `(a as usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
- --> $DIR/issue-22644.rs:18:31
+ --> $DIR/issue-22644.rs:19:31
|
-18 | println!("{}", a as usize < 4);
+19 | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^ - interpreted as generic arguments
| | |
| | not interpreted as comparison
| help: try comparing the casted value: `(a as usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
- --> $DIR/issue-22644.rs:20:31
+ --> $DIR/issue-22644.rs:21:31
|
-20 | println!("{}{}", a: usize < long_name, long_name);
+21 | println!("{}{}", a: usize < long_name, long_name);
| -------- ^ -------------------- interpreted as generic arguments
| | |
| | not interpreted as comparison
| help: try comparing the casted value: `(a: usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
- --> $DIR/issue-22644.rs:21:29
+ --> $DIR/issue-22644.rs:23:29
|
-21 | println!("{}", a: usize < 4);
+23 | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic
| -------- ^ - interpreted as generic arguments
| | |
| | not interpreted as comparison
| help: try comparing the casted value: `(a: usize)`
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
- --> $DIR/issue-22644.rs:26:20
+ --> $DIR/issue-22644.rs:28:20
|
-26 | <
+28 | < //~ ERROR `<` is interpreted as a start of generic
| ^ not interpreted as comparison
-27 | 4);
+29 | 4);
| - interpreted as generic arguments
help: try comparing the casted value
|
-23 | println!("{}", (a
-24 | as
-25 | usize)
+25 | println!("{}", (a
+26 | as
+27 | usize)
|
error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
- --> $DIR/issue-22644.rs:35:20
+ --> $DIR/issue-22644.rs:37:20
|
-35 | <
+37 | < //~ ERROR `<` is interpreted as a start of generic
| ^ not interpreted as comparison
-36 | 5);
+38 | 5);
| - interpreted as generic arguments
help: try comparing the casted value
|
-28 | println!("{}", (a
-29 |
-30 |
-31 | as
+30 | println!("{}", (a
+31 |
32 |
-33 |
+33 | as
+34 |
+35 |
...
error: `<` is interpreted as a start of generic arguments for `usize`, not a shift
- --> $DIR/issue-22644.rs:38:31
+ --> $DIR/issue-22644.rs:40:31
|
-38 | println!("{}", a as usize << long_name);
+40 | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic
| ---------- ^^ --------- interpreted as generic arguments
| | |
| | not interpreted as shift
| help: try shifting the casted value: `(a as usize)`
error: expected type, found `4`
- --> $DIR/issue-22644.rs:40:28
+ --> $DIR/issue-22644.rs:42:28
|
-40 | println!("{}", a: &mut 4);
+42 | println!("{}", a: &mut 4); //~ ERROR expected type, found `4`
| ^ expecting a type here because of type ascription
// except according to those terms.
fn main() {
- a;
- "".lorem;
- "".ipsum;
+ a; //~ ERROR cannot find value `a`
+ "".lorem; //~ ERROR no field
+ "".ipsum; //~ ERROR no field
}
error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-33525.rs:12:5
|
-12 | a;
+12 | a; //~ ERROR cannot find value `a`
| ^ not found in this scope
error[E0609]: no field `lorem` on type `&'static str`
--> $DIR/issue-33525.rs:13:8
|
-13 | "".lorem;
+13 | "".lorem; //~ ERROR no field
| ^^^^^
error[E0609]: no field `ipsum` on type `&'static str`
--> $DIR/issue-33525.rs:14:8
|
-14 | "".ipsum;
+14 | "".ipsum; //~ ERROR no field
| ^^^^^
error: aborting due to 3 previous errors
use std::collections::HashMap;
fn main() {
- for _ in HashMap::new().iter().cloned() {}
+ for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
+ //~^ ERROR type mismatch
}
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as std::iter::Iterator>::Item == &_`
--> $DIR/issue-33941.rs:14:36
|
-14 | for _ in HashMap::new().iter().cloned() {}
+14 | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
| ^^^^^^ expected tuple, found reference
|
= note: expected type `(&_, &_)`
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as std::iter::Iterator>::Item == &_`
--> $DIR/issue-33941.rs:14:5
|
-14 | for _ in HashMap::new().iter().cloned() {}
+14 | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
|
= note: expected type `(&_, &_)`
struct Foo(u32);
-fn test() -> Foo { Foo }
+fn test() -> Foo { Foo } //~ ERROR mismatched types
fn main() {}
error[E0308]: mismatched types
--> $DIR/issue-35241.rs:13:20
|
-13 | fn test() -> Foo { Foo }
+13 | fn test() -> Foo { Foo } //~ ERROR mismatched types
| --- ^^^
| | |
| | expected struct `Foo`, found fn item
enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope
//~^ HELP possible candidate is found in another module, you can import it into scope
Apple(i64),
- //~^ HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
- //~| HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
Orange(i64),
}
fn should_return_fruit() -> Apple {
//~^ ERROR cannot find type `Apple` in this scope
//~| NOTE not found in this scope
+ //~| HELP you can try using the variant's enum
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~| NOTE not found in this scope
fn should_return_fruit_too() -> Fruit::Apple {
//~^ ERROR expected type, found variant `Fruit::Apple`
//~| NOTE not a type
+ //~| HELP you can try using the variant's enum
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~| NOTE not found in this scope
fn bar() -> Variant3 {
//~^ ERROR cannot find type `Variant3` in this scope
//~| NOTE not found in this scope
+ //~| HELP you can try using the variant's enum
}
fn qux() -> Some {
Variant1,
Variant2(),
Variant3(usize),
- //~^ HELP there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
Variant4 {},
}
}
error[E0412]: cannot find type `Apple` in this scope
- --> $DIR/issue-35675.rs:20:29
+ --> $DIR/issue-35675.rs:18:29
|
-20 | fn should_return_fruit() -> Apple {
+18 | fn should_return_fruit() -> Apple {
| ^^^^^
| |
| not found in this scope
| help: you can try using the variant's enum: `Fruit`
error[E0425]: cannot find function `Apple` in this scope
- --> $DIR/issue-35675.rs:23:5
+ --> $DIR/issue-35675.rs:22:5
|
-23 | Apple(5)
+22 | Apple(5)
| ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
|
error[E0573]: expected type, found variant `Fruit::Apple`
- --> $DIR/issue-35675.rs:28:33
+ --> $DIR/issue-35675.rs:27:33
|
-28 | fn should_return_fruit_too() -> Fruit::Apple {
+27 | fn should_return_fruit_too() -> Fruit::Apple {
| ^^^^^^^^^^^^
| |
| not a type
| help: you can try using the variant's enum: `x::Enum`
error[E0573]: expected type, found variant `Some`
- --> $DIR/issue-35675.rs:49:13
+ --> $DIR/issue-35675.rs:50:13
|
-49 | fn qux() -> Some {
+50 | fn qux() -> Some {
| ^^^^ not a type
|
= help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`?
fn bar(arg: Box<private::Future>) {
arg.wait();
//~^ ERROR the `wait` method cannot be invoked on a trait object
- //~| another candidate was found in the following trait, perhaps add a `use` for it:
}
fn main() {
fn main() {
let x = Box::new(3);
- f(&mut *x);
+ f(&mut *x); //~ ERROR cannot borrow immutable
}
|
14 | let x = Box::new(3);
| - consider changing this to `mut x`
-15 | f(&mut *x);
+15 | f(&mut *x); //~ ERROR cannot borrow immutable
| ^^ cannot borrow as mutable
error: aborting due to previous error
impl<T> Foo for T {
#[allow(unconditional_recursion)]
- fn recurse(&self) {
+ fn recurse(&self) { //~ ERROR reached the type-length limit
(self, self).recurse();
}
}
error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...`
--> $DIR/issue-37311.rs:23:5
|
-23 | / fn recurse(&self) {
+23 | / fn recurse(&self) { //~ ERROR reached the type-length limit
24 | | (self, self).recurse();
25 | | }
| |_____^
fn main() {
let mut f = Foo { v: Vec::new() };
f.v.push("hello".to_string());
- let e = f.v[0];
+ let e = f.v[0]; //~ ERROR cannot move out of indexed content
}
error[E0507]: cannot move out of indexed content
--> $DIR/issue-40402-1.rs:19:13
|
-19 | let e = f.v[0];
+19 | let e = f.v[0]; //~ ERROR cannot move out of indexed content
| ^^^^^^
| |
| cannot move out of indexed content
// are nested within a pattern
fn main() {
let x = vec![(String::new(), String::new())];
- let (a, b) = x[0];
+ let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
}
error[E0507]: cannot move out of indexed content
--> $DIR/issue-40402-2.rs:15:18
|
-15 | let (a, b) = x[0];
+15 | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
| - - ^^^^ cannot move out of indexed content
| | |
| | ...and here (use `ref b` or `ref mut b`)
// except according to those terms.
fn main() {
- for i 0..2 {
+ for i 0..2 { //~ ERROR missing `in`
}
}
error: missing `in` in `for` loop
--> $DIR/issue-40782.rs:12:10
|
-12 | for i 0..2 {
+12 | for i 0..2 { //~ ERROR missing `in`
| ^ help: try adding `in` here
error: aborting due to previous error
fn do_something<T>(collection: &mut Vec<T>) {
let _a = &collection;
- collection.swap(1, 2);
+ collection.swap(1, 2); //~ ERROR also borrowed as immutable
}
fn main() {}
|
12 | let _a = &collection;
| ---------- immutable borrow occurs here
-13 | collection.swap(1, 2);
+13 | collection.swap(1, 2); //~ ERROR also borrowed as immutable
| ^^^^^^^^^^ mutable borrow occurs here
14 | }
| - immutable borrow ends here
macro_rules! is_plainly_printable {
($i: ident) => {
- $i as u32 < 0
+ $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments
};
}
error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison
--> $DIR/issue-42954.rs:13:19
|
-13 | $i as u32 < 0
+13 | $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments
| --------- ^ - interpreted as generic arguments
| | |
| | not interpreted as comparison
pub fn main () {}
-fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
+fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types
}
error[E0308]: mismatched types
--> $DIR/issue-44023.rs:15:42
|
-15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
+15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types
| __________________________________________^
16 | | }
| |_^ expected isize, found ()
// except according to those terms.
fn main() {
- "😊"";
+ "😊""; //~ ERROR unterminated double quote
}
error: unterminated double quote string
--> $DIR/issue-44078.rs:12:8
|
-12 | "😊"";
+12 | "😊""; //~ ERROR unterminated double quote
| _________^
13 | | }
| |__^
}
fn main() {
- foo!(true);
+ foo!(true); //~ ERROR expected type, found keyword
+ //~^ ERROR expected identifier, found keyword
}
error: expected identifier, found keyword `true`
--> $DIR/issue-44406.rs:18:10
|
-18 | foo!(true);
+18 | foo!(true); //~ ERROR expected type, found keyword
| ^^^^
error: expected type, found keyword `true`
13 | bar(baz: $rest)
| - help: did you mean to use `;` here?
...
-18 | foo!(true);
+18 | foo!(true); //~ ERROR expected type, found keyword
| ^^^^ expecting a type here because of type ascription
error: aborting due to 2 previous errors
unsafe {
let f = |v: &mut Vec<_>| {
- unsafe {
+ unsafe { //~ ERROR unnecessary `unsafe`
v.set_len(24);
- |w: &mut Vec<u32>| { unsafe {
+ |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
w.set_len(32);
} };
}
- |x: &mut Vec<u32>| { unsafe {
+ |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
x.set_len(40);
} };
};
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:17:13
|
-17 | / unsafe {
+17 | / unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
-19 | | |w: &mut Vec<u32>| { unsafe {
+19 | | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
20 | | w.set_len(32);
21 | | } };
22 | | }
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
-17 | | unsafe {
+17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:19:38
|
-19 | |w: &mut Vec<u32>| { unsafe {
+19 | |w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| ______________________________________^
20 | | w.set_len(32);
21 | | } };
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
-17 | | unsafe {
+17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:23:34
|
-23 | |x: &mut Vec<u32>| { unsafe {
+23 | |x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
| __________________________________^
24 | | x.set_len(40);
25 | | } };
|
15 | / unsafe {
16 | | let f = |v: &mut Vec<_>| {
-17 | | unsafe {
+17 | | unsafe { //~ ERROR unnecessary `unsafe`
18 | | v.set_len(24);
... |
29 | | f(&mut v);
fn main() {
let unused = ();
- #![allow(unused_variables)]
+ #![allow(unused_variables)] //~ ERROR not permitted in this context
}
error: an inner attribute is not permitted in this context
--> $DIR/issue-45296.rs:14:7
|
-14 | #![allow(unused_variables)]
+14 | #![allow(unused_variables)] //~ ERROR not permitted in this context
| ^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
use std::fmt;
fn main() {
- let x: *const _ = 0 as _;
+ let x: *const _ = 0 as _; //~ ERROR cannot cast
- let x: *const _ = 0 as *const _;
+ let x: *const _ = 0 as *const _; //~ ERROR cannot cast
let y: Option<*const fmt::Debug> = Some(x) as _;
- let x = 0 as *const i32 as *const _ as *mut _;
+ let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
}
error[E0641]: cannot cast to a pointer of an unknown kind
--> $DIR/issue-45730.rs:13:23
|
-13 | let x: *const _ = 0 as _;
+13 | let x: *const _ = 0 as _; //~ ERROR cannot cast
| ^^^^^-
| |
| help: consider giving more type information
error[E0641]: cannot cast to a pointer of an unknown kind
--> $DIR/issue-45730.rs:15:23
|
-15 | let x: *const _ = 0 as *const _;
+15 | let x: *const _ = 0 as *const _; //~ ERROR cannot cast
| ^^^^^--------
| |
| help: consider giving more type information
error[E0641]: cannot cast to a pointer of an unknown kind
--> $DIR/issue-45730.rs:18:13
|
-18 | let x = 0 as *const i32 as *const _ as *mut _;
+18 | let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------
| |
| help: consider giving more type information
let p: &i32 = &a.field;
&*p
} else {
- &*x
+ &*x //~ ERROR explicit lifetime
}
}
15 | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
| - consider changing the type of `x` to `&'a i32`
...
-20 | &*x
+20 | &*x //~ ERROR explicit lifetime
| ^^^ lifetime `'a` required
error: aborting due to previous error
match *self {
Foo::Bar(s) => {
if s == "test" {
- other
+ other //~ ERROR explicit lifetime
} else {
self.clone()
}
17 | fn bar(&self, other: Foo) -> Foo<'a> {
| ----- consider changing the type of `other` to `Foo<'a>`
...
-21 | other
+21 | other //~ ERROR explicit lifetime
| ^^^^^ lifetime `'a` required
error: aborting due to previous error
// except according to those terms.
fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- if x > y { x } else { y }
+ if x > y { x } else { y } //~ ERROR explicit lifetime
}
fn main() { }
|
11 | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| - consider changing the type of `x` to `&'a i32`
-12 | if x > y { x } else { y }
+12 | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
// except according to those terms.
fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 {
- if x > y { x } else { y }
+ if x > y { x } else { y } //~ ERROR explicit lifetime
}
fn main () { }
|
11 | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 {
| ------ consider changing type to `(&'a i32, &'a i32)`
-12 | if x > y { x } else { y }
+12 | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
trait Foo {
fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- if x > y { x } else { y }
+ if x > y { x } else { y } //~ ERROR explicit lifetime
}
}
|
13 | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
| - consider changing the type of `x` to `&'a i32`
-14 | if x > y { x } else { y }
+14 | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
impl Foo {
fn foo<'a>(&'a self, x: &i32) -> &i32 {
- if true { &self.field } else { x }
+ if true { &self.field } else { x } //~ ERROR explicit lifetime
}
16 | fn foo<'a>(&'a self, x: &i32) -> &i32 {
| - consider changing the type of `x` to `&'a i32`
17 |
-18 | if true { &self.field } else { x }
+18 | if true { &self.field } else { x } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- if x > y { x } else { y }
+ if x > y { x } else { y } //~ ERROR lifetime mismatch
}
| |
| this parameter and the return type are declared with different lifetimes...
20 |
-21 | if x > y { x } else { y }
+21 | if x > y { x } else { y } //~ ERROR lifetime mismatch
| ^ ...but data from `x` is returned here
error: aborting due to previous error
// except according to those terms.
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
- if x > y { x } else { y }
+ if x > y { x } else { y } //~ ERROR explicit lifetime
}
fn main() { }
|
11 | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
| - consider changing the type of `y` to `&'a i32`
-12 | if x > y { x } else { y }
+12 | if x > y { x } else { y } //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
impl Foo {
fn foo<'a>(&self, x: &'a i32) -> &i32 {
- x
+ x //~ ERROR lifetime mismatch
}
| |
| this parameter and the return type are declared with different lifetimes...
17 |
-18 | x
+18 | x //~ ERROR lifetime mismatch
| ^ ...but data from `x` is returned here
error: aborting due to previous error
impl Foo {
fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
- if true { x } else { self }
+ if true { x } else { self } //~ ERROR lifetime mismatch
}
}
| |
| this parameter and the return type are declared with different lifetimes...
17 |
-18 | if true { x } else { self }
+18 | if true { x } else { self } //~ ERROR lifetime mismatch
| ^^^^ ...but data from `self` is returned here
error: aborting due to previous error
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: &i32, y: &i32) -> &i32 {
+fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime
if x > y { x } else { y }
}
error[E0106]: missing lifetime specifier
--> $DIR/ex1b-return-no-names-if-else.rs:11:29
|
-11 | fn foo(x: &i32, y: &i32) -> &i32 {
+11 | fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime
| ^ expected lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y`
}
fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
- y.push(x);
+ y.push(x); //~ ERROR explicit lifetime
}
fn main() { }
|
15 | fn foo<'a>(x: Ref<i32>, y: &mut Vec<Ref<'a, i32>>) {
| - consider changing the type of `x` to `Ref<'a, i32>`
-16 | y.push(x);
+16 | y.push(x); //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
where i32: Foo<'a>,
u32: Foo<'b>
{
- x.push(y);
+ x.push(y); //~ ERROR explicit lifetime required
}
fn main() {
let x = baz;
13 | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T)
| - consider changing the type of `y` to `&'a T`
...
-17 | x.push(y);
+17 | x.push(y); //~ ERROR explicit lifetime required
| ^ lifetime `'a` required
error: aborting due to previous error
}
fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
- x.push(y);
+ x.push(y); //~ ERROR explicit lifetime
}
fn main() { }
|
15 | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
| - consider changing the type of `y` to `Ref<'a, i32>`
-16 | x.push(y);
+16 | x.push(y); //~ ERROR explicit lifetime
| ^ lifetime `'a` required
error: aborting due to previous error
}
fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
fn main() { }
|
15 | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
| -------- -------- these two types are declared with different lifetimes...
-16 | x.push(y);
+16 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
let z = Ref { data: y.data };
- x.push(z);
+ x.push(z); //~ ERROR lifetime mismatch
}
fn main() { }
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| ------------ ------------ these two types are declared with different lifetimes...
16 | let z = Ref { data: y.data };
-17 | x.push(z);
+17 | x.push(z); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
}
fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
- let a: &mut Vec<Ref<i32>> = x;
+ let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch
let b = Ref { data: y.data };
a.push(b);
}
|
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| ------------ ------------ these two types are declared with different lifetimes...
-16 | let a: &mut Vec<Ref<i32>> = x;
+16 | let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
}
fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
- let a: &mut Vec<Ref<i32>> = x;
+ let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch
let b = Ref { data: y.data };
Vec::push(a, b);
}
|
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
| ------------ ------------ these two types are declared with different lifetimes...
-16 | let a: &mut Vec<Ref<i32>> = x;
+16 | let a: &mut Vec<Ref<i32>> = x; //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
// except according to those terms.
fn foo((v, w): (&u8, &u8), x: &u8) {
- v = x;
+ v = x; //~ ERROR lifetime mismatch
}
fn main() { }
|
11 | fn foo((v, w): (&u8, &u8), x: &u8) {
| --- --- these two types are declared with different lifetimes...
-12 | v = x;
+12 | v = x; //~ ERROR lifetime mismatch
| ^ ...but data from `x` flows here
error: aborting due to previous error
// except according to those terms.
fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
- z.push((x,y));
+ z.push((x,y)); //~ ERROR lifetime mismatch
+ //~^ ERROR lifetime mismatch
}
fn main() { }
|
11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| --- --- these two types are declared with different lifetimes...
-12 | z.push((x,y));
+12 | z.push((x,y)); //~ ERROR lifetime mismatch
| ^ ...but data flows into `z` here
error[E0623]: lifetime mismatch
|
11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
| --- --- these two types are declared with different lifetimes...
-12 | z.push((x,y));
+12 | z.push((x,y)); //~ ERROR lifetime mismatch
| ^ ...but data flows into `z` here
error: aborting due to 2 previous errors
}
fn foo(mut x: Ref, y: Ref) {
- x.b = y.b;
+ x.b = y.b; //~ ERROR lifetime mismatch
}
fn main() {}
|
15 | fn foo(mut x: Ref, y: Ref) {
| --- --- these two types are declared with different lifetimes...
-16 | x.b = y.b;
+16 | x.b = y.b; //~ ERROR lifetime mismatch
| ^^^ ...but data from `y` flows into `x` here
error: aborting due to previous error
}
fn foo(mut x: Ref) {
- x.a = x.b;
+ x.a = x.b; //~ ERROR lifetime mismatch
}
-fn main() {}
\ No newline at end of file
+fn main() {}
| ---
| |
| this type is declared with multiple lifetimes...
-16 | x.a = x.b;
+16 | x.a = x.b; //~ ERROR lifetime mismatch
| ^^^ ...but data with one lifetime flows into the other here
error: aborting due to previous error
}
fn foo(mut x: Ref) {
- x.a = x.b;
+ x.a = x.b; //~ ERROR lifetime mismatch
}
fn main() {}
| ---
| |
| this type is declared with multiple lifetimes...
-16 | x.a = x.b;
+16 | x.a = x.b; //~ ERROR lifetime mismatch
| ^^^ ...but data with one lifetime flows into the other here
error: aborting due to previous error
where &'a (): Sized,
&'b u32: Sized
{
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
fn main() {}
14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>)
| ------- ------- these two types are declared with different lifetimes...
...
-18 | x.push(y);
+18 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
}
fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
fn main() {}
|
14 | fn foo<'a, 'b>(mut x: Vec<Ref<'a>>, y: Ref<'b>) {
| ------- ------- these two types are declared with different lifetimes...
-15 | x.push(y);
+15 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
}
fn foo(mut x: Vec<Ref>, y: Ref) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
fn main() {}
|
14 | fn foo(mut x: Vec<Ref>, y: Ref) {
| --- --- these two types are declared with different lifetimes...
-15 | x.push(y);
+15 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
// except according to those terms.
fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
-fn main() { }
\ No newline at end of file
+fn main() { }
|
11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
| ------ ------ these two types are declared with different lifetimes...
-12 | x.push(y);
+12 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 }
fn foo(mut x: Ref, y: &u32) {
- y = x.b;
+ y = x.b; //~ ERROR lifetime mismatch
}
fn main() { }
| --- ----
| |
| these two types are declared with different lifetimes...
-14 | y = x.b;
+14 | y = x.b; //~ ERROR lifetime mismatch
| ^^^ ...but data from `x` flows into `y` here
error: aborting due to previous error
struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 }
fn foo(mut y: Ref, x: &u32) {
- y.b = x;
+ y.b = x; //~ ERROR lifetime mismatch
}
fn main() { }
|
13 | fn foo(mut y: Ref, x: &u32) {
| --- ---- these two types are declared with different lifetimes...
-14 | y.b = x;
+14 | y.b = x; //~ ERROR lifetime mismatch
| ^ ...but data from `x` flows into `y` here
error: aborting due to previous error
struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 }
fn foo(mut y: Ref, x: &u32) {
- y.b = x;
+ y.b = x; //~ ERROR lifetime mismatch
}
fn main() { }
|
13 | fn foo(mut y: Ref, x: &u32) {
| --- ---- these two types are declared with different lifetimes...
-14 | y.b = x;
+14 | y.b = x; //~ ERROR lifetime mismatch
| ^ ...but data from `x` flows into `y` here
error: aborting due to previous error
}
fn foo(mut x: Ref, y: &u32) {
- x.b = y;
+ x.b = y; //~ ERROR lifetime mismatch
}
fn main() {}
|
16 | fn foo(mut x: Ref, y: &u32) {
| --- ---- these two types are declared with different lifetimes...
-17 | x.b = y;
+17 | x.b = y; //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
impl Foo {
fn foo<'a>(&self, x: &i32) -> &i32 {
- x
+ x //~ ERROR lifetime mismatch
}
}
| ---- ----
| |
| this parameter and the return type are declared with different lifetimes...
-17 | x
+17 | x //~ ERROR lifetime mismatch
| ^ ...but data from `x` is returned here
error: aborting due to previous error
impl Foo {
fn foo<'a>(&self, x: &Foo) -> &Foo {
- if true { x } else { self }
+ if true { x } else { self } //~ ERROR lifetime mismatch
}
}
| ---- ----
| |
| this parameter and the return type are declared with different lifetimes...
-17 | if true { x } else { self }
+17 | if true { x } else { self } //~ ERROR lifetime mismatch
| ^ ...but data from `x` is returned here
error: aborting due to previous error
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
- y.push(z);
+ y.push(z); //~ ERROR lifetime mismatch
}
fn main() { }
|
10 | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
| --- --- these two types are declared with different lifetimes...
-11 | y.push(z);
+11 | y.push(z); //~ ERROR lifetime mismatch
| ^ ...but data from `z` flows into `y` here
error: aborting due to previous error
}
impl Foo for () {
fn foo(x: &mut Vec<&u8>, y: &u8) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
}
fn main() {}
|
14 | fn foo(x: &mut Vec<&u8>, y: &u8) {
| --- --- these two types are declared with different lifetimes...
-15 | x.push(y);
+15 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
- y.push(z);
+ y.push(z); //~ ERROR lifetime mismatch
}
fn main() { }
|
10 | fn foo(x:Box<Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
| --- --- these two types are declared with different lifetimes...
-11 | y.push(z);
+11 | y.push(z); //~ ERROR lifetime mismatch
| ^ ...but data from `z` flows into `y` here
error: aborting due to previous error
// except according to those terms.
fn foo(x: &mut Vec<&u8>, y: &u8) {
- x.push(y);
+ x.push(y); //~ ERROR lifetime mismatch
}
fn main() { }
|
11 | fn foo(x: &mut Vec<&u8>, y: &u8) {
| --- --- these two types are declared with different lifetimes...
-12 | x.push(y);
+12 | x.push(y); //~ ERROR lifetime mismatch
| ^ ...but data from `y` flows into `x` here
error: aborting due to previous error
// except according to those terms.
fn f() {
- let x = vec![1].iter();
+ let x = vec![1].iter(); //~ ERROR does not live long enough
}
fn main() {
error[E0597]: borrowed value does not live long enough
--> $DIR/borrowck-let-suggestion.rs:12:27
|
-12 | let x = vec![1].iter();
+12 | let x = vec![1].iter(); //~ ERROR does not live long enough
| ------- ^ temporary value dropped here while still borrowed
| |
| temporary value created here
struct List<'a, T: ListItem<'a>> {
slice: &'a [T]
+ //~^ ERROR may not live long enough
}
impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
struct Foo<T> {
foo: &'static T
+ //~^ ERROR may not live long enough
}
trait X<K>: Sized {
fn foo<'a, L: X<&'a Nested<K>>>();
+ //~^ ERROR may not live long enough
// check that we give a sane error for `Self`
fn bar<'a, L: X<&'a Nested<Self>>>();
+ //~^ ERROR may not live long enough
}
struct Nested<K>(K);
impl<K> Nested<K> {
fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
+ //~^ ERROR may not live long enough
}
fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
+ //~^ ERROR may not live long enough
}
}
| ^^^^^^^^^^^^^^
error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5
|
-27 | struct Foo<T> {
+28 | struct Foo<T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
-28 | foo: &'static T
+29 | foo: &'static T
| ^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'static T` does not outlive the data it points at
- --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5
|
-28 | foo: &'static T
+29 | foo: &'static T
| ^^^^^^^^^^^^^^^
error[E0309]: the parameter type `K` may not live long enough
- --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5
|
-31 | trait X<K>: Sized {
+33 | trait X<K>: Sized {
| - help: consider adding an explicit lifetime bound `K: 'a`...
-32 | fn foo<'a, L: X<&'a Nested<K>>>();
+34 | fn foo<'a, L: X<&'a Nested<K>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
- --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5
|
-32 | fn foo<'a, L: X<&'a Nested<K>>>();
+34 | fn foo<'a, L: X<&'a Nested<K>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0309]: the parameter type `Self` may not live long enough
- --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:37:5
|
-34 | fn bar<'a, L: X<&'a Nested<Self>>>();
+37 | fn bar<'a, L: X<&'a Nested<Self>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
note: ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
- --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:37:5
|
-34 | fn bar<'a, L: X<&'a Nested<Self>>>();
+37 | fn bar<'a, L: X<&'a Nested<Self>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0309]: the parameter type `K` may not live long enough
- --> $DIR/lifetime-doesnt-live-long-enough.rs:39:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:43:5
|
-38 | impl<K> Nested<K> {
+42 | impl<K> Nested<K> {
| - help: consider adding an explicit lifetime bound `K: 'a`...
-39 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
-40 | | }
+43 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
+44 | | //~^ ERROR may not live long enough
+45 | | }
| |_____^
|
note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
- --> $DIR/lifetime-doesnt-live-long-enough.rs:39:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:43:5
|
-39 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
-40 | | }
+43 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
+44 | | //~^ ERROR may not live long enough
+45 | | }
| |_____^
error[E0309]: the parameter type `M` may not live long enough
- --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:46:5
|
-41 | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
+46 | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
| ^ -- help: consider adding an explicit lifetime bound `M: 'a`...
| _____|
| |
-42 | | }
+47 | | //~^ ERROR may not live long enough
+48 | | }
| |_____^
|
note: ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
- --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5
+ --> $DIR/lifetime-doesnt-live-long-enough.rs:46:5
|
-41 | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
-42 | | }
+46 | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
+47 | | //~^ ERROR may not live long enough
+48 | | }
| |_____^
error: aborting due to 6 previous errors
// compile-flags: -D bad-style
fn main() {
- let _InappropriateCamelCasing = true;
+ let _InappropriateCamelCasing = true; //~ ERROR should have a snake
}
error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
--> $DIR/command-line-lint-group-deny.rs:14:9
|
-14 | let _InappropriateCamelCasing = true;
+14 | let _InappropriateCamelCasing = true; //~ ERROR should have a snake
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D non-snake-case` implied by `-D bad-style`
// compile-flags: -F bad-style
fn main() {
- let _InappropriateCamelCasing = true;
+ let _InappropriateCamelCasing = true; //~ ERROR should have a snake
}
error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
--> $DIR/command-line-lint-group-forbid.rs:14:9
|
-14 | let _InappropriateCamelCasing = true;
+14 | let _InappropriateCamelCasing = true; //~ ERROR should have a snake
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-F non-snake-case` implied by `-F bad-style`
#![deny(bad_style)]
#![allow(dead_code)]
-fn CamelCase() {}
+fn CamelCase() {} //~ ERROR should have a snake
#[allow(bad_style)]
mod test {
#[forbid(bad_style)]
mod bad {
- fn CamelCase() {}
+ fn CamelCase() {} //~ ERROR should have a snake
- static bad: isize = 1;
+ static bad: isize = 1; //~ ERROR should have an upper
}
mod warn {
#![warn(bad_style)]
- fn CamelCase() {}
+ fn CamelCase() {} //~ WARN should have a snake
- struct snake_case;
+ struct snake_case; //~ WARN should have a camel
}
}
error: function `CamelCase` should have a snake case name such as `camel_case`
--> $DIR/lint-group-style.rs:14:1
|
-14 | fn CamelCase() {}
+14 | fn CamelCase() {} //~ ERROR should have a snake
| ^^^^^^^^^^^^^^^^^
|
note: lint level defined here
error: function `CamelCase` should have a snake case name such as `camel_case`
--> $DIR/lint-group-style.rs:22:9
|
-22 | fn CamelCase() {}
+22 | fn CamelCase() {} //~ ERROR should have a snake
| ^^^^^^^^^^^^^^^^^
|
note: lint level defined here
error: static variable `bad` should have an upper case name such as `BAD`
--> $DIR/lint-group-style.rs:24:9
|
-24 | static bad: isize = 1;
+24 | static bad: isize = 1; //~ ERROR should have an upper
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
warning: function `CamelCase` should have a snake case name such as `camel_case`
--> $DIR/lint-group-style.rs:30:9
|
-30 | fn CamelCase() {}
+30 | fn CamelCase() {} //~ WARN should have a snake
| ^^^^^^^^^^^^^^^^^
|
note: lint level defined here
warning: type `snake_case` should have a camel case name such as `SnakeCase`
--> $DIR/lint-group-style.rs:32:9
|
-32 | struct snake_case;
+32 | struct snake_case; //~ WARN should have a camel
| ^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
#![forbid(unused, non_snake_case)]
-#[allow(unused_variables)]
+#[allow(unused_variables)] //~ ERROR overruled
fn foo() {}
-#[allow(unused)]
+#[allow(unused)] //~ ERROR overruled
fn bar() {}
-#[allow(bad_style)]
+#[allow(bad_style)] //~ ERROR overruled
fn main() {
println!("hello forbidden world")
}
17 | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
18 |
-19 | #[allow(unused_variables)]
+19 | #[allow(unused_variables)] //~ ERROR overruled
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
error[E0453]: allow(unused) overruled by outer forbid(unused)
17 | #![forbid(unused, non_snake_case)]
| ------ `forbid` level set here
...
-22 | #[allow(unused)]
+22 | #[allow(unused)] //~ ERROR overruled
| ^^^^^^ overruled by previous forbid
error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case)
17 | #![forbid(unused, non_snake_case)]
| -------------- `forbid` level set here
...
-25 | #[allow(bad_style)]
+25 | #[allow(bad_style)] //~ ERROR overruled
| ^^^^^^^^^ overruled by previous forbid
error: aborting due to 3 previous errors
#![feature(no_debug)]
#[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub`
+//~^ WARN static is marked #[no_mangle]
#[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const`
+//~^ ERROR const items should never be #[no_mangle]
#[no_mangle] // should suggest removal (generics can't be no-mangle)
pub fn defiant<T>(_t: T) {}
+//~^ WARN functions generic over types must be mangled
#[no_mangle]
fn rio_grande() {} // should suggest `pub`
+//~^ WARN function is marked
struct Equinox {
warp_factor: f32,
}
#[no_debug] // should suggest removal of deprecated attribute
+//~^ WARN deprecated
fn main() {
while true { // should suggest `loop`
+ //~^ WARN denote infinite loops
let mut a = (1); // should suggest no `mut`, no parens
+ //~^ WARN does not need to be mutable
+ //~| WARN unnecessary parentheses
let d = Equinox { warp_factor: 9.975 };
match d {
Equinox { warp_factor: warp_factor } => {} // should suggest shorthand
+ //~^ WARN this pattern is redundant
}
println!("{}", a);
}
warning: unnecessary parentheses around assigned value
- --> $DIR/suggestions.rs:30:21
+ --> $DIR/suggestions.rs:36:21
|
-30 | let mut a = (1); // should suggest no `mut`, no parens
+36 | let mut a = (1); // should suggest no `mut`, no parens
| ^^^ help: remove these parentheses
|
note: lint level defined here
| ^^^^^^^^^^^^^
warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721
- --> $DIR/suggestions.rs:27:1
+ --> $DIR/suggestions.rs:31:1
|
-27 | #[no_debug] // should suggest removal of deprecated attribute
+31 | #[no_debug] // should suggest removal of deprecated attribute
| ^^^^^^^^^^^ help: remove this attribute
|
= note: #[warn(deprecated)] on by default
warning: variable does not need to be mutable
- --> $DIR/suggestions.rs:30:13
+ --> $DIR/suggestions.rs:36:13
|
-30 | let mut a = (1); // should suggest no `mut`, no parens
+36 | let mut a = (1); // should suggest no `mut`, no parens
| ---^^
| |
| help: remove this `mut`
= note: #[warn(private_no_mangle_statics)] on by default
error: const items should never be #[no_mangle]
- --> $DIR/suggestions.rs:15:14
+ --> $DIR/suggestions.rs:16:14
|
-15 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const`
+16 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const`
| -----^^^^^^^^^^^^^^^^^^^^^^
| |
| help: try a static value: `pub static`
= note: #[deny(no_mangle_const_items)] on by default
warning: functions generic over types must be mangled
- --> $DIR/suggestions.rs:18:1
+ --> $DIR/suggestions.rs:20:1
|
-17 | #[no_mangle] // should suggest removal (generics can't be no-mangle)
+19 | #[no_mangle] // should suggest removal (generics can't be no-mangle)
| ------------ help: remove this attribute
-18 | pub fn defiant<T>(_t: T) {}
+20 | pub fn defiant<T>(_t: T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(no_mangle_generic_items)] on by default
warning: function is marked #[no_mangle], but not exported
- --> $DIR/suggestions.rs:21:1
+ --> $DIR/suggestions.rs:24:1
|
-21 | fn rio_grande() {} // should suggest `pub`
+24 | fn rio_grande() {} // should suggest `pub`
| -^^^^^^^^^^^^^^^^^
| |
| help: try making it public: `pub `
= note: #[warn(private_no_mangle_fns)] on by default
warning: denote infinite loops with `loop { ... }`
- --> $DIR/suggestions.rs:29:5
+ --> $DIR/suggestions.rs:34:5
|
-29 | while true { // should suggest `loop`
+34 | while true { // should suggest `loop`
| ^---------
| |
| _____help: use `loop`
| |
-30 | | let mut a = (1); // should suggest no `mut`, no parens
-31 | | let d = Equinox { warp_factor: 9.975 };
-32 | | match d {
+35 | | //~^ WARN denote infinite loops
+36 | | let mut a = (1); // should suggest no `mut`, no parens
+37 | | //~^ WARN does not need to be mutable
... |
-35 | | println!("{}", a);
-36 | | }
+44 | | println!("{}", a);
+45 | | }
| |_____^
|
= note: #[warn(while_true)] on by default
warning: the `warp_factor:` in this pattern is redundant
- --> $DIR/suggestions.rs:33:23
+ --> $DIR/suggestions.rs:41:23
|
-33 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand
+41 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand
| ------------^^^^^^^^^^^^
| |
| help: remove this
fn main() {
for _ in &[1,2,3] {
- break 22
+ break 22 //~ ERROR `break` with value from a `for` loop
}
}
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value-no-repeat.rs:22:9
|
-22 | break 22
+22 | break 22 //~ ERROR `break` with value from a `for` loop
| ^^^^^^^^ can only break with a value inside `loop`
error: aborting due to previous error
x: fn(&u8, &u8),
y: for<'a> fn(&'a u8, &'a u8),
) {
- let z = match 22 {
+ let z = match 22 { //~ ERROR incompatible types
0 => x,
_ => y,
};
error[E0308]: match arms have incompatible types
--> $DIR/old-lub-glb-hr.rs:18:13
|
-18 | let z = match 22 {
+18 | let z = match 22 { //~ ERROR incompatible types
| _____________^
19 | | 0 => x,
20 | | _ => y,
x: &for<'a, 'b> Foo<&'a u8, &'b u8>,
y: &for<'a> Foo<&'a u8, &'a u8>,
) {
- let z = match 22 {
+ let z = match 22 { //~ ERROR incompatible types
0 => x,
_ => y,
};
error[E0308]: match arms have incompatible types
--> $DIR/old-lub-glb-object.rs:20:13
|
-20 | let z = match 22 {
+20 | let z = match 22 { //~ ERROR incompatible types
| _____________^
21 | | 0 => x,
22 | | _ => y,
// a local macro
macro_rules! pong {
- () => { syntax error };
+ () => { syntax error }; //~ ERROR expected one of
+ //~^ ERROR expected one of
}
fn main() {
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:19:20
|
-19 | () => { syntax error };
+19 | () => { syntax error }; //~ ERROR expected one of
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
-$DIR/main.rs:23:5: 23:13 note: in this expansion of pong! (defined in $DIR/main.rs)
+$DIR/main.rs:24:5: 24:13 note: in this expansion of pong! (defined in $DIR/main.rs)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:19:20
|
-19 | () => { syntax error };
+19 | () => { syntax error }; //~ ERROR expected one of
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
-$DIR/main.rs:24:5: 24:13 note: in this expansion of ping! (defined in <ping macros>)
+$DIR/main.rs:25:5: 25:13 note: in this expansion of ping! (defined in <ping macros>)
<ping macros>:1:11: 1:24 note: in this expansion of pong! (defined in $DIR/main.rs)
error: aborting due to 2 previous errors
// except according to those terms.
fn main() {
- println!(3 + 4);
+ println!(3 + 4); //~ ERROR expected a literal
}
error: expected a literal
--> $DIR/bad_hello.rs:12:14
|
-12 | println!(3 + 4);
+12 | println!(3 + 4); //~ ERROR expected a literal
| ^^^^^
error: aborting due to previous error
fn main() {
println!("%.*3$s %s!\n", "Hello,", "World", 4);
- println!("%1$*2$.*3$f", 123.456);
+ println!("%1$*2$.*3$f", 123.456); //~ ERROR never used
// This should *not* produce hints, on the basis that there's equally as
// many "correct" format specifiers. It's *probably* just an actual typo.
- println!("{} %f", "one", 2.0);
+ println!("{} %f", "one", 2.0); //~ ERROR never used
- println!("Hi there, $NAME.", NAME="Tim");
+ println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used
}
error: argument never used
--> $DIR/format-foreign.rs:13:29
|
-13 | println!("%1$*2$.*3$f", 123.456);
+13 | println!("%1$*2$.*3$f", 123.456); //~ ERROR never used
| ^^^^^^^
|
= help: `%1$*2$.*3$f` should be written as `{0:1$.2$}`
error: argument never used
--> $DIR/format-foreign.rs:17:30
|
-17 | println!("{} %f", "one", 2.0);
+17 | println!("{} %f", "one", 2.0); //~ ERROR never used
| ^^^
error: named argument never used
--> $DIR/format-foreign.rs:19:39
|
-19 | println!("Hi there, $NAME.", NAME="Tim");
+19 | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used
| ^^^^^
|
= help: `$NAME` should be written as `{NAME}`
789
);
- println!("Some stuff", UNUSED="args");
+ println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used
println!("Some more $STUFF",
"woo!",
error: named argument never used
--> $DIR/format-unused-lables.rs:20:35
|
-20 | println!("Some stuff", UNUSED="args");
+20 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used
| ^^^^^^
error: multiple unused formatting arguments
macro_rules! fake_method_stmt {
() => {
- 1.fake()
+ 1.fake() //~ ERROR no method
}
}
macro_rules! fake_field_stmt {
() => {
- 1.fake
+ 1.fake //~ ERROR doesn't have fields
}
}
macro_rules! fake_anon_field_stmt {
() => {
- (1).0
+ (1).0 //~ ERROR no field
}
}
macro_rules! fake_method_expr {
() => {
- 1.fake()
+ 1.fake() //~ ERROR no method
}
}
macro_rules! fake_field_expr {
() => {
- 1.fake
+ 1.fake //~ ERROR doesn't have fields
}
}
macro_rules! fake_anon_field_expr {
() => {
- (1).0
+ (1).0 //~ ERROR no field
}
}
error[E0599]: no method named `fake` found for type `{integer}` in the current scope
--> $DIR/macro-backtrace-invalid-internals.rs:15:13
|
-15 | 1.fake()
+15 | 1.fake() //~ ERROR no method
| ^^^^
...
50 | fake_method_stmt!();
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:21:13
|
-21 | 1.fake
+21 | 1.fake //~ ERROR doesn't have fields
| ^^^^
...
51 | fake_field_stmt!();
error[E0609]: no field `0` on type `{integer}`
--> $DIR/macro-backtrace-invalid-internals.rs:27:11
|
-27 | (1).0
+27 | (1).0 //~ ERROR no field
| ^^^^^
...
52 | fake_anon_field_stmt!();
error[E0599]: no method named `fake` found for type `{integer}` in the current scope
--> $DIR/macro-backtrace-invalid-internals.rs:33:13
|
-33 | 1.fake()
+33 | 1.fake() //~ ERROR no method
| ^^^^
...
54 | let _ = fake_method_expr!();
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/macro-backtrace-invalid-internals.rs:39:13
|
-39 | 1.fake
+39 | 1.fake //~ ERROR doesn't have fields
| ^^^^
...
55 | let _ = fake_field_expr!();
error[E0609]: no field `0` on type `{integer}`
--> $DIR/macro-backtrace-invalid-internals.rs:45:11
|
-45 | (1).0
+45 | (1).0 //~ ERROR no field
| ^^^^^
...
56 | let _ = fake_anon_field_expr!();
// we replace the span of the expanded expression with that of the call site.
macro_rules! nested_expr {
- () => (fake)
+ () => (fake) //~ ERROR cannot find
+ //~^ ERROR cannot find
}
macro_rules! call_nested_expr {
error[E0425]: cannot find value `fake` in this scope
--> $DIR/macro-backtrace-nested.rs:15:12
|
-15 | () => (fake)
+15 | () => (fake) //~ ERROR cannot find
| ^^^^ not found in this scope
...
-27 | 1 + call_nested_expr!();
+28 | 1 + call_nested_expr!();
| ------------------- in this macro invocation
error[E0425]: cannot find value `fake` in this scope
--> $DIR/macro-backtrace-nested.rs:15:12
|
-15 | () => (fake)
+15 | () => (fake) //~ ERROR cannot find
| ^^^^ not found in this scope
...
-28 | call_nested_expr_sum!();
+29 | call_nested_expr_sum!();
| ------------------------ in this macro invocation
error: aborting due to 2 previous errors
}
macro_rules! myprintln {
- ($fmt:expr) => (myprint!(concat!($fmt, "\n")));
+ ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); //~ ERROR no arguments were given
}
fn main() {
error: 1 positional argument in format string, but no arguments were given
--> $DIR/macro-backtrace-println.rs:24:30
|
-24 | ($fmt:expr) => (myprint!(concat!($fmt, "/n")));
+24 | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); //~ ERROR no arguments were given
| ^^^^^^^^^^^^^^^^^^^
...
28 | myprintln!("{}");
// except according to those terms.
fn main() {
- printlx!("oh noes!");
+ printlx!("oh noes!"); //~ ERROR cannot find
}
error: cannot find macro `printlx!` in this scope
--> $DIR/macro-name-typo.rs:12:5
|
-12 | printlx!("oh noes!");
+12 | printlx!("oh noes!"); //~ ERROR cannot find
| ^^^^^^^ help: you could try the macro: `println!`
error: aborting due to previous error
impl<T: $t> Foo for T {}
});
-foo!(m::m2::A);
+foo!(m::m2::A); //~ ERROR failed to resolve
fn main() {}
error[E0433]: failed to resolve. Use of undeclared type or module `m`
--> $DIR/macro_path_as_generic_bound.rs:17:6
|
-17 | foo!(m::m2::A);
+17 | foo!(m::m2::A); //~ ERROR failed to resolve
| ^ Use of undeclared type or module `m`
error: cannot continue compilation due to previous error
}
fn main() {
- k!();
- kl!();
+ k!(); //~ ERROR cannot find
+ kl!(); //~ ERROR cannot find
}
error: cannot find macro `kl!` in this scope
--> $DIR/macro_undefined.rs:22:5
|
-22 | kl!();
+22 | kl!(); //~ ERROR cannot find
| ^^
|
= help: have you added the `#[macro_use]` on the module/import?
error: cannot find macro `k!` in this scope
--> $DIR/macro_undefined.rs:21:5
|
-21 | k!();
+21 | k!(); //~ ERROR cannot find
| ^ help: you could try the macro: `kl!`
error: aborting due to 2 previous errors
macro_rules! my_faulty_macro {
() => {
- my_faulty_macro!(bcd);
+ my_faulty_macro!(bcd); //~ ERROR no rules
};
}
macro_rules! my_recursive_macro {
() => {
- my_recursive_macro!();
+ my_recursive_macro!(); //~ ERROR recursion limit
};
}
error: no rules expected the token `bcd`
--> $DIR/trace_faulty_macros.rs:17:26
|
-17 | my_faulty_macro!(bcd);
+17 | my_faulty_macro!(bcd); //~ ERROR no rules
| ^^^
...
43 | my_faulty_macro!();
error: recursion limit reached while expanding the macro `my_recursive_macro`
--> $DIR/trace_faulty_macros.rs:32:9
|
-32 | my_recursive_macro!();
+32 | my_recursive_macro!(); //~ ERROR recursion limit
| ^^^^^^^^^^^^^^^^^^^^^^
...
44 | my_recursive_macro!();
// Test that parameter cardinality or missing method error gets span exactly.
-pub struct Foo;
+pub struct Foo; //~ NOTE not found for this
impl Foo {
fn zero(self) -> Foo { self }
//~^ NOTE defined here
error[E0599]: no method named `take` found for type `Foo` in the current scope
--> $DIR/method-call-err-msg.rs:34:7
|
-13 | pub struct Foo;
+13 | pub struct Foo; //~ NOTE not found for this
| --------------- method `take` not found for this
...
34 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope
fn foo(x: i16) { }
//~^ ERROR method `foo` has an incompatible type for trait
//~| NOTE expected u16
+ //~| NOTE expected type `fn(u16)`
fn bar(&mut self) { }
//~^ ERROR method `bar` has an incompatible type for trait
//~| NOTE types differ in mutability
//~| NOTE expected type `fn(&Bar)`
- //~| NOTE found type `fn(&mut Bar)`
}
fn main() {
found type `fn(i16)`
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/E0053.rs:22:12
+ --> $DIR/E0053.rs:23:12
|
13 | fn bar(&self); //~ NOTE type in trait
| ----- type in trait
...
-22 | fn bar(&mut self) { }
+23 | fn bar(&mut self) { }
| ^^^^^^^^^ types differ in mutability
|
= note: expected type `fn(&Bar)`
//~| ERROR E0308
//~| NOTE expected &{integer}, found integral variable
//~| NOTE expected type `&{integer}`
- //~| NOTE found type `{integer}`
_ => ()
}
}
fn bar<F: Fn<usize>>(_: F) {}
fn main() {
fn f(_: u64) {}
- foo(|_: isize| {});
- bar(|_: isize| {});
- foo(f);
- bar(f);
+ foo(|_: isize| {}); //~ ERROR type mismatch
+ bar(|_: isize| {}); //~ ERROR type mismatch
+ foo(f); //~ ERROR type mismatch
+ bar(f); //~ ERROR type mismatch
}
error[E0631]: type mismatch in closure arguments
--> $DIR/E0631.rs:17:5
|
-17 | foo(|_: isize| {});
+17 | foo(|_: isize| {}); //~ ERROR type mismatch
| ^^^ ------------- found signature of `fn(isize) -> _`
| |
| expected signature of `fn(usize) -> _`
error[E0631]: type mismatch in closure arguments
--> $DIR/E0631.rs:18:5
|
-18 | bar(|_: isize| {});
+18 | bar(|_: isize| {}); //~ ERROR type mismatch
| ^^^ ------------- found signature of `fn(isize) -> _`
| |
| expected signature of `fn(usize) -> _`
error[E0631]: type mismatch in function arguments
--> $DIR/E0631.rs:19:5
|
-19 | foo(f);
+19 | foo(f); //~ ERROR type mismatch
| ^^^
| |
| expected signature of `fn(usize) -> _`
error[E0631]: type mismatch in function arguments
--> $DIR/E0631.rs:20:5
|
-20 | bar(f);
+20 | bar(f); //~ ERROR type mismatch
| ^^^
| |
| expected signature of `fn(usize) -> _`
}
fn a() -> Foo {
- Some(Foo { bar: 1 })
+ Some(Foo { bar: 1 }) //~ ERROR mismatched types
}
fn a2() -> Foo {
- Ok(Foo { bar: 1})
+ Ok(Foo { bar: 1}) //~ ERROR mismatched types
}
fn b() -> Option<Foo> {
- Foo { bar: 1 }
+ Foo { bar: 1 } //~ ERROR mismatched types
}
fn c() -> Result<Foo, Bar> {
- Foo { bar: 1 }
+ Foo { bar: 1 } //~ ERROR mismatched types
}
fn d() -> X<X<String, String>, String> {
},
y: 3,
};
- x
+ x //~ ERROR mismatched types
}
fn e() -> X<X<String, String>, String> {
},
y: "".to_string(),
};
- x
+ x //~ ERROR mismatched types
}
fn main() {}
|
25 | fn a() -> Foo {
| --- expected `Foo` because of return type
-26 | Some(Foo { bar: 1 })
+26 | Some(Foo { bar: 1 }) //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option`
|
= note: expected type `Foo`
|
29 | fn a2() -> Foo {
| --- expected `Foo` because of return type
-30 | Ok(Foo { bar: 1})
+30 | Ok(Foo { bar: 1}) //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result`
|
= note: expected type `Foo`
|
33 | fn b() -> Option<Foo> {
| ----------- expected `std::option::Option<Foo>` because of return type
-34 | Foo { bar: 1 }
+34 | Foo { bar: 1 } //~ ERROR mismatched types
| ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo`
|
= note: expected type `std::option::Option<Foo>`
|
37 | fn c() -> Result<Foo, Bar> {
| ---------------- expected `std::result::Result<Foo, Bar>` because of return type
-38 | Foo { bar: 1 }
+38 | Foo { bar: 1 } //~ ERROR mismatched types
| ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo`
|
= note: expected type `std::result::Result<Foo, Bar>`
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
+49 | x //~ ERROR mismatched types
| ^ expected struct `std::string::String`, found integral variable
|
= note: expected type `X<X<_, std::string::String>, std::string::String>`
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
+60 | x //~ ERROR mismatched types
| ^ expected struct `std::string::String`, found integral variable
|
= note: expected type `X<X<_, std::string::String>, _>`
// except according to those terms.
fn main() {
- 1 + Some(1);
- 2 as usize - Some(1);
- 3 * ();
- 4 / "";
- 5 < String::new();
- 6 == Ok(1);
+ 1 + Some(1); //~ ERROR is not satisfied
+ 2 as usize - Some(1); //~ ERROR is not satisfied
+ 3 * (); //~ ERROR is not satisfied
+ 4 / ""; //~ ERROR is not satisfied
+ 5 < String::new(); //~ ERROR is not satisfied
+ 6 == Ok(1); //~ ERROR is not satisfied
}
error[E0277]: the trait bound `{integer}: std::ops::Add<std::option::Option<{integer}>>` is not satisfied
--> $DIR/binops.rs:12:7
|
-12 | 1 + Some(1);
+12 | 1 + Some(1); //~ ERROR is not satisfied
| ^ no implementation for `{integer} + std::option::Option<{integer}>`
|
= help: the trait `std::ops::Add<std::option::Option<{integer}>>` is not implemented for `{integer}`
error[E0277]: the trait bound `usize: std::ops::Sub<std::option::Option<{integer}>>` is not satisfied
--> $DIR/binops.rs:13:16
|
-13 | 2 as usize - Some(1);
+13 | 2 as usize - Some(1); //~ ERROR is not satisfied
| ^ no implementation for `usize - std::option::Option<{integer}>`
|
= help: the trait `std::ops::Sub<std::option::Option<{integer}>>` is not implemented for `usize`
error[E0277]: the trait bound `{integer}: std::ops::Mul<()>` is not satisfied
--> $DIR/binops.rs:14:7
|
-14 | 3 * ();
+14 | 3 * (); //~ ERROR is not satisfied
| ^ no implementation for `{integer} * ()`
|
= help: the trait `std::ops::Mul<()>` is not implemented for `{integer}`
error[E0277]: the trait bound `{integer}: std::ops::Div<&str>` is not satisfied
--> $DIR/binops.rs:15:7
|
-15 | 4 / "";
+15 | 4 / ""; //~ ERROR is not satisfied
| ^ no implementation for `{integer} / &str`
|
= help: the trait `std::ops::Div<&str>` is not implemented for `{integer}`
error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd<std::string::String>` is not satisfied
--> $DIR/binops.rs:16:7
|
-16 | 5 < String::new();
+16 | 5 < String::new(); //~ ERROR is not satisfied
| ^ can't compare `{integer}` with `std::string::String`
|
= help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}`
error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not satisfied
--> $DIR/binops.rs:17:7
|
-17 | 6 == Ok(1);
+17 | 6 == Ok(1); //~ ERROR is not satisfied
| ^^ can't compare `{integer}` with `std::result::Result<{integer}, _>`
|
= help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}`
fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V
{
- u as *const V
+ u as *const V //~ ERROR is invalid
}
fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str
{
- u as *const str
+ u as *const str //~ ERROR is invalid
}
trait Foo { fn foo(&self) {} }
let fat_sv : *const [i8] = unsafe { &*(0 as *const [i8; 1])};
let foo: &Foo = &f;
- let _ = v as &u8;
- let _ = v as E;
- let _ = v as fn();
- let _ = v as (u32,);
- let _ = Some(&v) as *const u8;
+ let _ = v as &u8; //~ ERROR non-primitive cast
+ let _ = v as E; //~ ERROR non-primitive cast
+ let _ = v as fn(); //~ ERROR non-primitive cast
+ let _ = v as (u32,); //~ ERROR non-primitive cast
+ let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast
- let _ = v as f32;
- let _ = main as f64;
- let _ = &v as usize;
- let _ = f as *const u8;
- let _ = 3_i32 as bool;
- let _ = E::A as bool;
- let _ = 0x61u32 as char;
+ let _ = v as f32; //~ ERROR is invalid
+ let _ = main as f64; //~ ERROR is invalid
+ let _ = &v as usize; //~ ERROR is invalid
+ let _ = f as *const u8; //~ ERROR is invalid
+ let _ = 3_i32 as bool; //~ ERROR cannot cast
+ let _ = E::A as bool; //~ ERROR cannot cast
+ let _ = 0x61u32 as char; //~ ERROR can be cast as
- let _ = false as f32;
- let _ = E::A as f32;
- let _ = 'a' as f32;
+ let _ = false as f32; //~ ERROR is invalid
+ let _ = E::A as f32; //~ ERROR is invalid
+ let _ = 'a' as f32; //~ ERROR is invalid
- let _ = false as *const u8;
- let _ = E::A as *const u8;
- let _ = 'a' as *const u8;
+ let _ = false as *const u8; //~ ERROR is invalid
+ let _ = E::A as *const u8; //~ ERROR is invalid
+ let _ = 'a' as *const u8; //~ ERROR is invalid
- let _ = 42usize as *const [u8];
- let _ = v as *const [u8];
- let _ = fat_v as *const Foo;
- let _ = foo as *const str;
- let _ = foo as *mut str;
- let _ = main as *mut str;
- let _ = &f as *mut f32;
- let _ = &f as *const f64;
- let _ = fat_sv as usize;
+ let _ = 42usize as *const [u8]; //~ ERROR is invalid
+ let _ = v as *const [u8]; //~ ERROR cannot cast
+ let _ = fat_v as *const Foo; //~ ERROR is not satisfied
+ let _ = foo as *const str; //~ ERROR is invalid
+ let _ = foo as *mut str; //~ ERROR is invalid
+ let _ = main as *mut str; //~ ERROR is invalid
+ let _ = &f as *mut f32; //~ ERROR is invalid
+ let _ = &f as *const f64; //~ ERROR is invalid
+ let _ = fat_sv as usize; //~ ERROR is invalid
let a : *const str = "hello";
- let _ = a as *const Foo;
+ let _ = a as *const Foo; //~ ERROR is not satisfied
// check no error cascade
- let _ = main.f as *const u32;
+ let _ = main.f as *const u32; //~ ERROR no field
let cf: *const Foo = &0;
- let _ = cf as *const [u16];
- let _ = cf as *const Bar;
+ let _ = cf as *const [u16]; //~ ERROR is invalid
+ let _ = cf as *const Bar; //~ ERROR is invalid
- vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>();
+ vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid
}
error[E0606]: casting `*const U` as `*const V` is invalid
--> $DIR/cast-rfc0401.rs:13:5
|
-13 | u as *const V
+13 | u as *const V //~ ERROR is invalid
| ^^^^^^^^^^^^^
|
= note: vtable kinds may not match
error[E0606]: casting `*const U` as `*const str` is invalid
--> $DIR/cast-rfc0401.rs:18:5
|
-18 | u as *const str
+18 | u as *const str //~ ERROR is invalid
| ^^^^^^^^^^^^^^^
|
= note: vtable kinds may not match
error[E0609]: no field `f` on type `fn() {main}`
--> $DIR/cast-rfc0401.rs:75:18
|
-75 | let _ = main.f as *const u32;
+75 | let _ = main.f as *const u32; //~ ERROR no field
| ^
error[E0605]: non-primitive cast: `*const u8` as `&u8`
--> $DIR/cast-rfc0401.rs:39:13
|
-39 | let _ = v as &u8;
+39 | let _ = v as &u8; //~ ERROR non-primitive cast
| ^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-primitive cast: `*const u8` as `E`
--> $DIR/cast-rfc0401.rs:40:13
|
-40 | let _ = v as E;
+40 | let _ = v as E; //~ ERROR non-primitive cast
| ^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-primitive cast: `*const u8` as `fn()`
--> $DIR/cast-rfc0401.rs:41:13
|
-41 | let _ = v as fn();
+41 | let _ = v as fn(); //~ ERROR non-primitive cast
| ^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-primitive cast: `*const u8` as `(u32,)`
--> $DIR/cast-rfc0401.rs:42:13
|
-42 | let _ = v as (u32,);
+42 | let _ = v as (u32,); //~ ERROR non-primitive cast
| ^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8`
--> $DIR/cast-rfc0401.rs:43:13
|
-43 | let _ = Some(&v) as *const u8;
+43 | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0606]: casting `*const u8` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:45:13
|
-45 | let _ = v as f32;
+45 | let _ = v as f32; //~ ERROR is invalid
| ^^^^^^^^
error[E0606]: casting `fn() {main}` as `f64` is invalid
--> $DIR/cast-rfc0401.rs:46:13
|
-46 | let _ = main as f64;
+46 | let _ = main as f64; //~ ERROR is invalid
| ^^^^^^^^^^^
error[E0606]: casting `&*const u8` as `usize` is invalid
--> $DIR/cast-rfc0401.rs:47:13
|
-47 | let _ = &v as usize;
+47 | let _ = &v as usize; //~ ERROR is invalid
| ^^^^^^^^^^^
|
= help: cast through a raw pointer first
error[E0606]: casting `f32` as `*const u8` is invalid
--> $DIR/cast-rfc0401.rs:48:13
|
-48 | let _ = f as *const u8;
+48 | let _ = f as *const u8; //~ ERROR is invalid
| ^^^^^^^^^^^^^^
error[E0054]: cannot cast as `bool`
--> $DIR/cast-rfc0401.rs:49:13
|
-49 | let _ = 3_i32 as bool;
+49 | let _ = 3_i32 as bool; //~ ERROR cannot cast
| ^^^^^^^^^^^^^ unsupported cast
|
= help: compare with zero instead
error[E0054]: cannot cast as `bool`
--> $DIR/cast-rfc0401.rs:50:13
|
-50 | let _ = E::A as bool;
+50 | let _ = E::A as bool; //~ ERROR cannot cast
| ^^^^^^^^^^^^ unsupported cast
|
= help: compare with zero instead
error[E0604]: only `u8` can be cast as `char`, not `u32`
--> $DIR/cast-rfc0401.rs:51:13
|
-51 | let _ = 0x61u32 as char;
+51 | let _ = 0x61u32 as char; //~ ERROR can be cast as
| ^^^^^^^^^^^^^^^
error[E0606]: casting `bool` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:53:13
|
-53 | let _ = false as f32;
+53 | let _ = false as f32; //~ ERROR is invalid
| ^^^^^^^^^^^^
|
= help: cast through an integer first
error[E0606]: casting `E` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:54:13
|
-54 | let _ = E::A as f32;
+54 | let _ = E::A as f32; //~ ERROR is invalid
| ^^^^^^^^^^^
|
= help: cast through an integer first
error[E0606]: casting `char` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:55:13
|
-55 | let _ = 'a' as f32;
+55 | let _ = 'a' as f32; //~ ERROR is invalid
| ^^^^^^^^^^
|
= help: cast through an integer first
error[E0606]: casting `bool` as `*const u8` is invalid
--> $DIR/cast-rfc0401.rs:57:13
|
-57 | let _ = false as *const u8;
+57 | let _ = false as *const u8; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^^
error[E0606]: casting `E` as `*const u8` is invalid
--> $DIR/cast-rfc0401.rs:58:13
|
-58 | let _ = E::A as *const u8;
+58 | let _ = E::A as *const u8; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^
error[E0606]: casting `char` as `*const u8` is invalid
--> $DIR/cast-rfc0401.rs:59:13
|
-59 | let _ = 'a' as *const u8;
+59 | let _ = 'a' as *const u8; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^
error[E0606]: casting `usize` as `*const [u8]` is invalid
--> $DIR/cast-rfc0401.rs:61:13
|
-61 | let _ = 42usize as *const [u8];
+61 | let _ = 42usize as *const [u8]; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]`
--> $DIR/cast-rfc0401.rs:62:13
|
-62 | let _ = v as *const [u8];
+62 | let _ = v as *const [u8]; //~ ERROR cannot cast
| ^^^^^^^^^^^^^^^^
error[E0606]: casting `&Foo` as `*const str` is invalid
--> $DIR/cast-rfc0401.rs:64:13
|
-64 | let _ = foo as *const str;
+64 | let _ = foo as *const str; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^
error[E0606]: casting `&Foo` as `*mut str` is invalid
--> $DIR/cast-rfc0401.rs:65:13
|
-65 | let _ = foo as *mut str;
+65 | let _ = foo as *mut str; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^
error[E0606]: casting `fn() {main}` as `*mut str` is invalid
--> $DIR/cast-rfc0401.rs:66:13
|
-66 | let _ = main as *mut str;
+66 | let _ = main as *mut str; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^
error[E0606]: casting `&f32` as `*mut f32` is invalid
--> $DIR/cast-rfc0401.rs:67:13
|
-67 | let _ = &f as *mut f32;
+67 | let _ = &f as *mut f32; //~ ERROR is invalid
| ^^^^^^^^^^^^^^
error[E0606]: casting `&f32` as `*const f64` is invalid
--> $DIR/cast-rfc0401.rs:68:13
|
-68 | let _ = &f as *const f64;
+68 | let _ = &f as *const f64; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^
error[E0606]: casting `*const [i8]` as `usize` is invalid
--> $DIR/cast-rfc0401.rs:69:13
|
-69 | let _ = fat_sv as usize;
+69 | let _ = fat_sv as usize; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^
|
= help: cast through a thin pointer first
error[E0606]: casting `*const Foo` as `*const [u16]` is invalid
--> $DIR/cast-rfc0401.rs:78:13
|
-78 | let _ = cf as *const [u16];
+78 | let _ = cf as *const [u16]; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^^^
|
= note: vtable kinds may not match
error[E0606]: casting `*const Foo` as `*const Bar` is invalid
--> $DIR/cast-rfc0401.rs:79:13
|
-79 | let _ = cf as *const Bar;
+79 | let _ = cf as *const Bar; //~ ERROR is invalid
| ^^^^^^^^^^^^^^^^
|
= note: vtable kinds may not match
error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
--> $DIR/cast-rfc0401.rs:63:13
|
-63 | let _ = fat_v as *const Foo;
+63 | let _ = fat_v as *const Foo; //~ ERROR is not satisfied
| ^^^^^ `[u8]` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
--> $DIR/cast-rfc0401.rs:72:13
|
-72 | let _ = a as *const Foo;
+72 | let _ = a as *const Foo; //~ ERROR is not satisfied
| ^ `str` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
error[E0606]: casting `&{float}` as `f32` is invalid
--> $DIR/cast-rfc0401.rs:81:30
|
-81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>();
+81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid
| ^^^^^^^^ cannot cast `&{float}` as `f32`
|
help: did you mean `*s`?
--> $DIR/cast-rfc0401.rs:81:30
|
-81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>();
+81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); //~ ERROR is invalid
| ^
error: aborting due to 34 previous errors
fn f<F: Fn<usize>>(_: F) {}
fn main() {
[1, 2, 3].sort_by(|| panic!());
+ //~^ ERROR closure is expected to take
[1, 2, 3].sort_by(|tuple| panic!());
+ //~^ ERROR closure is expected to take
[1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
+ //~^ ERROR closure is expected to take
f(|| panic!());
+ //~^ ERROR closure is expected to take
let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
+ //~^ ERROR closure is expected to take
let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
+ //~^ ERROR closure is expected to take
let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
+ //~^ ERROR closure is expected to take
}
| expected closure that takes 2 arguments
error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
- --> $DIR/closure-arg-count.rs:16:15
+ --> $DIR/closure-arg-count.rs:17:15
|
-16 | [1, 2, 3].sort_by(|tuple| panic!());
+17 | [1, 2, 3].sort_by(|tuple| panic!());
| ^^^^^^^ ------- takes 1 argument
| |
| expected closure that takes 2 arguments
error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument
- --> $DIR/closure-arg-count.rs:17:15
+ --> $DIR/closure-arg-count.rs:19:15
|
-17 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
+19 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
| ^^^^^^^ ----------------- takes 1 argument
| |
| expected closure that takes 2 arguments
error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
- --> $DIR/closure-arg-count.rs:18:5
+ --> $DIR/closure-arg-count.rs:21:5
|
-18 | f(|| panic!());
+21 | f(|| panic!());
| ^ -- takes 0 arguments
| |
| expected closure that takes 1 argument
= note: required by `f`
error[E0593]: closure is expected to take a single tuple as argument, but it takes 2 distinct arguments
- --> $DIR/closure-arg-count.rs:20:53
+ --> $DIR/closure-arg-count.rs:24:53
|
-20 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
+24 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
| ^^^ ------ help: consider changing the closure to accept a tuple: `|(i, x)|`
| |
| expected closure that takes a single tuple as argument
error[E0593]: closure is expected to take a single tuple as argument, but it takes 2 distinct arguments
- --> $DIR/closure-arg-count.rs:21:53
+ --> $DIR/closure-arg-count.rs:26:53
|
-21 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
+26 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
| ^^^ ------------- help: consider changing the closure to accept a tuple: `|(i, x): (usize, _)|`
| |
| expected closure that takes a single tuple as argument
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
- --> $DIR/closure-arg-count.rs:22:53
+ --> $DIR/closure-arg-count.rs:28:53
|
-22 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
+28 | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
| ^^^ --------- takes 3 distinct arguments
| |
| expected closure that takes a single 2-tuple as argument
fn main() {
let a = [(1u32, 2u32)];
- a.iter().map(|_: (u32, u32)| 45);
- a.iter().map(|_: &(u16, u16)| 45);
- a.iter().map(|_: (u16, u16)| 45);
+ a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch
+ a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch
+ a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch
}
fn baz<F: Fn(*mut &u32)>(_: F) {}
fn _test<'a>(f: fn(*mut &'a u32)) {
- baz(f);
+ baz(f); //~ ERROR type mismatch
+ //~^ ERROR type mismatch
}
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:13:14
|
-13 | a.iter().map(|_: (u32, u32)| 45);
+13 | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch
| ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
| |
| expected signature of `fn(&(u32, u32)) -> _`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:14:14
|
-14 | a.iter().map(|_: &(u16, u16)| 45);
+14 | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch
| ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
| |
| expected signature of `fn(&(u32, u32)) -> _`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-arg-type-mismatch.rs:15:14
|
-15 | a.iter().map(|_: (u16, u16)| 45);
+15 | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch
| ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
| |
| expected signature of `fn(&(u32, u32)) -> _`
error[E0631]: type mismatch in function arguments
--> $DIR/closure-arg-type-mismatch.rs:20:5
|
-20 | baz(f);
+20 | baz(f); //~ ERROR type mismatch
| ^^^
| |
| expected signature of `for<'r> fn(*mut &'r u32) -> _`
error[E0271]: type mismatch resolving `for<'r> <fn(*mut &'a u32) as std::ops::FnOnce<(*mut &'r u32,)>>::Output == ()`
--> $DIR/closure-arg-type-mismatch.rs:20:5
|
-20 | baz(f);
+20 | baz(f); //~ ERROR type mismatch
| ^^^ expected bound lifetime parameter, found concrete lifetime
|
= note: required by `baz`
fn baz<T: Foo>(_: T) {}
fn main() {
- baz(|_| ());
+ baz(|_| ()); //~ ERROR type mismatch
+ //~^ ERROR type mismatch
}
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:18:9: 18:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()`
--> $DIR/closure-mismatch.rs:18:5
|
-18 | baz(|_| ());
+18 | baz(|_| ()); //~ ERROR type mismatch
| ^^^ expected bound lifetime parameter, found concrete lifetime
|
= note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]`
error[E0631]: type mismatch in closure arguments
--> $DIR/closure-mismatch.rs:18:5
|
-18 | baz(|_| ());
+18 | baz(|_| ()); //~ ERROR type mismatch
| ^^^ ------ found signature of `fn(_) -> _`
| |
| expected signature of `for<'r> fn(&'r ()) -> _`
trait Foo {
fn f() -> u32;
- const fn g();
+ const fn g(); //~ ERROR cannot be declared const
}
impl Foo for u32 {
- const fn f() -> u32 { 22 }
+ const fn f() -> u32 { 22 } //~ ERROR cannot be declared const
fn g() {}
}
error[E0379]: trait fns cannot be declared const
--> $DIR/const-fn-in-trait.rs:17:5
|
-17 | const fn g();
+17 | const fn g(); //~ ERROR cannot be declared const
| ^^^^^ trait fns cannot be const
error[E0379]: trait fns cannot be declared const
--> $DIR/const-fn-in-trait.rs:21:5
|
-21 | const fn f() -> u32 { 22 }
+21 | const fn f() -> u32 { 22 } //~ ERROR cannot be declared const
| ^^^^^ trait fns cannot be const
error: aborting due to 2 previous errors
apply(&3, takes_imm);
apply(&3, takes_mut);
//~^ ERROR type mismatch
- //~| NOTE types differ in mutability
//~| NOTE required by `apply`
+ //~| NOTE expected signature
+ //~| NOTE found signature
apply(&mut 3, takes_mut);
apply(&mut 3, takes_imm);
//~^ ERROR type mismatch
- //~| NOTE types differ in mutability
//~| NOTE required by `apply`
+ //~| NOTE expected signature
+ //~| NOTE found signature
}
= note: required by `apply`
error[E0631]: type mismatch in function arguments
- --> $DIR/fn-variance-1.rs:27:5
+ --> $DIR/fn-variance-1.rs:28:5
|
-27 | apply(&mut 3, takes_imm);
+28 | apply(&mut 3, takes_imm);
| ^^^^^
| |
| expected signature of `fn(&mut {integer}) -> _`
t as *mut Trait
//~^ ERROR: mismatched types
//~| NOTE: expected type `()`
- //~| NOTE: found type `*mut Trait`
//~| NOTE: expected (), found *-ptr
}
const stdout: i32 = 1;
unsafe {
write(stdout, $arr.as_ptr() as *const i8,
- $arr.len() * size_of($arr[0]));
+ $arr.len() * size_of($arr[0])); //~ ERROR mismatched types
}
}}
}
macro_rules! cast {
- ($x:expr) => ($x as ())
+ ($x:expr) => ($x as ()) //~ ERROR non-primitive cast
}
fn main() {
error[E0308]: mismatched types
--> $DIR/issue-26480.rs:26:19
|
-26 | $arr.len() * size_of($arr[0]));
+26 | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
...
37 | write!(hello);
error[E0605]: non-primitive cast: `{integer}` as `()`
--> $DIR/issue-26480.rs:32:19
|
-32 | ($x:expr) => ($x as ())
+32 | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast
| ^^^^^^^^
...
38 | cast!(2);
impl<bool> Parser<bool> for bool {
fn parse(text: &str) -> Option<bool> {
- Some(true)
+ Some(true) //~ ERROR mismatched types
}
}
error[E0308]: mismatched types
--> $DIR/issue-35030.rs:19:14
|
-19 | Some(true)
+19 | Some(true) //~ ERROR mismatched types
| ^^^^ expected type parameter, found bool
|
= note: expected type `bool` (type parameter)
fn main() {
once::<&str>("str").fuse().filter(|a: &str| true).count();
//~^ ERROR no method named `count`
- //~| ERROR E0281
- //~| ERROR E0281
- //~| NOTE expected &str, found str
- //~| NOTE expected &str, found str
- //~| NOTE implements
- //~| NOTE implements
- //~| NOTE requires
- //~| NOTE requires
+ //~| ERROR type mismatch in closure arguments
//~| NOTE the method `count` exists but the following trait bounds
+ //~| NOTE expected signature
+ //~| NOTE found signature
}
struct Foo {
}
-fn foo(&foo: Foo) {
+fn foo(&foo: Foo) { //~ ERROR mismatched types
}
fn bar(foo: Foo) {
// The somewhat unexpected help message in this case is courtesy of
// match_default_bindings.
-fn agh(&&bar: &u32) {
+fn agh(&&bar: &u32) { //~ ERROR mismatched types
}
-fn bgh(&&bar: u32) {
+fn bgh(&&bar: u32) { //~ ERROR mismatched types
}
-fn ugh(&[bar]: &u32) {
+fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice
}
fn main() {}
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:16:8
|
-16 | fn foo(&foo: Foo) {
+16 | fn foo(&foo: Foo) { //~ ERROR mismatched types
| ^^^^ expected struct `Foo`, found reference
|
= note: expected type `Foo`
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:30:9
|
-30 | fn agh(&&bar: &u32) {
+30 | fn agh(&&bar: &u32) { //~ ERROR mismatched types
| ^^^^ expected u32, found reference
|
= note: expected type `u32`
error[E0308]: mismatched types
--> $DIR/issue-38371.rs:33:8
|
-33 | fn bgh(&&bar: u32) {
+33 | fn bgh(&&bar: u32) { //~ ERROR mismatched types
| ^^^^^ expected u32, found reference
|
= note: expected type `u32`
error[E0529]: expected an array or slice, found `u32`
--> $DIR/issue-38371.rs:36:9
|
-36 | fn ugh(&[bar]: &u32) {
+36 | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice
| ^^^^^ pattern cannot match with input type `u32`
error: aborting due to 4 previous errors
// except according to those terms.
fn main() {
- let x: u32 = (
+ let x: u32 = ( //~ ERROR mismatched types
);
}
error[E0308]: mismatched types
--> $DIR/main.rs:12:18
|
-12 | let x: u32 = (
+12 | let x: u32 = ( //~ ERROR mismatched types
| __________________^
13 | | );
| |_____^ expected u32, found ()
let ans = s("what"); //~ ERROR mismatched types
//~^ NOTE expected isize, found reference
//~| NOTE expected type
- //~| NOTE found type
let ans = s();
//~^ ERROR this function takes 1 parameter but 0 parameters were supplied
//~| NOTE expected 1 parameter
found type `&'static str`
error[E0057]: this function takes 1 parameter but 0 parameters were supplied
- --> $DIR/overloaded-calls-bad.rs:42:15
+ --> $DIR/overloaded-calls-bad.rs:41:15
|
-42 | let ans = s();
+41 | let ans = s();
| ^^^ expected 1 parameter
error[E0057]: this function takes 1 parameter but 2 parameters were supplied
- --> $DIR/overloaded-calls-bad.rs:45:17
+ --> $DIR/overloaded-calls-bad.rs:44:17
|
-45 | let ans = s("burma", "shave");
+44 | let ans = s("burma", "shave");
| ^^^^^^^^^^^^^^^^ expected 1 parameter
error: aborting due to 3 previous errors
fn d(x: Box<Foo>) {
a(x); //~ ERROR mismatched types [E0308]
- //~| NOTE expected type `Box<Foo + std::marker::Send + 'static>`
- //~| NOTE found type `Box<Foo + 'static>`
+ //~| NOTE expected type `std::boxed::Box<Foo + std::marker::Send + 'static>`
//~| NOTE expected trait `Foo + std::marker::Send`, found trait `Foo`
}
struct Bar;
impl Foo for Bar {
- fn foo(x: i16) { }
- fn bar(&mut self, bar: &Bar) { }
+ fn foo(x: i16) { } //~ ERROR incompatible type
+ fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type
}
fn main() {
14 | fn foo(x: u16);
| --- type in trait
...
-21 | fn foo(x: i16) { }
+21 | fn foo(x: i16) { } //~ ERROR incompatible type
| ^^^ expected u16, found i16
|
= note: expected type `fn(u16)`
15 | fn bar(&mut self, bar: &mut Bar);
| -------- type in trait
...
-22 | fn bar(&mut self, bar: &Bar) { }
+22 | fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type
| ^^^^ types differ in mutability
|
= note: expected type `fn(&mut Bar, &mut Bar)`
pub fn main() {
let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
- //~^ NOTE implements
- //~| NOTE implements
+ //~^ NOTE found signature of `fn(usize, isize)
let z = call_it(3, f);
//~^ ERROR type mismatch
- //~| NOTE expected isize, found usize
- //~| NOTE expected isize, found usize
- //~| NOTE requires
- //~| NOTE requires
- //~| NOTE required by `call_it`
- //~| NOTE required by `call_it`
+ //~| NOTE expected signature of `fn(isize, isize)
+ //~| required by `call_it`
println!("{}", z);
}
error[E0631]: type mismatch in closure arguments
- --> $DIR/unboxed-closures-vtable-mismatch.rs:25:13
+ --> $DIR/unboxed-closures-vtable-mismatch.rs:24:13
|
22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
| -------------------------------------------------- found signature of `fn(usize, isize) -> _`
-...
-25 | let z = call_it(3, f);
+23 | //~^ NOTE found signature of `fn(usize, isize)
+24 | let z = call_it(3, f);
| ^^^^^^^ expected signature of `fn(isize, isize) -> _`
|
= note: required by `call_it`
}
fn test(proto: P) {
- match proto {
+ match proto { //~ ERROR non-exhaustive patterns
P::C(PC::Q) => (),
}
}
error[E0004]: non-exhaustive patterns: `C(QA)` not covered
--> $DIR/issue-40221.rs:21:11
|
-21 | match proto {
+21 | match proto { //~ ERROR non-exhaustive patterns
| ^^^^^ pattern `C(QA)` not covered
error: aborting due to previous error
struct X {
}
-impl m1::X for X {
+impl m1::X for X { //~ ERROR not all trait items implemented
}
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
--> $DIR/m2.rs:19:1
|
-19 | / impl m1::X for X {
+19 | / impl m1::X for X { //~ ERROR not all trait items implemented
20 | | }
| |_^ missing `CONSTANT`, `Type`, `method` in implementation
|
fn foo<X>() { }
fn main() {
- foo();
+ foo(); //~ ERROR type annotations needed
}
error[E0282]: type annotations needed
--> $DIR/missing-type-parameter.rs:14:5
|
-14 | foo();
+14 | foo(); //~ ERROR type annotations needed
| ^^^ cannot infer type for `X`
error: aborting due to previous error
// compile-flags: -Z parse-only
fn main() {
- let mut ref x = 10;
+ let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect
let ref mut y = 11;
}
error: the order of `mut` and `ref` is incorrect
--> $DIR/mut-ref.rs:14:9
|
-14 | let mut ref x = 10;
+14 | let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect
| ^^^^^^^ help: try switching the order: `ref mut`
error: aborting due to previous error
}
None => {
map.set(String::new()); // Just AST errors here
+ //~^ ERROR borrowed as immutable (Ast)
}
}
}
match map.get() {
Some(v) => {
map.set(String::new()); // Both AST and MIR error here
+ //~^ ERROR borrowed as immutable (Mir)
+ //~| ERROR borrowed as immutable (Ast)
return v;
}
None => {
map.set(String::new()); // Just AST errors here
+ //~^ ERROR borrowed as immutable (Ast)
}
}
}
33 | map.set(String::new()); // Just AST errors here
| ^^^ mutable borrow occurs here
...
-37 | }
+38 | }
| - immutable borrow ends here
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
- --> $DIR/get_default.rs:43:17
+ --> $DIR/get_default.rs:44:17
|
-41 | match map.get() {
+42 | match map.get() {
| --- immutable borrow occurs here
-42 | Some(v) => {
-43 | map.set(String::new()); // Both AST and MIR error here
+43 | Some(v) => {
+44 | map.set(String::new()); // Both AST and MIR error here
| ^^^ mutable borrow occurs here
...
-51 | }
+55 | }
| - immutable borrow ends here
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
- --> $DIR/get_default.rs:47:17
+ --> $DIR/get_default.rs:50:17
|
-41 | match map.get() {
+42 | match map.get() {
| --- immutable borrow occurs here
...
-47 | map.set(String::new()); // Just AST errors here
+50 | map.set(String::new()); // Just AST errors here
| ^^^ mutable borrow occurs here
...
-51 | }
+55 | }
| - immutable borrow ends here
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
- --> $DIR/get_default.rs:43:17
+ --> $DIR/get_default.rs:44:17
|
-41 | match map.get() {
+42 | match map.get() {
| --- immutable borrow occurs here
-42 | Some(v) => {
-43 | map.set(String::new()); // Both AST and MIR error here
+43 | Some(v) => {
+44 | map.set(String::new()); // Both AST and MIR error here
| ^^^ mutable borrow occurs here
error: aborting due to 4 previous errors
// compile-flags:-Znll
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
- &*x
+ &*x //~ ERROR free region `'a` does not outlive `'b`
+ //~^ ERROR `*x` does not live long enough
+ //~| WARN not reporting region error due to -Znll
}
fn main() { }
warning: not reporting region error due to -Znll
--> $DIR/named-region-basic.rs:19:5
|
-19 | &*x
+19 | &*x //~ ERROR free region `'a` does not outlive `'b`
| ^^^
error[E0597]: `*x` does not live long enough
--> $DIR/named-region-basic.rs:19:6
|
-19 | &*x
+19 | &*x //~ ERROR free region `'a` does not outlive `'b`
| ^^ does not live long enough
|
= note: borrowed value must be valid for the static lifetime...
--> $DIR/named-region-basic.rs:18:1
|
18 | / fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
-19 | | &*x
-20 | | }
+19 | | &*x //~ ERROR free region `'a` does not outlive `'b`
+20 | | //~^ ERROR `*x` does not live long enough
+21 | | //~| WARN not reporting region error due to -Znll
+22 | | }
| |_^
error: free region `'a` does not outlive `'b`
--> $DIR/named-region-basic.rs:19:5
|
-19 | &*x
+19 | &*x //~ ERROR free region `'a` does not outlive `'b`
| ^^^
error: aborting due to 2 previous errors
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
}
-#[rustc_on_unimplemented] //~ ERROR this attribute must have a value
+#[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value
trait BadAnnotation1
{}
{}
#[rustc_on_unimplemented(lorem="")]
+//~^ this attribute must have a valid
trait BadAnnotation4 {}
#[rustc_on_unimplemented(lorem(ipsum(dolor)))]
+//~^ this attribute must have a valid
trait BadAnnotation5 {}
#[rustc_on_unimplemented(message="x", message="y")]
+//~^ this attribute must have a valid
trait BadAnnotation6 {}
#[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
+//~^ this attribute must have a valid
trait BadAnnotation7 {}
#[rustc_on_unimplemented(on(), message="y")]
+//~^ empty `on`-clause
trait BadAnnotation8 {}
#[rustc_on_unimplemented(on="x", message="y")]
+//~^ this attribute must have a valid
trait BadAnnotation9 {}
#[rustc_on_unimplemented(on(x="y"), message="y")]
trait BadAnnotation10 {}
#[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
+//~^ this attribute must have a valid
trait BadAnnotation11 {}
pub fn main() {
error[E0232]: `#[rustc_on_unimplemented]` requires a value
--> $DIR/bad-annotation.rs:26:1
|
-26 | #[rustc_on_unimplemented] //~ ERROR this attribute must have a value
+26 | #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value
| ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
= note: eg `#[rustc_on_unimplemented = "foo"]`
error[E0232]: this attribute must have a valid value
- --> $DIR/bad-annotation.rs:43:26
+ --> $DIR/bad-annotation.rs:44:26
|
-43 | #[rustc_on_unimplemented(lorem(ipsum(dolor)))]
+44 | #[rustc_on_unimplemented(lorem(ipsum(dolor)))]
| ^^^^^^^^^^^^^^^^^^^ expected value here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
error[E0232]: this attribute must have a valid value
- --> $DIR/bad-annotation.rs:46:39
+ --> $DIR/bad-annotation.rs:48:39
|
-46 | #[rustc_on_unimplemented(message="x", message="y")]
+48 | #[rustc_on_unimplemented(message="x", message="y")]
| ^^^^^^^^^^^ expected value here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
error[E0232]: this attribute must have a valid value
- --> $DIR/bad-annotation.rs:49:39
+ --> $DIR/bad-annotation.rs:52:39
|
-49 | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
+52 | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
error[E0232]: empty `on`-clause in `#[rustc_on_unimplemented]`
- --> $DIR/bad-annotation.rs:52:26
+ --> $DIR/bad-annotation.rs:56:26
|
-52 | #[rustc_on_unimplemented(on(), message="y")]
+56 | #[rustc_on_unimplemented(on(), message="y")]
| ^^^^ empty on-clause here
error[E0232]: this attribute must have a valid value
- --> $DIR/bad-annotation.rs:55:26
+ --> $DIR/bad-annotation.rs:60:26
|
-55 | #[rustc_on_unimplemented(on="x", message="y")]
+60 | #[rustc_on_unimplemented(on="x", message="y")]
| ^^^^^^ expected value here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
error[E0232]: this attribute must have a valid value
- --> $DIR/bad-annotation.rs:61:40
+ --> $DIR/bad-annotation.rs:67:40
|
-61 | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
+67 | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here
|
= note: eg `#[rustc_on_unimplemented = "foo"]`
#![feature(pub_restricted)]
-pub(crate) () fn foo() {}
+pub(crate) () fn foo() {} //~ unmatched visibility
error: unmatched visibility `pub`
--> $DIR/pub-restricted-error-fn.rs:13:10
|
-13 | pub(crate) () fn foo() {}
+13 | pub(crate) () fn foo() {} //~ unmatched visibility
| ^
error: aborting due to previous error
struct Bar(pub(()));
struct Foo {
- pub(crate) () foo: usize,
+ pub(crate) () foo: usize, //~ ERROR expected identifier
}
error: expected identifier, found `(`
--> $DIR/pub-restricted-error.rs:16:16
|
-16 | pub(crate) () foo: usize,
+16 | pub(crate) () foo: usize, //~ ERROR expected identifier
| ^
error: aborting due to previous error
#![feature(pub_restricted)]
-pub (.) fn afn() {}
+pub (.) fn afn() {} //~ ERROR expected identifier
fn main() {}
error: expected identifier, found `.`
--> $DIR/pub-restricted-non-path.rs:13:6
|
-13 | pub (.) fn afn() {}
+13 | pub (.) fn afn() {} //~ ERROR expected identifier
| ^
error: aborting due to previous error
mod a {}
-pub (a) fn afn() {}
-pub (b) fn bfn() {}
+pub (a) fn afn() {} //~ incorrect visibility restriction
+pub (b) fn bfn() {} //~ incorrect visibility restriction
pub fn privfn() {}
mod x {
mod y {
pub (super) s: usize,
valid_private: usize,
pub (in y) valid_in_x: usize,
- pub (a) invalid: usize,
- pub (in x) non_parent_invalid: usize,
+ pub (a) invalid: usize, //~ incorrect visibility restriction
+ pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted
}
}
// test multichar names
mod xyz {}
-pub (xyz) fn xyz() {}
+pub (xyz) fn xyz() {} //~ incorrect visibility restriction
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:15:6
|
-15 | pub (a) fn afn() {}
+15 | pub (a) fn afn() {} //~ incorrect visibility restriction
| ^ help: make this visible only to module `a` with `in`: `in a`
|
= help: some possible visibility restrictions are:
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:16:6
|
-16 | pub (b) fn bfn() {}
+16 | pub (b) fn bfn() {} //~ incorrect visibility restriction
| ^ help: make this visible only to module `b` with `in`: `in b`
|
= help: some possible visibility restrictions are:
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:32:14
|
-32 | pub (a) invalid: usize,
+32 | pub (a) invalid: usize, //~ incorrect visibility restriction
| ^ help: make this visible only to module `a` with `in`: `in a`
|
= help: some possible visibility restrictions are:
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:41:6
|
-41 | pub (xyz) fn xyz() {}
+41 | pub (xyz) fn xyz() {} //~ incorrect visibility restriction
| ^^^ help: make this visible only to module `xyz` with `in`: `in xyz`
|
= help: some possible visibility restrictions are:
error: visibilities can only be restricted to ancestor modules
--> $DIR/pub-restricted.rs:33:17
|
-33 | pub (in x) non_parent_invalid: usize,
+33 | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted
| ^
error: aborting due to 5 previous errors
}
fn main() {
- let x = Foo + return;
+ let x = Foo + return; //~ ERROR unreachable
}
error: unreachable expression
--> $DIR/expr_add.rs:27:13
|
-27 | let x = Foo + return;
+27 | let x = Foo + return; //~ ERROR unreachable
| ^^^^^^^^^^^^
|
note: lint level defined here
fn a() {
// the `22` is unreachable:
- let x: [usize; 2] = [return, 22];
+ let x: [usize; 2] = [return, 22]; //~ ERROR unreachable
}
fn b() {
// the `array is unreachable:
- let x: [usize; 2] = [22, return];
+ let x: [usize; 2] = [22, return]; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_array.rs:20:34
|
-20 | let x: [usize; 2] = [return, 22];
+20 | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable
| ^^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_array.rs:25:25
|
-25 | let x: [usize; 2] = [22, return];
+25 | let x: [usize; 2] = [22, return]; //~ ERROR unreachable
| ^^^^^^^^^^^^
error: aborting due to 2 previous errors
fn foo() {
// No error here.
let x;
- x = return;
+ x = return; //~ ERROR unreachable
}
fn bar() {
// Here we consider the `return` unreachable because
// "evaluating" the `*p` has type `!`. This is somewhat
// dubious, I suppose.
- *p = return;
+ *p = return; //~ ERROR unreachable
}
}
fn baz() {
let mut i = 0;
- *{return; &mut i} = 22;
+ *{return; &mut i} = 22; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_assign.rs:20:5
|
-20 | x = return;
+20 | x = return; //~ ERROR unreachable
| ^^^^^^^^^^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_assign.rs:30:14
|
-30 | *p = return;
+30 | *p = return; //~ ERROR unreachable
| ^^^^^^
error: unreachable expression
--> $DIR/expr_assign.rs:36:15
|
-36 | *{return; &mut i} = 22;
+36 | *{return; &mut i} = 22; //~ ERROR unreachable
| ^^^^^^
error: aborting due to 3 previous errors
// Here the tail expression is considered unreachable:
let x = {
return;
- 22
+ 22 //~ ERROR unreachable
};
}
error: unreachable expression
--> $DIR/expr_block.rs:21:9
|
-21 | 22
+21 | 22 //~ ERROR unreachable
| ^^
|
note: lint level defined here
#![deny(unreachable_code)]
fn main() {
- let x = box return;
+ let x = box return; //~ ERROR unreachable
println!("hi");
}
error: unreachable expression
--> $DIR/expr_box.rs:16:13
|
-16 | let x = box return;
+16 | let x = box return; //~ ERROR unreachable
| ^^^^^^^^^^
|
note: lint level defined here
fn a() {
// the `22` is unreachable:
- foo(return, 22);
+ foo(return, 22); //~ ERROR unreachable
}
fn b() {
// the call is unreachable:
- bar(return);
+ bar(return); //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_call.rs:23:17
|
-23 | foo(return, 22);
+23 | foo(return, 22); //~ ERROR unreachable
| ^^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_call.rs:28:5
|
-28 | bar(return);
+28 | bar(return); //~ ERROR unreachable
| ^^^^^^^^^^^
error: aborting due to 2 previous errors
fn a() {
// the cast is unreachable:
- let x = {return} as !;
+ let x = {return} as !; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_cast.rs:20:13
|
-20 | let x = {return} as !;
+20 | let x = {return} as !; //~ ERROR unreachable
| ^^^^^^^^^^^^^
|
note: lint level defined here
fn a() {
// The match is considered unreachable here, because the `return`
// diverges:
- match {return} { }
+ match {return} { } //~ ERROR unreachable
}
fn b() {
error: unreachable expression
--> $DIR/expr_match.rs:20:5
|
-20 | match {return} { }
+20 | match {return} { } //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
fn a() {
// the `22` is unreachable:
- Foo.foo(return, 22);
+ Foo.foo(return, 22); //~ ERROR unreachable
}
fn b() {
// the call is unreachable:
- Foo.bar(return);
+ Foo.bar(return); //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_method.rs:26:21
|
-26 | Foo.foo(return, 22);
+26 | Foo.foo(return, 22); //~ ERROR unreachable
| ^^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_method.rs:31:5
|
-31 | Foo.bar(return);
+31 | Foo.bar(return); //~ ERROR unreachable
| ^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
fn a() {
// the repeat is unreachable:
- let x: [usize; 2] = [return; 2];
+ let x: [usize; 2] = [return; 2]; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_repeat.rs:20:25
|
-20 | let x: [usize; 2] = [return; 2];
+20 | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable
| ^^^^^^^^^^^
|
note: lint level defined here
fn a() {
// Here we issue that the "2nd-innermost" return is unreachable,
// but we stop there.
- let x = {return {return {return;}}};
+ let x = {return {return {return;}}}; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_return.rs:21:22
|
-21 | let x = {return {return {return;}}};
+21 | let x = {return {return {return;}}}; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^
|
note: lint level defined here
fn a() {
// struct expr is unreachable:
- let x = Foo { a: 22, b: 33, ..return };
+ let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable
}
fn b() {
// the `33` is unreachable:
- let x = Foo { a: return, b: 33, ..return };
+ let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable
}
fn c() {
// the `..return` is unreachable:
- let x = Foo { a: 22, b: return, ..return };
+ let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable
}
fn d() {
// the struct expr is unreachable:
- let x = Foo { a: 22, b: return };
+ let x = Foo { a: 22, b: return }; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_struct.rs:25:13
|
-25 | let x = Foo { a: 22, b: 33, ..return };
+25 | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_struct.rs:30:33
|
-30 | let x = Foo { a: return, b: 33, ..return };
+30 | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable
| ^^
error: unreachable expression
--> $DIR/expr_struct.rs:35:39
|
-35 | let x = Foo { a: 22, b: return, ..return };
+35 | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable
| ^^^^^^
error: unreachable expression
--> $DIR/expr_struct.rs:40:13
|
-40 | let x = Foo { a: 22, b: return };
+40 | let x = Foo { a: 22, b: return }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
fn a() {
// the `2` is unreachable:
- let x: (usize, usize) = (return, 2);
+ let x: (usize, usize) = (return, 2); //~ ERROR unreachable
}
fn b() {
// the tuple is unreachable:
- let x: (usize, usize) = (2, return);
+ let x: (usize, usize) = (2, return); //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_tup.rs:20:38
|
-20 | let x: (usize, usize) = (return, 2);
+20 | let x: (usize, usize) = (return, 2); //~ ERROR unreachable
| ^
|
note: lint level defined here
error: unreachable expression
--> $DIR/expr_tup.rs:25:29
|
-25 | let x: (usize, usize) = (2, return);
+25 | let x: (usize, usize) = (2, return); //~ ERROR unreachable
| ^^^^^^^^^^^
error: aborting due to 2 previous errors
fn a() {
// the cast is unreachable:
- let x = {return}: !;
+ let x = {return}: !; //~ ERROR unreachable
}
fn main() { }
error: unreachable expression
--> $DIR/expr_type.rs:20:13
|
-20 | let x = {return}: !;
+20 | let x = {return}: !; //~ ERROR unreachable
| ^^^^^^^^^^^
|
note: lint level defined here
#![feature(never_type)]
fn foo() {
- let x: ! = ! { return; 22 };
+ let x: ! = ! { return; 22 }; //~ ERROR unreachable
+ //~^ ERROR cannot apply unary operator `!` to type `!`
}
fn main() { }
error: unreachable expression
--> $DIR/expr_unary.rs:18:28
|
-18 | let x: ! = ! { return; 22 };
+18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
| ^^
|
note: lint level defined here
error[E0600]: cannot apply unary operator `!` to type `!`
--> $DIR/expr_unary.rs:18:16
|
-18 | let x: ! = ! { return; 22 };
+18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
| ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
fn main() {
let _ = namespaced_enums::A;
- //~^ ERROR unresolved value `namespaced_enums::A`
- //~| HELP you can import it into scope: `use namespaced_enums::Foo::A;`
+ //~^ ERROR cannot find value `A`
let _ = namespaced_enums::B(10);
- //~^ ERROR unresolved function `namespaced_enums::B`
- //~| HELP you can import it into scope: `use namespaced_enums::Foo::B;`
+ //~^ ERROR cannot find function `B`
let _ = namespaced_enums::C { a: 10 };
- //~^ ERROR unresolved struct, variant or union type `namespaced_enums::C`
- //~| HELP you can import it into scope: `use namespaced_enums::Foo::C;`
+ //~^ ERROR cannot find struct, variant or union type `C`
}
|
error[E0425]: cannot find function `B` in module `namespaced_enums`
- --> $DIR/enums-are-namespaced-xc.rs:18:31
+ --> $DIR/enums-are-namespaced-xc.rs:17:31
|
-18 | let _ = namespaced_enums::B(10);
+17 | let _ = namespaced_enums::B(10);
| ^ not found in `namespaced_enums`
help: possible candidate is found in another module, you can import it into scope
|
|
error[E0422]: cannot find struct, variant or union type `C` in module `namespaced_enums`
- --> $DIR/enums-are-namespaced-xc.rs:21:31
+ --> $DIR/enums-are-namespaced-xc.rs:19:31
|
-21 | let _ = namespaced_enums::C { a: 10 };
+19 | let _ = namespaced_enums::C { a: 10 };
| ^ not found in `namespaced_enums`
help: possible candidate is found in another module, you can import it into scope
|
impl Foo for *const BarTy {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
a;
- //~^ ERROR unresolved value `a`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `a`
+ //~| NOTE not found in this scope
}
}
impl<'a> Foo for &'a BarTy {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
x;
- //~^ ERROR unresolved value `x`
- //~| NOTE did you mean `self.x`?
+ //~^ ERROR cannot find value `x`
y;
- //~^ ERROR unresolved value `y`
- //~| NOTE did you mean `self.y`?
+ //~^ ERROR cannot find value `y`
a;
- //~^ ERROR unresolved value `a`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `a`
+ //~| NOTE not found in this scope
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
b;
- //~^ ERROR unresolved value `b`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `b`
+ //~| NOTE not found in this scope
}
}
impl<'a> Foo for &'a mut BarTy {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
x;
- //~^ ERROR unresolved value `x`
- //~| NOTE did you mean `self.x`?
+ //~^ ERROR cannot find value `x`
y;
- //~^ ERROR unresolved value `y`
- //~| NOTE did you mean `self.y`?
+ //~^ ERROR cannot find value `y`
a;
- //~^ ERROR unresolved value `a`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `a`
+ //~| NOTE not found in this scope
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
b;
- //~^ ERROR unresolved value `b`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `b`
+ //~| NOTE not found in this scope
}
}
impl Foo for Box<BarTy> {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
}
}
impl Foo for *const isize {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
}
}
impl<'a> Foo for &'a isize {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
}
}
impl<'a> Foo for &'a mut isize {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
}
}
impl Foo for Box<isize> {
fn bar(&self) {
baz();
- //~^ ERROR unresolved function `baz`
- //~| NOTE did you mean `self.baz(...)`?
+ //~^ ERROR cannot find function `baz`
bah;
- //~^ ERROR unresolved value `bah`
- //~| NOTE did you mean `Self::bah`?
+ //~^ ERROR cannot find value `bah`
}
}
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `a` in this scope
- --> $DIR/issue-14254.rs:32:9
+ --> $DIR/issue-14254.rs:31:9
|
-32 | a;
+31 | a;
| ^ not found in this scope
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:40:9
+ --> $DIR/issue-14254.rs:39:9
|
-40 | baz();
+39 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `x` in this scope
- --> $DIR/issue-14254.rs:43:9
+ --> $DIR/issue-14254.rs:41:9
|
-43 | x;
+41 | x;
| ^ help: try: `self.x`
error[E0425]: cannot find value `y` in this scope
- --> $DIR/issue-14254.rs:46:9
+ --> $DIR/issue-14254.rs:43:9
|
-46 | y;
+43 | y;
| ^ help: try: `self.y`
error[E0425]: cannot find value `a` in this scope
- --> $DIR/issue-14254.rs:49:9
+ --> $DIR/issue-14254.rs:45:9
|
-49 | a;
+45 | a;
| ^ not found in this scope
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:52:9
+ --> $DIR/issue-14254.rs:48:9
|
-52 | bah;
+48 | bah;
| ^^^ help: try: `Self::bah`
error[E0425]: cannot find value `b` in this scope
- --> $DIR/issue-14254.rs:55:9
+ --> $DIR/issue-14254.rs:50:9
|
-55 | b;
+50 | b;
| ^ not found in this scope
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:63:9
+ --> $DIR/issue-14254.rs:58:9
|
-63 | baz();
+58 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `x` in this scope
- --> $DIR/issue-14254.rs:66:9
+ --> $DIR/issue-14254.rs:60:9
|
-66 | x;
+60 | x;
| ^ help: try: `self.x`
error[E0425]: cannot find value `y` in this scope
- --> $DIR/issue-14254.rs:69:9
+ --> $DIR/issue-14254.rs:62:9
|
-69 | y;
+62 | y;
| ^ help: try: `self.y`
error[E0425]: cannot find value `a` in this scope
- --> $DIR/issue-14254.rs:72:9
+ --> $DIR/issue-14254.rs:64:9
|
-72 | a;
+64 | a;
| ^ not found in this scope
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:75:9
+ --> $DIR/issue-14254.rs:67:9
|
-75 | bah;
+67 | bah;
| ^^^ help: try: `Self::bah`
error[E0425]: cannot find value `b` in this scope
- --> $DIR/issue-14254.rs:78:9
+ --> $DIR/issue-14254.rs:69:9
|
-78 | b;
+69 | b;
| ^ not found in this scope
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:86:9
+ --> $DIR/issue-14254.rs:77:9
|
-86 | baz();
+77 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:89:9
+ --> $DIR/issue-14254.rs:79:9
|
-89 | bah;
+79 | bah;
| ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:97:9
+ --> $DIR/issue-14254.rs:86:9
|
-97 | baz();
+86 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:100:9
- |
-100 | bah;
- | ^^^ help: try: `Self::bah`
+ --> $DIR/issue-14254.rs:88:9
+ |
+88 | bah;
+ | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:108:9
- |
-108 | baz();
- | ^^^ help: try: `self.baz`
+ --> $DIR/issue-14254.rs:95:9
+ |
+95 | baz();
+ | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:111:9
- |
-111 | bah;
- | ^^^ help: try: `Self::bah`
+ --> $DIR/issue-14254.rs:97:9
+ |
+97 | bah;
+ | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:119:9
+ --> $DIR/issue-14254.rs:104:9
|
-119 | baz();
+104 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:122:9
+ --> $DIR/issue-14254.rs:106:9
|
-122 | bah;
+106 | bah;
| ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope
- --> $DIR/issue-14254.rs:130:9
+ --> $DIR/issue-14254.rs:113:9
|
-130 | baz();
+113 | baz();
| ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope
- --> $DIR/issue-14254.rs:133:9
+ --> $DIR/issue-14254.rs:115:9
|
-133 | bah;
+115 | bah;
| ^^^ help: try: `Self::bah`
error[E0601]: main function not found
pub fn new() -> GslResult {
Result {
//~^ ERROR expected struct, variant or union type, found enum `Result`
-//~| HELP possible better candidates are found in other modules, you can import them into scope
-//~| HELP std::fmt::Result
-//~| HELP std::io::Result
-//~| HELP std::thread::Result
val: 0f64,
err: 0f64
}
// except according to those terms.
enum SomeEnum {
+//~^ HELP you can import it into scope
E
}
fn main() {
- E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E`
- //~^ HELP you can import it into scope: `use SomeEnum::E;`
+ E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E`
}
error[E0422]: cannot find struct, variant or union type `E` in this scope
- --> $DIR/issue-17518.rs:16:5
+ --> $DIR/issue-17518.rs:17:5
|
-16 | E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E`
+17 | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E`
| ^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
// help: `std::ops::Mul`
impl Mul for Foo {
-//~^ ERROR unresolved trait `Mul`
-//~| HELP possible candidates are found in other modules, you can import them into scope
-//~| HELP `mul1::Mul`
-//~| HELP `mul2::Mul`
-//~| HELP `std::ops::Mul`
+//~^ ERROR cannot find trait `Mul`
}
// BEFORE, we got:
// help: `mul4::Mul`
// help: and 2 other candidates
fn getMul() -> Mul {
-//~^ ERROR unresolved type `Mul`
-//~| HELP possible candidates are found in other modules, you can import them into scope
-//~| HELP `mul1::Mul`
-//~| HELP `mul2::Mul`
-//~| HELP `mul3::Mul`
-//~| HELP `mul4::Mul`
-//~| HELP and 2 other candidates
+//~^ ERROR cannot find type `Mul`
}
// Let's also test what happens if the trait doesn't exist:
impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
-//~^ ERROR unresolved trait `ThisTraitReallyDoesntExistInAnyModuleReally`
+//~^ ERROR cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally`
}
// Let's also test what happens if there's just one alternative:
impl Div for Foo {
-//~^ ERROR unresolved trait `Div`
-//~| HELP `use std::ops::Div;`
+//~^ ERROR cannot find trait `Div`
}
fn main() {
|
error[E0412]: cannot find type `Mul` in this scope
- --> $DIR/issue-21221-1.rs:72:16
+ --> $DIR/issue-21221-1.rs:68:16
|
-72 | fn getMul() -> Mul {
+68 | fn getMul() -> Mul {
| ^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
and 2 other candidates
error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope
- --> $DIR/issue-21221-1.rs:83:6
+ --> $DIR/issue-21221-1.rs:73:6
|
-83 | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
+73 | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0405]: cannot find trait `Div` in this scope
- --> $DIR/issue-21221-1.rs:88:6
+ --> $DIR/issue-21221-1.rs:78:6
|
-88 | impl Div for Foo {
+78 | impl Div for Foo {
| ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
// except according to those terms.
pub mod foo {
+//~^ HELP you can import it into scope
pub mod bar {
// note: trait T is not public, but being in the current
// crate, it's fine to show it, since the programmer can
struct Foo;
impl T for Foo { }
-//~^ ERROR unresolved trait `T`
-//~| HELP you can import it into scope: `use foo::bar::T;`
+//~^ ERROR cannot find trait `T`
error[E0405]: cannot find trait `T` in this scope
- --> $DIR/issue-21221-2.rs:28:6
+ --> $DIR/issue-21221-2.rs:29:6
|
-28 | impl T for Foo { }
+29 | impl T for Foo { }
| ^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
extern crate issue_21221_3;
struct Foo;
+//~^ HELP possible candidate is found in another module
// NOTE: This shows only traits accessible from the current
// crate, thus the two private entities:
// `issue_21221_3::outer::public_module::OuterTrait`
// are hidden from the view.
impl OuterTrait for Foo {}
-//~^ ERROR unresolved trait `OuterTrait`
-//~| HELP you can import it into scope: `use issue_21221_3::outer::OuterTrait;`
+//~^ ERROR cannot find trait `OuterTrait`
fn main() {
println!("Hello, world!");
}
error[E0405]: cannot find trait `OuterTrait` in this scope
- --> $DIR/issue-21221-3.rs:25:6
+ --> $DIR/issue-21221-3.rs:26:6
|
-25 | impl OuterTrait for Foo {}
+26 | impl OuterTrait for Foo {}
| ^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
extern crate issue_21221_4;
struct Foo;
+//~^ HELP possible candidate is found in another module
impl T for Foo {}
-//~^ ERROR unresolved trait `T`
-//~| HELP you can import it into scope: `use issue_21221_4::T;`
+//~^ ERROR cannot find trait `T`
fn main() {
println!("Hello, world!");
error[E0405]: cannot find trait `T` in this scope
- --> $DIR/issue-21221-4.rs:20:6
+ --> $DIR/issue-21221-4.rs:21:6
|
-20 | impl T for Foo {}
+21 | impl T for Foo {}
| ^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
}
impl ToNbt<Self> {}
-//~^ ERROR unresolved type `Self`
-//~| NOTE `Self` is only available in traits and impls
-//~| ERROR the trait `ToNbt` cannot be made into an object
-//~| NOTE the trait `ToNbt` cannot be made into an object
-//~| NOTE method `new` has no receiver
+//~^ ERROR unsupported cyclic reference
+//~| NOTE cyclic reference
+//~| NOTE the cycle begins when processing
+//~| NOTE ...which then again requires
fn main() {}
fn bark() {
// If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom
shave();
- //~^ ERROR unresolved function `shave`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `shave`
+ //~| NOTE not found in this scope
}
}
impl Clone for cat {
fn clone(&self) -> Self {
clone();
- //~^ ERROR unresolved function `clone`
- //~| NOTE did you mean `self.clone(...)`?
+ //~^ ERROR cannot find function `clone`
loop {}
}
}
impl Default for cat {
fn default() -> Self {
default();
- //~^ ERROR unresolved function `default`
- //~| NOTE did you mean `Self::default`?
+ //~^ ERROR cannot find function `default`
loop {}
}
}
impl Groom for cat {
fn shave(other: usize) {
whiskers -= other;
- //~^ ERROR unresolved value `whiskers`
- //~| ERROR unresolved value `whiskers`
- //~| NOTE did you mean `self.whiskers`?
+ //~^ ERROR cannot find value `whiskers`
//~| NOTE `self` value is only available in methods with `self` parameter
shave(4);
- //~^ ERROR unresolved function `shave`
- //~| NOTE did you mean `Self::shave`?
+ //~^ ERROR cannot find function `shave`
purr();
- //~^ ERROR unresolved function `purr`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `purr`
+ //~| NOTE not found in this scope
}
}
fn purr_louder() {
static_method();
- //~^ ERROR unresolved function `static_method`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `static_method`
+ //~| NOTE not found in this scope
purr();
- //~^ ERROR unresolved function `purr`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `purr`
+ //~| NOTE not found in this scope
purr();
- //~^ ERROR unresolved function `purr`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `purr`
+ //~| NOTE not found in this scope
purr();
- //~^ ERROR unresolved function `purr`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `purr`
+ //~| NOTE not found in this scope
}
}
fn purr(&self) {
grow_older();
- //~^ ERROR unresolved function `grow_older`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `grow_older`
+ //~| NOTE not found in this scope
shave();
- //~^ ERROR unresolved function `shave`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `shave`
+ //~| NOTE not found in this scope
}
fn burn_whiskers(&mut self) {
whiskers = 0;
- //~^ ERROR unresolved value `whiskers`
- //~| NOTE did you mean `self.whiskers`?
+ //~^ ERROR cannot find value `whiskers`
}
pub fn grow_older(other:usize) {
whiskers = 4;
- //~^ ERROR unresolved value `whiskers`
- //~| ERROR unresolved value `whiskers`
- //~| NOTE did you mean `self.whiskers`?
+ //~^ ERROR cannot find value `whiskers`
//~| NOTE `self` value is only available in methods with `self` parameter
purr_louder();
- //~^ ERROR unresolved function `purr_louder`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `purr_louder`
+ //~| NOTE not found in this scope
}
}
| ^^^^^ help: try: `self.clone`
error[E0425]: cannot find function `default` in this scope
- --> $DIR/issue-2356.rs:43:5
+ --> $DIR/issue-2356.rs:42:5
|
-43 | default();
+42 | default();
| ^^^^^^^ help: try: `Self::default`
error[E0425]: cannot find value `whiskers` in this scope
- --> $DIR/issue-2356.rs:52:5
+ --> $DIR/issue-2356.rs:50:5
|
-52 | whiskers -= other;
+50 | whiskers -= other;
| ^^^^^^^^
| |
| `self` value is only available in methods with `self` parameter
| help: try: `self.whiskers`
error[E0425]: cannot find function `shave` in this scope
- --> $DIR/issue-2356.rs:57:5
+ --> $DIR/issue-2356.rs:53:5
|
-57 | shave(4);
+53 | shave(4);
| ^^^^^ help: try: `Self::shave`
error[E0425]: cannot find function `purr` in this scope
- --> $DIR/issue-2356.rs:60:5
+ --> $DIR/issue-2356.rs:55:5
|
-60 | purr();
+55 | purr();
| ^^^^ not found in this scope
error[E0425]: cannot find function `static_method` in this scope
- --> $DIR/issue-2356.rs:70:9
+ --> $DIR/issue-2356.rs:65:9
|
-70 | static_method();
+65 | static_method();
| ^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `purr` in this scope
- --> $DIR/issue-2356.rs:73:9
+ --> $DIR/issue-2356.rs:68:9
|
-73 | purr();
+68 | purr();
| ^^^^ not found in this scope
error[E0425]: cannot find function `purr` in this scope
- --> $DIR/issue-2356.rs:76:9
+ --> $DIR/issue-2356.rs:71:9
|
-76 | purr();
+71 | purr();
| ^^^^ not found in this scope
error[E0425]: cannot find function `purr` in this scope
- --> $DIR/issue-2356.rs:79:9
+ --> $DIR/issue-2356.rs:74:9
|
-79 | purr();
+74 | purr();
| ^^^^ not found in this scope
error[E0424]: expected value, found module `self`
- --> $DIR/issue-2356.rs:87:8
+ --> $DIR/issue-2356.rs:82:8
|
-87 | if self.whiskers > 3 {
+82 | if self.whiskers > 3 {
| ^^^^ `self` value is only available in methods with `self` parameter
error[E0425]: cannot find function `grow_older` in this scope
- --> $DIR/issue-2356.rs:95:5
+ --> $DIR/issue-2356.rs:90:5
|
-95 | grow_older();
+90 | grow_older();
| ^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `shave` in this scope
- --> $DIR/issue-2356.rs:98:5
+ --> $DIR/issue-2356.rs:93:5
|
-98 | shave();
+93 | shave();
| ^^^^^ not found in this scope
error[E0425]: cannot find value `whiskers` in this scope
- --> $DIR/issue-2356.rs:104:5
- |
-104 | whiskers = 0;
- | ^^^^^^^^ help: try: `self.whiskers`
+ --> $DIR/issue-2356.rs:99:5
+ |
+99 | whiskers = 0;
+ | ^^^^^^^^ help: try: `self.whiskers`
error[E0425]: cannot find value `whiskers` in this scope
- --> $DIR/issue-2356.rs:110:5
+ --> $DIR/issue-2356.rs:104:5
|
-110 | whiskers = 4;
+104 | whiskers = 4;
| ^^^^^^^^
| |
| `self` value is only available in methods with `self` parameter
| help: try: `self.whiskers`
error[E0425]: cannot find function `purr_louder` in this scope
- --> $DIR/issue-2356.rs:115:5
+ --> $DIR/issue-2356.rs:107:5
|
-115 | purr_louder();
+107 | purr_louder();
| ^^^^^^^^^^^ not found in this scope
error[E0424]: expected value, found module `self`
- --> $DIR/issue-2356.rs:122:5
+ --> $DIR/issue-2356.rs:114:5
|
-122 | self += 1;
+114 | self += 1;
| ^^^^ `self` value is only available in methods with `self` parameter
error: aborting due to 17 previous errors
// except according to those terms.
fn foo(_: Self) {
-//~^ ERROR unresolved type `Self`
+//~^ ERROR cannot find type `Self`
//~| NOTE `Self` is only available in traits and impls
}
let s: Something = Something {
handle: Handle
- //~^ ERROR cannot find value `Handle` in this scope
- //~| NOTE did you mean `handle`?
+ //~^ ERROR expected value, found struct `Handle`
+ //~| NOTE did you mean `Handle { /* fields */ }`?
+ //~| NOTE did you mean `handle`
};
}
type K = I;
impl K for isize {} //~ ERROR expected trait, found type alias `K`
//~| NOTE type aliases cannot be used for traits
+ //~| NOTE did you mean `I`
use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
//~^ no `ImportError` in the root
error[E0432]: unresolved import `ImportError`
- --> $DIR/issue-5035.rs:16:5
+ --> $DIR/issue-5035.rs:17:5
|
-16 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
+17 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
| ^^^^^^^^^^^ no `ImportError` in the root
error[E0404]: expected trait, found type alias `K`
fn foo_bar() {}
fn foo(c: esize) {} // Misspelled primitive type name.
+//~^ ERROR cannot find
enum Bar { }
type A = Baz; // Misspelled type name.
+//~^ ERROR cannot find
type B = Opiton<u8>; // Misspelled type name from the prelude.
+//~^ ERROR cannot find
mod m {
type A = Baz; // No suggestion here, Bar is not visible
+ //~^ ERROR cannot find
pub struct First;
pub struct Second;
fn main() {
let v = [0u32; MAXITEM]; // Misspelled constant name.
+ //~^ ERROR cannot find
foobar(); // Misspelled function name.
+ //~^ ERROR cannot find
let b: m::first = m::second; // Misspelled item in module.
+ //~^ ERROR cannot find
+ //~| ERROR cannot find
}
| ^^^^^ did you mean `isize`?
error[E0412]: cannot find type `Baz` in this scope
- --> $DIR/levenshtein.rs:19:10
+ --> $DIR/levenshtein.rs:20:10
|
-19 | type A = Baz; // Misspelled type name.
+20 | type A = Baz; // Misspelled type name.
| ^^^ did you mean `Bar`?
error[E0412]: cannot find type `Opiton` in this scope
- --> $DIR/levenshtein.rs:20:10
+ --> $DIR/levenshtein.rs:22:10
|
-20 | type B = Opiton<u8>; // Misspelled type name from the prelude.
+22 | type B = Opiton<u8>; // Misspelled type name from the prelude.
| ^^^^^^ did you mean `Option`?
error[E0412]: cannot find type `Baz` in this scope
- --> $DIR/levenshtein.rs:23:14
+ --> $DIR/levenshtein.rs:26:14
|
-23 | type A = Baz; // No suggestion here, Bar is not visible
+26 | type A = Baz; // No suggestion here, Bar is not visible
| ^^^ not found in this scope
error[E0425]: cannot find value `MAXITEM` in this scope
- --> $DIR/levenshtein.rs:30:20
+ --> $DIR/levenshtein.rs:34:20
|
-30 | let v = [0u32; MAXITEM]; // Misspelled constant name.
+34 | let v = [0u32; MAXITEM]; // Misspelled constant name.
| ^^^^^^^ did you mean `MAX_ITEM`?
error[E0425]: cannot find function `foobar` in this scope
- --> $DIR/levenshtein.rs:31:5
+ --> $DIR/levenshtein.rs:36:5
|
-31 | foobar(); // Misspelled function name.
+36 | foobar(); // Misspelled function name.
| ^^^^^^ did you mean `foo_bar`?
error[E0412]: cannot find type `first` in module `m`
- --> $DIR/levenshtein.rs:32:15
+ --> $DIR/levenshtein.rs:38:15
|
-32 | let b: m::first = m::second; // Misspelled item in module.
+38 | let b: m::first = m::second; // Misspelled item in module.
| ^^^^^ did you mean `First`?
error[E0425]: cannot find value `second` in module `m`
- --> $DIR/levenshtein.rs:32:26
+ --> $DIR/levenshtein.rs:38:26
|
-32 | let b: m::first = m::second; // Misspelled item in module.
+38 | let b: m::first = m::second; // Misspelled item in module.
| ^^^^^^ did you mean `Second`?
error: aborting due to 8 previous errors
n::Z; //~ ERROR tuple struct `Z` is private
Z;
//~^ ERROR expected value, found struct `Z`
- //~| NOTE tuple struct constructors with private fields are invisible outside of their mod
+ //~| NOTE constructor is not visible here due to private fields
+ //~| NOTE did you mean `S`
+ //~| NOTE did you mean `Z { /* fields */ }`
}
}
S;
//~^ ERROR expected value, found struct `S`
//~| NOTE constructor is not visible here due to private fields
+ //~| NOTE did you mean `S { /* fields */ }`
m::n::Z; //~ ERROR tuple struct `Z` is private
xcrate::m::S; //~ ERROR tuple struct `S` is private
xcrate::S;
//~^ ERROR expected value, found struct `xcrate::S`
+ //~| NOTE did you mean `xcrate::S { /* fields */ }`
//~| NOTE constructor is not visible here due to private fields
xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
}
|
error[E0423]: expected value, found struct `S`
- --> $DIR/privacy-struct-ctor.rs:36:5
+ --> $DIR/privacy-struct-ctor.rs:38:5
|
-36 | S;
+38 | S;
| ^
| |
| constructor is not visible here due to private fields
| did you mean `S { /* fields */ }`?
help: possible better candidate is found in another module, you can import it into scope
|
-32 | use m::S;
+34 | use m::S;
|
error[E0423]: expected value, found struct `xcrate::S`
- --> $DIR/privacy-struct-ctor.rs:42:5
+ --> $DIR/privacy-struct-ctor.rs:45:5
|
-42 | xcrate::S;
+45 | xcrate::S;
| ^^^^^^^^^
| |
| constructor is not visible here due to private fields
| did you mean `xcrate::S { /* fields */ }`?
help: possible better candidate is found in another module, you can import it into scope
|
-32 | use m::S;
+34 | use m::S;
|
error[E0603]: tuple struct `Z` is private
| ^^^^
error[E0603]: tuple struct `S` is private
- --> $DIR/privacy-struct-ctor.rs:35:5
+ --> $DIR/privacy-struct-ctor.rs:37:5
|
-35 | m::S; //~ ERROR tuple struct `S` is private
+37 | m::S; //~ ERROR tuple struct `S` is private
| ^^^^
error[E0603]: tuple struct `Z` is private
- --> $DIR/privacy-struct-ctor.rs:39:5
+ --> $DIR/privacy-struct-ctor.rs:42:5
|
-39 | m::n::Z; //~ ERROR tuple struct `Z` is private
+42 | m::n::Z; //~ ERROR tuple struct `Z` is private
| ^^^^^^^
error[E0603]: tuple struct `S` is private
- --> $DIR/privacy-struct-ctor.rs:41:5
+ --> $DIR/privacy-struct-ctor.rs:44:5
|
-41 | xcrate::m::S; //~ ERROR tuple struct `S` is private
+44 | xcrate::m::S; //~ ERROR tuple struct `S` is private
| ^^^^^^^^^^^^
error[E0603]: tuple struct `Z` is private
- --> $DIR/privacy-struct-ctor.rs:45:5
+ --> $DIR/privacy-struct-ctor.rs:49:5
|
-45 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
+49 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private
| ^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors
fn method(&self) {
let _: field;
- //~^ ERROR unresolved type `field`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find type `field`
+ //~| NOTE not found in this scope
let field(..);
- //~^ ERROR unresolved tuple struct/variant `field`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find tuple struct/variant `field`
+ //~| NOTE not found in this scope
field;
- //~^ ERROR unresolved value `field`
- //~| NOTE did you mean `self.field`?
+ //~^ ERROR cannot find value `field`
let _: Type;
- //~^ ERROR unresolved type `Type`
- //~| NOTE did you mean `Self::Type`?
+ //~^ ERROR cannot find type `Type`
let Type(..);
- //~^ ERROR unresolved tuple struct/variant `Type`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find tuple struct/variant `Type`
+ //~| NOTE not found in this scope
Type;
- //~^ ERROR unresolved value `Type`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `Type`
+ //~| NOTE not found in this scope
let _: method;
- //~^ ERROR unresolved type `method`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find type `method`
+ //~| NOTE not found in this scope
let method(..);
- //~^ ERROR unresolved tuple struct/variant `method`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find tuple struct/variant `method`
+ //~| NOTE not found in this scope
method;
- //~^ ERROR unresolved value `method`
- //~| NOTE did you mean `self.method(...)`?
+ //~^ ERROR cannot find value `method`
}
}
| ^^^^^ help: try: `self.field`
error[E0412]: cannot find type `Type` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:36:16
+ --> $DIR/resolve-assoc-suggestions.rs:35:16
|
-36 | let _: Type;
+35 | let _: Type;
| ^^^^ help: try: `Self::Type`
error[E0531]: cannot find tuple struct/variant `Type` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:39:13
+ --> $DIR/resolve-assoc-suggestions.rs:37:13
|
-39 | let Type(..);
+37 | let Type(..);
| ^^^^ not found in this scope
error[E0425]: cannot find value `Type` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:42:9
+ --> $DIR/resolve-assoc-suggestions.rs:40:9
|
-42 | Type;
+40 | Type;
| ^^^^ not found in this scope
error[E0412]: cannot find type `method` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:46:16
+ --> $DIR/resolve-assoc-suggestions.rs:44:16
|
-46 | let _: method;
+44 | let _: method;
| ^^^^^^ not found in this scope
error[E0531]: cannot find tuple struct/variant `method` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:49:13
+ --> $DIR/resolve-assoc-suggestions.rs:47:13
|
-49 | let method(..);
+47 | let method(..);
| ^^^^^^ not found in this scope
error[E0425]: cannot find value `method` in this scope
- --> $DIR/resolve-assoc-suggestions.rs:52:9
+ --> $DIR/resolve-assoc-suggestions.rs:50:9
|
-52 | method;
+50 | method;
| ^^^^^^ help: try: `self.method`
error: aborting due to 9 previous errors
// Speculative resolution of `Self` and `self` silently fails,
// "did you mean" messages are not printed.
field;
- //~^ ERROR unresolved value `field`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find value `field`
+ //~| NOTE not found in this scope
method();
- //~^ ERROR unresolved function `method`
- //~| NOTE no resolution found
+ //~^ ERROR cannot find function `method`
+ //~| NOTE not found in this scope
}
field;
- //~^ ERROR unresolved value `field`
- //~| NOTE did you mean `self.field`?
+ //~^ ERROR cannot find value `field`
method();
- //~^ ERROR unresolved function `method`
- //~| NOTE did you mean `self.method(...)`?
+ //~^ ERROR cannot find function `method`
}
}
| ^^^^^ help: try: `self.field`
error[E0425]: cannot find function `method` in this scope
- --> $DIR/resolve-speculative-adjustment.rs:38:9
+ --> $DIR/resolve-speculative-adjustment.rs:37:9
|
-38 | method();
+37 | method();
| ^^^^^^ help: try: `self.method`
error: aborting due to 4 previous errors
a::b.J
//~^ ERROR expected value, found module `a::b`
//~| NOTE did you mean `a::b::J`?
+ //~| NOTE did you mean `I`
}
fn h5() {
let v = Vec::new();
v.push(a::b);
//~^ ERROR expected value, found module `a::b`
- //~| NOTE not a value
+ //~| NOTE did you mean `I`
}
fn h6() -> i32 {
a::b.f()
//~^ ERROR expected value, found module `a::b`
//~| NOTE did you mean `a::b::f(...)`?
+ //~| NOTE did you mean `I`
}
fn h7() {
a::b
//~^ ERROR expected value, found module `a::b`
- //~| NOTE not a value
+ //~| NOTE did you mean `I`
}
fn h8() -> i32 {
a::b()
//~^ ERROR expected function, found module `a::b`
- //~| NOTE not a function
+ //~| NOTE did you mean `I`
}
| did you mean `a::b::J`?
error[E0423]: expected value, found module `a`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:51:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5
|
-51 | a.b.f();
+52 | a.b.f();
| ^--
| |
| did you mean `a::b`?
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:12
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:56:12
|
-55 | v.push(a::b);
+56 | v.push(a::b);
| ^^^-
| |
| did you mean `I`?
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:61:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:62:5
|
-61 | a::b.f()
+62 | a::b.f()
| ^^^-----
| | |
| | did you mean `I`?
| did you mean `a::b::f(...)`?
error[E0423]: expected value, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:67:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:69:5
|
-67 | a::b
+69 | a::b
| ^^^-
| |
| did you mean `I`?
error[E0423]: expected function, found module `a::b`
- --> $DIR/suggest-path-instead-of-mod-dot-item.rs:73:5
+ --> $DIR/suggest-path-instead-of-mod-dot-item.rs:75:5
|
-73 | a::b()
+75 | a::b()
| ^^^-
| |
| did you mean `I`?
fn main() {
if foo {
//~^ NOTE: unclosed delimiter
- //~| ERROR: unresolved value `foo`
- //~| NOTE: no resolution found
+ //~| ERROR: cannot find value `foo`
+ //~| NOTE: not found in this scope
) //~ ERROR: incorrect close delimiter: `)`
}
pub fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(path: P,
callback: F)
-> io::Result<bool> {
- if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory`
- //~^ NOTE: no resolution found
+ if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory`
+ //~^ NOTE: not found in this scope
callback(path.as_ref(); //~ NOTE: unclosed delimiter
- //~^ ERROR: expected one of
+ //~^ NOTE: expected one of
+ //~| ERROR expected one of
fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
//~^ expected (), found enum `std::result::Result`
//~| expected type `()`
//~| found type `std::result::Result<bool, std::io::Error>`
+ //~| expected one of
} else { //~ ERROR: incorrect close delimiter: `}`
//~^ ERROR: expected one of
+ //~| unexpected token
Ok(false);
}
error: incorrect close delimiter: `}`
- --> $DIR/token-error-correct-3.rs:29:9
+ --> $DIR/token-error-correct-3.rs:31:9
|
-29 | } else { //~ ERROR: incorrect close delimiter: `}`
+31 | } else { //~ ERROR: incorrect close delimiter: `}`
| ^
|
note: unclosed delimiter
| ^ expected one of `,`, `.`, `?`, or an operator here
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)`
- --> $DIR/token-error-correct-3.rs:29:9
+ --> $DIR/token-error-correct-3.rs:31:9
|
-25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
+26 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
| - expected one of `.`, `;`, `?`, `}`, or an operator here
...
-29 | } else { //~ ERROR: incorrect close delimiter: `}`
+31 | } else { //~ ERROR: incorrect close delimiter: `}`
| ^ unexpected token
error[E0425]: cannot find function `is_directory` in this scope
--> $DIR/token-error-correct-3.rs:21:13
|
-21 | if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory`
+21 | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory`
| ^^^^^^^^^^^^ not found in this scope
error[E0308]: mismatched types
- --> $DIR/token-error-correct-3.rs:25:13
+ --> $DIR/token-error-correct-3.rs:26:13
|
-25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
+26 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;`
| |
| expected (), found enum `std::result::Result`
//~^ NOTE: unclosed delimiter
//~| NOTE: unclosed delimiter
//~| ERROR: expected expression, found `;`
- //~| ERROR: unresolved function `foo`
- //~| NOTE: no resolution found
- //~| ERROR: unresolved function `bar`
- //~| NOTE: no resolution found
- //~| ERROR: expected one of `)`, `,`, `.`, `<`, `?`
}
//~^ ERROR: incorrect close delimiter: `}`
//~| ERROR: incorrect close delimiter: `}`
error: incorrect close delimiter: `}`
- --> $DIR/token-error-correct.rs:23:1
+ --> $DIR/token-error-correct.rs:18:1
|
-23 | }
+18 | }
| ^
|
note: unclosed delimiter
| ^
error: incorrect close delimiter: `}`
- --> $DIR/token-error-correct.rs:23:1
+ --> $DIR/token-error-correct.rs:18:1
|
-23 | }
+18 | }
| ^
|
note: unclosed delimiter
| ^
error: expected expression, found `)`
- --> $DIR/token-error-correct.rs:23:1
+ --> $DIR/token-error-correct.rs:18:1
|
-23 | }
+18 | }
| ^
error: aborting due to 4 previous errors
impl S {
fn f() {
- let s = Self(0, 1);
+ let s = Self(0, 1); //~ ERROR expected function
match s {
- Self(..) => {}
+ Self(..) => {} //~ ERROR expected tuple struct/variant
}
}
}
fn main() {
- let s = A(0, 1);
+ let s = A(0, 1); //~ ERROR expected function
match s {
- A(..) => {}
+ A(..) => {} //~ ERROR expected tuple struct/variant
}
}
error[E0423]: expected function, found self type `Self`
--> $DIR/tuple-struct-alias.rs:16:17
|
-16 | let s = Self(0, 1);
+16 | let s = Self(0, 1); //~ ERROR expected function
| ^^^^ did you mean `Self { /* fields */ }`?
error[E0532]: expected tuple struct/variant, found self type `Self`
--> $DIR/tuple-struct-alias.rs:18:13
|
-18 | Self(..) => {}
+18 | Self(..) => {} //~ ERROR expected tuple struct/variant
| ^^^^ did you mean `Self { /* fields */ }`?
error[E0423]: expected function, found type alias `A`
--> $DIR/tuple-struct-alias.rs:24:13
|
-24 | let s = A(0, 1);
+24 | let s = A(0, 1); //~ ERROR expected function
| ^
| |
| did you mean `S`?
error[E0532]: expected tuple struct/variant, found type alias `A`
--> $DIR/tuple-struct-alias.rs:26:9
|
-26 | A(..) => {}
+26 | A(..) => {} //~ ERROR expected tuple struct/variant
| ^
| |
| did you mean `S`?
// except according to those terms.
fn f<F:Nonexist(isize) -> isize>(x: F) {}
-//~^ ERROR unresolved trait `Nonexist`
-//~| NOTE no resolution found
+//~^ ERROR cannot find trait `Nonexist`
+//~| NOTE not found in this scope
type Typedef = isize;
impl Foo {
fn bar() {
f(cx);
- //~^ ERROR unresolved value `cx`
- //~| ERROR unresolved value `cx`
- //~| NOTE did you mean `self.cx`?
+ //~^ ERROR cannot find value `cx` in this scope
//~| NOTE `self` value is only available in methods with `self` parameter
}
}
// test whether the use suggestion isn't
// placed into the expansion of `#[derive(Debug)]
- type Bar = Path;
+ type Bar = Path; //~ ERROR cannot find
}
fn main() {
y!();
- let _ = A;
+ let _ = A; //~ ERROR cannot find
foo();
}
fn foo() {
- type Dict<K, V> = HashMap<K, V>;
+ type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find
}
error[E0412]: cannot find type `Path` in this scope
--> $DIR/use_suggestion_placement.rs:25:16
|
-25 | type Bar = Path;
+25 | type Bar = Path; //~ ERROR cannot find
| ^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
error[E0425]: cannot find value `A` in this scope
--> $DIR/use_suggestion_placement.rs:30:13
|
-30 | let _ = A;
+30 | let _ = A; //~ ERROR cannot find
| ^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
error[E0412]: cannot find type `HashMap` in this scope
--> $DIR/use_suggestion_placement.rs:35:23
|
-35 | type Dict<K, V> = HashMap<K, V>;
+35 | type Dict<K, V> = HashMap<K, V>; //~ ERROR cannot find
| ^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
let f = Foo{bar:6};
match &f {
- FOO => {},
+ FOO => {}, //~ ERROR mismatched types
_ => panic!(),
}
}
error[E0308]: mismatched types
--> $DIR/const.rs:26:9
|
-26 | FOO => {},
+26 | FOO => {}, //~ ERROR mismatched types
| ^^^ expected &Foo, found struct `Foo`
|
= note: expected type `&Foo`
pub fn main() {
let Wrap(x) = &Wrap(3);
- *x += 1;
+ *x += 1; //~ ERROR cannot assign to immutable
if let Some(x) = &Some(3) {
- *x += 1;
+ *x += 1; //~ ERROR cannot assign to immutable
} else {
panic!();
}
while let Some(x) = &Some(3) {
- *x += 1;
+ *x += 1; //~ ERROR cannot assign to immutable
break;
}
}
|
20 | let Wrap(x) = &Wrap(3);
| - consider changing this to `x`
-21 | *x += 1;
+21 | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*x`
|
24 | if let Some(x) = &Some(3) {
| - consider changing this to `x`
-25 | *x += 1;
+25 | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*x`
|
30 | while let Some(x) = &Some(3) {
| - consider changing this to `x`
-31 | *x += 1;
+31 | *x += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error: aborting due to 3 previous errors
fn main() {
match &&Some(5i32) {
Some(n) => {
- *n += 1;
+ *n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
match &mut &Some(5i32) {
Some(n) => {
- *n += 1;
+ *n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
match &&mut Some(5i32) {
Some(n) => {
- *n += 1;
+ *n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
|
18 | Some(n) => {
| - consider changing this to `n`
-19 | *n += 1;
+19 | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*n`
|
26 | Some(n) => {
| - consider changing this to `n`
-27 | *n += 1;
+27 | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error[E0594]: cannot assign to immutable borrowed content `*n`
|
34 | Some(n) => {
| - consider changing this to `n`
-35 | *n += 1;
+35 | *n += 1; //~ ERROR cannot assign to immutable
| ^^^^^^^ cannot borrow as mutable
error: aborting due to 3 previous errors
let mut tups = vec![(Foo{}, Foo{})];
// The below desugars to &(ref n, mut m).
for (n, mut m) in &tups {
+ //~^ ERROR cannot bind by-move and by-ref in the same pattern
}
}
let x = &Some((3, 3));
let _: &i32 = match x {
Some((x, 3)) | &Some((ref x, 5)) => x,
+ //~^ ERROR is bound in inconsistent ways
_ => &5i32,
};
}
let s: &'static str = "abc";
match &s {
- "abc" => true,
+ "abc" => true, //~ ERROR mismatched types
_ => panic!(),
};
}
let s: &'static [u8] = b"abc";
match &s {
- b"abc" => true,
+ b"abc" => true, //~ ERROR mismatched types
_ => panic!(),
};
}
error[E0308]: mismatched types
--> $DIR/lit.rs:19:13
|
-19 | "abc" => true,
+19 | "abc" => true, //~ ERROR mismatched types
| ^^^^^ expected &str, found str
|
= note: expected type `&&str`
error[E0308]: mismatched types
--> $DIR/lit.rs:28:9
|
-28 | b"abc" => true,
+28 | b"abc" => true, //~ ERROR mismatched types
| ^^^^^^ expected &[u8], found array of 3 elements
|
= note: expected type `&&[u8]`
fn main() {
let foo = 22;
match foo {
- u32::XXX => { }
+ u32::XXX => { } //~ ERROR no associated item named
_ => { }
}
}
error[E0599]: no associated item named `XXX` found for type `u32` in the current scope
--> $DIR/no-double-error.rs:18:9
|
-18 | u32::XXX => { }
+18 | u32::XXX => { } //~ ERROR no associated item named
| ^^^^^^^^ associated item not found in `u32`
error: aborting due to previous error
pub fn main() {
let sl: &[u8] = b"foo";
- match sl {
+ match sl { //~ ERROR non-exhaustive patterns
[first, remainder..] => {},
};
}
error[E0004]: non-exhaustive patterns: `&[]` not covered
--> $DIR/slice.rs:17:11
|
-17 | match sl {
+17 | match sl { //~ ERROR non-exhaustive patterns
| ^^ pattern `&[]` not covered
error: aborting due to previous error
// except according to those terms.
fn main() {
- if let Some(y) = &Some(22) {
+ if let Some(y) = &Some(22) { //~ ERROR non-reference pattern
println!("{}", y);
}
}
error: non-reference pattern used to match a reference (see issue #42640)
--> $DIR/suggestion.rs:12:12
|
-12 | if let Some(y) = &Some(22) {
+12 | if let Some(y) = &Some(22) { //~ ERROR non-reference pattern
| ^^^^^^^ help: consider using: `&Some(y)`
|
= help: add #![feature(match_default_bindings)] to the crate attributes to enable
}
fn main() {
- need_to_use_this_value();
+ need_to_use_this_value(); //~ WARN unused return value
let mut m = MyStruct { n: 2 };
let n = MyStruct { n: 3 };
- m.need_to_use_this_method_value();
+ m.need_to_use_this_method_value(); //~ WARN unused return value
m.is_even(); // trait method!
+ //~^ WARN unused return value
m.replace(3); // won't warn (annotation needs to be in trait definition)
// comparison methods are `must_use`
- 2.eq(&3);
- m.eq(&n);
+ 2.eq(&3); //~ WARN unused return value
+ m.eq(&n); //~ WARN unused return value
// lint includes comparison operators
- 2 == 3;
- m == n;
+ 2 == 3; //~ WARN unused comparison
+ m == n; //~ WARN unused comparison
}
warning: unused return value of `need_to_use_this_value` which must be used: it's important
--> $DIR/fn_must_use.rs:59:5
|
-59 | need_to_use_this_value();
+59 | need_to_use_this_value(); //~ WARN unused return value
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used
--> $DIR/fn_must_use.rs:64:5
|
-64 | m.need_to_use_this_method_value();
+64 | m.need_to_use_this_method_value(); //~ WARN unused return value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unused return value of `EvenNature::is_even` which must be used: no side effects
| ^^^^^^^^^^^^
warning: unused return value of `std::cmp::PartialEq::eq` which must be used
- --> $DIR/fn_must_use.rs:70:5
+ --> $DIR/fn_must_use.rs:71:5
|
-70 | 2.eq(&3);
+71 | 2.eq(&3); //~ WARN unused return value
| ^^^^^^^^^
warning: unused return value of `std::cmp::PartialEq::eq` which must be used
- --> $DIR/fn_must_use.rs:71:5
+ --> $DIR/fn_must_use.rs:72:5
|
-71 | m.eq(&n);
+72 | m.eq(&n); //~ WARN unused return value
| ^^^^^^^^^
warning: unused comparison which must be used
- --> $DIR/fn_must_use.rs:74:5
+ --> $DIR/fn_must_use.rs:75:5
|
-74 | 2 == 3;
+75 | 2 == 3; //~ WARN unused comparison
| ^^^^^^
warning: unused comparison which must be used
- --> $DIR/fn_must_use.rs:75:5
+ --> $DIR/fn_must_use.rs:76:5
|
-75 | m == n;
+76 | m == n; //~ WARN unused comparison
| ^^^^^^
}
// `.` is similar to `,` so list parsing should continue to closing `}`
-use x::{A. B};
+use x::{A. B}; //~ ERROR expected one of `,` or `as`, found `.`
fn main() {}
error: expected one of `,` or `as`, found `.`
--> $DIR/similar-tokens.rs:17:10
|
-17 | use x::{A. B};
+17 | use x::{A. B}; //~ ERROR expected one of `,` or `as`, found `.`
| ^ expected one of `,` or `as` here
error: aborting due to previous error
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct ListNode {
+struct ListNode { //~ ERROR has infinite size
head: u8,
tail: Option<ListNode>,
}
error[E0072]: recursive type `ListNode` has infinite size
--> $DIR/E0072.rs:11:1
|
-11 | struct ListNode {
+11 | struct ListNode { //~ ERROR has infinite size
| ^^^^^^^^^^^^^^^ recursive type has infinite size
12 | head: u8,
13 | tail: Option<ListNode>,
foo: Vec<u32>,
}
-impl Copy for Foo { }
+impl Copy for Foo { } //~ ERROR may not be implemented for this type
-#[derive(Copy)]
+#[derive(Copy)] //~ ERROR may not be implemented for this type
struct Foo2<'a> {
ty: &'a mut bool,
}
Baz,
}
-impl Copy for EFoo { }
+impl Copy for EFoo { } //~ ERROR may not be implemented for this type
-#[derive(Copy)]
+#[derive(Copy)] //~ ERROR may not be implemented for this type
enum EFoo2<'a> {
Bar(&'a mut bool),
Baz,
12 | foo: Vec<u32>,
| ------------- this field does not implement `Copy`
...
-15 | impl Copy for Foo { }
+15 | impl Copy for Foo { } //~ ERROR may not be implemented for this type
| ^^^^
error[E0204]: the trait `Copy` may not be implemented for this type
--> $DIR/E0204.rs:17:10
|
-17 | #[derive(Copy)]
+17 | #[derive(Copy)] //~ ERROR may not be implemented for this type
| ^^^^
18 | struct Foo2<'a> {
19 | ty: &'a mut bool,
23 | Bar { x: Vec<u32> },
| ----------- this field does not implement `Copy`
...
-27 | impl Copy for EFoo { }
+27 | impl Copy for EFoo { } //~ ERROR may not be implemented for this type
| ^^^^
error[E0204]: the trait `Copy` may not be implemented for this type
--> $DIR/E0204.rs:29:10
|
-29 | #[derive(Copy)]
+29 | #[derive(Copy)] //~ ERROR may not be implemented for this type
| ^^^^
30 | enum EFoo2<'a> {
31 | Bar(&'a mut bool),
}
const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1;
+//~^ destructors cannot be evaluated at compile-time
fn main() {
}
//~| NOTE first mutable borrow occurs here
//~| NOTE second mutable borrow occurs here
f((Box::new(|| {})))
+ //~^ NOTE borrow occurs due to use of `f` in closure
}));
//~^ NOTE first borrow ends here
}
fn test7() {
fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
let mut f = |g: Box<FnMut(isize)>, b: isize| {};
- //~^ NOTE moved
+ //~^ NOTE captured outer variable
f(Box::new(|a| {
//~^ NOTE borrow of `f` occurs here
foo(f);
...
26 | f((Box::new(|| {})))
| - borrow occurs due to use of `f` in closure
-27 | }));
+27 | //~^ NOTE borrow occurs due to use of `f` in closure
+28 | }));
| - first borrow ends here
error[E0596]: cannot borrow immutable borrowed content `*f` as mutable
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:39:5
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:40:5
|
-37 | fn test2<F>(f: &F) where F: FnMut() {
+38 | fn test2<F>(f: &F) where F: FnMut() {
| -- use `&mut F` here to make mutable
-38 | //~^ NOTE use `&mut F` here to make mutable
-39 | (*f)();
+39 | //~^ NOTE use `&mut F` here to make mutable
+40 | (*f)();
| ^^^^ cannot borrow as mutable
error[E0596]: cannot borrow immutable `Box` content `*f.f` as mutable
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:50:5
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:51:5
|
-48 | fn test4(f: &Test) {
+49 | fn test4(f: &Test) {
| ----- use `&mut Test` here to make mutable
-49 | //~^ NOTE use `&mut Test` here to make mutable
-50 | f.f.call_mut(())
+50 | //~^ NOTE use `&mut Test` here to make mutable
+51 | f.f.call_mut(())
| ^^^ cannot borrow as mutable
error[E0504]: cannot move `f` into closure because it is borrowed
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:72:13
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:73:13
|
-70 | f(Box::new(|a| {
+71 | f(Box::new(|a| {
| - borrow of `f` occurs here
-71 | //~^ NOTE borrow of `f` occurs here
-72 | foo(f);
+72 | //~^ NOTE borrow of `f` occurs here
+73 | foo(f);
| ^ move into closure occurs here
error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
- --> $DIR/borrowck-call-is-borrow-issue-12224.rs:72:13
+ --> $DIR/borrowck-call-is-borrow-issue-12224.rs:73:13
|
-68 | let mut f = |g: Box<FnMut(isize)>, b: isize| {};
+69 | let mut f = |g: Box<FnMut(isize)>, b: isize| {};
| ----- captured outer variable
...
-72 | foo(f);
+73 | foo(f);
| ^ cannot move out of captured outer variable in an `FnMut` closure
error: aborting due to 5 previous errors
v3.push(&id('x')); // statement 6
//~^ ERROR borrowed value does not live long enough
//~| NOTE temporary value created here
- //~| NOTE temporary value only lives until here
+ //~| NOTE temporary value dropped here while still borrowed
//~| NOTE consider using a `let` binding to increase its lifetime
{
v4.push(&id('y'));
//~^ ERROR borrowed value does not live long enough
//~| NOTE temporary value created here
- //~| NOTE temporary value only lives until here
+ //~| NOTE temporary value dropped here while still borrowed
//~| NOTE consider using a `let` binding to increase its lifetime
} // (statement 7)
v5.push(&id('z'));
//~^ ERROR borrowed value does not live long enough
//~| NOTE temporary value created here
- //~| NOTE temporary value only lives until here
+ //~| NOTE temporary value dropped here while still borrowed
//~| NOTE consider using a `let` binding to increase its lifetime
v1.push(&old[0]);
fn main() {
let msg;
match Some("Hello".to_string()) {
- Some(ref m) => { //~ ERROR borrowed value does not live long enough
+ Some(ref m) => {
msg = m;
},
None => { panic!() }
- }
+ } //~ ERROR borrowed value does not live long enough
println!("{}", *msg);
}
error[E0597]: borrowed value does not live long enough
--> $DIR/borrowck-ref-into-rvalue.rs:18:5
|
-14 | Some(ref m) => { //~ ERROR borrowed value does not live long enough
+14 | Some(ref m) => {
| ----- borrow occurs here
...
-18 | }
+18 | } //~ ERROR borrowed value does not live long enough
| ^ borrowed value dropped here while still borrowed
19 | println!("{}", *msg);
20 | }
//~^ ERROR E0308
//~| NOTE expected usize, found struct `std::string::String`
//~| NOTE expected type `usize`
- //~| NOTE found type `std::string::String`
//~| HELP here are some functions which might fulfill your needs:
let x: &str = String::new();
//~^ ERROR E0308
//~| NOTE expected &str, found struct `std::string::String`
//~| NOTE expected type `&str`
- //~| NOTE found type `std::string::String`
//~| HELP try with `&String::new()`
let y = String::new();
test(&y);
//~^ ERROR E0308
//~| NOTE types differ in mutability
//~| NOTE expected type `&mut std::string::String`
- //~| NOTE found type `&std::string::String`
test2(&y);
//~^ ERROR E0308
//~| NOTE types differ in mutability
//~| NOTE expected type `&mut i32`
- //~| NOTE found type `&std::string::String`
let f;
f = box f;
//~^ ERROR E0308
//~| NOTE cyclic type of infinite size
- //~| NOTE expected type `_`
- //~| NOTE found type `Box<_>`
let s = &mut String::new();
s = format!("foo");
- //~^ ERROR E0308
- //~| NOTE expected mutable reference, found struct `std::string::String`
- //~| NOTE expected type `&mut std::string::String`
- //~| HELP try with `&mut format!("foo")`
- //~| NOTE this error originates in a macro outside of the current crate
}
- .len()
error[E0308]: mismatched types
- --> $DIR/coerce-suggestions.rs:23:19
+ --> $DIR/coerce-suggestions.rs:22:19
|
-23 | let x: &str = String::new();
+22 | let x: &str = String::new();
| ^^^^^^^^^^^^^ expected &str, found struct `std::string::String`
|
= note: expected type `&str`
= help: try with `&String::new()`
error[E0308]: mismatched types
- --> $DIR/coerce-suggestions.rs:30:10
+ --> $DIR/coerce-suggestions.rs:28:10
|
-30 | test(&y);
+28 | test(&y);
| ^^ types differ in mutability
|
= note: expected type `&mut std::string::String`
found type `&std::string::String`
error[E0308]: mismatched types
- --> $DIR/coerce-suggestions.rs:35:11
+ --> $DIR/coerce-suggestions.rs:32:11
|
-35 | test2(&y);
+32 | test2(&y);
| ^^ types differ in mutability
|
= note: expected type `&mut i32`
found type `&std::string::String`
error[E0308]: mismatched types
- --> $DIR/coerce-suggestions.rs:41:9
+ --> $DIR/coerce-suggestions.rs:37:9
|
-41 | f = box f;
+37 | f = box f;
| ^^^^^ cyclic type of infinite size
error[E0308]: mismatched types
- --> $DIR/coerce-suggestions.rs:48:9
+ --> $DIR/coerce-suggestions.rs:42:9
|
-48 | s = format!("foo");
+42 | s = format!("foo");
| ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String`
|
= note: expected type `&mut std::string::String`
fn main() {
let b = {
let a = Box::new(RefCell::new(4));
- *a.borrow() + 1 //~ ERROR `*a` does not live long enough
- };
+ *a.borrow() + 1
+ }; //~ ERROR `*a` does not live long enough
println!("{}", b);
}
error[E0597]: `*a` does not live long enough
--> $DIR/destructor-restrictions.rs:19:5
|
-18 | *a.borrow() + 1 //~ ERROR `*a` does not live long enough
+18 | *a.borrow() + 1
| - borrow occurs here
-19 | };
+19 | }; //~ ERROR `*a` does not live long enough
| ^- borrowed value needs to live until here
| |
| `*a` dropped here while still borrowed
#![feature(attr_literals)]
-#[repr(align(16))]
+#[repr(align(16))] //~ ERROR is experimental
struct Gem {
mohs_hardness: u8,
poofed: bool,
weapon: Weapon,
}
-#[repr(simd)]
+#[repr(simd)] //~ ERROR are experimental
struct Weapon {
name: String,
damage: u32
impl Gem {
#[must_use] fn summon_weapon(&self) -> Weapon { self.weapon }
+ //~^ WARN is experimental
}
-#[must_use]
+#[must_use] //~ WARN is experimental
fn bubble(gem: Gem) -> Result<Gem, ()> {
if gem.poofed {
Ok(gem)
error: the struct `#[repr(align(u16))]` attribute is experimental (see issue #33626)
--> $DIR/gated-features-attr-spans.rs:13:1
|
-13 | #[repr(align(16))]
+13 | #[repr(align(16))] //~ ERROR is experimental
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(repr_align)] to the crate attributes to enable
error: SIMD types are experimental and possibly buggy (see issue #27731)
--> $DIR/gated-features-attr-spans.rs:20:1
|
-20 | #[repr(simd)]
+20 | #[repr(simd)] //~ ERROR are experimental
| ^^^^^^^^^^^^^
|
= help: add #![feature(repr_simd)] to the crate attributes to enable
= help: add #![feature(fn_must_use)] to the crate attributes to enable
warning: `#[must_use]` on functions is experimental (see issue #43302)
- --> $DIR/gated-features-attr-spans.rs:30:1
+ --> $DIR/gated-features-attr-spans.rs:31:1
|
-30 | #[must_use]
+31 | #[must_use] //~ WARN is experimental
| ^^^^^^^^^^^
|
= help: add #![feature(fn_must_use)] to the crate attributes to enable
trait Foo {
fn bar(&self);
+ //~^ NOTE item in trait
+ //~| NOTE `bar` from trait
+ //~| NOTE item in trait
+ //~| NOTE `bar` from trait
const MY_CONST: u32;
+ //~^ NOTE item in trait
+ //~| NOTE `MY_CONST` from trait
}
pub struct FooConstForMethod;
type bar = u64;
//~^ ERROR E0325
//~| NOTE does not match trait
+ //~| NOTE not a member
+ //~| ERROR E0437
const MY_CONST: u32 = 1;
}
impl Debug for FooTypeForMethod {
}
+//~^^ ERROR E0046
+//~| NOTE missing `fmt` in implementation
+//~| NOTE `fmt` from trait:
fn main () {}
error[E0437]: type `bar` is not a member of trait `Foo`
- --> $DIR/impl-wrong-item-for-trait.rs:46:5
+ --> $DIR/impl-wrong-item-for-trait.rs:52:5
|
-46 | type bar = u64;
+52 | type bar = u64;
| ^^^^^^^^^^^^^^^ not a member of trait `Foo`
error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
- --> $DIR/impl-wrong-item-for-trait.rs:24:5
+ --> $DIR/impl-wrong-item-for-trait.rs:30:5
|
15 | fn bar(&self);
| -------------- item in trait
...
-24 | const bar: u64 = 1;
+30 | const bar: u64 = 1;
| ^^^^^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `bar`
- --> $DIR/impl-wrong-item-for-trait.rs:21:1
+ --> $DIR/impl-wrong-item-for-trait.rs:27:1
|
15 | fn bar(&self);
| -------------- `bar` from trait
...
-21 | / impl Foo for FooConstForMethod {
-22 | | //~^ ERROR E0046
-23 | | //~| NOTE missing `bar` in implementation
-24 | | const bar: u64 = 1;
+27 | / impl Foo for FooConstForMethod {
+28 | | //~^ ERROR E0046
+29 | | //~| NOTE missing `bar` in implementation
+30 | | const bar: u64 = 1;
... |
-27 | | const MY_CONST: u32 = 1;
-28 | | }
+33 | | const MY_CONST: u32 = 1;
+34 | | }
| |_^ missing `bar` in implementation
error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo`
- --> $DIR/impl-wrong-item-for-trait.rs:36:5
+ --> $DIR/impl-wrong-item-for-trait.rs:42:5
|
-16 | const MY_CONST: u32;
+20 | const MY_CONST: u32;
| -------------------- item in trait
...
-36 | fn MY_CONST() {}
+42 | fn MY_CONST() {}
| ^^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `MY_CONST`
- --> $DIR/impl-wrong-item-for-trait.rs:32:1
+ --> $DIR/impl-wrong-item-for-trait.rs:38:1
|
-16 | const MY_CONST: u32;
+20 | const MY_CONST: u32;
| -------------------- `MY_CONST` from trait
...
-32 | / impl Foo for FooMethodForConst {
-33 | | //~^ ERROR E0046
-34 | | //~| NOTE missing `MY_CONST` in implementation
-35 | | fn bar(&self) {}
+38 | / impl Foo for FooMethodForConst {
+39 | | //~^ ERROR E0046
+40 | | //~| NOTE missing `MY_CONST` in implementation
+41 | | fn bar(&self) {}
... |
-38 | | //~| NOTE does not match trait
-39 | | }
+44 | | //~| NOTE does not match trait
+45 | | }
| |_^ missing `MY_CONST` in implementation
error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo`
- --> $DIR/impl-wrong-item-for-trait.rs:46:5
+ --> $DIR/impl-wrong-item-for-trait.rs:52:5
|
15 | fn bar(&self);
| -------------- item in trait
...
-46 | type bar = u64;
+52 | type bar = u64;
| ^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `bar`
- --> $DIR/impl-wrong-item-for-trait.rs:43:1
+ --> $DIR/impl-wrong-item-for-trait.rs:49:1
|
15 | fn bar(&self);
| -------------- `bar` from trait
...
-43 | / impl Foo for FooTypeForMethod {
-44 | | //~^ ERROR E0046
-45 | | //~| NOTE missing `bar` in implementation
-46 | | type bar = u64;
+49 | / impl Foo for FooTypeForMethod {
+50 | | //~^ ERROR E0046
+51 | | //~| NOTE missing `bar` in implementation
+52 | | type bar = u64;
... |
-49 | | const MY_CONST: u32 = 1;
-50 | | }
+57 | | const MY_CONST: u32 = 1;
+58 | | }
| |_^ missing `bar` in implementation
error[E0046]: not all trait items implemented, missing: `fmt`
- --> $DIR/impl-wrong-item-for-trait.rs:52:1
+ --> $DIR/impl-wrong-item-for-trait.rs:60:1
|
-52 | / impl Debug for FooTypeForMethod {
-53 | | }
+60 | / impl Debug for FooTypeForMethod {
+61 | | }
| |_^ missing `fmt` in implementation
|
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
fn main() {
let r = {
let x: Box<_> = box 42;
- let f = to_fn_once(move|| &x);
+ let f = to_fn_once(move|| &x); //~ ERROR does not live long enough
f()
};
error[E0597]: `x` does not live long enough
--> $DIR/issue-11925.rs:18:36
|
-18 | let f = to_fn_once(move|| &x);
+18 | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough
| ^
| |
| borrow occurs here
fn main() {
let v = vec![
&id(3)
- ];
+ ]; //~ ERROR borrowed value does not live long enough
for &&x in &v {
println!("{}", x + 3);
|
15 | &id(3)
| ----- temporary value created here
-16 | ];
+16 | ]; //~ ERROR borrowed value does not live long enough
| ^ temporary value dropped here while still borrowed
...
21 | }
fn foo2(x: RefCell<String>) -> String {
let ret = {
let y = x;
- y.borrow().clone() //~ ERROR `y` does not live long enough
- };
+ y.borrow().clone()
+ }; //~ ERROR `y` does not live long enough
ret
}
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:28:5
|
-27 | y.borrow().clone() //~ ERROR `y` does not live long enough
+27 | y.borrow().clone()
| - borrow occurs here
-28 | };
+28 | }; //~ ERROR `y` does not live long enough
| ^- borrowed value needs to live until here
| |
| `y` dropped here while still borrowed
#![warn(unused)]
#[rustc_error]
-fn main() {
- let theTwo = 2;
- let theOtherTwo = 2;
+fn main() { //~ ERROR compilation successful
+ let theTwo = 2; //~ WARN should have a snake case name
+ let theOtherTwo = 2; //~ WARN should have a snake case name
+ //~^ WARN unused variable
println!("{}", theTwo);
}
warning: unused variable: `theOtherTwo`
--> $DIR/issue-24690.rs:23:9
|
-23 | let theOtherTwo = 2;
+23 | let theOtherTwo = 2; //~ WARN should have a snake case name
| ^^^^^^^^^^^
|
note: lint level defined here
warning: variable `theTwo` should have a snake case name such as `the_two`
--> $DIR/issue-24690.rs:22:9
|
-22 | let theTwo = 2;
+22 | let theTwo = 2; //~ WARN should have a snake case name
| ^^^^^^
|
= note: #[warn(non_snake_case)] on by default
warning: variable `theOtherTwo` should have a snake case name such as `the_other_two`
--> $DIR/issue-24690.rs:23:9
|
-23 | let theOtherTwo = 2;
+23 | let theOtherTwo = 2; //~ WARN should have a snake case name
| ^^^^^^^^^^^
error: compilation successful
--> $DIR/issue-24690.rs:21:1
|
-21 | / fn main() {
-22 | | let theTwo = 2;
-23 | | let theOtherTwo = 2;
-24 | | println!("{}", theTwo);
-25 | | }
+21 | / fn main() { //~ ERROR compilation successful
+22 | | let theTwo = 2; //~ WARN should have a snake case name
+23 | | let theOtherTwo = 2; //~ WARN should have a snake case name
+24 | | //~^ WARN unused variable
+25 | | println!("{}", theTwo);
+26 | | }
| |_^
struct SomeType {}
trait Foo {
- fn handler(self: &SomeType);
+ fn handler(self: &SomeType); //~ ERROR invalid `self` type
}
fn main() {}
error[E0307]: invalid `self` type: &SomeType
--> $DIR/issue-27522.rs:16:22
|
-16 | fn handler(self: &SomeType);
+16 | fn handler(self: &SomeType); //~ ERROR invalid `self` type
| ^^^^^^^^^
|
= note: type must be `Self` or a type that dereferences to it`
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(Option<i32>, String) {}
-fn bar(x, y: usize) {}
+fn foo(Option<i32>, String) {} //~ ERROR expected one of
+//~^ ERROR expected one of
+fn bar(x, y: usize) {} //~ ERROR expected one of
fn main() {
foo(Some(42), 2);
- foo(Some(42), 2, "");
- bar("", "");
+ foo(Some(42), 2, ""); //~ ERROR this function takes
+ bar("", ""); //~ ERROR mismatched types
bar(1, 2);
- bar(1, 2, 3);
+ bar(1, 2, 3); //~ ERROR this function takes
}
error: expected one of `:` or `@`, found `<`
--> $DIR/issue-34264.rs:11:14
|
-11 | fn foo(Option<i32>, String) {}
+11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of
| ^ expected one of `:` or `@` here
error: expected one of `:` or `@`, found `)`
--> $DIR/issue-34264.rs:11:27
|
-11 | fn foo(Option<i32>, String) {}
+11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of
| ^ expected one of `:` or `@` here
error: expected one of `:` or `@`, found `,`
- --> $DIR/issue-34264.rs:12:9
+ --> $DIR/issue-34264.rs:13:9
|
-12 | fn bar(x, y: usize) {}
+13 | fn bar(x, y: usize) {} //~ ERROR expected one of
| ^ expected one of `:` or `@` here
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
- --> $DIR/issue-34264.rs:16:9
+ --> $DIR/issue-34264.rs:17:9
|
-11 | fn foo(Option<i32>, String) {}
+11 | fn foo(Option<i32>, String) {} //~ ERROR expected one of
| ------------------------------ defined here
...
-16 | foo(Some(42), 2, "");
+17 | foo(Some(42), 2, ""); //~ ERROR this function takes
| ^^^^^^^^^^^^^^^ expected 2 parameters
error[E0308]: mismatched types
- --> $DIR/issue-34264.rs:17:13
+ --> $DIR/issue-34264.rs:18:13
|
-17 | bar("", "");
+18 | bar("", ""); //~ ERROR mismatched types
| ^^ expected usize, found reference
|
= note: expected type `usize`
- .len()
error[E0061]: this function takes 2 parameters but 3 parameters were supplied
- --> $DIR/issue-34264.rs:19:9
+ --> $DIR/issue-34264.rs:20:9
|
-12 | fn bar(x, y: usize) {}
+13 | fn bar(x, y: usize) {} //~ ERROR expected one of
| ---------------------- defined here
...
-19 | bar(1, 2, 3);
+20 | bar(1, 2, 3); //~ ERROR this function takes
| ^^^^^^^ expected 2 parameters
error: aborting due to 6 previous errors
use std::ops::Add;
impl<T: Clone, Add> Add for Foo<T> {
+//~^ ERROR expected trait, found type parameter
type Output = usize;
fn add(self, rhs: Self) -> Self::Output {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#[foo]
+#[foo] //~ ERROR is currently unknown to the compiler
mod foo {
- #![foo]
+ #![foo] //~ ERROR is currently unknown to the compiler
}
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:11:1
|
-11 | #[foo]
+11 | #[foo] //~ ERROR is currently unknown to the compiler
| ^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:13:5
|
-13 | #![foo]
+13 | #![foo] //~ ERROR is currently unknown to the compiler
| ^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
}
fn bar<T: B>(a: &T) {
- a.foo()
+ a.foo() //~ ERROR multiple applicable items
}
trait C {
}
fn quz<T: D>(a: &T) {
- a.foo()
+ a.foo() //~ ERROR multiple applicable items
}
trait E : Sized {
}
fn foo<T: F>(a: T) {
- a.foo()
+ a.foo() //~ ERROR multiple applicable items
}
fn pass<T: C>(a: &T) {
error[E0034]: multiple applicable items in scope
--> $DIR/issue-37767.rs:20:7
|
-20 | a.foo()
+20 | a.foo() //~ ERROR multiple applicable items
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in the trait `A`
error[E0034]: multiple applicable items in scope
--> $DIR/issue-37767.rs:32:7
|
-32 | a.foo()
+32 | a.foo() //~ ERROR multiple applicable items
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in the trait `C`
error[E0034]: multiple applicable items in scope
--> $DIR/issue-37767.rs:44:7
|
-44 | a.foo()
+44 | a.foo() //~ ERROR multiple applicable items
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in the trait `E`
pub fn main() {
let x = "Hello " + "World!";
+ //~^ ERROR cannot be applied to type
// Make sure that the span outputs a warning
// for not having an implementation for std::ops::Add
// that won't output for the above string concatenation
let y = World::Hello + World::Goodbye;
+ //~^ ERROR cannot be applied to type
}
enum World {
| ^^^^^^^^^^^^^^^^^^^
error[E0369]: binary operation `+` cannot be applied to type `World`
- --> $DIR/issue-39018.rs:17:13
+ --> $DIR/issue-39018.rs:18:13
|
-17 | let y = World::Hello + World::Goodbye;
+18 | let y = World::Hello + World::Goodbye;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: an implementation of `std::ops::Add` might be missing for `World`
fn main() {
match T::T1(123, 456) {
T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
+ //~^ ERROR is not bound in all patterns
+ //~| ERROR is not bound in all patterns
+ //~| ERROR is not bound in all patterns
+ //~| ERROR is not bound in all patterns
}
}
fn main () {
{println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
+ //~^ ERROR does not live long enough
}
#![allow(dead_code)]
#![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
+//~^ ERROR `derive` may only be applied to structs, enums and unions
struct DerivedOn;
fn main() {}
}
}
-struct Myisize(isize);
+struct Myisize(isize); //~ NOTE not found for this
impl Myisize {
fn fff(i: isize) -> isize { //~ NOTE candidate
u.f8(42) + u.f9(342) + m.fff(42)
//~^ ERROR no method named `f9` found for type `usize` in the current scope
//~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
- //~| NOTE to use it here write `CtxtFn::f9(u, 342)` instead
+ //~| NOTE the following traits define an item
//~| ERROR no method named `fff` found for type `Myisize` in the current scope
//~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
- //~| NOTE to use it here write `OtherTrait::f9(u, 342)` instead
- //~| NOTE to use it here write `UnusedTrait::f9(u, 342)` instead
+
+
}
fn param_bound<T: ManyImplTrait>(t: T) -> bool {
t.is_str()
//~^ ERROR no method named `is_str` found for type `T` in the current scope
//~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
- //~| NOTE to use it here write `ManyImplTrait::is_str(t)` instead
+ //~| NOTE the following trait defines
}
fn main() {
error[E0599]: no method named `fff` found for type `Myisize` in the current scope
--> $DIR/issue-7575.rs:74:30
|
-48 | struct Myisize(isize);
+48 | struct Myisize(isize); //~ NOTE not found for this
| ---------------------- method `fff` not found for this
...
74 | u.f8(42) + u.f9(342) + m.fff(42)
macro_rules! m {
($a:tt $b:tt) => {
- $b $a;
+ $b $a; //~ WARN struct is never used
}
}
warning: struct is never used: `S`
--> $DIR/macro-span-replacement.rs:15:9
|
-15 | $b $a;
+15 | $b $a; //~ WARN struct is never used
| ^^^^^^
...
20 | m!(S struct);
}
fn main() {
- foo::<T>!();
- foo::<>!();
- m!(MyTrait<>);
+ foo::<T>!(); //~ ERROR generic arguments in macro path
+ foo::<>!(); //~ ERROR generic arguments in macro path
+ m!(MyTrait<>); //~ ERROR generic arguments in macro path
+ //~^ ERROR unexpected generic arguments in path
}
error: unexpected generic arguments in path
--> $DIR/macro-ty-params.rs:20:8
|
-20 | m!(MyTrait<>);
+20 | m!(MyTrait<>); //~ ERROR generic arguments in macro path
| ^^^^^^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:18:8
|
-18 | foo::<T>!();
+18 | foo::<T>!(); //~ ERROR generic arguments in macro path
| ^^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:19:8
|
-19 | foo::<>!();
+19 | foo::<>!(); //~ ERROR generic arguments in macro path
| ^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:20:15
|
-20 | m!(MyTrait<>);
+20 | m!(MyTrait<>); //~ ERROR generic arguments in macro path
| ^^
error: aborting due to 5 previous errors
}
fn main() {
- let _: Result<(), String> = Ok();
- foo();
- foo(());
- bar();
- S.baz();
- S.generic::<()>();
+ let _: Result<(), String> = Ok(); //~ ERROR this function takes
+ foo(); //~ ERROR this function takes
+ foo(()); //~ ERROR this function takes
+ bar(); //~ ERROR this function takes
+ S.baz(); //~ ERROR this function takes
+ S.generic::<()>(); //~ ERROR this function takes
}
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
--> $DIR/missing-unit-argument.rs:21:33
|
-21 | let _: Result<(), String> = Ok();
+21 | let _: Result<(), String> = Ok(); //~ ERROR this function takes
| ^^^^
help: expected the unit value `()`; create it with empty parentheses
|
-21 | let _: Result<(), String> = Ok(());
+21 | let _: Result<(), String> = Ok(()); //~ ERROR this function takes
| ^^
error[E0061]: this function takes 2 parameters but 0 parameters were supplied
11 | fn foo(():(), ():()) {}
| ----------------------- defined here
...
-22 | foo();
+22 | foo(); //~ ERROR this function takes
| ^^^^^ expected 2 parameters
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
11 | fn foo(():(), ():()) {}
| ----------------------- defined here
...
-23 | foo(());
+23 | foo(()); //~ ERROR this function takes
| ^^ expected 2 parameters
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
12 | fn bar(():()) {}
| ---------------- defined here
...
-24 | bar();
+24 | bar(); //~ ERROR this function takes
| ^^^^^
help: expected the unit value `()`; create it with empty parentheses
|
-24 | bar(());
+24 | bar(()); //~ ERROR this function takes
| ^^
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
16 | fn baz(self, (): ()) { }
| ------------------------ defined here
...
-25 | S.baz();
+25 | S.baz(); //~ ERROR this function takes
| ^^^
help: expected the unit value `()`; create it with empty parentheses
|
-25 | S.baz(());
+25 | S.baz(()); //~ ERROR this function takes
| ^^
error[E0061]: this function takes 1 parameter but 0 parameters were supplied
17 | fn generic<T>(self, _: T) { }
| ----------------------------- defined here
...
-26 | S.generic::<()>();
+26 | S.generic::<()>(); //~ ERROR this function takes
| ^^^^^^^
help: expected the unit value `()`; create it with empty parentheses
|
-26 | S.generic::<()>(());
+26 | S.generic::<()>(()); //~ ERROR this function takes
| ^^
error: aborting due to 6 previous errors
// Make sure that the span of a closure marked `move` begins at the `move` keyword.
fn main() {
- let x: () = move || ();
+ let x: () = move || (); //~ ERROR mismatched types
}
error[E0308]: mismatched types
--> $DIR/move-closure.rs:15:17
|
-15 | let x: () = move || ();
+15 | let x: () = move || (); //~ ERROR mismatched types
| ^^^^^^^^^^ expected (), found closure
|
= note: expected type `()`
// except according to those terms.
// It should just use the entire body instead of pointing at the next two lines
-struct
+struct //~ ERROR has infinite size
ListNode
{
head: u8,
error[E0072]: recursive type `ListNode` has infinite size
--> $DIR/multiline-span-E0072.rs:12:1
|
-12 | / struct
+12 | / struct //~ ERROR has infinite size
13 | | ListNode
14 | | {
15 | | head: u8,
let x = 1;
let y = 2;
let z = 3;
- foo(1 as u32 +
+ foo(1 as u32 + //~ ERROR not satisfied
bar(x,
error[E0277]: the trait bound `u32: std::ops::Add<()>` is not satisfied
--> $DIR/multiline-span-simple.rs:23:18
|
-23 | foo(1 as u32 +
+23 | foo(1 as u32 + //~ ERROR not satisfied
| ^ no implementation for `u32 + ()`
|
= help: the trait `std::ops::Add<()>` is not implemented for `u32`
#![warn(unused)]
use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
+//~^ WARN unused imports
fn main() {
let _ = min(1, 2);
trait B {
fn foo(mut a: &String) {
- a.push_str("bar");
+ a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content
}
}
pub fn foo<'a>(mut a: &'a String) {
- a.push_str("foo");
+ a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
}
struct A {}
impl A {
pub fn foo(mut a: &String) {
- a.push_str("foo");
+ a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
}
}
|
12 | fn foo(mut a: &String) {
| ------- use `&mut String` here to make mutable
-13 | a.push_str("bar");
+13 | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
|
17 | pub fn foo<'a>(mut a: &'a String) {
| ---------- use `&'a mut String` here to make mutable
-18 | a.push_str("foo");
+18 | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
| ^ cannot borrow as mutable
error[E0596]: cannot borrow immutable borrowed content `*a` as mutable
|
24 | pub fn foo(mut a: &String) {
| ------- use `&mut String` here to make mutable
-25 | a.push_str("foo");
+25 | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content
| ^ cannot borrow as mutable
error: aborting due to 3 previous errors
let p;
{
let b = m.borrow();
- p = &*b; //~ ERROR `b` does not live long enough
- }
+ p = &*b;
+ } //~ ERROR `b` does not live long enough
}
error[E0597]: `b` does not live long enough
--> $DIR/mut-ptr-cant-outlive-ref.rs:19:5
|
-18 | p = &*b; //~ ERROR `b` does not live long enough
+18 | p = &*b;
| - borrow occurs here
-19 | }
+19 | } //~ ERROR `b` does not live long enough
| ^ `b` dropped here while still borrowed
20 | }
| - borrowed value needs to live until here
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::bar::{foo1, foo2};
+use std::bar::{foo1, foo2}; //~ ERROR unresolved import
fn main() {}
error[E0432]: unresolved import `std::bar`
--> $DIR/non-existing-module-import.rs:11:10
|
-11 | use std::bar::{foo1, foo2};
+11 | use std::bar::{foo1, foo2}; //~ ERROR unresolved import
| ^^^ Could not find `bar` in `std`
error: aborting due to previous error
struct Foo {
bar: u8,
- pub bar: u8,
- pub(crate) bar: u8,
+ pub bar: u8, //~ ERROR is already declared
+ pub(crate) bar: u8, //~ ERROR is already declared
}
fn main() {}
|
15 | bar: u8,
| ------- `bar` first declared here
-16 | pub bar: u8,
+16 | pub bar: u8, //~ ERROR is already declared
| ^^^^^^^^^^^ field already declared
error[E0124]: field `bar` is already declared
|
15 | bar: u8,
| ------- `bar` first declared here
-16 | pub bar: u8,
-17 | pub(crate) bar: u8,
+16 | pub bar: u8, //~ ERROR is already declared
+17 | pub(crate) bar: u8, //~ ERROR is already declared
| ^^^^^^^^^^^^^^^^^^ field already declared
error: aborting due to 2 previous errors
let a = 42;
let b = 42;
&a..&b
- //~^ ERROR `a` does not live long enough
- //~^^ ERROR `b` does not live long enough
};
+ //~^ ERROR `a` does not live long enough
+ //~^^ ERROR `b` does not live long enough
}
error[E0597]: `a` does not live long enough
- --> $DIR/range-2.rs:20:5
+ --> $DIR/range-2.rs:18:5
|
17 | &a..&b
| - borrow occurs here
-...
-20 | };
+18 | };
| ^ `a` dropped here while still borrowed
+...
21 | }
| - borrowed value needs to live until here
error[E0597]: `b` does not live long enough
- --> $DIR/range-2.rs:20:5
+ --> $DIR/range-2.rs:18:5
|
17 | &a..&b
| - borrow occurs here
-...
-20 | };
+18 | };
| ^ `b` dropped here while still borrowed
+...
21 | }
| - borrowed value needs to live until here
use std::rc::Rc;
-struct Foo<'a> {
+struct Foo<'a> { //~ ERROR recursive type
bar: Bar<'a>,
b: Rc<Bar<'a>>,
}
-struct Bar<'a> {
+struct Bar<'a> { //~ ERROR recursive type
y: (Foo<'a>, Foo<'a>),
z: Option<Bar<'a>>,
a: &'a Foo<'a>,
error[E0072]: recursive type `Foo` has infinite size
--> $DIR/recursive-type-field.rs:13:1
|
-13 | struct Foo<'a> {
+13 | struct Foo<'a> { //~ ERROR recursive type
| ^^^^^^^^^^^^^^ recursive type has infinite size
14 | bar: Bar<'a>,
| ------------ recursive without indirection
error[E0072]: recursive type `Bar` has infinite size
--> $DIR/recursive-type-field.rs:18:1
|
-18 | struct Bar<'a> {
+18 | struct Bar<'a> { //~ ERROR recursive type
| ^^^^^^^^^^^^^^ recursive type has infinite size
19 | y: (Foo<'a>, Foo<'a>),
| --------------------- recursive without indirection
let mut f;
{
let c = 1;
- let c_ref = &c; //~ ERROR `c` does not live long enough
+ let c_ref = &c;
f = move |a: isize, b: isize| { a + b + *c_ref };
- }
+ } //~ ERROR `c` does not live long enough
}
error[E0597]: `c` does not live long enough
--> $DIR/regionck-unboxed-closure-lifetimes.rs:19:5
|
-17 | let c_ref = &c; //~ ERROR `c` does not live long enough
+17 | let c_ref = &c;
| - borrow occurs here
18 | f = move |a: isize, b: isize| { a + b + *c_ref };
-19 | }
+19 | } //~ ERROR `c` does not live long enough
| ^ `c` dropped here while still borrowed
20 | }
| - borrowed value needs to live until here
{
let ss: &isize = &id(1);
blah = box ss as Box<Foo>;
- }
+ } //~ ERROR does not live long enough
}
22 | let ss: &isize = &id(1);
| ----- temporary value created here
23 | blah = box ss as Box<Foo>;
-24 | }
+24 | } //~ ERROR does not live long enough
| ^ temporary value dropped here while still borrowed
25 | }
| - temporary value needs to live until here
let _ = {
let tmp0 = 3;
- let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough
+ let tmp1 = &tmp0;
repeater3(tmp1)
- };
+ }; //~ ERROR `tmp0` does not live long enough
}
error[E0597]: `tmp0` does not live long enough
--> $DIR/regions-close-over-type-parameter-2.rs:35:5
|
-33 | let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough
+33 | let tmp1 = &tmp0;
| ---- borrow occurs here
34 | repeater3(tmp1)
-35 | };
+35 | }; //~ ERROR `tmp0` does not live long enough
| ^- borrowed value needs to live until here
| |
| `tmp0` dropped here while still borrowed
loop {
let x = 1 + *p;
- p = &x; //~ ERROR `x` does not live long enough
- }
+ p = &x;
+ } //~ ERROR `x` does not live long enough
}
error[E0597]: `x` does not live long enough
--> $DIR/regions-escape-loop-via-variable.rs:22:5
|
-21 | p = &x; //~ ERROR `x` does not live long enough
+21 | p = &x;
| - borrow occurs here
-22 | }
+22 | } //~ ERROR `x` does not live long enough
| ^ `x` dropped here while still borrowed
23 | }
| - borrowed value needs to live until here
//~^ NOTE use of borrowed `x`
let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
//~^ NOTE use of borrowed `x`
- _y.push(&mut z); //~ ERROR `z` does not live long enough
- //~^ NOTE does not live long enough
+ _y.push(&mut z); //~ NOTE borrow occurs here
x += 1; //~ ERROR cannot assign
//~^ NOTE assignment to borrowed `x` occurs here
- }
- //~^ NOTE borrowed value only lives until here
+ } //~ NOTE `z` dropped here while still borrowed
+ //~^ ERROR `z` does not live long enough
}
//~^ NOTE borrowed value needs to live until here
error[E0597]: `z` does not live long enough
- --> $DIR/regions-escape-loop-via-vec.rs:26:5
+ --> $DIR/regions-escape-loop-via-vec.rs:25:5
|
-22 | _y.push(&mut z); //~ ERROR `z` does not live long enough
+22 | _y.push(&mut z); //~ NOTE borrow occurs here
| - borrow occurs here
...
-26 | }
+25 | } //~ NOTE `z` dropped here while still borrowed
| ^ `z` dropped here while still borrowed
-27 | //~^ NOTE borrowed value only lives until here
-28 | }
+26 | //~^ ERROR `z` does not live long enough
+27 | }
| - borrowed value needs to live until here
error[E0503]: cannot use `x` because it was mutably borrowed
| ^^^^^ use of borrowed `x`
error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/regions-escape-loop-via-vec.rs:24:9
+ --> $DIR/regions-escape-loop-via-vec.rs:23:9
|
14 | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
...
-24 | x += 1; //~ ERROR cannot assign
+23 | x += 1; //~ ERROR cannot assign
| ^^^^^^ assignment to borrowed `x` occurs here
error: aborting due to 4 previous errors
// Here we complain because the resulting region
// of this borrow is the fn body as a whole.
- y = borrow(&*x); //~ ERROR `*x` does not live long enough
+ y = borrow(&*x);
assert_eq!(*x, *y);
if cond() { break; }
- }
+ } //~ ERROR `*x` does not live long enough
assert!(*y != 0);
}
error[E0597]: `*x` does not live long enough
--> $DIR/regions-infer-borrow-scope-within-loop.rs:28:5
|
-24 | y = borrow(&*x); //~ ERROR `*x` does not live long enough
+24 | y = borrow(&*x);
| -- borrow occurs here
...
-28 | }
+28 | } //~ ERROR `*x` does not live long enough
| ^ `*x` dropped here while still borrowed
29 | assert!(*y != 0);
30 | }
fn main() {
let bad = {
let x = 1;
- let y = &x; //~ ERROR `x` does not live long enough
+ let y = &x;
scoped(|| {
let _z = y;
//~^ ERROR `y` does not live long enough
})
- };
+ }; //~ ERROR `x` does not live long enough
bad.join();
}
error[E0597]: `x` does not live long enough
--> $DIR/send-is-not-static-ensures-scoping.rs:32:5
|
-26 | let y = &x; //~ ERROR `x` does not live long enough
+26 | let y = &x;
| - borrow occurs here
...
-32 | };
+32 | }; //~ ERROR `x` does not live long enough
| ^ `x` dropped here while still borrowed
...
35 | }
29 | let _z = y;
| ^ does not live long enough
...
-32 | };
+32 | }; //~ ERROR `x` does not live long enough
| - borrowed value only lives until here
...
35 | }
fn mutex() {
let lock = {
let x = 1;
- Mutex::new(&x) //~ ERROR does not live long enough
- };
+ Mutex::new(&x)
+ }; //~ ERROR does not live long enough
let _dangling = *lock.lock().unwrap();
}
fn rwlock() {
let lock = {
let x = 1;
- RwLock::new(&x) //~ ERROR does not live long enough
- };
+ RwLock::new(&x)
+ }; //~ ERROR does not live long enough
let _dangling = *lock.read().unwrap();
}
let (_tx, rx) = {
let x = 1;
let (tx, rx) = mpsc::channel();
- let _ = tx.send(&x); //~ ERROR does not live long enough
+ let _ = tx.send(&x);
(tx, rx)
- };
+ }; //~ ERROR does not live long enough
let _dangling = rx.recv();
}
error[E0597]: `x` does not live long enough
--> $DIR/send-is-not-static-std-sync-2.rs:22:5
|
-21 | Mutex::new(&x) //~ ERROR does not live long enough
+21 | Mutex::new(&x)
| - borrow occurs here
-22 | };
+22 | }; //~ ERROR does not live long enough
| ^ `x` dropped here while still borrowed
...
25 | }
error[E0597]: `x` does not live long enough
--> $DIR/send-is-not-static-std-sync-2.rs:31:5
|
-30 | RwLock::new(&x) //~ ERROR does not live long enough
+30 | RwLock::new(&x)
| - borrow occurs here
-31 | };
+31 | }; //~ ERROR does not live long enough
| ^ `x` dropped here while still borrowed
32 | let _dangling = *lock.read().unwrap();
33 | }
error[E0597]: `x` does not live long enough
--> $DIR/send-is-not-static-std-sync-2.rs:41:5
|
-39 | let _ = tx.send(&x); //~ ERROR does not live long enough
+39 | let _ = tx.send(&x);
| - borrow occurs here
40 | (tx, rx)
-41 | };
+41 | }; //~ ERROR does not live long enough
| ^ `x` dropped here while still borrowed
...
44 | }
drop(y); //~ ERROR cannot move out
{
let z = 2;
- *lock.lock().unwrap() = &z; //~ ERROR does not live long enough
- }
+ *lock.lock().unwrap() = &z;
+ } //~ ERROR does not live long enough
}
fn rwlock() {
drop(y); //~ ERROR cannot move out
{
let z = 2;
- *lock.write().unwrap() = &z; //~ ERROR does not live long enough
- }
+ *lock.write().unwrap() = &z;
+ } //~ ERROR does not live long enough
}
fn channel() {
drop(y); //~ ERROR cannot move out
{
let z = 2;
- tx.send(&z).unwrap(); //~ ERROR does not live long enough
- }
+ tx.send(&z).unwrap();
+ } //~ ERROR does not live long enough
}
fn main() {}
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:27:5
|
-26 | *lock.lock().unwrap() = &z; //~ ERROR does not live long enough
+26 | *lock.lock().unwrap() = &z;
| - borrow occurs here
-27 | }
+27 | } //~ ERROR does not live long enough
| ^ `z` dropped here while still borrowed
28 | }
| - borrowed value needs to live until here
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:39:5
|
-38 | *lock.write().unwrap() = &z; //~ ERROR does not live long enough
+38 | *lock.write().unwrap() = &z;
| - borrow occurs here
-39 | }
+39 | } //~ ERROR does not live long enough
| ^ `z` dropped here while still borrowed
40 | }
| - borrowed value needs to live until here
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:53:5
|
-52 | tx.send(&z).unwrap(); //~ ERROR does not live long enough
+52 | tx.send(&z).unwrap();
| - borrow occurs here
-53 | }
+53 | } //~ ERROR does not live long enough
| ^ `z` dropped here while still borrowed
54 | }
| - borrowed value needs to live until here
{
let x: &[isize] = &vec![1, 2, 3, 4, 5];
y = &x[1..];
- }
+ } //~ ERROR does not live long enough
}
16 | let x: &[isize] = &vec![1, 2, 3, 4, 5];
| ------------------- temporary value created here
17 | y = &x[1..];
-18 | }
+18 | } //~ ERROR does not live long enough
| ^ temporary value dropped here while still borrowed
19 | }
| - temporary value needs to live until here
fn main() {
let tup = (1,);
- println!("☃{}", tup[0]);
+ println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type
}
error[E0608]: cannot index into a value of type `({integer},)`
--> $DIR/suggestion-non-ascii.rs:14:21
|
-14 | println!("☃{}", tup[0]);
+14 | println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type
| ^^^^^^ help: to access tuple elements, use: `tup.0`
error: aborting due to previous error
use std::ops::Deref;
fn homura<T: Deref<Trget = i32>>(_: T) {}
+//~^ ERROR not found
fn main() {}
let foo = 1;
// `foo` shouldn't be suggested, it is too dissimilar from `bar`.
- println!("Hello {}", bar);
+ println!("Hello {}", bar); //~ ERROR cannot find value
// But this is close enough.
- println!("Hello {}", fob);
+ println!("Hello {}", fob); //~ ERROR cannot find value
}
error[E0425]: cannot find value `bar` in this scope
--> $DIR/typo-suggestion.rs:15:26
|
-15 | println!("Hello {}", bar);
+15 | println!("Hello {}", bar); //~ ERROR cannot find value
| ^^^ not found in this scope
error[E0425]: cannot find value `fob` in this scope
--> $DIR/typo-suggestion.rs:18:26
|
-18 | println!("Hello {}", fob);
+18 | println!("Hello {}", fob); //~ ERROR cannot find value
| ^^^ did you mean `foo`?
error: aborting due to 2 previous errors
#![warn(unused)]
-enum Enum {
+enum Enum { //~ WARN enum is never used
A,
B,
C,
D,
}
-struct Struct {
+struct Struct { //~ WARN struct is never used
a: usize,
b: usize,
c: usize,
d: usize,
}
-fn func() -> usize {
+fn func() -> usize { //~ WARN function is never used
3
}
-fn
+fn //~ WARN function is never used
func_complete_span()
-> usize
{
warning: enum is never used: `Enum`
--> $DIR/unused-warning-point-at-signature.rs:15:1
|
-15 | enum Enum {
+15 | enum Enum { //~ WARN enum is never used
| ^^^^^^^^^
|
note: lint level defined here
warning: struct is never used: `Struct`
--> $DIR/unused-warning-point-at-signature.rs:22:1
|
-22 | struct Struct {
+22 | struct Struct { //~ WARN struct is never used
| ^^^^^^^^^^^^^
warning: function is never used: `func`
--> $DIR/unused-warning-point-at-signature.rs:29:1
|
-29 | fn func() -> usize {
+29 | fn func() -> usize { //~ WARN function is never used
| ^^^^^^^^^^^^^^^^^^
warning: function is never used: `func_complete_span`
--> $DIR/unused-warning-point-at-signature.rs:33:1
|
-33 | / fn
+33 | / fn //~ WARN function is never used
34 | | func_complete_span()
35 | | -> usize
36 | | {
struct S<T>(T);
m!{ S<u8> } //~ ERROR unexpected generic arguments in path
-//~^ ERROR expected module, found struct `S`
mod m {
m!{ m<> } //~ ERROR unexpected generic arguments in path
| ^^^^^
error: unexpected generic arguments in path
- --> $DIR/visibility-ty-params.rs:20:9
+ --> $DIR/visibility-ty-params.rs:19:9
|
-20 | m!{ m<> } //~ ERROR unexpected generic arguments in path
+19 | m!{ m<> } //~ ERROR unexpected generic arguments in path
| ^^^
error: aborting due to 2 previous errors
let f2 = f;
let dangling = {
let pointer = Box::new(42);
- f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough
- };
+ f2.xmute(&pointer)
+ }; //~ ERROR `pointer` does not live long enough
println!("{}", dangling);
}
error[E0597]: `pointer` does not live long enough
--> $DIR/wf-method-late-bound-regions.rs:31:5
|
-30 | f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough
+30 | f2.xmute(&pointer)
| ------- borrow occurs here
-31 | };
+31 | }; //~ ERROR `pointer` does not live long enough
| ^ `pointer` dropped here while still borrowed
32 | println!("{}", dangling);
33 | }
pub trait Arbitrary: Sized + 'static {}
-impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {}
+impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
fn main() {
-}
\ No newline at end of file
+}
error[E0478]: lifetime bound not satisfied
--> $DIR/static-lifetime.rs:13:20
|
-13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {}
+13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
| ^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:1
--> $DIR/static-lifetime.rs:13:1
|
-13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {}
+13 | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but lifetime parameter must outlive the static lifetime
fn main() {
- let x: &[u8] = "foo";
- let y: &[u8; 4] = "baaa";
- let z: &str = b"foo";
+ let x: &[u8] = "foo"; //~ ERROR mismatched types
+ let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types
+ let z: &str = b"foo"; //~ ERROR mismatched types
}
error[E0308]: mismatched types
--> $DIR/str-lit-type-mismatch.rs:13:20
|
-13 | let x: &[u8] = "foo";
+13 | let x: &[u8] = "foo"; //~ ERROR mismatched types
| ^^^^^ expected slice, found str
|
= note: expected type `&[u8]`
error[E0308]: mismatched types
--> $DIR/str-lit-type-mismatch.rs:14:23
|
-14 | let y: &[u8; 4] = "baaa";
+14 | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types
| ^^^^^^ expected array of 4 elements, found str
|
= note: expected type `&[u8; 4]`
error[E0308]: mismatched types
--> $DIR/str-lit-type-mismatch.rs:15:19
|
-15 | let z: &str = b"foo";
+15 | let z: &str = b"foo"; //~ ERROR mismatched types
| ^^^^^^ expected str, found array of 3 elements
|
= note: expected type `&str`
let foo = Foo {
one: 111,
..Foo::default(),
- //~^ ERROR cannot use a comma after struct expansion
+ //~^ ERROR cannot use a comma after the base struct
};
let foo = Foo {
..Foo::default(),
- //~^ ERROR cannot use a comma after struct expansion
+ //~^ ERROR cannot use a comma after the base struct
one: 111,
};
}
fn main() {
let y = true;
- foo(Box::new(move || y = false) as Box<_>);
+ foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
}
|
18 | let y = true;
| - help: consider making `y` mutable: `mut y`
-19 | foo(Box::new(move || y = false) as Box<_>);
+19 | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable
| ^^^^^^^^^
error: aborting due to previous error
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct Obj<F> where F: FnMut() -> u32 {
+struct Obj<F> where F: FnMut() -> u32 { //~ NOTE not found for this
closure: F,
}
error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope
--> $DIR/issue-18343.rs:17:7
|
-11 | struct Obj<F> where F: FnMut() -> u32 {
+11 | struct Obj<F> where F: FnMut() -> u32 { //~ NOTE not found for this
| ------------------------------------- method `closure` not found for this
...
17 | o.closure();
use std::boxed::FnBox;
struct FuncContainer {
+//~^ NOTE not found for this
+//~| NOTE not found for this
+//~| NOTE not found for this
f1: fn(data: u8),
f2: extern "C" fn(data: u8),
f3: unsafe fn(data: u8),
}
struct Obj<F> where F: FnOnce() -> u32 {
+//~^ NOTE not found for this
+//~| NOTE not found for this
+//~| NOTE not found for this
+//~| NOTE not found for this
+//~| NOTE not found for this
+//~| NOTE not found for this
closure: F,
not_closure: usize,
}
struct BoxedObj {
+//~^ NOTE not found for this
+//~| NOTE not found for this
boxed_closure: Box<FnBox() -> u32>,
}
-error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
- --> $DIR/issue-2392.rs:50:15
+error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:60:36: 60:41]>` in the current scope
+ --> $DIR/issue-2392.rs:61:15
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
...
-50 | o_closure.closure(); //~ ERROR no method named `closure` found
+61 | o_closure.closure(); //~ ERROR no method named `closure` found
| ^^^^^^^ field, not a method
|
= help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field
-error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope
- --> $DIR/issue-2392.rs:54:15
+error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:60:36: 60:41]>` in the current scope
+ --> $DIR/issue-2392.rs:65:15
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `not_closure` not found for this
...
-54 | o_closure.not_closure();
+65 | o_closure.not_closure();
| ^^^^^^^^^^^ field, not a method
|
= help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`?
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
- --> $DIR/issue-2392.rs:60:12
+ --> $DIR/issue-2392.rs:71:12
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
...
-60 | o_func.closure(); //~ ERROR no method named `closure` found
+71 | o_func.closure(); //~ ERROR no method named `closure` found
| ^^^^^^^ field, not a method
|
= help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
- --> $DIR/issue-2392.rs:65:14
+ --> $DIR/issue-2392.rs:76:14
|
-30 | struct BoxedObj {
+39 | struct BoxedObj {
| --------------- method `boxed_closure` not found for this
...
-65 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found
+76 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found
| ^^^^^^^^^^^^^ field, not a method
|
= help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
- --> $DIR/issue-2392.rs:70:19
+ --> $DIR/issue-2392.rs:81:19
|
-30 | struct BoxedObj {
+39 | struct BoxedObj {
| --------------- method `boxed_closure` not found for this
...
-70 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found
+81 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found
| ^^^^^^^^^^^^^ field, not a method
|
= help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
- --> $DIR/issue-2392.rs:77:12
+ --> $DIR/issue-2392.rs:88:12
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
...
-77 | w.wrap.closure();//~ ERROR no method named `closure` found
+88 | w.wrap.closure();//~ ERROR no method named `closure` found
| ^^^^^^^ field, not a method
|
= help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field
error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
- --> $DIR/issue-2392.rs:81:12
+ --> $DIR/issue-2392.rs:92:12
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `not_closure` not found for this
...
-81 | w.wrap.not_closure();
+92 | w.wrap.not_closure();
| ^^^^^^^^^^^ field, not a method
|
= help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`?
error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<std::boxed::FnBox<(), Output=u32> + 'static>>` in the current scope
- --> $DIR/issue-2392.rs:86:24
+ --> $DIR/issue-2392.rs:97:24
|
-25 | struct Obj<F> where F: FnOnce() -> u32 {
+28 | struct Obj<F> where F: FnOnce() -> u32 {
| -------------------------------------- method `closure` not found for this
...
-86 | check_expression().closure();//~ ERROR no method named `closure` found
+97 | check_expression().closure();//~ ERROR no method named `closure` found
| ^^^^^^^ field, not a method
|
= help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field
error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope
- --> $DIR/issue-2392.rs:94:31
- |
-15 | struct FuncContainer {
- | -------------------- method `f1` not found for this
+ --> $DIR/issue-2392.rs:105:31
+ |
+15 | struct FuncContainer {
+ | -------------------- method `f1` not found for this
...
-94 | (*self.container).f1(1); //~ ERROR no method named `f1` found
- | ^^ field, not a method
- |
- = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field
+105 | (*self.container).f1(1); //~ ERROR no method named `f1` found
+ | ^^ field, not a method
+ |
+ = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field
error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope
- --> $DIR/issue-2392.rs:97:31
- |
-15 | struct FuncContainer {
- | -------------------- method `f2` not found for this
+ --> $DIR/issue-2392.rs:108:31
+ |
+15 | struct FuncContainer {
+ | -------------------- method `f2` not found for this
...
-97 | (*self.container).f2(1); //~ ERROR no method named `f2` found
- | ^^ field, not a method
- |
- = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field
+108 | (*self.container).f2(1); //~ ERROR no method named `f2` found
+ | ^^ field, not a method
+ |
+ = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field
error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope
- --> $DIR/issue-2392.rs:100:31
+ --> $DIR/issue-2392.rs:111:31
|
15 | struct FuncContainer {
| -------------------- method `f3` not found for this
...
-100 | (*self.container).f3(1); //~ ERROR no method named `f3` found
+111 | (*self.container).f3(1); //~ ERROR no method named `f3` found
| ^^ field, not a method
|
= help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-struct Example {
+struct Example { //~ NOTE not found for this
example: Box<Fn(i32) -> i32>
}
error[E0599]: no method named `example` found for type `Example` in the current scope
--> $DIR/issue-32128.rs:22:10
|
-11 | struct Example {
+11 | struct Example { //~ NOTE not found for this
| -------------- method `example` not found for this
...
22 | demo.example(1);
let p = &o;
p.closure(); //~ ERROR no method named `closure` found
//~^ HELP use `(p.closure)(...)` if you meant to call the function stored in the `closure` field
- //~| NOTE `closure` is a field storing a function, not a method
+ //~| NOTE field, not a method
let q = &p;
q.fn_ptr(); //~ ERROR no method named `fn_ptr` found
//~^ HELP use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field
- //~| NOTE `fn_ptr` is a field storing a function, not a method
+ //~| NOTE field, not a method
let r = D(C { c_fn_ptr: empty });
let s = &r;
s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found
//~^ HELP use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr`
- //~| NOTE `c_fn_ptr` is a field storing a function, not a method
+ //~| NOTE field, not a method
}
fn main() {
let dog = animal::Dog::new(3);
- let dog_age = dog.dog_age();
+ let dog_age = dog.dog_age(); //~ ERROR no method
//let dog_age = dog.dog_age;
println!("{}", dog_age);
}
12 | pub struct Dog {
| -------------- method `dog_age` not found for this
...
-26 | let dog_age = dog.dog_age();
+26 | let dog_age = dog.dog_age(); //~ ERROR no method
| ^^^^^^^ private field, not a method
error: aborting due to previous error
extern crate m1;
-extern crate m2 as m1;
+extern crate m2 as m1; //~ ERROR is defined multiple times
fn main() {}
|
15 | extern crate m1;
| ---------------- previous import of the extern crate `m1` here
-16 | extern crate m2 as m1;
+16 | extern crate m2 as m1; //~ ERROR is defined multiple times
| ^^^^^^^^^^^^^^^^^^^^^^
| |
| `m1` reimported here
}
use extension1::ConstructorExtension;
-use extension2::ConstructorExtension;
+use extension2::ConstructorExtension; //~ ERROR is defined multiple times
fn main() {}
|
19 | use extension1::ConstructorExtension;
| -------------------------------- previous import of the trait `ConstructorExtension` here
-20 | use extension2::ConstructorExtension;
+20 | use extension2::ConstructorExtension; //~ ERROR is defined multiple times
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here
|
= note: `ConstructorExtension` must be defined only once in the type namespace of this module
help: You can use `as` to change the binding name of the import
|
-20 | use extension2::ConstructorExtension as OtherConstructorExtension;
+20 | use extension2::ConstructorExtension as OtherConstructorExtension; //~ ERROR is defined multiple times
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
fn main() {
let a: Vec<u8> = Vec::new();
- foo(&a);
+ foo(&a); //~ ERROR mismatched types
}
error[E0308]: mismatched types
--> $DIR/issue-43420-no-over-suggest.rs:18:9
|
-18 | foo(&a);
+18 | foo(&a); //~ ERROR mismatched types
| ^^ expected slice, found struct `std::vec::Vec`
|
= note: expected type `&[u16]`
#[allow(unreachable_code)]
fn main() {
'foo: loop {
- break 'fo;
+ break 'fo; //~ ERROR use of undeclared label
}
'bar: loop {
- continue 'bor;
+ continue 'bor; //~ ERROR use of undeclared label
}
'longlabel: loop {
'longlabel1: loop {
- break 'longlable;
+ break 'longlable; //~ ERROR use of undeclared label
}
}
}
error[E0426]: use of undeclared label `'fo`
--> $DIR/suggest-labels.rs:14:15
|
-14 | break 'fo;
+14 | break 'fo; //~ ERROR use of undeclared label
| ^^^ did you mean `'foo`?
error[E0426]: use of undeclared label `'bor`
--> $DIR/suggest-labels.rs:18:18
|
-18 | continue 'bor;
+18 | continue 'bor; //~ ERROR use of undeclared label
| ^^^^ did you mean `'bar`?
error[E0426]: use of undeclared label `'longlable`
--> $DIR/suggest-labels.rs:23:19
|
-23 | break 'longlable;
+23 | break 'longlable; //~ ERROR use of undeclared label
| ^^^^^^^^^^ did you mean `'longlabel1`?
error: aborting due to 3 previous errors
fn main() {
let f = Foo;
- f.bat(1.0);
+ f.bat(1.0); //~ ERROR no method named
let s = "foo".to_string();
- let _ = s.is_emtpy();
+ let _ = s.is_emtpy(); //~ ERROR no method named
// Generates a warning for `count_zeros()`. `count_ones()` is also a close
// match, but the former is closer.
- let _ = 63u32.count_eos();
+ let _ = 63u32.count_eos(); //~ ERROR no method named
// Does not generate a warning
- let _ = 63u32.count_o();
+ let _ = 63u32.count_o(); //~ ERROR no method named
}
11 | struct Foo;
| ----------- method `bat` not found for this
...
-28 | f.bat(1.0);
+28 | f.bat(1.0); //~ ERROR no method named
| ^^^
|
= help: did you mean `bar`?
error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope
--> $DIR/suggest-methods.rs:31:15
|
-31 | let _ = s.is_emtpy();
+31 | let _ = s.is_emtpy(); //~ ERROR no method named
| ^^^^^^^^
|
= help: did you mean `is_empty`?
error[E0599]: no method named `count_eos` found for type `u32` in the current scope
--> $DIR/suggest-methods.rs:35:19
|
-35 | let _ = 63u32.count_eos();
+35 | let _ = 63u32.count_eos(); //~ ERROR no method named
| ^^^^^^^^^
|
= help: did you mean `count_zeros`?
error[E0599]: no method named `count_o` found for type `u32` in the current scope
--> $DIR/suggest-methods.rs:38:19
|
-38 | let _ = 63u32.count_o();
+38 | let _ = 63u32.count_o(); //~ ERROR no method named
| ^^^^^^^
error: aborting due to 4 previous errors
fn foo() -> Result<u32, ()> {
let x: Option<u32> = None;
- x?;
+ x?; //~ the trait bound
Ok(22)
}
fn bar() -> u32 {
let x: Option<u32> = None;
- x?;
+ x?; //~ the `?` operator
22
}
error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` is not satisfied
--> $DIR/try-on-option.rs:17:5
|
-17 | x?;
+17 | x?; //~ the trait bound
| ^^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
|
= note: required by `std::convert::From::from`
error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
--> $DIR/try-on-option.rs:23:5
|
-23 | x?;
+23 | x?; //~ the `?` operator
| --
| |
| cannot use the `?` operator in a function that returns `u32`
fn main() {
// error for a `Try` type on a non-`Try` fn
- std::fs::File::open("foo")?;
+ std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
// a non-`Try` type on a non-`Try` fn
- ()?;
+ ()?; //~ ERROR the `?` operator can only
// an unrelated use of `Try`
- try_trait_generic::<()>();
+ try_trait_generic::<()>(); //~ ERROR the trait bound
}
fn try_trait_generic<T: Try>() -> T {
// and a non-`Try` object on a `Try` fn.
- ()?;
+ ()?; //~ ERROR the `?` operator can only
loop {}
}
error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
--> $DIR/try-operator-on-main.rs:17:5
|
-17 | std::fs::File::open("foo")?;
+17 | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
| ---------------------------
| |
| cannot use the `?` operator in a function that returns `()`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
--> $DIR/try-operator-on-main.rs:20:5
|
-20 | ()?;
+20 | ()?; //~ ERROR the `?` operator can only
| ---
| |
| the `?` operator cannot be applied to type `()`
error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
--> $DIR/try-operator-on-main.rs:23:5
|
-23 | try_trait_generic::<()>();
+23 | try_trait_generic::<()>(); //~ ERROR the trait bound
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()`
|
= note: required by `try_trait_generic`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
--> $DIR/try-operator-on-main.rs:30:5
|
-30 | ()?;
+30 | ()?; //~ ERROR the `?` operator can only
| ---
| |
| the `?` operator cannot be applied to type `()`
// compile-flags: -Z parse-only
fn main () {
- (1, (2, 3)).1.1;
+ (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1`
}
error: unexpected token: `1.1`
--> $DIR/tuple-float-index.rs:14:17
|
-14 | (1, (2, 3)).1.1;
+14 | (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1`
| ------------^^^
| | |
| | unexpected token
// except according to those terms.
fn main() {
- let x: Vec::with_capacity(10, 20);
+ let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10`
+ //~^ ERROR this function takes 1 parameter
}
error: expected type, found `10`
--> $DIR/type-ascription-instead-of-initializer.rs:12:31
|
-12 | let x: Vec::with_capacity(10, 20);
+12 | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10`
| -- ^^
| ||
| |help: use `=` if you meant to assign
error[E0061]: this function takes 1 parameter but 2 parameters were supplied
--> $DIR/type-ascription-instead-of-initializer.rs:12:31
|
-12 | let x: Vec::with_capacity(10, 20);
+12 | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10`
| ^^^^^^ expected 1 parameter
error: aborting due to 2 previous errors
fn main() {
println!("test"):
- 0;
+ 0; //~ ERROR expected type, found `0`
}
fn foo() {
- println!("test"): 0;
+ println!("test"): 0; //~ ERROR expected type, found `0`
}
|
14 | println!("test"):
| - help: did you mean to use `;` here?
-15 | 0;
+15 | 0; //~ ERROR expected type, found `0`
| ^ expecting a type here because of type ascription
error: expected type, found `0`
--> $DIR/type-ascription-instead-of-statement-end.rs:19:23
|
-19 | println!("test"): 0;
+19 | println!("test"): 0; //~ ERROR expected type, found `0`
| ^ expecting a type here because of type ascription
error: aborting due to 2 previous errors
fn main() {
f() :
- f();
+ f(); //~ ERROR expected type, found function
}
fn f() {}
|
14 | f() :
| - help: did you mean to use `;` here instead?
-15 | f();
+15 | f(); //~ ERROR expected type, found function
| ^^^
| |
| not a type
FAIL
//~^ ERROR
-//~| ERROR
option.map(|some| 42; //~ NOTE: unclosed delimiter
//~^ ERROR: expected one of
//~| NOTE: expected one of
- //~| NOTE: unexpected token
+
} //~ ERROR: incorrect close delimiter
//~^ ERROR: expected expression, found `)`
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-impl S {
+impl S { //~ ERROR cannot find type
pub
-}
+} //~ ERROR expected one of
|
12 | pub
| - expected one of 7 possible tokens here
-13 | }
+13 | } //~ ERROR expected one of
| ^ unexpected token
error[E0412]: cannot find type `S` in this scope
--> $DIR/issue-41155.rs:11:6
|
-11 | impl S {
+11 | impl S { //~ ERROR cannot find type
| ^ not found in this scope
error[E0601]: main function not found
macro_rules! ignored_expr {
() => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
//~^ NOTE expected one of `.`, `;`, `?`, `}`, or an operator here
- //~| NOTE unexpected token
+
2 )
}
FAIL
//~^ ERROR
-//~| ERROR
fn main() {
let foo = inner::Foo;
- foo.method();
+ foo.method(); //~ ERROR is private
}
error[E0624]: method `method` is private
--> $DIR/trait-method-private.rs:29:9
|
-29 | foo.method();
+29 | foo.method(); //~ ERROR is private
| ^^^^^^
|
= help: items from traits can only be used if the trait is in scope
unsafe fn foo() -> (i8, *const (), Option<fn()>) {
let i = mem::transmute(bar);
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR transmute called with types of different sizes
+
let p = mem::transmute(foo);
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
let of = mem::transmute(main);
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
(i, p, of)
}
// Error as usual if the resulting type is not pointer-sized.
mem::transmute::<_, u8>(main);
//~^ ERROR transmute called with types of different sizes
- //~^^ NOTE transmuting between fn() {main} and u8
+
mem::transmute::<_, *mut ()>(foo);
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
mem::transmute::<_, fn()>(bar);
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
// No error if a coercion would otherwise occur.
mem::transmute::<fn(), usize>(main);
unsafe fn baz() {
mem::transmute::<_, *mut ()>(Some(foo));
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
mem::transmute::<_, fn()>(Some(bar));
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
mem::transmute::<_, Option<fn()>>(Some(baz));
- //~^ ERROR is zero-sized and can't be transmuted
- //~^^ NOTE cast with `as` to a pointer instead
+ //~^ ERROR can't transmute zero-sized type
+
// No error if a coercion would otherwise occur.
mem::transmute::<Option<fn()>, usize>(Some(main));
unsafe fn f<T>(x: T) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: T (size can vary) to i32
+//~^ ERROR transmute called with types of different sizes
}
unsafe fn g<T>(x: (T, i32)) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: (T, i32) (size can vary because of T) to i32
+//~^ ERROR transmute called with types of different sizes
}
unsafe fn h<T>(x: [T; 10]) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: [T; 10] (size can vary because of T) to i32
+//~^ ERROR transmute called with types of different sizes
}
struct Bad<T> {
unsafe fn i<T>(x: Bad<T>) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: Bad<T> (size can vary because of T) to i32
+//~^ ERROR transmute called with types of different sizes
}
enum Worse<T> {
unsafe fn j<T>(x: Worse<T>) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: Worse<T> (size can vary because of T) to i32
+//~^ ERROR transmute called with types of different sizes
}
unsafe fn k<T>(x: Option<T>) {
let _: i32 = transmute(x);
-//~^ ERROR differently sized types: std::option::Option<T> (size can vary because of T) to i32
+//~^ ERROR transmute called with types of different sizes
}
fn main() {}
// `x { ... }` should not be interpreted as a struct literal here
if x = x {
//~^ ERROR mismatched types
- //~| HELP did you mean to compare equality?
+ //~| HELP try comparing for equality
println!("{}", x);
}
// Explicit parentheses on the left should match behavior of above
if (x = x) {
//~^ ERROR mismatched types
- //~| HELP did you mean to compare equality?
+ //~| HELP try comparing for equality
println!("{}", x);
}
// The struct literal interpretation is fine with explicit parentheses on the right
if y = (Foo { foo: x }) {
//~^ ERROR mismatched types
- //~| HELP did you mean to compare equality?
+ //~| HELP try comparing for equality
println!("{}", x);
}
// "invalid left-hand side expression" error is suppresed
if 3 = x {
//~^ ERROR mismatched types
- //~| HELP did you mean to compare equality?
+ //~| HELP try comparing for equality
println!("{}", x);
}
if (if true { x = 4 } else { x = 5 }) {
// except according to those terms.
fn main() {
- let x = [];
+ let x = []; //~ ERROR type annotations needed
}
error[E0282]: type annotations needed
--> $DIR/cannot_infer_local_or_array.rs:12:13
|
-12 | let x = [];
+12 | let x = []; //~ ERROR type annotations needed
| - ^^ cannot infer type for `_`
| |
| consider giving `x` a type
fn main() { }
fn unconstrained_type() {
- [];
+ []; //~ ERROR type annotations needed
}
error[E0282]: type annotations needed
--> $DIR/issue-22897.rs:14:5
|
-14 | [];
+14 | []; //~ ERROR type annotations needed
| ^^ cannot infer type for `[_; 0]`
error: aborting due to previous error
fn foo(self);
}
-fn foo<'a,'b,T>(x: &'a T, y: &'b T)
+fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required
where &'a T : Foo,
&'b T : Foo
{
error[E0283]: type annotations required: cannot resolve `&'a T: Foo`
--> $DIR/issue-40294.rs:15:1
|
-15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T)
+15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required
16 | | where &'a T : Foo,
17 | | &'b T : Foo
18 | | {
fn main() {
match X::Y(0) {
- X::Y { number } => {}
+ X::Y { number } => {} //~ ERROR does not have a field named `number`
+ //~^ ERROR pattern does not mention field `0`
}
}
error[E0026]: variant `X::Y` does not have a field named `number`
--> $DIR/issue-41314.rs:17:16
|
-17 | X::Y { number } => {}
+17 | X::Y { number } => {} //~ ERROR does not have a field named `number`
| ^^^^^^ variant `X::Y` does not have field `number`
error[E0027]: pattern does not mention field `0`
--> $DIR/issue-41314.rs:17:9
|
-17 | X::Y { number } => {}
+17 | X::Y { number } => {} //~ ERROR does not have a field named `number`
| ^^^^^^^^^^^^^^^ missing field `0`
|
= note: trying to match a tuple variant with a struct variant pattern
// except according to those terms.
fn main() {
- let x = |_| { };
+ let x = |_| { }; //~ ERROR type annotations needed
}
error[E0282]: type annotations needed
--> $DIR/unknown_type_for_closure.rs:12:14
|
-12 | let x = |_| { };
+12 | let x = |_| { }; //~ ERROR type annotations needed
| ^ consider giving this closure parameter a type
error: aborting due to previous error
fn g<F>(_: F) where F: FnOnce(Option<F>) {}
fn main() {
- g(|_| { });
+ g(|_| { }); //~ ERROR closure/generator type that references itself
}
error[E0644]: closure/generator type that references itself
--> $DIR/unboxed-closure-no-cyclic-sig.rs:18:7
|
-18 | g(|_| { });
+18 | g(|_| { }); //~ ERROR closure/generator type that references itself
| ^^^^^^^^ cyclic type of infinite size
|
= note: closures cannot capture themselves or take themselves as argument;
// the closure implements `FnOnce`, not that it moves from inside
// a `Fn` closure.)
let y = (vec![1, 2, 3], 0);
- let c = || drop(y.0);
+ let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
foo(c);
}
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
--> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:13
|
-24 | let c = || drop(y.0);
+24 | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
| ^^^^^^^^^^^^
25 | foo(c);
| --- the requirement to implement `Fn` derives from here
note: closure is `FnOnce` because it moves the variable `y` out of its environment
--> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:21
|
-24 | let c = || drop(y.0);
+24 | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
| ^
error: aborting due to previous error
union U1 {
a: u8, // should not be reported
b: u8, // should not be reported
- c: u8, // should be reported
+ c: u8, //~ ERROR field is never used
}
union U2 {
- a: u8, // should be reported
+ a: u8, //~ ERROR field is never used
b: u8, // should not be reported
c: u8, // should not be reported
}
-union NoDropLike { a: u8 } // should be reported as unused
+union NoDropLike { a: u8 } //~ ERROR field is never used
union U {
a: u8, // should not be reported
b: u8, // should not be reported
- c: u8, // should be reported
+ c: u8, //~ ERROR field is never used
}
type A = U;
error: field is never used: `c`
--> $DIR/union-fields.rs:16:5
|
-16 | c: u8, // should be reported
+16 | c: u8, //~ ERROR field is never used
| ^^^^^
|
note: lint level defined here
error: field is never used: `a`
--> $DIR/union-fields.rs:19:5
|
-19 | a: u8, // should be reported
+19 | a: u8, //~ ERROR field is never used
| ^^^^^
error: field is never used: `a`
--> $DIR/union-fields.rs:23:20
|
-23 | union NoDropLike { a: u8 } // should be reported as unused
+23 | union NoDropLike { a: u8 } //~ ERROR field is never used
| ^^^^^
error: field is never used: `c`
--> $DIR/union-fields.rs:28:5
|
-28 | c: u8, // should be reported
+28 | c: u8, //~ ERROR field is never used
| ^^^^^
error: aborting due to 4 previous errors
#![feature(untagged_unions)]
union Foo<T: ?Sized> {
- value: T,
+ value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
}
struct Foo2<T: ?Sized> {
- value: T,
+ value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
t: u32,
}
enum Foo3<T: ?Sized> {
- Value(T),
+ Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
}
fn main() {}
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied
--> $DIR/union-sized-field.rs:14:5
|
-14 | value: T,
+14 | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
| ^^^^^^^^ `T` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied
--> $DIR/union-sized-field.rs:18:5
|
-18 | value: T,
+18 | value: T, //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
| ^^^^^^^^ `T` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied
--> $DIR/union-sized-field.rs:23:11
|
-23 | Value(T),
+23 | Value(T), //~ ERROR the trait bound `T: std::marker::Sized` is not satisfied
| ^^ `T` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
// if the user specified a format in the ui test
// print the output to the stderr file, otherwise extract
// the rendered error messages from json and print them
- let explicit = self.props.compile_flags.iter().any(|s| s.starts_with("--error-format"));
+ let explicit = self.props.compile_flags.iter().any(|s| s.contains("--error-format"));
- let mut proc_res = self.compile_test();
+ let proc_res = self.compile_test();
let expected_stderr_path = self.expected_output_path("stderr");
let expected_stderr = self.load_expected_output(&expected_stderr_path);
let expected_stdout = self.load_expected_output(&expected_stdout_path);
let normalized_stdout =
- self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout, explicit);
+ self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout);
let stderr = if explicit {
proc_res.stderr.clone()
};
let normalized_stderr =
- self.normalize_output(&stderr, &self.props.normalize_stderr, explicit);
+ self.normalize_output(&stderr, &self.props.normalize_stderr);
let mut errors = 0;
errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout);
errors += self.compare_output("stderr", &normalized_stderr, &expected_stderr);
- // rewrite the output to the human readable one (shown in case of errors)
- proc_res.stderr = normalized_stderr;
-
if errors > 0 {
println!("To update references, run this command from build directory:");
let relative_path_to_file =
&proc_res);
}
+ let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
+
if self.props.run_pass {
let proc_res = self.exec_compiled_test();
self.fatal_proc_rec("test run failed!", &proc_res);
}
}
+ if !explicit {
+ if !expected_errors.is_empty() || !proc_res.status.success() {
+ // "// error-pattern" comments
+ self.check_expected_errors(expected_errors, &proc_res);
+ } else if !self.props.error_patterns.is_empty() || !proc_res.status.success() {
+ // "//~ERROR comments"
+ self.check_error_patterns(&proc_res.stderr, &proc_res);
+ }
+ }
}
fn run_mir_opt_test(&self) {
mir_dump_dir
}
- fn normalize_output(
- &self,
- output: &str,
- custom_rules: &[(String, String)],
- json: bool,
- ) -> String {
+ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String {
let parent_dir = self.testpaths.file.parent().unwrap();
+ let cflags = self.props.compile_flags.join(" ");
+ let json = cflags.contains("--error-format json") ||
+ cflags.contains("--error-format pretty-json") ||
+ cflags.contains("--error-format=json") ||
+ cflags.contains("--error-format=pretty-json");
let parent_dir_str = if json {
parent_dir.display().to_string().replace("\\", "\\\\")
} else {
-Subproject commit 80853e2f24a01db96fe9821e468dd2af75a4d2e5
+Subproject commit 6dbfe23c4d1af109c894ff9d7d5da97c025584e5