Point at local similarly named element and tweak references to variants

Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
This commit is contained in:
Esteban Küber 2019-10-14 17:20:50 -07:00
parent 0f677c65e8
commit b26ddb8af3
132 changed files with 600 additions and 331 deletions

View File

@ -850,12 +850,14 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
Res::Def(kind @ DefKind::Mod, def_id)
| Res::Def(kind @ DefKind::Enum, def_id)
| Res::Def(kind @ DefKind::Trait, def_id) => {
let module = self.r.new_module(parent,
ModuleKind::Def(kind, def_id, ident.name),
def_id,
expansion,
span);
self.r.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
let module = self.r.new_module(
parent,
ModuleKind::Def(kind, def_id, ident.name),
def_id,
expansion,
span,
);
self.r.define(parent, ident, TypeNS, (module, vis, span, expansion));
}
Res::Def(DefKind::Struct, _)
| Res::Def(DefKind::Union, _)
@ -868,17 +870,17 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
| Res::Def(DefKind::AssocOpaqueTy, _)
| Res::PrimTy(..)
| Res::ToolMod =>
self.r.define(parent, ident, TypeNS, (res, vis, DUMMY_SP, expansion)),
self.r.define(parent, ident, TypeNS, (res, vis, span, expansion)),
Res::Def(DefKind::Fn, _)
| Res::Def(DefKind::Method, _)
| Res::Def(DefKind::Static, _)
| Res::Def(DefKind::Const, _)
| Res::Def(DefKind::AssocConst, _)
| Res::Def(DefKind::Ctor(..), _) =>
self.r.define(parent, ident, ValueNS, (res, vis, DUMMY_SP, expansion)),
self.r.define(parent, ident, ValueNS, (res, vis, span, expansion)),
Res::Def(DefKind::Macro(..), _)
| Res::NonMacroAttr(..) =>
self.r.define(parent, ident, MacroNS, (res, vis, DUMMY_SP, expansion)),
self.r.define(parent, ident, MacroNS, (res, vis, span, expansion)),
Res::Def(DefKind::TyParam, _) | Res::Def(DefKind::ConstParam, _)
| Res::Local(..) | Res::SelfTy(..) | Res::SelfCtor(..) | Res::Err =>
bug!("unexpected resolution: {:?}", res)

View File

