1
Fork 0

Change some helps to suggestions

This commit is contained in:
Oliver Schneider 2017-05-16 15:12:24 +02:00
parent 4a286639e8
commit a9d9a4aab4
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
26 changed files with 139 additions and 159 deletions

View file

@ -991,7 +991,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
.span_suggestion(err.span, .span_suggestion(err.span,
&format!("to force the closure to take ownership of {} \ &format!("to force the closure to take ownership of {} \
(and any other referenced variables), \ (and any other referenced variables), \
use the `move` keyword, as shown:", use the `move` keyword",
cmt_path_or_string), cmt_path_or_string),
suggestion) suggestion)
.emit(); .emit();

View file

@ -211,6 +211,18 @@ impl Diagnostic {
/// Prints out a message with a suggested edit of the code. /// Prints out a message with a suggested edit of the code.
/// ///
/// In case of short messages and a simple suggestion,
/// rustc displays it as a label like
///
/// "try adding parentheses: `(tup.0).1`"
///
/// The message
/// * should not end in any punctuation (a `:` is added automatically)
/// * should not be a question
/// * should not contain any parts like "the following", "as shown"
/// * may look like "to do xyz, use" or "to do xyz, use abc"
/// * may contain a name of a function, variable or type, but not whole expressions
///
/// See `diagnostic::CodeSuggestion` for more information. /// See `diagnostic::CodeSuggestion` for more information.
pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self { pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
self.suggestions.push(CodeSuggestion { self.suggestions.push(CodeSuggestion {

View file

@ -51,7 +51,7 @@ impl Emitter for EmitterWriter {
// This substitution is only removal, don't show it // This substitution is only removal, don't show it
format!("help: {}", sugg.msg) format!("help: {}", sugg.msg)
} else { } else {
format!("help: {} `{}`", sugg.msg, substitution) format!("help: {}: `{}`", sugg.msg, substitution)
}; };
primary_span.push_span_label(sugg.substitution_spans().next().unwrap(), msg); primary_span.push_span_label(sugg.substitution_spans().next().unwrap(), msg);
} else { } else {

View file

@ -2409,13 +2409,15 @@ impl<'a> Resolver<'a> {
.map(|suggestion| import_candidate_to_paths(&suggestion)).collect::<Vec<_>>(); .map(|suggestion| import_candidate_to_paths(&suggestion)).collect::<Vec<_>>();
enum_candidates.sort(); enum_candidates.sort();
for (sp, variant_path, enum_path) in enum_candidates { for (sp, variant_path, enum_path) in enum_candidates {
let msg = format!("there is an enum variant `{}`, did you mean to use `{}`?", if sp == DUMMY_SP {
let msg = format!("there is an enum variant `{}`, \
try using `{}`?",
variant_path, variant_path,
enum_path); enum_path);
if sp == DUMMY_SP {
err.help(&msg); err.help(&msg);
} else { } else {
err.span_help(sp, &msg); err.span_suggestion(span, "you can try using the variant's enum",
enum_path);
} }
} }
} }
@ -2424,18 +2426,20 @@ impl<'a> Resolver<'a> {
let self_is_available = this.self_value_is_available(path[0].ctxt, span); let self_is_available = this.self_value_is_available(path[0].ctxt, span);
match candidate { match candidate {
AssocSuggestion::Field => { AssocSuggestion::Field => {
err.span_label(span, format!("did you mean `self.{}`?", path_str)); err.span_suggestion(span, "try",
format!("self.{}", path_str));
if !self_is_available { if !self_is_available {
err.span_label(span, format!("`self` value is only available in \ err.span_label(span, format!("`self` value is only available in \
methods with `self` parameter")); methods with `self` parameter"));
} }
} }
AssocSuggestion::MethodWithSelf if self_is_available => { AssocSuggestion::MethodWithSelf if self_is_available => {
err.span_label(span, format!("did you mean `self.{}(...)`?", err.span_suggestion(span, "try",
path_str)); format!("self.{}", path_str));
} }
AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => { AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => {
err.span_label(span, format!("did you mean `Self::{}`?", path_str)); err.span_suggestion(span, "try",
format!("Self::{}", path_str));
} }
} }
return err; return err;

View file

@ -658,9 +658,10 @@ impl<'a> Resolver<'a> {
if let Some(suggestion) = suggestion { if let Some(suggestion) = suggestion {
if suggestion != name { if suggestion != name {
if let MacroKind::Bang = kind { if let MacroKind::Bang = kind {
err.help(&format!("did you mean `{}!`?", suggestion)); err.span_suggestion(span, "you could try the macro",
format!("{}!", suggestion));
} else { } else {
err.help(&format!("did you mean `{}`?", suggestion)); err.span_suggestion(span, "try", suggestion.to_string());
} }
} else { } else {
err.help("have you added the `#[macro_use]` on the module/import?"); err.help("have you added the `#[macro_use]` on the module/import?");

View file

@ -253,7 +253,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) { match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
Ok(s) => { Ok(s) => {
err.span_suggestion(self.cast_span, err.span_suggestion(self.cast_span,
"try casting to a reference instead:", "try casting to a reference instead",
format!("&{}{}", mtstr, s)); format!("&{}{}", mtstr, s));
} }
Err(_) => { Err(_) => {
@ -272,7 +272,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) { match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
Ok(s) => { Ok(s) => {
err.span_suggestion(self.cast_span, err.span_suggestion(self.cast_span,
"try casting to a `Box` instead:", "try casting to a `Box` instead",
format!("Box<{}>", s)); format!("Box<{}>", s));
} }
Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr), Err(_) => span_help!(err, self.cast_span, "did you mean `Box<{}>`?", tstr),

View file

@ -320,7 +320,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
from a string reference. String concatenation \ from a string reference. String concatenation \
appends the string on the right to the string \ appends the string on the right to the string \
on the left and may require reallocation. This \ on the left and may require reallocation. This \
requires ownership of the string on the left."), suggestion); requires ownership of the string on the left"), suggestion);
is_string_addition = true; is_string_addition = true;
} }

View file

@ -1490,7 +1490,7 @@ impl<'a> Parser<'a> {
s.print_bounds(" +", &bounds)?; s.print_bounds(" +", &bounds)?;
s.pclose() s.pclose()
}); });
err.span_suggestion(sum_span, "try adding parentheses:", sum_with_parens); err.span_suggestion(sum_span, "try adding parentheses", sum_with_parens);
} }
TyKind::Ptr(..) | TyKind::BareFn(..) => { TyKind::Ptr(..) | TyKind::BareFn(..) => {
err.span_label(sum_span, "perhaps you forgot parentheses?"); err.span_label(sum_span, "perhaps you forgot parentheses?");
@ -5280,7 +5280,7 @@ impl<'a> Parser<'a> {
`pub(in path::to::module)`: visible only on the specified path"##; `pub(in path::to::module)`: visible only on the specified path"##;
let path = self.parse_path(PathStyle::Mod)?; let path = self.parse_path(PathStyle::Mod)?;
let path_span = self.prev_span; let path_span = self.prev_span;
let help_msg = format!("make this visible only to module `{}` with `in`:", path); let help_msg = format!("make this visible only to module `{}` with `in`", path);
self.expect(&token::CloseDelim(token::Paren))?; // `)` self.expect(&token::CloseDelim(token::Paren))?; // `)`
let mut err = self.span_fatal_help(path_span, msg, suggestion); let mut err = self.span_fatal_help(path_span, msg, suggestion);
err.span_suggestion(path_span, &help_msg, format!("in {}", path)); err.span_suggestion(path_span, &help_msg, format!("in {}", path));

View file

@ -1,76 +1,62 @@
error: cannot find derive macro `FooWithLongNan` in this scope error: cannot find derive macro `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:36:10 --> $DIR/resolve-error.rs:37:10
| |
36 | #[derive(FooWithLongNan)] 37 | #[derive(FooWithLongNan)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
|
= help: did you mean `FooWithLongName`?
error: cannot find attribute macro `attr_proc_macra` in this scope error: cannot find attribute macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:39:3 --> $DIR/resolve-error.rs:40:3
| |
39 | #[attr_proc_macra] 40 | #[attr_proc_macra]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
|
= help: did you mean `attr_proc_macro`?
error: cannot find attribute macro `FooWithLongNan` in this scope error: cannot find attribute macro `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:42:3 --> $DIR/resolve-error.rs:43:3
| |
42 | #[FooWithLongNan] 43 | #[FooWithLongNan]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: cannot find derive macro `Dlone` in this scope error: cannot find derive macro `Dlone` in this scope
--> $DIR/resolve-error.rs:45:10 --> $DIR/resolve-error.rs:46:10
| |
45 | #[derive(Dlone)] 46 | #[derive(Dlone)]
| ^^^^^ | ^^^^^ help: try: `Clone`
|
= help: did you mean `Clone`?
error: cannot find derive macro `Dlona` in this scope error: cannot find derive macro `Dlona` in this scope
--> $DIR/resolve-error.rs:48:10 --> $DIR/resolve-error.rs:49:10
| |
48 | #[derive(Dlona)] 49 | #[derive(Dlona)]
| ^^^^^ | ^^^^^ help: try: `Clona`
|
= help: did you mean `Clona`?
error: cannot find derive macro `attr_proc_macra` in this scope error: cannot find derive macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:51:10 --> $DIR/resolve-error.rs:52:10
| |
51 | #[derive(attr_proc_macra)] 52 | #[derive(attr_proc_macra)]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: cannot find macro `FooWithLongNama!` in this scope error: cannot find macro `FooWithLongNama!` in this scope
--> $DIR/resolve-error.rs:55:5 --> $DIR/resolve-error.rs:56:5
| |
55 | FooWithLongNama!(); 56 | FooWithLongNama!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`
|
= help: did you mean `FooWithLongNam!`?
error: cannot find macro `attr_proc_macra!` in this scope error: cannot find macro `attr_proc_macra!` in this scope
--> $DIR/resolve-error.rs:57:5 --> $DIR/resolve-error.rs:58:5
| |
57 | attr_proc_macra!(); 58 | attr_proc_macra!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`
|
= help: did you mean `attr_proc_mac!`?
error: cannot find macro `Dlona!` in this scope error: cannot find macro `Dlona!` in this scope
--> $DIR/resolve-error.rs:59:5 --> $DIR/resolve-error.rs:60:5
| |
59 | Dlona!(); 60 | Dlona!();
| ^^^^^ | ^^^^^
error: cannot find macro `bang_proc_macrp!` in this scope error: cannot find macro `bang_proc_macrp!` in this scope
--> $DIR/resolve-error.rs:61:5 --> $DIR/resolve-error.rs:62:5
| |
61 | bang_proc_macrp!(); 62 | bang_proc_macrp!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`
|
= help: did you mean `bang_proc_macro!`?
error: aborting due to 10 previous errors error: aborting due to 10 previous errors

View file

@ -1,4 +1,4 @@
error: cast to unsized type: `&{integer}` as `std::marker::Send` error[E0620]: cast to unsized type: `&{integer}` as `std::marker::Send`
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5 --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5
| |
12 | &1 as Send; 12 | &1 as Send;
@ -6,7 +6,7 @@ error: cast to unsized type: `&{integer}` as `std::marker::Send`
| | | |
| help: try casting to a reference instead: `&Send` | help: try casting to a reference instead: `&Send`
error: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
--> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5 --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5
| |
13 | Box::new(1) as Send; 13 | Box::new(1) as Send;
@ -14,5 +14,5 @@ error: cast to unsized type: `std::boxed::Box<{integer}>` as `std::marker::Send`
| | | |
| help: try casting to a `Box` instead: `Box<Send>` | help: try casting to a `Box` instead: `Box<Send>`
error: aborting due to previous error(s) error: aborting due to 2 previous errors

View file

@ -2,13 +2,10 @@ error[E0412]: cannot find type `Apple` in this scope
--> $DIR/issue-35675.rs:20:29 --> $DIR/issue-35675.rs:20:29
| |
20 | fn should_return_fruit() -> Apple { 20 | fn should_return_fruit() -> Apple {
| ^^^^^ not found in this scope | ^^^^^
| | |
help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? | not found in this scope
--> $DIR/issue-35675.rs:14:5 | help: you can try using the variant's enum: `Fruit`
|
14 | Apple(i64),
| ^^^^^^^^^^
error[E0425]: cannot find function `Apple` in this scope error[E0425]: cannot find function `Apple` in this scope
--> $DIR/issue-35675.rs:23:5 --> $DIR/issue-35675.rs:23:5
@ -17,19 +14,18 @@ error[E0425]: cannot find function `Apple` in this scope
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
| |
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
| use Fruit::Apple; |
12 | use Fruit::Apple;
|
error[E0573]: expected type, found variant `Fruit::Apple` error[E0573]: expected type, found variant `Fruit::Apple`
--> $DIR/issue-35675.rs:28:33 --> $DIR/issue-35675.rs:28:33
| |
28 | fn should_return_fruit_too() -> Fruit::Apple { 28 | fn should_return_fruit_too() -> Fruit::Apple {
| ^^^^^^^^^^^^ not a type | ^^^^^^^^^^^^
| | |
help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? | not a type
--> $DIR/issue-35675.rs:14:5 | help: you can try using the variant's enum: `Fruit`
|
14 | Apple(i64),
| ^^^^^^^^^^
error[E0425]: cannot find function `Apple` in this scope error[E0425]: cannot find function `Apple` in this scope
--> $DIR/issue-35675.rs:31:5 --> $DIR/issue-35675.rs:31:5
@ -38,7 +34,9 @@ error[E0425]: cannot find function `Apple` in this scope
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
| |
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
| use Fruit::Apple; |
12 | use Fruit::Apple;
|
error[E0573]: expected type, found variant `Ok` error[E0573]: expected type, found variant `Ok`
--> $DIR/issue-35675.rs:36:13 --> $DIR/issue-35675.rs:36:13
@ -46,20 +44,17 @@ error[E0573]: expected type, found variant `Ok`
36 | fn foo() -> Ok { 36 | fn foo() -> Ok {
| ^^ not a type | ^^ not a type
| |
= help: there is an enum variant `std::prelude::v1::Ok`, did you mean to use `std::prelude::v1`? = help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`?
= help: there is an enum variant `std::prelude::v1::Result::Ok`, did you mean to use `std::prelude::v1::Result`? = help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`?
error[E0412]: cannot find type `Variant3` in this scope error[E0412]: cannot find type `Variant3` in this scope
--> $DIR/issue-35675.rs:44:13 --> $DIR/issue-35675.rs:44:13
| |
44 | fn bar() -> Variant3 { 44 | fn bar() -> Variant3 {
| ^^^^^^^^ not found in this scope | ^^^^^^^^
| | |
help: there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`? | not found in this scope
--> $DIR/issue-35675.rs:63:9 | help: you can try using the variant's enum: `x::Enum`
|
63 | Variant3(usize),
| ^^^^^^^^^^^^^^^
error[E0573]: expected type, found variant `Some` error[E0573]: expected type, found variant `Some`
--> $DIR/issue-35675.rs:49:13 --> $DIR/issue-35675.rs:49:13
@ -67,8 +62,8 @@ error[E0573]: expected type, found variant `Some`
49 | fn qux() -> Some { 49 | fn qux() -> Some {
| ^^^^ not a type | ^^^^ not a type
| |
= help: there is an enum variant `std::option::Option::Some`, did you mean to use `std::option::Option`? = help: there is an enum variant `std::option::Option::Some`, try using `std::option::Option`?
= help: there is an enum variant `std::prelude::v1::Some`, did you mean to use `std::prelude::v1`? = help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`?
error: aborting due to previous error(s) error: aborting due to 7 previous errors

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of indexed content
19 | let e = f.v[0]; 19 | let e = f.v[0];
| ^^^^^^ | ^^^^^^
| | | |
| help: consider using a reference instead `&f.v[0]` | help: consider using a reference instead: `&f.v[0]`
| cannot move out of indexed content | cannot move out of indexed content
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,9 +2,7 @@ error: cannot find macro `printlx!` in this scope
--> $DIR/macro-name-typo.rs:12:5 --> $DIR/macro-name-typo.rs:12:5
| |
12 | printlx!("oh noes!"); 12 | printlx!("oh noes!");
| ^^^^^^^ | ^^^^^^^ help: you could try the macro: `println!`
|
= help: did you mean `println!`?
error: aborting due to previous error(s) error: aborting due to previous error

View file

@ -10,9 +10,7 @@ error: cannot find macro `k!` in this scope
--> $DIR/macro_undefined.rs:21:5 --> $DIR/macro_undefined.rs:21:5
| |
21 | k!(); 21 | k!();
| ^ | ^ help: you could try the macro: `kl!`
|
= help: did you mean `kl!`?
error: aborting due to previous error(s) error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-19109.rs:14:5 --> $DIR/issue-19109.rs:14:5
| |
13 | fn function(t: &mut Trait) { 13 | fn function(t: &mut Trait) {
| - help: possibly return type missing here? `-> *mut Trait ` | - help: possibly return type missing here?: `-> *mut Trait `
14 | t as *mut Trait 14 | t as *mut Trait
| ^^^^^^^^^^^^^^^ expected (), found *-ptr | ^^^^^^^^^^^^^^^ expected (), found *-ptr
| |

View file

@ -2,17 +2,13 @@ error: cannot find derive macro `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:37:10 --> $DIR/resolve-error.rs:37:10
| |
37 | #[derive(FooWithLongNan)] 37 | #[derive(FooWithLongNan)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
|
= help: did you mean `FooWithLongName`?
error: cannot find attribute macro `attr_proc_macra` in this scope error: cannot find attribute macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:40:3 --> $DIR/resolve-error.rs:40:3
| |
40 | #[attr_proc_macra] 40 | #[attr_proc_macra]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
|
= help: did you mean `attr_proc_macro`?
error: cannot find attribute macro `FooWithLongNan` in this scope error: cannot find attribute macro `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:43:3 --> $DIR/resolve-error.rs:43:3
@ -24,17 +20,13 @@ error: cannot find derive macro `Dlone` in this scope
--> $DIR/resolve-error.rs:46:10 --> $DIR/resolve-error.rs:46:10
| |
46 | #[derive(Dlone)] 46 | #[derive(Dlone)]
| ^^^^^ | ^^^^^ help: try: `Clone`
|
= help: did you mean `Clone`?
error: cannot find derive macro `Dlona` in this scope error: cannot find derive macro `Dlona` in this scope
--> $DIR/resolve-error.rs:49:10 --> $DIR/resolve-error.rs:49:10
| |
49 | #[derive(Dlona)] 49 | #[derive(Dlona)]
| ^^^^^ | ^^^^^ help: try: `Clona`
|
= help: did you mean `Clona`?
error: cannot find derive macro `attr_proc_macra` in this scope error: cannot find derive macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:52:10 --> $DIR/resolve-error.rs:52:10
@ -46,17 +38,13 @@ error: cannot find macro `FooWithLongNama!` in this scope
--> $DIR/resolve-error.rs:56:5 --> $DIR/resolve-error.rs:56:5
| |
56 | FooWithLongNama!(); 56 | FooWithLongNama!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`
|
= help: did you mean `FooWithLongNam!`?
error: cannot find macro `attr_proc_macra!` in this scope error: cannot find macro `attr_proc_macra!` in this scope
--> $DIR/resolve-error.rs:58:5 --> $DIR/resolve-error.rs:58:5
| |
58 | attr_proc_macra!(); 58 | attr_proc_macra!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`
|
= help: did you mean `attr_proc_mac!`?
error: cannot find macro `Dlona!` in this scope error: cannot find macro `Dlona!` in this scope
--> $DIR/resolve-error.rs:60:5 --> $DIR/resolve-error.rs:60:5
@ -68,9 +56,7 @@ error: cannot find macro `bang_proc_macrp!` in this scope
--> $DIR/resolve-error.rs:62:5 --> $DIR/resolve-error.rs:62:5
| |
62 | bang_proc_macrp!(); 62 | bang_proc_macrp!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`
|
= help: did you mean `bang_proc_macro!`?
error: aborting due to previous error(s) error: aborting due to previous error(s)

View file

@ -2,7 +2,7 @@ error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:29:9 --> $DIR/issue-14254.rs:29:9
| |
29 | baz(); 29 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `a` in this scope error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:32:9 --> $DIR/issue-14254.rs:32:9
@ -14,19 +14,19 @@ error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:40:9 --> $DIR/issue-14254.rs:40:9
| |
40 | baz(); 40 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `x` in this scope error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:43:9 --> $DIR/issue-14254.rs:43:9
| |
43 | x; 43 | x;
| ^ did you mean `self.x`? | ^ help: try: `self.x`
error[E0425]: cannot find value `y` in this scope error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:46:9 --> $DIR/issue-14254.rs:46:9
| |
46 | y; 46 | y;
| ^ did you mean `self.y`? | ^ help: try: `self.y`
error[E0425]: cannot find value `a` in this scope error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:49:9 --> $DIR/issue-14254.rs:49:9
@ -38,7 +38,7 @@ error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:52:9 --> $DIR/issue-14254.rs:52:9
| |
52 | bah; 52 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find value `b` in this scope error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:55:9 --> $DIR/issue-14254.rs:55:9
@ -50,19 +50,19 @@ error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:63:9 --> $DIR/issue-14254.rs:63:9
| |
63 | baz(); 63 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `x` in this scope error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-14254.rs:66:9 --> $DIR/issue-14254.rs:66:9
| |
66 | x; 66 | x;
| ^ did you mean `self.x`? | ^ help: try: `self.x`
error[E0425]: cannot find value `y` in this scope error[E0425]: cannot find value `y` in this scope
--> $DIR/issue-14254.rs:69:9 --> $DIR/issue-14254.rs:69:9
| |
69 | y; 69 | y;
| ^ did you mean `self.y`? | ^ help: try: `self.y`
error[E0425]: cannot find value `a` in this scope error[E0425]: cannot find value `a` in this scope
--> $DIR/issue-14254.rs:72:9 --> $DIR/issue-14254.rs:72:9
@ -74,7 +74,7 @@ error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:75:9 --> $DIR/issue-14254.rs:75:9
| |
75 | bah; 75 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find value `b` in this scope error[E0425]: cannot find value `b` in this scope
--> $DIR/issue-14254.rs:78:9 --> $DIR/issue-14254.rs:78:9
@ -86,61 +86,61 @@ error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:86:9 --> $DIR/issue-14254.rs:86:9
| |
86 | baz(); 86 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:89:9 --> $DIR/issue-14254.rs:89:9
| |
89 | bah; 89 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:97:9 --> $DIR/issue-14254.rs:97:9
| |
97 | baz(); 97 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:100:9 --> $DIR/issue-14254.rs:100:9
| |
100 | bah; 100 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:108:9 --> $DIR/issue-14254.rs:108:9
| |
108 | baz(); 108 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:111:9 --> $DIR/issue-14254.rs:111:9
| |
111 | bah; 111 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:119:9 --> $DIR/issue-14254.rs:119:9
| |
119 | baz(); 119 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:122:9 --> $DIR/issue-14254.rs:122:9
| |
122 | bah; 122 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0425]: cannot find function `baz` in this scope error[E0425]: cannot find function `baz` in this scope
--> $DIR/issue-14254.rs:130:9 --> $DIR/issue-14254.rs:130:9
| |
130 | baz(); 130 | baz();
| ^^^ did you mean `self.baz(...)`? | ^^^ help: try: `self.baz`
error[E0425]: cannot find value `bah` in this scope error[E0425]: cannot find value `bah` in this scope
--> $DIR/issue-14254.rs:133:9 --> $DIR/issue-14254.rs:133:9
| |
133 | bah; 133 | bah;
| ^^^ did you mean `Self::bah`? | ^^^ help: try: `Self::bah`
error[E0601]: main function not found error[E0601]: main function not found

View file

@ -8,13 +8,13 @@ error[E0425]: cannot find function `clone` in this scope
--> $DIR/issue-2356.rs:35:5 --> $DIR/issue-2356.rs:35:5
| |
35 | clone(); 35 | clone();
| ^^^^^ did you mean `self.clone(...)`? | ^^^^^ help: try: `self.clone`
error[E0425]: cannot find function `default` in this scope error[E0425]: cannot find function `default` in this scope
--> $DIR/issue-2356.rs:43:5 --> $DIR/issue-2356.rs:43:5
| |
43 | default(); 43 | default();
| ^^^^^^^ did you mean `Self::default`? | ^^^^^^^ help: try: `Self::default`
error[E0425]: cannot find value `whiskers` in this scope error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:52:5 --> $DIR/issue-2356.rs:52:5
@ -22,14 +22,14 @@ error[E0425]: cannot find value `whiskers` in this scope
52 | whiskers -= other; 52 | whiskers -= other;
| ^^^^^^^^ | ^^^^^^^^
| | | |
| did you mean `self.whiskers`? | help: try: `self.whiskers`
| `self` value is only available in methods with `self` parameter | `self` value is only available in methods with `self` parameter
error[E0425]: cannot find function `shave` in this scope error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:57:5 --> $DIR/issue-2356.rs:57:5
| |
57 | shave(4); 57 | shave(4);
| ^^^^^ did you mean `Self::shave`? | ^^^^^ help: try: `Self::shave`
error[E0425]: cannot find function `purr` in this scope error[E0425]: cannot find function `purr` in this scope
--> $DIR/issue-2356.rs:60:5 --> $DIR/issue-2356.rs:60:5
@ -83,7 +83,7 @@ error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:104:5 --> $DIR/issue-2356.rs:104:5
| |
104 | whiskers = 0; 104 | whiskers = 0;
| ^^^^^^^^ did you mean `self.whiskers`? | ^^^^^^^^ help: try: `self.whiskers`
error[E0425]: cannot find value `whiskers` in this scope error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:110:5 --> $DIR/issue-2356.rs:110:5
@ -91,7 +91,7 @@ error[E0425]: cannot find value `whiskers` in this scope
110 | whiskers = 4; 110 | whiskers = 4;
| ^^^^^^^^ | ^^^^^^^^
| | | |
| did you mean `self.whiskers`? | help: try: `self.whiskers`
| `self` value is only available in methods with `self` parameter | `self` value is only available in methods with `self` parameter
error[E0425]: cannot find function `purr_louder` in this scope error[E0425]: cannot find function `purr_louder` in this scope

View file

@ -14,13 +14,13 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-assoc-suggestions.rs:32:9 --> $DIR/resolve-assoc-suggestions.rs:32:9
| |
32 | field; 32 | field;
| ^^^^^ did you mean `self.field`? | ^^^^^ help: try: `self.field`
error[E0412]: cannot find type `Type` in this scope error[E0412]: cannot find type `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:36:16 --> $DIR/resolve-assoc-suggestions.rs:36:16
| |
36 | let _: Type; 36 | let _: Type;
| ^^^^ did you mean `Self::Type`? | ^^^^ help: try: `Self::Type`
error[E0531]: cannot find tuple struct/variant `Type` in this scope error[E0531]: cannot find tuple struct/variant `Type` in this scope
--> $DIR/resolve-assoc-suggestions.rs:39:13 --> $DIR/resolve-assoc-suggestions.rs:39:13
@ -50,7 +50,7 @@ error[E0425]: cannot find value `method` in this scope
--> $DIR/resolve-assoc-suggestions.rs:52:9 --> $DIR/resolve-assoc-suggestions.rs:52:9
| |
52 | method; 52 | method;
| ^^^^^^ did you mean `self.method(...)`? | ^^^^^^ help: try: `self.method`
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View file

@ -14,13 +14,13 @@ error[E0425]: cannot find value `field` in this scope
--> $DIR/resolve-speculative-adjustment.rs:35:9 --> $DIR/resolve-speculative-adjustment.rs:35:9
| |
35 | field; 35 | field;
| ^^^^^ did you mean `self.field`? | ^^^^^ help: try: `self.field`
error[E0425]: cannot find function `method` in this scope error[E0425]: cannot find function `method` in this scope
--> $DIR/resolve-speculative-adjustment.rs:38:9 --> $DIR/resolve-speculative-adjustment.rs:38:9
| |
38 | method(); 38 | method();
| ^^^^^^ did you mean `self.method(...)`? | ^^^^^^ help: try: `self.method`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -35,7 +35,7 @@ error[E0308]: mismatched types
--> $DIR/token-error-correct-3.rs:25:13 --> $DIR/token-error-correct-3.rs:25:13
| |
25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types 25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: did you mean to add a semicolon here? `;` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: did you mean to add a semicolon here?: `;`
| | | |
| expected (), found enum `std::result::Result` | expected (), found enum `std::result::Result`
| |

View file

@ -4,7 +4,7 @@ error[E0425]: cannot find value `cx` in this scope
19 | f(cx); 19 | f(cx);
| ^^ | ^^
| | | |
| did you mean `self.cx`? | help: try: `self.cx`
| `self` value is only available in methods with `self` parameter | `self` value is only available in methods with `self` parameter
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
12 | let x = "Hello " + "World!"; 12 | let x = "Hello " + "World!";
| ^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings | ^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
| |
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left. help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
| |
12 | let x = "Hello ".to_owned() + "World!"; 12 | let x = "Hello ".to_owned() + "World!";
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^

View file

@ -2,7 +2,7 @@ error[E0608]: cannot index into a value of type `({integer},)`
--> $DIR/suggestion-non-ascii.rs:14:21 --> $DIR/suggestion-non-ascii.rs:14:21
| |
14 | println!("☃{}", tup[0]); 14 | println!("☃{}", tup[0]);
| ^^^^^^ help: to access tuple elements, use `tup.0` | ^^^^^^ help: to access tuple elements, use: `tup.0`
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,7 @@ error: unexpected token: `1.1`
| ------------^^^ | ------------^^^
| | | | | |
| | unexpected token | | unexpected token
| help: try parenthesizing the first index `((1, (2, 3)).1).1` | help: try parenthesizing the first index: `((1, (2, 3)).1).1`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
25 | if x = x { 25 | if x = x {
| ^^^^^ | ^^^^^
| | | |
| help: did you mean to compare equality? `x == x` | help: did you mean to compare equality?: `x == x`
| expected bool, found () | expected bool, found ()
| |
= note: expected type `bool` = note: expected type `bool`
@ -16,7 +16,7 @@ error[E0308]: mismatched types
31 | if (x = x) { 31 | if (x = x) {
| ^^^^^^^ | ^^^^^^^
| | | |
| help: did you mean to compare equality? `x == x` | help: did you mean to compare equality?: `x == x`
| expected bool, found () | expected bool, found ()
| |
= note: expected type `bool` = note: expected type `bool`
@ -28,7 +28,7 @@ error[E0308]: mismatched types
37 | if y = (Foo { foo: x }) { 37 | if y = (Foo { foo: x }) {
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| | | |
| help: did you mean to compare equality? `y == (Foo { foo: x })` | help: did you mean to compare equality?: `y == (Foo { foo: x })`
| expected bool, found () | expected bool, found ()
| |
= note: expected type `bool` = note: expected type `bool`
@ -40,7 +40,7 @@ error[E0308]: mismatched types
43 | if 3 = x { 43 | if 3 = x {
| ^^^^^ | ^^^^^
| | | |
| help: did you mean to compare equality? `3 == x` | help: did you mean to compare equality?: `3 == x`
| expected bool, found () | expected bool, found ()
| |
= note: expected type `bool` = note: expected type `bool`