@ -58,21 +58,6 @@ fn reduce_impl_span_to_impl_keyword(cm: &SourceMap, impl_span: Span) -> Span {
impl_span
}
crate fn add_typo_suggestion(
err: &mut DiagnosticBuilder<'_>, suggestion: Option<TypoSuggestion>, span: Span
) -> bool {
if let Some(suggestion) = suggestion {
let msg = format!(
"{} {} with a similar name exists", suggestion.res.article(), suggestion.res.descr()
);
err.span_suggestion(
span, &msg, suggestion.candidate.to_string(), Applicability::MaybeIncorrect
);
return true;
}
false
}
impl<'a> Resolver<'a> {
crate fn add_module_candidates(
&mut self,
@ -641,7 +626,7 @@ impl<'a> Resolver<'a> {
let suggestion = self.early_lookup_typo_candidate(
ScopeSet::Macro(macro_kind), parent_scope, ident, is_expected
);
add_typo_suggestion(err, suggestion, ident.span);
self.add_typo_suggestion(err, suggestion, ident.span);
if macro_kind == MacroKind::Derive &&
(ident.as_str() == "Send" || ident.as_str() == "Sync") {
@ -652,6 +637,33 @@ impl<'a> Resolver<'a> {
err.help("have you added the `#[macro_use]` on the module/import?");
}
}
crate fn add_typo_suggestion(
&self,
err: &mut DiagnosticBuilder<'_>,
suggestion: Option<TypoSuggestion>,
span: Span,
) -> bool {
if let Some(suggestion) = suggestion {
let msg = format!(
"{} {} with a similar name exists", suggestion.res.article(), suggestion.res.descr()
);
err.span_suggestion(
span, &msg, suggestion.candidate.to_string(), Applicability::MaybeIncorrect
);
let def_span = suggestion.res.opt_def_id()
.and_then(|def_id| self.definitions.opt_span(def_id));
if let Some(span) = def_span {
err.span_label(span, &format!(
"similarly named {} `{}` defined here",
suggestion.res.descr(),
suggestion.candidate.as_str(),
));
}
return true;
}
false
}
}
impl<'a, 'b> ImportResolver<'a, 'b> {

View File

@ -974,7 +974,7 @@ function:
struct Foo { a: bool };
let f = Foo();
// error: expected function, found `Foo`
// error: expected function, tuple struct or tuple variant, found `Foo`
// `Foo` is a struct name, but this expression uses it like a function name
```
@ -992,7 +992,8 @@ yield this error:
```compile_fail,E0423
println("");
// error: expected function, found macro `println`
// error: expected function, tuple struct or tuple variant,
// found macro `println`
// did you mean `println!(...)`? (notice the trailing `!`)
```
@ -1592,7 +1593,7 @@ enum State {
fn print_on_failure(state: &State) {
match *state {
// error: expected unit struct/variant or constant, found tuple
// error: expected unit struct, unit variant or constant, found tuple
// variant `State::Failed`
State::Failed => println!("Failed"),
_ => ()

View File

@ -199,21 +199,36 @@ impl<'a> PathSource<'a> {
}
fn descr_expected(self) -> &'static str {
match self {
match &self {
PathSource::Type => "type",
PathSource::Trait(_) => "trait",
PathSource::Pat => "unit struct/variant or constant",
PathSource::Pat => "unit struct, unit variant or constant",
PathSource::Struct => "struct, variant or union type",
PathSource::TupleStruct => "tuple struct/variant",
PathSource::TupleStruct => "tuple struct or tuple variant",
PathSource::TraitItem(ns) => match ns {
TypeNS => "associated type",
ValueNS => "method or associated constant",
MacroNS => bug!("associated macro"),
},
PathSource::Expr(parent) => match parent.map(|p| &p.kind) {
PathSource::Expr(parent) => match &parent.as_ref().map(|p| &p.kind) {
// "function" here means "anything callable" rather than `DefKind::Fn`,
// this is not precise but usually more helpful than just "value".
Some(&ExprKind::Call(..)) => "function",
Some(ExprKind::Call(call_expr, _)) => {
match &call_expr.kind {
ExprKind::Path(_, path) => {
let mut msg = "function";
if let Some(segment) = path.segments.iter().last() {
if let Some(c) = segment.ident.to_string().chars().next() {
if c.is_uppercase() {
msg = "function, tuple struct or tuple variant";
}
}
}
msg
}
_ => "function"
}
}
_ => "value",
},
}

View File

@ -1,7 +1,7 @@
use crate::{CrateLint, Module, ModuleKind, ModuleOrUniformRoot};
use crate::{PathResult, PathSource, Segment};
use crate::path_names_to_string;
use crate::diagnostics::{add_typo_suggestion, ImportSuggestion, TypoSuggestion};
use crate::diagnostics::{ImportSuggestion, TypoSuggestion};
use crate::late::{LateResolutionVisitor, RibKind};
use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
@ -237,18 +237,19 @@ impl<'a> LateResolutionVisitor<'a, '_> {
}
// Try Levenshtein algorithm.
let levenshtein_worked = add_typo_suggestion(
&mut err, self.lookup_typo_candidate(path, ns, is_expected, span), ident_span
);
let typo_sugg = self.lookup_typo_candidate(path, ns, is_expected, span);
let levenshtein_worked = self.r.add_typo_suggestion(&mut err, typo_sugg, ident_span);
// Try context-dependent help if relaxed lookup didn't work.
if let Some(res) = res {
if self.smart_resolve_context_dependent_help(&mut err,
span,
source,
res,
&path_str,
&fallback_label) {
if self.smart_resolve_context_dependent_help(
&mut err,
span,
source,
res,
&path_str,
&fallback_label,
) {
return (err, candidates);
}
}

View File

@ -2269,7 +2269,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant], i
fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &QPath) {
span_err!(tcx.sess, span, E0533,
"expected unit struct/variant or constant, found {} `{}`",
"expected unit struct, unit variant or constant, found {} `{}`",
res.descr(),
hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false)));
}

View File

@ -613,9 +613,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
};
let report_unexpected_res = |res: Res| {
let msg = format!("expected tuple struct/variant, found {} `{}`",
res.descr(),
hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false)));
let msg = format!(
"expected tuple struct or tuple variant, found {} `{}`",
res.descr(),
hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false)),
);
let mut err = struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg);
match (res, &pat.kind) {
(Res::Def(DefKind::Fn, _), _) | (Res::Def(DefKind::Method, _), _) => {

View File

@ -4346,11 +4346,12 @@ enum X {
Entry,
}
X::Entry(); // error: expected function, found `X::Entry`
X::Entry(); // error: expected function, tuple struct or tuple variant,
// found `X::Entry`
// Or even simpler:
let x = 0i32;
x(); // error: expected function, found `i32`
x(); // error: expected function, tuple struct or tuple variant, found `i32`
```
Only functions and methods can be called using `()`. Example:

View File

@ -1,6 +1,8 @@
error[E0412]: cannot find type `A` in this scope
--> $DIR/associated-types-eq-1.rs:10:12
|
LL | fn foo2<I: Foo>(x: I) {
| - similarly named type parameter `I` defined here
LL | let _: A = x.boo();
| ^ help: a type parameter with a similar name exists: `I`

View File

@ -7,7 +7,7 @@ impl Cat {
fn meow(&self) {
println!("Meow");
meows += 1; //~ ERROR cannot find value `meows` in this scope
sleep(); //~ ERROR cannot find function `sleep` in this scope
sleep(); //~ ERROR cannot find function `sleep` in this
}
}

View File

@ -2,7 +2,10 @@ error[E0573]: expected type, found const parameter `C`
--> $DIR/struct-with-invalid-const-param.rs:4:23
|
LL | struct S<const C: u8>(C);
| ^ help: a struct with a similar name exists: `S`
| ----------------------^--
| | |
| | help: a struct with a similar name exists: `S`
| similarly named struct `S` defined here
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/struct-with-invalid-const-param.rs:1:12

View File

@ -16,21 +16,21 @@ enum ManyVariants {
}
fn result_test() {
let x = Option(1); //~ ERROR expected function, found enum
let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum
if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum
if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum
println!("It is OK.");
}
let y = Example::Ex(String::from("test"));
if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum
if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum
println!("It is OK.");
}
let y = Void(); //~ ERROR expected function, found enum
let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum
let z = ManyVariants(); //~ ERROR expected function, found enum
let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum
}
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0423]: expected function, found enum `Option`
error[E0423]: expected function, tuple struct or tuple variant, found enum `Option`
--> $DIR/issue-43871-enum-instead-of-variant.rs:19:13
|
LL | let x = Option(1);
@ -11,7 +11,7 @@ LL | let x = std::option::Option::None(1);
LL | let x = std::option::Option::Some(1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0532]: expected tuple struct/variant, found enum `Option`
error[E0532]: expected tuple struct or tuple variant, found enum `Option`
--> $DIR/issue-43871-enum-instead-of-variant.rs:21:12
|
LL | if let Option(_) = x {
@ -24,7 +24,7 @@ LL | if let std::option::Option::None(_) = x {
LL | if let std::option::Option::Some(_) = x {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0532]: expected tuple struct/variant, found enum `Example`
error[E0532]: expected tuple struct or tuple variant, found enum `Example`
--> $DIR/issue-43871-enum-instead-of-variant.rs:27:12
|
LL | if let Example(_) = y {
@ -37,13 +37,13 @@ LL | if let Example::Ex(_) = y {
LL | if let Example::NotEx(_) = y {
| ^^^^^^^^^^^^^^
error[E0423]: expected function, found enum `Void`
error[E0423]: expected function, tuple struct or tuple variant, found enum `Void`
--> $DIR/issue-43871-enum-instead-of-variant.rs:31:13
|
LL | let y = Void();
| ^^^^
error[E0423]: expected function, found enum `ManyVariants`
error[E0423]: expected function, tuple struct or tuple variant, found enum `ManyVariants`
--> $DIR/issue-43871-enum-instead-of-variant.rs:33:13
|
LL | let z = ManyVariants();

View File

@ -13,12 +13,15 @@ enum E {
fn main() {
let e1 = Empty1; //~ ERROR expected value, found struct `Empty1`
let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1`
let e1 = Empty1();
//~^ ERROR expected function, tuple struct or tuple variant, found struct `Empty1`
let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3`
let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3`
let e3 = E::Empty3();
//~^ ERROR expected function, tuple struct or tuple variant, found struct variant `E::Empty3`
let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1`
let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1`
let xe1 = XEmpty1();
//~^ ERROR expected function, tuple struct or tuple variant, found struct `XEmpty1`
let xe3 = XE::Empty3; //~ ERROR no variant or associated item named `Empty3` found for type
let xe3 = XE::Empty3(); //~ ERROR no variant or associated item named `Empty3` found for type

View File

@ -10,7 +10,7 @@ LL | let e1 = Empty1;
| did you mean `Empty1 { /* fields */ }`?
| help: a unit struct with a similar name exists: `XEmpty2`
error[E0423]: expected function, found struct `Empty1`
error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
--> $DIR/empty-struct-braces-expr.rs:16:14
|
LL | struct Empty1 {}
@ -23,7 +23,7 @@ LL | let e1 = Empty1();
| help: a unit struct with a similar name exists: `XEmpty2`
error[E0423]: expected value, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-expr.rs:17:14
--> $DIR/empty-struct-braces-expr.rs:18:14
|
LL | Empty3 {}
| --------- `E::Empty3` defined here
@ -31,8 +31,8 @@ LL | Empty3 {}
LL | let e3 = E::Empty3;
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
error[E0423]: expected function, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-expr.rs:18:14
error[E0423]: expected function, tuple struct or tuple variant, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-expr.rs:19:14
|
LL | Empty3 {}
| --------- `E::Empty3` defined here
@ -41,7 +41,7 @@ LL | let e3 = E::Empty3();
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
error[E0423]: expected value, found struct `XEmpty1`
--> $DIR/empty-struct-braces-expr.rs:20:15
--> $DIR/empty-struct-braces-expr.rs:22:15
|
LL | let xe1 = XEmpty1;
| ^^^^^^^
@ -49,8 +49,8 @@ LL | let xe1 = XEmpty1;
| did you mean `XEmpty1 { /* fields */ }`?
| help: a unit struct with a similar name exists: `XEmpty2`
error[E0423]: expected function, found struct `XEmpty1`
--> $DIR/empty-struct-braces-expr.rs:21:15
error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
--> $DIR/empty-struct-braces-expr.rs:23:15
|
LL | let xe1 = XEmpty1();
| ^^^^^^^
@ -59,7 +59,7 @@ LL | let xe1 = XEmpty1();
| help: a unit struct with a similar name exists: `XEmpty2`
error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope
--> $DIR/empty-struct-braces-expr.rs:22:19
--> $DIR/empty-struct-braces-expr.rs:25:19
|
LL | let xe3 = XE::Empty3;
| ^^^^^^
@ -68,7 +68,7 @@ LL | let xe3 = XE::Empty3;
| help: there is a variant with a similar name: `XEmpty3`
error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope
--> $DIR/empty-struct-braces-expr.rs:23:19
--> $DIR/empty-struct-braces-expr.rs:26:19
|
LL | let xe3 = XE::Empty3();
| ^^^^^^
@ -77,7 +77,7 @@ LL | let xe3 = XE::Empty3();
| help: there is a variant with a similar name: `XEmpty3`
error: no variant `Empty1` in enum `empty_struct::XE`
--> $DIR/empty-struct-braces-expr.rs:25:9
--> $DIR/empty-struct-braces-expr.rs:28:9
|
LL | XE::Empty1 {};
| ^^^^^^ help: there is a variant with a similar name: `XEmpty3`

View File

@ -22,13 +22,13 @@ fn main() {
}
match e3 {
E::Empty3 => ()
//~^ ERROR expected unit struct/variant or constant, found struct variant `E::Empty3`
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `E::Empty3`
}
match xe1 {
XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
}
match xe3 {
XE::XEmpty3 => ()
//~^ ERROR expected unit struct/variant or constant, found struct variant `XE::XEmpty3`
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
}
}

View File

@ -1,4 +1,4 @@
error[E0532]: expected unit struct/variant or constant, found struct variant `E::Empty3`
error[E0532]: expected unit struct, unit variant or constant, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-pat-1.rs:24:9
|
LL | Empty3 {}
@ -7,7 +7,7 @@ LL | Empty3 {}
LL | E::Empty3 => ()
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
error[E0532]: expected unit struct/variant or constant, found struct variant `XE::XEmpty3`
error[E0532]: expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
--> $DIR/empty-struct-braces-pat-1.rs:31:9
|
LL | XE::XEmpty3 => ()

View File

@ -12,15 +12,15 @@ fn main() {
let xe1 = XEmpty1 {};
match e1 {
Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
Empty1() => () //~ ERROR expected tuple struct or tuple variant, found struct `Empty1`
}
match xe1 {
XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
XEmpty1() => () //~ ERROR expected tuple struct or tuple variant, found struct `XEmpty1`
}
match e1 {
Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
Empty1(..) => () //~ ERROR expected tuple struct or tuple variant, found struct `Empty1`
}
match xe1 {
XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
XEmpty1(..) => () //~ ERROR expected tuple struct or tuple variant, found struct `XEmpty1`
}
}

View File

@ -1,4 +1,4 @@
error[E0532]: expected tuple struct/variant, found struct `Empty1`
error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
--> $DIR/empty-struct-braces-pat-2.rs:15:9
|
LL | struct Empty1 {}
@ -10,7 +10,7 @@ LL | Empty1() => ()
| did you mean `Empty1 { /* fields */ }`?
| help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
--> $DIR/empty-struct-braces-pat-2.rs:18:9
|
LL | XEmpty1() => ()
@ -19,7 +19,7 @@ LL | XEmpty1() => ()
| did you mean `XEmpty1 { /* fields */ }`?
| help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found struct `Empty1`
error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
--> $DIR/empty-struct-braces-pat-2.rs:21:9
|
LL | struct Empty1 {}
@ -31,7 +31,7 @@ LL | Empty1(..) => ()
| did you mean `Empty1 { /* fields */ }`?
| help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
--> $DIR/empty-struct-braces-pat-2.rs:24:9
|
LL | XEmpty1(..) => ()

View File

@ -15,18 +15,18 @@ fn main() {
match e3 {
E::Empty3() => ()
//~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3`
//~^ ERROR expected tuple struct or tuple variant, found struct variant `E::Empty3`
}
match xe3 {
XE::XEmpty3() => ()
//~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3`
//~^ ERROR expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
}
match e3 {
E::Empty3(..) => ()
//~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3`
//~^ ERROR expected tuple struct or tuple variant, found struct variant `E::Empty3`
}
match xe3 {
XE::XEmpty3(..) => ()
//~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3
//~^ ERROR expected tuple struct or tuple variant, found struct variant `XE::XEmpty3
}
}

View File

@ -1,4 +1,4 @@
error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3`
error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-pat-3.rs:17:9
|
LL | Empty3 {}
@ -7,7 +7,7 @@ LL | Empty3 {}
LL | E::Empty3() => ()
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
--> $DIR/empty-struct-braces-pat-3.rs:21:9
|
LL | XE::XEmpty3() => ()
@ -16,7 +16,7 @@ LL | XE::XEmpty3() => ()
| | help: a tuple variant with a similar name exists: `XEmpty5`
| did you mean `XE::XEmpty3 { /* fields */ }`?
error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3`
error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
--> $DIR/empty-struct-braces-pat-3.rs:25:9
|
LL | Empty3 {}
@ -25,7 +25,7 @@ LL | Empty3 {}
LL | E::Empty3(..) => ()
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
--> $DIR/empty-struct-braces-pat-3.rs:29:9
|
LL | XE::XEmpty3(..) => ()

View File

@ -27,11 +27,11 @@ fn main() {
match e4 {
E::Empty4 => ()
//~^ ERROR expected unit struct/variant or constant, found tuple variant `E::Empty4`
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `E::Empty4`
}
match xe5 {
XE::XEmpty5 => (),
//~^ ERROR expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5`
_ => {},
}
}

View File

@ -16,7 +16,7 @@ LL | use empty_struct::*;
LL | XEmpty6 => ()
| ^^^^^^^ cannot be named the same as a tuple struct
error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4`
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::Empty4`
--> $DIR/empty-struct-tuple-pat.rs:29:9
|
LL | Empty4()
@ -25,7 +25,7 @@ LL | Empty4()
LL | E::Empty4 => ()
| ^^^^^^^^^ did you mean `E::Empty4( /* fields */ )`?
error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5`
--> $DIR/empty-struct-tuple-pat.rs:33:9
|
LL | XE::XEmpty5 => (),

View File

@ -18,32 +18,37 @@ fn main() {
let xe4 = XE::XEmpty4;
match e2 {
Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
Empty2() => () //~ ERROR expected tuple struct or tuple variant, found unit struct `Empty2`
}
match xe2 {
XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
XEmpty2() => ()
//~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2`
}
match e2 {
Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
Empty2(..) => ()
//~^ ERROR expected tuple struct or tuple variant, found unit struct `Empty2`
}
match xe2 {
XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
XEmpty2(..) => ()
//~^ ERROR expected tuple struct or tuple variant, found unit struct `XEmpty2`
}
match e4 {
E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
E::Empty4() => ()
//~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4`
}
match xe4 {
XE::XEmpty4() => (),
//~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
//~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
_ => {},
}
match e4 {
E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
E::Empty4(..) => ()
//~^ ERROR expected tuple struct or tuple variant, found unit variant `E::Empty4`
}
match xe4 {
XE::XEmpty4(..) => (),
//~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
//~^ ERROR expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
_ => {},
}
}

View File

@ -1,49 +1,49 @@
error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2`
--> $DIR/empty-struct-unit-pat.rs:21:9
|
LL | Empty2() => ()
| ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
--> $DIR/empty-struct-unit-pat.rs:24:9
|
LL | XEmpty2() => ()
| ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
--> $DIR/empty-struct-unit-pat.rs:27:9
error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2`
--> $DIR/empty-struct-unit-pat.rs:28:9
|
LL | Empty2(..) => ()
| ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
--> $DIR/empty-struct-unit-pat.rs:30:9
error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
--> $DIR/empty-struct-unit-pat.rs:32:9
|
LL | XEmpty2(..) => ()
| ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
--> $DIR/empty-struct-unit-pat.rs:34:9
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
--> $DIR/empty-struct-unit-pat.rs:37:9
|
LL | E::Empty4() => ()
| ^^^^^^^^^ not a tuple struct/variant
| ^^^^^^^^^ not a tuple struct or tuple variant
error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
--> $DIR/empty-struct-unit-pat.rs:37:9
error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
--> $DIR/empty-struct-unit-pat.rs:41:9
|
LL | XE::XEmpty4() => (),
| ^^^^-------
| |
| help: a tuple variant with a similar name exists: `XEmpty5`
error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
--> $DIR/empty-struct-unit-pat.rs:42:9
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
--> $DIR/empty-struct-unit-pat.rs:46:9
|
LL | E::Empty4(..) => ()
| ^^^^^^^^^ not a tuple struct/variant
| ^^^^^^^^^ not a tuple struct or tuple variant
error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
--> $DIR/empty-struct-unit-pat.rs:45:9
error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4`
--> $DIR/empty-struct-unit-pat.rs:50:9
|
LL | XE::XEmpty4(..) => (),
| ^^^^-------

View File

@ -1,3 +1,3 @@
fn main() {
let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope
let a(1) = 13; //~ ERROR cannot find tuple struct or tuple variant `a` in this scope
}

View File

@ -1,4 +1,4 @@
error[E0531]: cannot find tuple struct/variant `a` in this scope
error[E0531]: cannot find tuple struct or tuple variant `a` in this scope
--> $DIR/enums-pats-not-idents.rs:2:9
|
LL | let a(1) = 13;

View File

@ -1,4 +1,4 @@
error[E0164]: expected tuple struct/variant, found associated constant `<Foo>::B`
error[E0164]: expected tuple struct or tuple variant, found associated constant `<Foo>::B`
--> $DIR/E0164.rs:9:9
|
LL | Foo::B(i) => i,

View File

@ -26,17 +26,23 @@ help: surround the struct literal with parentheses
LL | for _ in (std::ops::Range { start: 0, end: 10 }) {}
| ^ ^
error[E0423]: expected function, found struct `Foo`
error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo`
--> $DIR/E0423.rs:4:13
|
LL | struct Foo { a: bool };
| ---------------------- `Foo` defined here
LL | struct Foo { a: bool };
| ---------------------- `Foo` defined here
LL |
LL | let f = Foo();
| ^^^
| |
| did you mean `Foo { /* fields */ }`?
| help: a function with a similar name exists (notice the capitalization): `foo`
LL | let f = Foo();
| ^^^
| |
| did you mean `Foo { /* fields */ }`?
| help: a function with a similar name exists (notice the capitalization): `foo`
...
LL | / fn foo() {
LL | | for _ in std::ops::Range { start: 0, end: 10 } {}
LL | |
LL | | }
| |_- similarly named function `foo` defined here
error[E0423]: expected value, found struct `T`
--> $DIR/E0423.rs:14:8

View File

@ -7,7 +7,7 @@ LL | | self.bar();
LL | | }
| |_____- this function doesn't have a `self` parameter
error[E0424]: expected unit struct/variant or constant, found module `self`
error[E0424]: expected unit struct, unit variant or constant, found module `self`
--> $DIR/E0424.rs:12:9
|
LL | / fn main () {

View File

@ -3,7 +3,7 @@ fn main() {
match SomeStruct(value) {
StructConst1(_) => { },
//~^ ERROR expected tuple struct/variant, found constant `StructConst1`
//~^ ERROR expected tuple struct or tuple variant, found constant `StructConst1`
_ => { },
}

View File

@ -1,8 +1,8 @@
error[E0532]: expected tuple struct/variant, found constant `StructConst1`
error[E0532]: expected tuple struct or tuple variant, found constant `StructConst1`
--> $DIR/E0532.rs:5:9
|
LL | StructConst1(_) => { },
| ^^^^^^^^^^^^ not a tuple struct/variant
| ^^^^^^^^^^^^ not a tuple struct or tuple variant
error: aborting due to previous error

View File

@ -8,7 +8,7 @@ fn hof<F>(_: F) where F: FnMut(()) {}
fn ice() {
hof(|c| match c {
A::new() => (), //~ ERROR expected tuple struct/variant, found method
A::new() => (), //~ ERROR expected tuple struct or tuple variant, found method
_ => ()
})
}

View File

@ -1,4 +1,4 @@
error[E0164]: expected tuple struct/variant, found method `<A>::new`
error[E0164]: expected tuple struct or tuple variant, found method `<A>::new`
--> $DIR/fn-in-pat.rs:11:9
|
LL | A::new() => (),

View File

@ -46,6 +46,9 @@ LL | import();
error[E0412]: cannot find type `A` in this scope
--> $DIR/glob-resolve1.rs:28:11
|
LL | pub enum B { B1 }
| ----------------- similarly named enum `B` defined here
...
LL | foo::<A>();
| ^
|
@ -61,6 +64,9 @@ LL | use bar::A;
error[E0412]: cannot find type `C` in this scope
--> $DIR/glob-resolve1.rs:29:11
|
LL | pub enum B { B1 }
| ----------------- similarly named enum `B` defined here
...
LL | foo::<C>();
| ^
|
@ -76,6 +82,9 @@ LL | use bar::C;
error[E0412]: cannot find type `D` in this scope
--> $DIR/glob-resolve1.rs:30:11
|
LL | pub enum B { B1 }
| ----------------- similarly named enum `B` defined here
...
LL | foo::<D>();
| ^
|

View File

@ -1,3 +1,5 @@
// ignore-x86
// ^ due to stderr output differences
// aux-build:two_macros.rs
macro_rules! define_vec {

View File

@ -1,5 +1,5 @@
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:19:9
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:21:9
|
LL | extern crate std as core;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,20 +8,24 @@ LL | define_other_core!();
| --------------------- in this macro invocation
error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9
|
LL | Vec::panic!();
| ^^^ ambiguous name
|
= note: `Vec` could refer to a struct from prelude
note: `Vec` could also refer to the crate imported here
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:5:9
note: `Vec` could refer to the crate imported here
--> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9
|
LL | extern crate std as Vec;
| ^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | define_vec!();
| -------------- in this macro invocation
note: `Vec` could also refer to the struct defined here
--> $SRC_DIR/libstd/prelude/v1.rs:LL:COL
|
LL | pub use crate::vec::Vec;
| ^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -3,7 +3,7 @@ fn foo(_: usize) -> Foo { Foo(false) }
fn main() {
match Foo(true) {
foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
foo(x) //~ ERROR expected tuple struct or tuple variant, found function `foo`
=> ()
}
}

View File

@ -1,6 +1,9 @@
error[E0532]: expected tuple struct/variant, found function `foo`
error[E0532]: expected tuple struct or tuple variant, found function `foo`
--> $DIR/issue-10200.rs:6:9
|
LL | struct Foo(bool);
| ----------------- similarly named tuple struct `Foo` defined here
...
LL | foo(x)
| ^^^ help: a tuple struct with a similar name exists (notice the capitalization): `Foo`

View File

@ -2,6 +2,7 @@ mod foo { pub fn bar() {} }
fn main() {
match () {
foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar`
foo::bar => {}
//~^ ERROR expected unit struct, unit variant or constant, found function `foo::bar`
}
}

View File

@ -1,8 +1,8 @@
error[E0532]: expected unit struct/variant or constant, found function `foo::bar`
error[E0532]: expected unit struct, unit variant or constant, found function `foo::bar`
--> $DIR/issue-12863.rs:5:9
|
LL | foo::bar => {}
| ^^^^^^^^ not a unit struct/variant or constant
| ^^^^^^^^ not a unit struct, unit variant or constant
error: aborting due to previous error

View File

@ -3,7 +3,7 @@ pub static X: usize = 1;
fn main() {
match 1 {
self::X => { },
//~^ ERROR expected unit struct/variant or constant, found static `self::X`
//~^ ERROR expected unit struct, unit variant or constant, found static `self::X`
_ => { },
}
}

View File

@ -1,8 +1,8 @@
error[E0532]: expected unit struct/variant or constant, found static `self::X`
error[E0532]: expected unit struct, unit variant or constant, found static `self::X`
--> $DIR/issue-17933.rs:5:9
|
LL | self::X => { },
| ^^^^^^^ not a unit struct/variant or constant
| ^^^^^^^ not a unit struct, unit variant or constant
error: aborting due to previous error

View File

@ -8,6 +8,6 @@ fn main() {
let f = FooB { x: 3, y: 4 };
match f {
FooB(a, b) => println!("{} {}", a, b),
//~^ ERROR expected tuple struct/variant, found struct variant `FooB`
//~^ ERROR expected tuple struct or tuple variant, found struct variant `FooB`
}
}

View File

@ -1,4 +1,4 @@
error[E0532]: expected tuple struct/variant, found struct variant `FooB`
error[E0532]: expected tuple struct or tuple variant, found struct variant `FooB`
--> $DIR/issue-19086.rs:10:9
|
LL | FooB { x: i32, y: i32 }

View File

@ -1,3 +1,5 @@
// ignore-x86
// ^ due to stderr output differences
fn main() {
match Some(1) {
None @ _ => {} //~ ERROR match bindings cannot shadow unit variants

View File

@ -1,11 +1,16 @@
error[E0530]: match bindings cannot shadow unit variants
--> $DIR/issue-27033.rs:3:9
--> $DIR/issue-27033.rs:5:9
|
LL | None @ _ => {}
| ^^^^ cannot be named the same as a unit variant
|
::: $SRC_DIR/libstd/prelude/v1.rs:LL:COL
|
LL | pub use crate::option::Option::{self, Some, None};
| ---- the unit variant `None` is defined here
error[E0530]: match bindings cannot shadow constants
--> $DIR/issue-27033.rs:7:9
--> $DIR/issue-27033.rs:9:9
|
LL | const C: u8 = 1;
| ---------------- the constant `C` is defined here

View File

@ -10,7 +10,7 @@ impl S {
}
fn main() {
if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1`
if let C1(..) = 0 {} //~ ERROR expected tuple struct or tuple variant, found constant `C1`
if let S::C2(..) = 0 {}
//~^ ERROR expected tuple struct/variant, found associated constant `<S>::C2`
//~^ ERROR expected tuple struct or tuple variant, found associated constant `<S>::C2`
}

View File

@ -1,10 +1,10 @@
error[E0532]: expected tuple struct/variant, found constant `C1`
error[E0532]: expected tuple struct or tuple variant, found constant `C1`
--> $DIR/issue-28992-empty.rs:13:12
|
LL | if let C1(..) = 0 {}
| ^^ not a tuple struct/variant
| ^^ not a tuple struct or tuple variant
error[E0164]: expected tuple struct/variant, found associated constant `<S>::C2`
error[E0164]: expected tuple struct or tuple variant, found associated constant `<S>::C2`
--> $DIR/issue-28992-empty.rs:14:12
|
LL | if let S::C2(..) = 0 {}

View File

@ -1,8 +1,11 @@
error[E0425]: cannot find function `g` in this scope
--> $DIR/issue-31845.rs:7:12
|
LL | g();
| ^ help: a function with a similar name exists: `h`
LL | / fn h() {
LL | | g();
| | ^ help: a function with a similar name exists: `h`
LL | | }
| |_________- similarly named function `h` defined here
error: aborting due to previous error

View File

@ -8,12 +8,12 @@ struct S;
fn main() {
match Foo::Baz {
Foo::Bar => {}
//~^ ERROR expected unit struct/variant or constant, found tuple variant `Foo::Bar`
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `Foo::Bar`
_ => {}
}
match S {
S(()) => {}
//~^ ERROR expected tuple struct/variant, found unit struct `S`
//~^ ERROR expected tuple struct or tuple variant, found unit struct `S`
}
}

View File

@ -1,8 +1,10 @@
error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo::Bar`
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Foo::Bar`
--> $DIR/issue-32004.rs:10:9
|
LL | Bar(i32),
| -------- `Foo::Bar` defined here
LL | Baz
| --- similarly named unit variant `Baz` defined here
...
LL | Foo::Bar => {}
| ^^^^^---
@ -10,11 +12,11 @@ LL | Foo::Bar => {}
| | help: a unit variant with a similar name exists: `Baz`
| did you mean `Foo::Bar( /* fields */ )`?
error[E0532]: expected tuple struct/variant, found unit struct `S`
error[E0532]: expected tuple struct or tuple variant, found unit struct `S`
--> $DIR/issue-32004.rs:16:9
|
LL | S(()) => {}
| ^ not a tuple struct/variant
| ^ not a tuple struct or tuple variant
error: aborting due to 2 previous errors

View File

@ -2,6 +2,6 @@ struct S(u8);
const C: S = S(10);
fn main() {
let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
let C(a) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C`
let C(..) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C`
}

View File

@ -1,12 +1,18 @@
error[E0532]: expected tuple struct/variant, found constant `C`
error[E0532]: expected tuple struct or tuple variant, found constant `C`
--> $DIR/issue-32086.rs:5:9
|
LL | struct S(u8);
| ------------- similarly named tuple struct `S` defined here
...
LL | let C(a) = S(11);
| ^ help: a tuple struct with a similar name exists: `S`
error[E0532]: expected tuple struct/variant, found constant `C`
error[E0532]: expected tuple struct or tuple variant, found constant `C`
--> $DIR/issue-32086.rs:6:9
|
LL | struct S(u8);
| ------------- similarly named tuple struct `S` defined here
...
LL | let C(..) = S(11);
| ^ help: a tuple struct with a similar name exists: `S`

View File

@ -7,13 +7,13 @@ enum Fruit {
fn should_return_fruit() -> Apple {
//~^ ERROR cannot find type `Apple` in this scope
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope
}
fn should_return_fruit_too() -> Fruit::Apple {
//~^ ERROR expected type, found variant `Fruit::Apple`
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~^ ERROR cannot find function, tuple struct or tuple variant `Apple` in this scope
}
fn foo() -> Ok {

View File

@ -9,7 +9,7 @@ help: there is an enum variant `Fruit::Apple`; try using the variant's enum
LL | fn should_return_fruit() -> Fruit {
| ^^^^^
error[E0425]: cannot find function `Apple` in this scope
error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope
--> $DIR/issue-35675.rs:9:5
|
LL | Apple(5)
@ -29,7 +29,7 @@ LL | fn should_return_fruit_too() -> Fruit::Apple {
| not a type
| help: try using the variant's enum: `Fruit`
error[E0425]: cannot find function `Apple` in this scope
error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope
--> $DIR/issue-35675.rs:15:5
|
LL | Apple(5)

View File

@ -1,6 +1,6 @@
fn main() {
let Box(a) = loop { };
//~^ ERROR expected tuple struct/variant, found struct `Box`
//~^ ERROR expected tuple struct or tuple variant, found struct `Box`
// (The below is a trick to allow compiler to infer a type for
// variable `a` without attempting to ascribe a type to the

View File

@ -1,4 +1,4 @@
error[E0532]: expected tuple struct/variant, found struct `Box`
error[E0532]: expected tuple struct or tuple variant, found struct `Box`
--> $DIR/issue-38412.rs:2:9
|
LL | let Box(a) = loop { };

View File

@ -6,13 +6,15 @@ mod bar {
use foo::B;
fn foo() {
B(()); //~ ERROR expected function, found struct `B` [E0423]
B(());
//~^ ERROR expected function, tuple struct or tuple variant, found struct `B` [E0423]
}
}
mod baz {
fn foo() {
B(()); //~ ERROR cannot find function `B` in this scope [E0425]
B(());
//~^ ERROR cannot find function, tuple struct or tuple variant `B` in this scope [E0425]
}
}

View File

@ -1,11 +1,11 @@
error[E0423]: expected function, found struct `B`
error[E0423]: expected function, tuple struct or tuple variant, found struct `B`
--> $DIR/issue-42944.rs:9:9
|
LL | B(());
| ^ constructor is not visible here due to private fields
error[E0425]: cannot find function `B` in this scope
--> $DIR/issue-42944.rs:15:9
error[E0425]: cannot find function, tuple struct or tuple variant `B` in this scope
--> $DIR/issue-42944.rs:16:9
|
LL | B(());
| ^ not found in this scope

View File

@ -1,6 +1,9 @@
error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope
--> $DIR/issue-46332.rs:9:5
|
LL | struct TyUint {}
| ---------------- similarly named struct `TyUint` defined here
...
LL | TyUInt {};
| ^^^^^^ help: a struct with a similar name exists (notice the capitalization): `TyUint`

View File

@ -1,5 +1,5 @@
use std::path::Path;
fn main() {
let Path::new(); //~ ERROR expected tuple struct/variant
let Path::new(); //~ ERROR expected tuple struct or tuple variant
}

View File

@ -1,4 +1,4 @@
error[E0164]: expected tuple struct/variant, found method `<Path>::new`
error[E0164]: expected tuple struct or tuple variant, found method `<Path>::new`
--> $DIR/issue-55587.rs:4:9
|
LL | let Path::new();

View File

@ -3,7 +3,7 @@ pub struct Foo {}
impl Foo {
fn bar(Self(foo): Self) {}
//~^ ERROR the `Self` constructor can only be used with tuple or unit structs
//~^^ ERROR expected tuple struct/variant, found self constructor `Self` [E0164]
//~^^ ERROR expected tuple struct or tuple variant, found self constructor `Self` [E0164]
}
fn main() {}

View File

@ -4,7 +4,7 @@ error: the `Self` constructor can only be used with tuple or unit structs
LL | fn bar(Self(foo): Self) {}
| ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }`
error[E0164]: expected tuple struct/variant, found self constructor `Self`
error[E0164]: expected tuple struct or tuple variant, found self constructor `Self`
--> $DIR/issue-56835.rs:4:12
|
LL | fn bar(Self(foo): Self) {}

View File

@ -11,7 +11,8 @@ impl Bar<[u8]> {
const SIZE: usize = 32;
fn new(slice: &[u8; Self::SIZE]) -> Self {
Foo(Box::new(*slice)) //~ ERROR: expected function, found trait `Foo`
Foo(Box::new(*slice))
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
}
}

View File

@ -1,8 +1,8 @@
error[E0423]: expected function, found trait `Foo`
error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo`
--> $DIR/issue-58022.rs:14:9
|
LL | Foo(Box::new(*slice))
| ^^^ not a function
| ^^^ not a function, tuple struct or tuple variant
error[E0283]: type annotations needed: cannot resolve `_: Foo`
--> $DIR/issue-58022.rs:4:25

View File

@ -1,6 +1,6 @@
fn main() {
let z = match 3 {
x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
x(1) => x(1) //~ ERROR cannot find tuple struct or tuple variant `x` in this scope
//~^ ERROR cannot find function `x` in this scope
};
assert!(z == 3);

View File

@ -1,4 +1,4 @@
error[E0531]: cannot find tuple struct/variant `x` in this scope
error[E0531]: cannot find tuple struct or tuple variant `x` in this scope
--> $DIR/issue-5927.rs:3:9
|
LL | x(1) => x(1)

View File

@ -6,9 +6,9 @@ enum MyEnum {
fn foo(en: MyEnum) {
match en {
MyEnum::Tuple => "",
//~^ ERROR expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple`
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple`
MyEnum::Struct => "",
//~^ ERROR expected unit struct/variant or constant, found struct variant `MyEnum::Struct`
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct`
};
}

View File

@ -1,4 +1,4 @@
error[E0532]: expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple`
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple`
--> $DIR/issue-63983.rs:8:9
|
LL | Tuple(i32),
@ -7,7 +7,7 @@ LL | Tuple(i32),
LL | MyEnum::Tuple => "",
| ^^^^^^^^^^^^^ did you mean `MyEnum::Tuple( /* fields */ )`?
error[E0532]: expected unit struct/variant or constant, found struct variant `MyEnum::Struct`
error[E0532]: expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct`
--> $DIR/issue-63983.rs:10:9
|
LL | Struct{ s: i32 },

View File

@ -1,5 +1,5 @@
struct X {}
const Y: X = X("ö"); //~ ERROR expected function, found struct `X`
const Y: X = X("ö"); //~ ERROR expected function, tuple struct or tuple variant, found struct `X`
fn main() {}

View File

@ -1,14 +1,15 @@
error[E0423]: expected function, found struct `X`
error[E0423]: expected function, tuple struct or tuple variant, found struct `X`
--> $DIR/issue-64792-bad-unicode-ctor.rs:3:14
|
LL | struct X {}
| ----------- `X` defined here
LL |
LL | const Y: X = X("ö");
| ^
| |
| did you mean `X { /* fields */ }`?
| help: a constant with a similar name exists: `Y`
| -------------^------
| | |
| | did you mean `X { /* fields */ }`?
| | help: a constant with a similar name exists: `Y`
| similarly named constant `Y` defined here
error: aborting due to previous error

View File

@ -6,7 +6,9 @@ enum E {
fn main() {
match None {
None => {}
Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A`
Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B`
Some(E::A(..)) => {}
//~^ ERROR expected tuple struct or tuple variant, found unit variant `E::A`
Some(E::B(..)) => {}
//~^ ERROR expected tuple struct or tuple variant, found unit variant `E::B`
}
}

View File

@ -1,14 +1,14 @@
error[E0532]: expected tuple struct/variant, found unit variant `E::A`
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::A`
--> $DIR/issue-pr29383.rs:9:14
|
LL | Some(E::A(..)) => {}
| ^^^^ not a tuple struct/variant
| ^^^^ not a tuple struct or tuple variant
error[E0532]: expected tuple struct/variant, found unit variant `E::B`
--> $DIR/issue-pr29383.rs:10:14
error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B`
--> $DIR/issue-pr29383.rs:11:14
|
LL | Some(E::B(..)) => {}
| ^^^^ not a tuple struct/variant
| ^^^^ not a tuple struct or tuple variant
error: aborting due to 2 previous errors

View File

@ -1,3 +1,3 @@
fn main() {
let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope
let Self = 22; //~ ERROR cannot find unit struct, unit variant or constant `Self` in this scope
}

View File

@ -1,4 +1,4 @@
error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
error[E0531]: cannot find unit struct, unit variant or constant `Self` in this scope
--> $DIR/keyword-self-as-identifier.rs:2:9
|
LL | let Self = 22;

View File

@ -1,8 +1,13 @@
error: cannot find macro `k` in this scope
--> $DIR/macro_undefined.rs:11:5
|
LL | k!();
| ^ help: a macro with a similar name exists: `kl`
LL | / macro_rules! kl {
LL | | () => ()
LL | | }
| |_____- similarly named macro `kl` defined here
...
LL | k!();
| ^ help: a macro with a similar name exists: `kl`
error: aborting due to previous error

View File

@ -4,9 +4,9 @@ fn main() {
let path = Path::new("foo");
match path {
Path::new("foo") => println!("foo"),
//~^ ERROR expected tuple struct/variant
//~^ ERROR expected tuple struct or tuple variant
Path::new("bar") => println!("bar"),
//~^ ERROR expected tuple struct/variant
//~^ ERROR expected tuple struct or tuple variant
_ => (),
}
}

View File

@ -1,4 +1,4 @@
error[E0164]: expected tuple struct/variant, found method `<Path>::new`
error[E0164]: expected tuple struct or tuple variant, found method `<Path>::new`
--> $DIR/match-fn-call.rs:6:9
|
LL | Path::new("foo") => println!("foo"),
@ -6,7 +6,7 @@ LL | Path::new("foo") => println!("foo"),
|
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
error[E0164]: expected tuple struct/variant, found method `<Path>::new`
error[E0164]: expected tuple struct or tuple variant, found method `<Path>::new`
--> $DIR/match-fn-call.rs:8:9
|
LL | Path::new("bar") => println!("bar"),

View File

@ -10,7 +10,7 @@ fn main() {
Color::Rgb(_, _, _) => { }
Color::Cmyk(_, _, _, _) => { }
Color::NoColor(_) => { }
//~^ ERROR expected tuple struct/variant, found unit variant `Color::NoColor`
//~^ ERROR expected tuple struct or tuple variant, found unit variant `Color::NoColor`
}
}
}

View File

@ -1,8 +1,8 @@
error[E0532]: expected tuple struct/variant, found unit variant `Color::NoColor`
error[E0532]: expected tuple struct or tuple variant, found unit variant `Color::NoColor`
--> $DIR/match-pattern-field-mismatch-2.rs:12:11
|
LL | Color::NoColor(_) => { }
| ^^^^^^^^^^^^^^ not a tuple struct/variant
| ^^^^^^^^^^^^^^ not a tuple struct or tuple variant
error: aborting due to previous error

View File

@ -8,7 +8,7 @@ fn main() {
fn foo(c: Color) {
match c {
Color::Rgb(_, _) => { }
//~^ ERROR this pattern has 2 fields, but the corresponding tuple variant has 3 fields
//~^ ERROR this pattern has 2 fields, but the corresponding tuple variant has 3
Color::Cmyk(_, _, _, _) => { }
Color::NoColor => { }
}

View File

@ -13,20 +13,20 @@ impl MyTrait for Foo {}
fn main() {
match 0u32 {
Foo::bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::bar`
}
match 0u32 {
<Foo>::bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::bar`
}
match 0u32 {
<Foo>::trait_bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::trait_bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::trait_bar`
}
if let Foo::bar = 0u32 {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::bar`
if let <Foo>::bar = 0u32 {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::bar`
if let Foo::trait_bar = 0u32 {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::trait_bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `<Foo>::trait_bar`
}

View File

@ -1,34 +1,34 @@
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::bar`
--> $DIR/method-path-in-pattern.rs:15:9
|
LL | Foo::bar => {}
| ^^^^^^^^
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::bar`
--> $DIR/method-path-in-pattern.rs:19:9
|
LL | <Foo>::bar => {}
| ^^^^^^^^^^
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::trait_bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::trait_bar`
--> $DIR/method-path-in-pattern.rs:23:9
|
LL | <Foo>::trait_bar => {}
| ^^^^^^^^^^^^^^^^
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::bar`
--> $DIR/method-path-in-pattern.rs:26:12
|
LL | if let Foo::bar = 0u32 {}
| ^^^^^^^^
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::bar`
--> $DIR/method-path-in-pattern.rs:28:12
|
LL | if let <Foo>::bar = 0u32 {}
| ^^^^^^^^^^
error[E0533]: expected unit struct/variant or constant, found method `<Foo>::trait_bar`
error[E0533]: expected unit struct, unit variant or constant, found method `<Foo>::trait_bar`
--> $DIR/method-path-in-pattern.rs:30:12
|
LL | if let Foo::trait_bar = 0u32 {}

View File

@ -9,6 +9,6 @@ impl MyTrait for Foo {}
fn main() {
match 0u32 {
<Foo as MyTrait>::trait_bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `MyTrait::trait_bar`
//~^ ERROR expected unit struct, unit variant or constant, found method `MyTrait::trait_bar`
}
}

View File

@ -1,8 +1,8 @@
error[E0532]: expected unit struct/variant or constant, found method `MyTrait::trait_bar`
error[E0532]: expected unit struct, unit variant or constant, found method `MyTrait::trait_bar`
--> $DIR/method-resolvable-path-in-pattern.rs:11:9
|
LL | <Foo as MyTrait>::trait_bar => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct/variant or constant
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
error: aborting due to previous error

View File

@ -1,6 +1,9 @@
error[E0423]: expected value, found type alias `m1::S`
--> $DIR/namespace-mix.rs:34:11
|
LL | pub struct TS();
| ---------------- similarly named tuple struct `TS` defined here
...
LL | check(m1::S);
| ^^^^^
|
@ -39,6 +42,8 @@ error[E0423]: expected value, found struct variant `m7::V`
|
LL | V {},
| ---- `m7::V` defined here
LL | TV(),
| ---- similarly named tuple variant `TV` defined here
...
LL | check(m7::V);
| ^^^^^ did you mean `m7::V { /* fields */ }`?

View File

@ -8,7 +8,7 @@ fn main() {
//~^ ERROR expected type, found `3`
match x {
Enum::Foo(a, b) => {}
//~^ ERROR expected tuple struct/variant, found struct variant `Enum::Foo`
//~^ ERROR expected tuple struct or tuple variant, found struct variant `Enum::Foo`
Enum::Bar(a, b) => {}
}
}

View File

@ -9,7 +9,7 @@ LL | let x = Enum::Foo(a: 3, b: 4);
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
= note: for more information, see https://github.com/rust-lang/rust/issues/23416
error[E0532]: expected tuple struct/variant, found struct variant `Enum::Foo`
error[E0532]: expected tuple struct or tuple variant, found struct variant `Enum::Foo`
--> $DIR/recover-from-bad-variant.rs:10:9
|
LL | Foo { a: usize, b: usize },

View File

@ -15,7 +15,7 @@ fn f(_c: char) {}
fn main() {
match A::B(1, 2) {
A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but
A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D`
A::D(_) => (), //~ ERROR expected tuple struct or tuple variant, found unit variant `A::D`
_ => ()
}
match 'c' {

View File

@ -4,9 +4,12 @@ error[E0433]: failed to resolve: use of undeclared type or module `E`
LL | E::V => {}
| ^ use of undeclared type or module `E`
error[E0532]: expected tuple struct/variant, found unit variant `A::D`
error[E0532]: expected tuple struct or tuple variant, found unit variant `A::D`
--> $DIR/pattern-error-continue.rs:18:9
|
LL | B(isize, isize),
| --------------- similarly named tuple variant `B` defined here
...
LL | A::D(_) => (),
| ^^^-
| |

View File

@ -17,7 +17,7 @@ pub mod foo1 {
fn test_glob1() {
use foo1::*;
Bar(); //~ ERROR expected function, found trait `Bar`
Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar`
}
// private type, public value
@ -47,7 +47,7 @@ pub mod foo3 {
fn test_glob3() {
use foo3::*;
Bar(); //~ ERROR cannot find function `Bar` in this scope
Bar(); //~ ERROR cannot find function, tuple struct or tuple variant `Bar` in this scope
let _x: Box<Bar>; //~ ERROR cannot find type `Bar` in this scope
}

View File

@ -1,6 +1,9 @@
error[E0423]: expected function, found trait `Bar`
error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar`
--> $DIR/privacy-ns1.rs:20:5
|
LL | pub struct Baz;
| --------------- similarly named unit struct `Baz` defined here
...
LL | Bar();
| ^^^
|
@ -20,6 +23,9 @@ LL | use foo3::Bar;
error[E0573]: expected type, found function `Bar`
--> $DIR/privacy-ns1.rs:35:17
|
LL | pub struct Baz;
| --------------- similarly named struct `Baz` defined here
...
LL | let _x: Box<Bar>;
| ^^^
|
@ -36,9 +42,12 @@ LL | use foo2::Bar;
LL | use foo3::Bar;
|
error[E0425]: cannot find function `Bar` in this scope
error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope
--> $DIR/privacy-ns1.rs:50:5
|
LL | pub struct Baz;
| --------------- similarly named unit struct `Baz` defined here
...
LL | Bar();
| ^^^
|
@ -58,6 +67,9 @@ LL | use foo3::Bar;
error[E0412]: cannot find type `Bar` in this scope
--> $DIR/privacy-ns1.rs:51:17
|
LL | pub struct Baz;
| --------------- similarly named struct `Baz` defined here
...
LL | let _x: Box<Bar>;
| ^^^
|

View File

@ -17,13 +17,13 @@ pub mod foo1 {
fn test_single1() {
use foo1::Bar;
Bar(); //~ ERROR expected function, found trait `Bar`
Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar`
}
fn test_list1() {
use foo1::{Bar,Baz};
Bar(); //~ ERROR expected function, found trait `Bar`
Bar(); //~ ERROR expected function, tuple struct or tuple variant, found trait `Bar`
}
// private type, public value

View File

@ -1,8 +1,8 @@
error[E0423]: expected function, found trait `Bar`
error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar`
--> $DIR/privacy-ns2.rs:20:5
|
LL | Bar();
| ^^^ not a function
| ^^^ not a function, tuple struct or tuple variant
|
help: possible better candidates are found in other modules, you can import them into scope
|
@ -13,9 +13,12 @@ LL | use foo2::Bar;
LL | use foo3::Bar;
|
error[E0423]: expected function, found trait `Bar`
error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar`
--> $DIR/privacy-ns2.rs:26:5
|
LL | pub struct Baz;
| --------------- similarly named unit struct `Baz` defined here
...
LL | Bar();
| ^^^
|
@ -50,6 +53,9 @@ LL | use foo3::Bar;
error[E0573]: expected type, found function `Bar`
--> $DIR/privacy-ns2.rs:47:17
|
LL | pub struct Baz;
| --------------- similarly named struct `Baz` defined here
...
LL | let _x: Box<Bar>;
| ^^^
|

View File

@ -1,6 +1,4 @@
// aux-build:parent-source-spans.rs
#![feature(decl_macro, proc_macro_hygiene)]
extern crate parent_source_spans;

View File

@ -1,5 +1,5 @@
error: first final: "hello"
--> $DIR/parent-source-spans.rs:17:12
--> $DIR/parent-source-spans.rs:15:12
|
LL | three!($a, $b);
| ^^
@ -8,7 +8,7 @@ LL | one!("hello", "world");
| ----------------------- in this macro invocation
error: second final: "world"
--> $DIR/parent-source-spans.rs:17:16
--> $DIR/parent-source-spans.rs:15:16
|
LL | three!($a, $b);
| ^^
@ -17,7 +17,7 @@ LL | one!("hello", "world");
| ----------------------- in this macro invocation
error: first parent: "hello"
--> $DIR/parent-source-spans.rs:11:5
--> $DIR/parent-source-spans.rs:9:5
|
LL | two!($a, $b);
| ^^^^^^^^^^^^^
@ -26,7 +26,7 @@ LL | one!("hello", "world");
| ----------------------- in this macro invocation
error: second parent: "world"
--> $DIR/parent-source-spans.rs:11:5
--> $DIR/parent-source-spans.rs:9:5
|
LL | two!($a, $b);
| ^^^^^^^^^^^^^
@ -35,31 +35,31 @@ LL | one!("hello", "world");
| ----------------------- in this macro invocation
error: first grandparent: "hello"
--> $DIR/parent-source-spans.rs:37:5
--> $DIR/parent-source-spans.rs:35:5
|
LL | one!("hello", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^
error: second grandparent: "world"
--> $DIR/parent-source-spans.rs:37:5
--> $DIR/parent-source-spans.rs:35:5
|
LL | one!("hello", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^
error: first source: "hello"
--> $DIR/parent-source-spans.rs:37:5
--> $DIR/parent-source-spans.rs:35:5
|
LL | one!("hello", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^
error: second source: "world"
--> $DIR/parent-source-spans.rs:37:5
--> $DIR/parent-source-spans.rs:35:5
|
LL | one!("hello", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^
error: first final: "yay"
--> $DIR/parent-source-spans.rs:17:12
--> $DIR/parent-source-spans.rs:15:12
|
LL | three!($a, $b);
| ^^
@ -68,7 +68,7 @@ LL | two!("yay", "rust");
| -------------------- in this macro invocation
error: second final: "rust"
--> $DIR/parent-source-spans.rs:17:16
--> $DIR/parent-source-spans.rs:15:16
|
LL | three!($a, $b);
| ^^
@ -77,55 +77,55 @@ LL | two!("yay", "rust");
| -------------------- in this macro invocation
error: first parent: "yay"
--> $DIR/parent-source-spans.rs:43:5
--> $DIR/parent-source-spans.rs:41:5
|
LL | two!("yay", "rust");
| ^^^^^^^^^^^^^^^^^^^^
error: second parent: "rust"
--> $DIR/parent-source-spans.rs:43:5
--> $DIR/parent-source-spans.rs:41:5
|
LL | two!("yay", "rust");
| ^^^^^^^^^^^^^^^^^^^^
error: first source: "yay"
--> $DIR/parent-source-spans.rs:43:5
--> $DIR/parent-source-spans.rs:41:5
|
LL | two!("yay", "rust");
| ^^^^^^^^^^^^^^^^^^^^
error: second source: "rust"
--> $DIR/parent-source-spans.rs:43:5
--> $DIR/parent-source-spans.rs:41:5
|
LL | two!("yay", "rust");
| ^^^^^^^^^^^^^^^^^^^^
error: first final: "hip"
--> $DIR/parent-source-spans.rs:49:12
--> $DIR/parent-source-spans.rs:47:12
|
LL | three!("hip", "hop");
| ^^^^^
error: second final: "hop"
--> $DIR/parent-source-spans.rs:49:19
--> $DIR/parent-source-spans.rs:47:19
|
LL | three!("hip", "hop");
| ^^^^^
error: first source: "hip"
--> $DIR/parent-source-spans.rs:49:12
--> $DIR/parent-source-spans.rs:47:12
|
LL | three!("hip", "hop");
| ^^^^^
error: second source: "hop"
--> $DIR/parent-source-spans.rs:49:19
--> $DIR/parent-source-spans.rs:47:19
|
LL | three!("hip", "hop");
| ^^^^^
error[E0425]: cannot find value `ok` in this scope
--> $DIR/parent-source-spans.rs:30:5
--> $DIR/parent-source-spans.rs:28:5
|
LL | parent_source_spans!($($tokens)*);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`
@ -134,7 +134,7 @@ LL | one!("hello", "world");
| ----------------------- in this macro invocation
error[E0425]: cannot find value `ok` in this scope
--> $DIR/parent-source-spans.rs:30:5
--> $DIR/parent-source-spans.rs:28:5
|
LL | parent_source_spans!($($tokens)*);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`
@ -143,7 +143,7 @@ LL | two!("yay", "rust");
| -------------------- in this macro invocation
error[E0425]: cannot find value `ok` in this scope
--> $DIR/parent-source-spans.rs:30:5
--> $DIR/parent-source-spans.rs:28:5
|
LL | parent_source_spans!($($tokens)*);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`

View File

@ -13,14 +13,24 @@ LL | Dlona!();
error: cannot find macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:50:5
|
LL | attr_proc_macra!();
| ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac`
LL | / macro_rules! attr_proc_mac {
LL | | () => {}
LL | | }
| |_- similarly named macro `attr_proc_mac` defined here
...
LL | attr_proc_macra!();
| ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac`
error: cannot find macro `FooWithLongNama` in this scope
--> $DIR/resolve-error.rs:47:5
|
LL | FooWithLongNama!();
| ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam`
LL | / macro_rules! FooWithLongNam {
LL | | () => {}
LL | | }
| |_- similarly named macro `FooWithLongNam` defined here
...
LL | FooWithLongNama!();
| ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam`
error: cannot find derive macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:42:10

View File

@ -18,7 +18,7 @@ impl S {
fn main() {
match 10 {
<S as Tr>::A::f::<u8> => {}
//~^ ERROR expected unit struct/variant or constant, found method `<<S as Tr>::A>::f<u8>`
//~^ ERROR expected unit struct, unit variant or constant, found method `<<S as Tr>::A>::f<u8>`
0 ..= <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
}
}

Some files were not shown because too many files have changed in this diff Show More