More systematic error reporting in path resolution

This commit is contained in:
Vadim Petrochenkov 2016-12-01 01:35:25 +03:00 committed by petrochenkov
parent 3fb676afb0
commit 09aba18e10
127 changed files with 1243 additions and 1249 deletions

View File

@ -298,8 +298,7 @@ pub trait CrateStore<'tcx> {
// trait/impl-item info
fn trait_of_item(&self, def_id: DefId) -> Option<DefId>;
fn associated_item<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<ty::AssociatedItem>;
fn associated_item(&self, def: DefId) -> Option<ty::AssociatedItem>;
// flags
fn is_const_fn(&self, did: DefId) -> bool;
@ -456,8 +455,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
// trait/impl-item info
fn trait_of_item(&self, def_id: DefId) -> Option<DefId> { bug!("trait_of_item") }
fn associated_item<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<ty::AssociatedItem> { bug!("associated_item") }
fn associated_item(&self, def: DefId) -> Option<ty::AssociatedItem> { bug!("associated_item") }
// flags
fn is_const_fn(&self, did: DefId) -> bool { bug!("is_const_fn") }

View File

@ -2071,7 +2071,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn associated_item(self, def_id: DefId) -> AssociatedItem {
self.associated_items.memoize(def_id, || {
if !def_id.is_local() {
return self.sess.cstore.associated_item(self.global_tcx(), def_id)
return self.sess.cstore.associated_item(def_id)
.expect("missing AssociatedItem in metadata");
}
@ -2526,8 +2526,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// ID of the impl that the method belongs to. Otherwise, return `None`.
pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> {
if def_id.krate != LOCAL_CRATE {
return self.sess.cstore.associated_item(self.global_tcx(), def_id)
.and_then(|item| {
return self.sess.cstore.associated_item(def_id).and_then(|item| {
match item.container {
TraitContainer(_) => None,
ImplContainer(def_id) => Some(def_id),

View File

@ -188,8 +188,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
self.get_crate_data(def_id.krate).get_trait_of_item(def_id.index)
}
fn associated_item<'a>(&self, _tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> Option<ty::AssociatedItem>
fn associated_item(&self, def: DefId) -> Option<ty::AssociatedItem>
{
self.dep_graph.read(DepNode::MetaData(def));
self.get_crate_data(def.krate).get_associated_item(def.index)

View File

@ -417,28 +417,18 @@ impl<'a> Resolver<'a> {
let ident = Ident::with_empty_ctxt(child.name);
let def = child.def;
let def_id = def.def_id();
let vis = match def {
Def::Macro(..) => ty::Visibility::Public,
_ if parent.is_trait() => ty::Visibility::Public,
_ => self.session.cstore.visibility(def_id),
};
let vis = self.session.cstore.visibility(def_id);
match def {
Def::Mod(..) | Def::Enum(..) => {
let module = self.new_module(parent, ModuleKind::Def(def, ident.name), def_id);
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, Mark::root()));
}
Def::Variant(..) => {
Def::Variant(..) | Def::TyAlias(..) => {
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::VariantCtor(..) => {
self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::Fn(..) |
Def::Static(..) |
Def::Const(..) |
Def::AssociatedConst(..) |
Def::Method(..) => {
Def::Fn(..) | Def::Static(..) | Def::Const(..) |
Def::VariantCtor(..) | Def::StructCtor(..) => {
self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::Trait(..) => {
@ -446,29 +436,19 @@ impl<'a> Resolver<'a> {
let module = self.new_module(parent, module_kind, parent.normal_ancestor_id);
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, Mark::root()));
// If this is a trait, add all the trait item names to the trait info.
let trait_item_def_ids = self.session.cstore.associated_item_def_ids(def_id);
for trait_item_def_id in trait_item_def_ids {
let trait_item_name = self.session.cstore.def_key(trait_item_def_id)
.disambiguated_data.data.get_opt_name()
.expect("opt_item_name returned None for trait");
self.trait_item_map.insert((trait_item_name, def_id), false);
}
}
Def::TyAlias(..) | Def::AssociatedTy(..) => {
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::Struct(..) => {
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, Mark::root()));
for child in self.session.cstore.item_children(def_id) {
let ns = if let Def::AssociatedTy(..) = child.def { TypeNS } else { ValueNS };
let ident = Ident::with_empty_ctxt(child.name);
self.define(module, ident, ns, (child.def, ty::Visibility::Public,
DUMMY_SP, Mark::root()));
// Record field names for error reporting.
let field_names = self.session.cstore.struct_field_names(def_id);
self.insert_field_names(def_id, field_names);
let has_self = self.session.cstore.associated_item(child.def.def_id())
.map_or(false, |item| item.method_has_self_argument);
self.trait_item_map.insert((def_id, child.name, ns), (child.def, has_self));
}
module.populated.set(true);
}
Def::StructCtor(..) => {
self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::Union(..) => {
Def::Struct(..) | Def::Union(..) => {
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, Mark::root()));
// Record field names for error reporting.
@ -478,15 +458,7 @@ impl<'a> Resolver<'a> {
Def::Macro(..) => {
self.define(parent, ident, MacroNS, (def, vis, DUMMY_SP, Mark::root()));
}
Def::Local(..) |
Def::PrimTy(..) |
Def::TyParam(..) |
Def::Upvar(..) |
Def::Label(..) |
Def::SelfTy(..) |
Def::Err => {
bug!("unexpected definition: {:?}", def);
}
_ => bug!("unexpected definition: {:?}", def)
}
}
@ -751,18 +723,15 @@ impl<'a, 'b> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b> {
// Add the item to the trait info.
let item_def_id = self.resolver.definitions.local_def_id(item.id);
let mut is_static_method = false;
let (def, ns) = match item.node {
TraitItemKind::Const(..) => (Def::AssociatedConst(item_def_id), ValueNS),
TraitItemKind::Method(ref sig, _) => {
is_static_method = !sig.decl.has_self();
(Def::Method(item_def_id), ValueNS)
}
TraitItemKind::Type(..) => (Def::AssociatedTy(item_def_id), TypeNS),
let (def, ns, has_self) = match item.node {
TraitItemKind::Const(..) => (Def::AssociatedConst(item_def_id), ValueNS, false),
TraitItemKind::Method(ref sig, _) =>
(Def::Method(item_def_id), ValueNS, sig.decl.has_self()),
TraitItemKind::Type(..) => (Def::AssociatedTy(item_def_id), TypeNS, false),
TraitItemKind::Macro(_) => bug!(), // handled above
};
self.resolver.trait_item_map.insert((item.ident.name, def_id), is_static_method);
self.resolver.trait_item_map.insert((def_id, item.ident.name, ns), (def, has_self));
let vis = ty::Visibility::Public;
self.resolver.define(parent, item.ident, ns, (def, vis, item.span, self.expansion));

View File

@ -860,6 +860,26 @@ match (A, B, C) {
```
"##,
E0422: r##"
You are trying to use an identifier that is either undefined or not a struct.
Erroneous code example:
``` compile_fail,E0422
fn main () {
let x = Foo { x: 1, y: 2 };
}
```
In this case, `Foo` is undefined, so it inherently isn't anything, and
definitely not a struct.
```compile_fail
fn main () {
let foo = 1;
let x = foo { x: 1, y: 2 };
}
```
In this case, `foo` is defined, but is not a struct, so Rust can't use it as
one.
"##,
E0423: r##"
A `struct` variant name was used like a function name.
@ -1519,7 +1539,12 @@ register_diagnostics! {
// E0419, merged into 531
// E0420, merged into 532
// E0421, merged into 531
// E0422, merged into 531/532
E0531, // unresolved pattern path kind `name`
// E0427, merged into 530
E0573,
E0574,
E0575,
E0576,
E0577,
E0578,
}

File diff suppressed because it is too large Load Diff

View File

@ -717,7 +717,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
}
// Record the destination of this import
self.def_map.insert(directive.id, PathResolution::new(module.def().unwrap()));
self.record_def(directive.id, PathResolution::new(module.def().unwrap()));
}
// Miscellaneous post-processing, including recording reexports, reporting conflicts,

View File

@ -1519,14 +1519,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
self.set_tainted_by_errors();
return self.tcx().types.err;
}
_ => {
struct_span_err!(tcx.sess, span, E0248,
"found value `{}` used as a type",
tcx.item_path_str(path.def.def_id()))
.span_label(span, &format!("value used as a type"))
.emit();
return self.tcx().types.err;
}
_ => span_bug!(span, "unexpected definition: {:?}", path.def)
}
}

View File

@ -2861,25 +2861,6 @@ struct Bar<S, T> { x: Foo<S, T> }
```
"##,
E0248: r##"
This error indicates an attempt to use a value where a type is expected. For
example:
```compile_fail,E0248
enum Foo {
Bar(u32)
}
fn do_something(x: Foo::Bar) { }
```
In this example, we're attempting to take a type of `Foo::Bar` in the
do_something function. This is not legal: `Foo::Bar` is a value of type `Foo`,
not a distinct static type. Likewise, it's not legal to attempt to
`impl Foo::Bar`: instead, you must `impl Foo` and then pattern match to specify
behavior for specific enum variants.
"##,
E0569: r##"
If an impl has a generic parameter with the `#[may_dangle]` attribute, then
that impl must be declared as an `unsafe impl. For example:
@ -4247,6 +4228,7 @@ register_diagnostics! {
E0245, // not a trait
// E0246, // invalid recursive type
// E0247,
// E0248, // value used as a type, now reported earlier during resolution as E0412
// E0249,
// E0319, // trait impls for defaulted traits allowed just for structs/enums
E0320, // recursive overflow during dropck

View File

@ -14,5 +14,5 @@
extern crate macro_crate_test;
fn main() {
macro_crate_test::foo(); //~ ERROR unresolved name
macro_crate_test::foo(); //~ ERROR unresolved function `macro_crate_test::foo`
}

View File

@ -39,6 +39,6 @@ fn main() {
assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23");
let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR unresolved name `abcd`
let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR unresolved value `abcd`
assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7");
}

View File

@ -14,8 +14,8 @@ trait SomeTrait {
fn main() {
let trait_obj: &SomeTrait = SomeTrait;
//~^ ERROR E0425
//~| NOTE unresolved name
//~^ ERROR expected value, found trait `SomeTrait`
//~| NOTE not a value
//~| ERROR E0038
//~| method `foo` has no receiver
//~| NOTE the trait `SomeTrait` cannot be made into an object

View File

@ -12,5 +12,4 @@ fn main () {
struct Foo { a: bool };
let f = Foo(); //~ ERROR E0423
//~^ struct called like a function
}

View File

@ -14,10 +14,7 @@ impl Foo {
fn bar(self) {}
fn foo() {
self.bar();
//~^ ERROR `self` is not available in a static method [E0424]
//~| NOTE not available in static method
//~| NOTE maybe a `self` argument is missing?
self.bar(); //~ ERROR E0424
}
}

View File

@ -10,7 +10,7 @@
trait Foo {
fn bar() {
Self; //~ ERROR E0425
elf; //~ ERROR E0425
}
}

View File

@ -11,10 +11,10 @@
// Check that associated paths starting with `<<` are successfully parsed.
fn main() {
let _: <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope
let _ = <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope
let <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope
let 0 ... <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope
let _: <<A>::B>::C; //~ ERROR unresolved type `A`
let _ = <<A>::B>::C; //~ ERROR unresolved type `A`
let <<A>::B>::C; //~ ERROR unresolved type `A`
let 0 ... <<A>::B>::C; //~ ERROR unresolved type `A`
//~^ ERROR only char and numeric types are allowed in range patterns
<<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope
<<A>::B>::C; //~ ERROR unresolved type `A`
}

View File

@ -17,7 +17,7 @@ pub trait Foo {
}
fn foo2<I: Foo>(x: I) {
let _: A = x.boo(); //~ERROR undefined or not in scope
let _: A = x.boo(); //~ ERROR unresolved type `A`
}
pub fn main() {}

View File

@ -132,6 +132,10 @@ pub struct UnstableStruct {
pub struct StableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
pub enum UnstableEnum {}
#[stable(feature = "rust1", since = "1.0.0")]
pub enum StableEnum {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]

View File

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name `m1::arguments`
mod m1 {}
fn main(arguments: Vec<String>) { log(debug, m1::arguments); }
fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
log(debug, m1::arguments);
//~^ ERROR unresolved function `log`
//~| ERROR unresolved value `debug`
//~| ERROR unresolved value `m1::arguments`
}

View File

@ -8,12 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name `m1::arguments`
mod m1 {
pub mod arguments {}
}
fn main(arguments: Vec<String>) {
fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
log(debug, m1::arguments);
//~^ ERROR unresolved function `log`
//~| ERROR unresolved value `debug`
//~| ERROR expected value, found module `m1::arguments`
}

View File

@ -16,8 +16,8 @@ impl cat {
fn sleep(&self) { loop{} }
fn meow(&self) {
println!("Meow");
meows += 1; //~ ERROR unresolved name
sleep(); //~ ERROR unresolved name
meows += 1; //~ ERROR unresolved value `meows`
sleep(); //~ ERROR unresolved function `sleep`
}
}

View File

@ -16,7 +16,7 @@ impl Foo for i8 {}
impl Foo for i16 {}
impl Foo for i32 {}
impl Foo for i64 {}
impl Foo for DoesNotExist {} //~ ERROR `DoesNotExist` is undefined
impl Foo for DoesNotExist {} //~ ERROR unresolved type `DoesNotExist`
impl Foo for u8 {}
impl Foo for u16 {}
impl Foo for u32 {}

View File

@ -20,7 +20,7 @@ fn closure<F, T>(x: F) -> Result<T, ()>
}
fn foo() -> Result<(), ()> {
try!(closure(|| bar(0 as *mut _))); //~ ERROR unresolved name `bar`
try!(closure(|| bar(0 as *mut _))); //~ ERROR unresolved function `bar`
Ok(())
}

View File

@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name `this_does_nothing_what_the`
fn main() { println!("doing"); this_does_nothing_what_the; println!("boing"); }
//~^ ERROR unresolved value `this_does_nothing_what_the`

View File

@ -22,13 +22,13 @@ enum E {
}
fn main() {
let e1 = Empty1; //~ ERROR `Empty1` is the name of a struct or struct variant
let e1 = Empty1(); //~ ERROR `Empty1` is the name of a struct or struct variant
let e3 = E::Empty3; //~ ERROR `E::Empty3` is the name of a struct or struct variant
let e3 = E::Empty3(); //~ ERROR `E::Empty3` is the name of a struct or struct variant
let e1 = Empty1; //~ ERROR expected value, found struct `Empty1`
let e1 = Empty1(); //~ ERROR expected function, 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 xe1 = XEmpty1; //~ ERROR `XEmpty1` is the name of a struct or struct variant
let xe1 = XEmpty1(); //~ ERROR `XEmpty1` is the name of a struct or struct variant
let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1`
let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1`
let xe3 = XE::Empty3; //~ ERROR no associated item named `Empty3` found for type
let xe3 = XE::Empty3(); //~ ERROR no associated item named `Empty3` found for type
}

View File

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

View File

@ -14,6 +14,6 @@ enum Foo {
Bar
}
fn foo(x: Foo::Bar) {} //~ERROR found value `Foo::Bar` used as a type
fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar`
fn main() {}

View File

@ -8,14 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: failed to resolve. Use of undeclared type or module `foo`
// In this test baz isn't resolved when called as foo.baz even though
// it's called from inside foo. This is somewhat surprising and may
// want to change eventually.
mod foo {
pub fn bar() { foo::baz(); }
pub fn bar() { foo::baz(); } //~ ERROR failed to resolve. Use of undeclared type or module `foo`
fn baz() { }
}

View File

@ -8,10 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name
mod foo {
pub fn x(y: isize) { log(debug, y); }
//~^ ERROR unresolved function `log`
//~| ERROR unresolved value `debug`
fn z(y: isize) { log(debug, y); }
//~^ ERROR unresolved function `log`
//~| ERROR unresolved value `debug`
}
fn main() { foo::z(10); }
fn main() { foo::z(10); } //~ ERROR function `z` is private

View File

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: failed to resolve. Use of undeclared type or module `bar`
mod foo {
pub fn x() { bar::x(); }
pub fn x() { bar::x(); } //~ ERROR failed to resolve. Use of undeclared type or module `bar`
}
mod bar {

View File

@ -24,7 +24,7 @@ extern "rust-intrinsic" {
// Unresolved bounds should still error.
fn align_of<T: NoSuchTrait>() -> usize;
//~^ ERROR trait `NoSuchTrait` is not in scope
//~^ ERROR unresolved trait `NoSuchTrait`
}
fn main() {}

View File

@ -13,7 +13,7 @@
fn main() {
// Odd formatting to make sure we get the right span.
for t in &
foo //~ ERROR unresolved name `foo`
foo //~ ERROR unresolved value `foo`
{
}
}

View File

@ -13,6 +13,6 @@
fn main() {
for _ in 0..10 {
iter.next(); //~ error: unresolved name `iter`
iter.next(); //~ ERROR unresolved value `iter`
}
}

View File

@ -29,13 +29,13 @@ mod bar {
fn foo<T>() {}
fn main() {
fpriv(); //~ ERROR: unresolved
epriv(); //~ ERROR: unresolved
B; //~ ERROR: unresolved
C; //~ ERROR: unresolved
import(); //~ ERROR: unresolved
fpriv(); //~ ERROR unresolved function `fpriv`
epriv(); //~ ERROR unresolved function `epriv`
B; //~ ERROR expected value, found enum `B`
C; //~ ERROR unresolved value `C`
import(); //~ ERROR: unresolved function `import`
foo::<A>(); //~ ERROR: not in scope
foo::<C>(); //~ ERROR: not in scope
foo::<D>(); //~ ERROR: not in scope
foo::<A>(); //~ ERROR: unresolved type `A`
foo::<C>(); //~ ERROR: unresolved type `C`
foo::<D>(); //~ ERROR: unresolved type `D`
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name
use module_of_many_things::*;
mod module_of_many_things {
@ -23,6 +21,6 @@ mod module_of_many_things {
fn main() {
f1();
f2();
f999(); // 'export' currently doesn't work?
f999(); //~ ERROR unresolved function `f999`
f4();
}

View File

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
println!("{}", x); //~ ERROR unresolved name `x`
println!("{}", x); //~ ERROR unresolved value `x`
}

View File

@ -11,10 +11,10 @@
// macro f should not be able to inject a reference to 'n'.
macro_rules! f { () => (n) }
//~^ ERROR unresolved name `n`
//~| ERROR unresolved name `n`
//~| ERROR unresolved name `n`
//~| ERROR unresolved name `n`
//~^ ERROR unresolved value `n`
//~| ERROR unresolved value `n`
//~| ERROR unresolved value `n`
//~| ERROR unresolved value `n`
fn main() -> (){
for n in 0..1 {

View File

@ -20,7 +20,7 @@ mod foo {
}
fn new() -> NoResult<MyEnum, String> {
//~^ ERROR: found value `foo::MyEnum::NoResult` used as a type
//~^ ERROR expected type, found variant `NoResult`
unimplemented!()
}
}
@ -30,18 +30,18 @@ mod bar {
use foo;
fn new() -> Result<foo::MyEnum, String> {
//~^ ERROR: found value `foo::MyEnum::Result` used as a type
//~^ ERROR expected type, found variant `Result`
unimplemented!()
}
}
fn new() -> Result<foo::MyEnum, String> {
//~^ ERROR: found value `foo::MyEnum::Result` used as a type
//~^ ERROR expected type, found variant `Result`
unimplemented!()
}
fn newer() -> NoResult<foo::MyEnum, String> {
//~^ ERROR: found value `foo::MyEnum::NoResult` used as a type
//~^ ERROR expected type, found variant `NoResult`
unimplemented!()
}

View File

@ -9,6 +9,6 @@
// except according to those terms.
impl Undefined {}
//~^ ERROR type name `Undefined` is undefined or not in scope
//~^ ERROR unresolved type `Undefined`
fn main() {}

View File

@ -13,10 +13,10 @@ static Y: u8 = 1;
fn foo() {}
impl X {}
//~^ ERROR type name `X` is undefined or not in scope
//~^ ERROR expected type, found constant `X`
impl Y {}
//~^ ERROR type name `Y` is undefined or not in scope
//~^ ERROR expected type, found static `Y`
impl foo {}
//~^ ERROR type name `foo` is undefined or not in scope
//~^ ERROR expected type, found function `foo`
fn main() {}

View File

@ -17,7 +17,7 @@ trait From<Src> {
trait To: Sized {
fn to<Dst: From<Self>>(self) ->
<Dst as From<Self>>::Dst
//~^ ERROR associated type `From::Dst` is undefined or not in scope
//~^ ERROR unresolved associated type `From::Dst`
{
From::from(self)
}

View File

@ -11,7 +11,7 @@
trait A {
type Output;
fn a(&self) -> <Self as A>::X;
//~^ ERROR: associated type `A::X` is undefined or not in scope
//~^ ERROR unresolved associated type `A::X`
}
impl A for u32 {

View File

@ -14,5 +14,5 @@ trait Trait {
fn main() {
<<i32 as Copy>::foobar as Trait>::foo();
//~^ ERROR associated type `Copy::foobar` is undefined or not in scope
//~^ ERROR unresolved associated type `Copy::foobar`
}

View File

@ -8,6 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: unresolved name `foobar`
fn main() { println!("{}", foobar); }
fn main() { println!("{}", foobar); } //~ ERROR unresolved value `foobar`

View File

@ -15,7 +15,7 @@ trait channel<T> {
}
// `chan` is not a trait, it's an enum
impl chan for isize { //~ ERROR `chan` is not a trait
impl chan for isize { //~ ERROR expected trait, found enum `chan`
fn send(&self, v: isize) { panic!() }
}

View File

@ -10,8 +10,6 @@
// Prefix in imports with empty braces should be resolved and checked privacy, stability, etc.
use foo::{};
//~^ ERROR failed to resolve. Maybe a missing `extern crate foo;`?
//~| NOTE foo
use foo::{}; //~ ERROR unresolved module or enum `foo`
fn main() {}

View File

@ -14,8 +14,7 @@
extern crate lint_stability;
use lint_stability::UnstableStruct::{};
//~^ ERROR use of unstable library feature 'test_feature'
use lint_stability::StableStruct::{}; // OK
use lint_stability::UnstableEnum::{}; //~ ERROR use of unstable library feature 'test_feature'
use lint_stability::StableEnum::{}; // OK
fn main() {}

View File

@ -13,7 +13,7 @@
extern crate issue_30535 as foo;
fn bar(
_: foo::Foo::FooV //~ ERROR value `foo::Foo::FooV` used as a type
_: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV`
) {}
fn main() {}

View File

@ -10,7 +10,7 @@
use std::fmt;
impl fmt::Display for DecoderError { //~ ERROR E0412
impl fmt::Display for DecoderError { //~ ERROR unresolved type `DecoderError`
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Missing data: {}", self.0)
}

View File

@ -14,7 +14,7 @@ fn f() {
fn g() {}
mod foo {
fn h() {
g(); //~ ERROR unresolved name
g(); //~ ERROR unresolved function `g`
}
}
}

View File

@ -11,5 +11,5 @@
fn main () {
let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `+`, `,`, or `>`, found `=`
let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
//~^ ERROR unresolved name `sr`
//~^ ERROR unresolved value `sr`
}

View File

@ -9,11 +9,11 @@
// except according to those terms.
struct Bar<T> {
inner: Foo<T> //~ ERROR type name `Foo` is undefined or not in scope
inner: Foo<T> //~ ERROR unresolved type `Foo`
}
enum Baz<T> {
Foo(Foo<T>) //~ ERROR type name `Foo` is undefined or not in scope
Foo(Foo<T>) //~ ERROR unresolved type `Foo`
}
fn main() {}

View File

@ -9,8 +9,8 @@
// except according to those terms.
struct Foo<T: ?Hash> { }
//~^ ERROR trait `Hash` is not in scope [E0405]
//~^^ ERROR parameter `T` is never used [E0392]
//~^ ERROR unresolved trait `Hash`
//~^^ ERROR parameter `T` is never used
//~^^^ WARN default bound relaxed for a type parameter, but this does nothing
fn main() { }

View File

@ -23,7 +23,7 @@ mod a {
pub mod sub {
use a::b::*;
fn sub() -> bar { 1 }
//~^ ERROR: type name `bar` is undefined or not in scope
//~^ ERROR unresolved type `bar`
}
}
@ -32,5 +32,5 @@ mod m1 {
}
fn main() {
foo(); //~ ERROR: unresolved name
foo(); //~ ERROR expected function, found module `foo`
}

View File

@ -25,7 +25,7 @@ mod a {
}
pub mod sub {
use a::b::*;
fn sub() -> isize { foo(); 1 } //~ ERROR: unresolved name `foo`
fn sub() -> isize { foo(); 1 } //~ ERROR unresolved function `foo`
}
}

View File

@ -9,6 +9,6 @@
// except according to those terms.
trait B < A > { fn a() -> A { this.a } } //~ ERROR unresolved name
trait B < A > { fn a() -> A { this.a } } //~ ERROR unresolved value `this`
fn main() {}

View File

@ -12,7 +12,7 @@
fn main() {
let z = match 3 {
x(1) => x(1) //~ ERROR unresolved tuple struct/variant `x`
//~^ ERROR unresolved name `x`
//~^ ERROR unresolved function `x`
};
assert!(z == 3);
}

View File

@ -12,7 +12,7 @@ struct Foo {
x: isize
}
impl Fo { //~ ERROR type name `Fo` is undefined or not in scope
impl Fo { //~ ERROR unresolved type `Fo`
fn foo() {}
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
impl B { //~ ERROR type name `B` is undefined or not in scope
impl B { //~ ERROR unresolved type `B`
}
fn main() {

View File

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
let super = "foo"; //~ ERROR unresolved unit struct/variant or constant `super`
let super = "foo"; //~ ERROR failed to resolve. There are too many initial `super`s
}

View File

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
let super: isize; //~ ERROR unresolved unit struct/variant or constant `super`
let super: isize; //~ ERROR failed to resolve. There are too many initial `super`s
}

View File

@ -25,6 +25,6 @@ test!(b,
// test1!(#[bar])
#[qux]
fn main() {
a::bar(); //~ ERROR unresolved name `a::bar`
a::bar(); //~ ERROR unresolved function `a::bar`
b::bar();
}

View File

@ -18,6 +18,6 @@ macro_rules! foo {
// not to the macro variable '$id'
fn main() {
foo!(
x //~ ERROR unresolved name `x`
x //~ ERROR unresolved value `x`
);
}

View File

@ -16,6 +16,6 @@ fn my_panic() -> ! { panic!(); }
fn main() {
match true { false => { my_panic(); } true => { } }
println!("{}", x); //~ ERROR unresolved name `x`
println!("{}", x); //~ ERROR unresolved value `x`
let x: isize;
}

View File

@ -34,7 +34,7 @@ fn main() {
[0, 1, 2, 3, x..] => {} //~ ERROR pattern requires
};
match does_not_exist { //~ ERROR unresolved name
match does_not_exist { //~ ERROR unresolved value `does_not_exist`
[] => {}
};
}

View File

@ -13,5 +13,5 @@
mod mod_file_aux;
fn main() {
assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved name
assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved function `mod_file_aux::bar`
}

View File

@ -13,6 +13,6 @@ use std::option::*;
fn main() {
let None: isize = 42; //~ ERROR let bindings cannot shadow unit variants
log(debug, None);
//~^ ERROR unresolved name `debug`
//~| ERROR unresolved name `log`
//~^ ERROR unresolved function `log`
//~| ERROR unresolved value `debug`
}

View File

@ -41,13 +41,13 @@ mod m2 {
fn f12() {
check(m1::S{}); //~ ERROR c::Item
check(m1::S); //~ ERROR unresolved name
check(m1::S); //~ ERROR expected value, found type alias `m1::S`
check(m2::S{}); //~ ERROR c::S
check(m2::S); //~ ERROR c::Item
}
fn xf12() {
check(xm1::S{}); //~ ERROR c::Item
check(xm1::S); //~ ERROR unresolved name
check(xm1::S); //~ ERROR expected value, found type alias `xm1::S`
check(xm2::S{}); //~ ERROR c::S
check(xm2::S); //~ ERROR c::Item
}
@ -107,13 +107,13 @@ mod m8 {
fn f78() {
check(m7::V{}); //~ ERROR c::Item
check(m7::V); //~ ERROR name of a struct or struct variant
check(m7::V); //~ ERROR expected value, found struct variant `m7::V`
check(m8::V{}); //~ ERROR c::E
check(m8::V); //~ ERROR c::Item
}
fn xf78() {
check(xm7::V{}); //~ ERROR c::Item
check(xm7::V); //~ ERROR name of a struct or struct variant
check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V`
check(xm8::V{}); //~ ERROR c::E
check(xm8::V); //~ ERROR c::Item
}

View File

@ -18,8 +18,8 @@ mod m {
pub fn main() {
use namespaced_enums::Foo::*;
foo(); //~ ERROR unresolved name `foo`
m::foo(); //~ ERROR unresolved name `m::foo`
bar(); //~ ERROR unresolved name `bar`
m::bar(); //~ ERROR unresolved name `m::bar`
foo(); //~ ERROR unresolved function `foo`
m::foo(); //~ ERROR unresolved function `m::foo`
bar(); //~ ERROR unresolved function `bar`
m::bar(); //~ ERROR unresolved function `m::bar`
}

View File

@ -28,8 +28,8 @@ mod m {
pub fn main() {
use m2::Foo::*;
foo(); //~ ERROR unresolved name `foo`
m::foo(); //~ ERROR unresolved name `m::foo`
bar(); //~ ERROR unresolved name `bar`
m::bar(); //~ ERROR unresolved name `m::bar`
foo(); //~ ERROR unresolved function `foo`
m::foo(); //~ ERROR unresolved function `m::foo`
bar(); //~ ERROR unresolved function `bar`
m::bar(); //~ ERROR unresolved function `m::bar`
}

View File

@ -11,4 +11,4 @@
#[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
fn f() {}
fn main() { f() } //~ ERROR unresolved name `f`
fn main() { f() } //~ ERROR unresolved function `f`

View File

@ -18,26 +18,26 @@
mod foo {
mod baz {
struct Test;
impl Add for Test {} //~ ERROR: not in scope
impl Clone for Test {} //~ ERROR: not in scope
impl Iterator for Test {} //~ ERROR: not in scope
impl ToString for Test {} //~ ERROR: not in scope
impl Writer for Test {} //~ ERROR: not in scope
impl Add for Test {} //~ ERROR unresolved trait `Add`
impl Clone for Test {} //~ ERROR unresolved trait `Clone`
impl Iterator for Test {} //~ ERROR unresolved trait `Iterator`
impl ToString for Test {} //~ ERROR unresolved trait `ToString`
impl Writer for Test {} //~ ERROR unresolved trait `Writer`
fn foo() {
drop(2) //~ ERROR: unresolved name
drop(2) //~ ERROR unresolved function `drop`
}
}
struct Test;
impl Add for Test {} //~ ERROR: not in scope
impl Clone for Test {} //~ ERROR: not in scope
impl Iterator for Test {} //~ ERROR: not in scope
impl ToString for Test {} //~ ERROR: not in scope
impl Writer for Test {} //~ ERROR: not in scope
impl Add for Test {} //~ ERROR unresolved trait `Add`
impl Clone for Test {} //~ ERROR unresolved trait `Clone`
impl Iterator for Test {} //~ ERROR unresolved trait `Iterator`
impl ToString for Test {} //~ ERROR unresolved trait `ToString`
impl Writer for Test {} //~ ERROR unresolved trait `Writer`
fn foo() {
drop(2) //~ ERROR: unresolved name
drop(2) //~ ERROR unresolved function `drop`
}
}
@ -45,14 +45,14 @@ fn qux() {
#[no_implicit_prelude]
mod qux_inner {
struct Test;
impl Add for Test {} //~ ERROR: not in scope
impl Clone for Test {} //~ ERROR: not in scope
impl Iterator for Test {} //~ ERROR: not in scope
impl ToString for Test {} //~ ERROR: not in scope
impl Writer for Test {} //~ ERROR: not in scope
impl Add for Test {} //~ ERROR unresolved trait `Add`
impl Clone for Test {} //~ ERROR unresolved trait `Clone`
impl Iterator for Test {} //~ ERROR unresolved trait `Iterator`
impl ToString for Test {} //~ ERROR unresolved trait `ToString`
impl Writer for Test {} //~ ERROR unresolved trait `Writer`
fn foo() {
drop(2) //~ ERROR: unresolved name
drop(2) //~ ERROR unresolved function `drop`
}
}
}

View File

@ -17,12 +17,12 @@
// fail with the same error message).
struct Test;
impl Add for Test {} //~ ERROR: not in scope
impl Clone for Test {} //~ ERROR: not in scope
impl Iterator for Test {} //~ ERROR: not in scope
impl ToString for Test {} //~ ERROR: not in scope
impl Writer for Test {} //~ ERROR: not in scope
impl Add for Test {} //~ ERROR unresolved trait `Add`
impl Clone for Test {} //~ ERROR unresolved trait `Clone`
impl Iterator for Test {} //~ ERROR unresolved trait `Iterator`
impl ToString for Test {} //~ ERROR unresolved trait `ToString`
impl Writer for Test {} //~ ERROR unresolved trait `Writer`
fn main() {
drop(2) //~ ERROR: unresolved name
drop(2) //~ ERROR unresolved function `drop`
}

View File

@ -15,5 +15,5 @@ extern crate empty_struct;
//~^ WARN custom derive crates and `#[no_link]` crates have no effect without `#[macro_use]`
fn main() {
empty_struct::XEmpty1; //~ ERROR unresolved name
empty_struct::XEmpty1; //~ ERROR unresolved value `empty_struct::XEmpty1`
}

View File

@ -14,11 +14,11 @@
trait Foo {
fn bar() {
let x = foo(); //~ ERROR unresolved name `foo`
let x = foo(); //~ ERROR unresolved function `foo`
}
fn main() {
let x = y.; //~ ERROR unexpected token
//~^ ERROR unresolved name `y`
//~^ ERROR unresolved value `y`
} //~ ERROR this file contains an un-closed delimiter

View File

@ -14,11 +14,11 @@
trait Foo {
fn bar() {
let x = foo(); //~ ERROR unresolved name `foo`
let x = foo(); //~ ERROR unresolved function `foo`
) //~ ERROR incorrect close delimiter: `)`
}
fn main() {
let x = y.; //~ ERROR unexpected token
//~^ ERROR unresolved name `y`
//~^ ERROR unresolved value `y`
}

View File

@ -12,5 +12,5 @@ macro_rules! foo { () => ( x ) }
fn main() {
let foo!() = 2;
x + 1; //~ ERROR unresolved name `x`
x + 1; //~ ERROR unresolved value `x`
}

View File

@ -27,7 +27,7 @@ pub mod foo1 {
fn test_glob1() {
use foo1::*;
Bar(); //~ ERROR unresolved name `Bar`
Bar(); //~ ERROR expected function, found trait `Bar`
}
// private type, public value
@ -42,7 +42,7 @@ pub mod foo2 {
fn test_glob2() {
use foo2::*;
let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined or not in scope
let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
}
// neither public
@ -57,8 +57,8 @@ pub mod foo3 {
fn test_glob3() {
use foo3::*;
Bar(); //~ ERROR unresolved name `Bar`
let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined or not in scope
Bar(); //~ ERROR unresolved function `Bar`
let _x: Box<Bar>; //~ ERROR unresolved type `Bar`
}
fn main() {

View File

@ -27,13 +27,13 @@ pub mod foo1 {
fn test_single1() {
use foo1::Bar;
Bar(); //~ ERROR unresolved name `Bar`
Bar(); //~ ERROR expected function, found trait `Bar`
}
fn test_list1() {
use foo1::{Bar,Baz};
Bar(); //~ ERROR unresolved name `Bar`
Bar(); //~ ERROR expected function, found trait `Bar`
}
// private type, public value
@ -48,13 +48,13 @@ pub mod foo2 {
fn test_single2() {
use foo2::Bar;
let _x : Box<Bar>; //~ ERROR type name `Bar` is undefined
let _x : Box<Bar>; //~ ERROR expected type, found function `Bar`
}
fn test_list2() {
use foo2::{Bar,Baz};
let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined
let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
}
// neither public

View File

@ -57,6 +57,6 @@ fn main() {
}
mod pathological {
pub(bad::path) mod m1 {} //~ ERROR failed to resolve module path
pub(bad::path) mod m1 {} //~ ERROR failed to resolve. Maybe a missing `extern crate bad;`?
pub(foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules
}

View File

@ -16,11 +16,11 @@ macro_rules! m {
struct S<T>(T);
m!{ S<u8> } //~ ERROR type or lifetime parameters in visibility path
//~^ ERROR failed to resolve module path. Not a module `S`
//~^ ERROR expected module, found struct `S`
mod foo {
struct S(pub(foo<T>) ()); //~ ERROR type or lifetime parameters in visibility path
//~^ ERROR type name `T` is undefined or not in scope
//~^ ERROR unresolved type `T`
}
fn main() {}

View File

@ -12,6 +12,6 @@
extern crate recursive_reexports;
fn f() -> recursive_reexports::S {} //~ ERROR type name `recursive_reexports::S` is undefined
fn f() -> recursive_reexports::S {} //~ ERROR unresolved type `recursive_reexports::S`
fn main() {}

View File

@ -0,0 +1,24 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
mod m {}
enum E {}
struct S;
trait Tr {}
use {}; // OK
use ::{}; // OK
use m::{}; // OK
use E::{}; // OK
use S::{}; //~ ERROR expected module or enum, found struct `S`
use Tr::{}; //~ ERROR expected module or enum, found trait `Tr`
use Nonexistent::{}; //~ ERROR unresolved module or enum `Nonexistent`
fn main () {}

View File

@ -0,0 +1,27 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
enum E {}
trait Tr {}
pub(E) struct S; //~ ERROR expected module, found enum `E`
pub(Tr) struct Z; //~ ERROR expected module, found trait `Tr`
pub(std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules
pub(nonexistent) struct G; //~ ERROR unresolved module `nonexistent`
pub(too_soon) struct H; //~ ERROR unresolved module `too_soon`
// Visibilities are resolved eagerly without waiting for modules becoming fully populated.
// Visibilities can only use ancestor modules legally which are always available in time,
// so the worst thing that can happen due to eager resolution is a suboptimal error message.
mod too_soon {}
fn main () {}

View File

@ -11,10 +11,10 @@
fn main() {
// Make sure primitive type fallback doesn't work in value namespace
std::mem::size_of(u16);
//~^ ERROR unresolved name `u16`
//~^ ERROR expected value, found builtin type `u16`
//~| ERROR this function takes 0 parameters but 1 parameter was supplied
// Make sure primitive type fallback doesn't work with global paths
let _: ::u8;
//~^ ERROR type name `::u8` is undefined or not in scope
//~^ ERROR unresolved type `u8`
}

View File

@ -10,10 +10,10 @@
trait NewTrait : SomeNonExistentTrait {}
//~^ ERROR trait `SomeNonExistentTrait` is not in scope
//~^ ERROR unresolved trait `SomeNonExistentTrait`
impl SomeNonExistentTrait for isize {}
//~^ ERROR trait `SomeNonExistentTrait` is not in scope
//~^ ERROR unresolved trait `SomeNonExistentTrait`
fn f<T:SomeNonExistentTrait>() {}
//~^ ERROR trait `SomeNonExistentTrait` is not in scope
//~^ ERROR unresolved trait `SomeNonExistentTrait`

View File

@ -15,5 +15,5 @@
#![crate_type="metadata"]
fn main() {
let _ = Foo; //~ ERROR unresolved name `Foo`
let _ = Foo; //~ ERROR unresolved value `Foo`
}

View File

@ -19,6 +19,6 @@ fn main() {
let x = 0;
let foo = Foo {
x,
y //~ ERROR unresolved name `y`
y //~ ERROR unresolved value `y`
};
}

View File

@ -18,7 +18,7 @@ pub fn main() {
// this now fails (correctly, I claim) because hygiene prevents
// the assembled identifier from being a reference to the binding.
assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string());
//~^ ERROR: unresolved name `asdf_fdsa`
//~^ ERROR unresolved value `asdf_fdsa`
assert_eq!(stringify!(use_mention_distinction), "use_mention_distinction");
}

View File

@ -14,5 +14,5 @@
fn foo() {}
fn main() {
foo(); //~ ERROR unresolved name `foo`
foo(); //~ ERROR unresolved function `foo`
}

View File

@ -0,0 +1,66 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_type_defaults)]
trait Tr {
type Y = u16;
fn Y() {}
}
impl Tr for u8 {}
trait Dr {
type X = u16;
fn Z() {}
}
impl Dr for u8 {}
enum E { Y }
type A = u32;
fn main() {
let _: <u8 as Tr>::N; //~ ERROR unresolved associated type `Tr::N`
let _: <u8 as E>::N; //~ ERROR unresolved associated type `E::N`
let _: <u8 as A>::N; //~ ERROR unresolved associated type `A::N`
<u8 as Tr>::N; //~ ERROR unresolved method or associated constant `Tr::N`
<u8 as E>::N; //~ ERROR unresolved method or associated constant `E::N`
<u8 as A>::N; //~ ERROR unresolved method or associated constant `A::N`
let _: <u8 as Tr>::Y; // OK
let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y`
<u8 as Tr>::Y; // OK
<u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y`
let _: <u8 as Tr>::N::NN; //~ ERROR unresolved associated type `Tr::N`
let _: <u8 as E>::N::NN; //~ ERROR unresolved associated type `E::N`
let _: <u8 as A>::N::NN; //~ ERROR unresolved associated type `A::N`
<u8 as Tr>::N::NN; //~ ERROR unresolved associated type `Tr::N`
<u8 as E>::N::NN; //~ ERROR unresolved associated type `E::N`
<u8 as A>::N::NN; //~ ERROR unresolved associated type `A::N`
let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type
let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
<u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y`
<u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
let _: <u8 as Tr::N>::NN; //~ ERROR unresolved associated type `Tr::N::NN`
let _: <u8 as E::N>::NN; //~ ERROR unresolved associated type `E::N::NN`
let _: <u8 as A::N>::NN; //~ ERROR unresolved associated type `A::N::NN`
<u8 as Tr::N>::NN; //~ ERROR unresolved method or associated constant `Tr::N::NN`
<u8 as E::N>::NN; //~ ERROR unresolved method or associated constant `E::N::NN`
<u8 as A::N>::NN; //~ ERROR unresolved method or associated constant `A::N::NN`
let _: <u8 as Tr::Y>::NN; //~ ERROR unresolved associated type `Tr::Y::NN`
let _: <u8 as E::Y>::NN; //~ ERROR unresolved associated type `E::Y::NN`
<u8 as Tr::Y>::NN; //~ ERROR unresolved method or associated constant `Tr::Y::NN`
<u8 as E::Y>::NN; //~ ERROR unresolved method or associated constant `E::Y::NN`
let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found method `Dr::Z`
<u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X`
let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found method `Dr::Z`
<u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X`
}

View File

@ -15,7 +15,7 @@
enum Ty {
A,
B(Ty::A),
//~^ ERROR: found value `Ty::A` used as a type
//~^ ERROR expected type, found variant `Ty::A`
}
@ -25,6 +25,6 @@ enum E {
}
impl E::A {}
//~^ ERROR: found value `E::A` used as a type
//~^ ERROR expected type, found variant `E::A`
fn main() {}

View File

@ -17,6 +17,6 @@ extern crate xcrate_unit_struct;
fn main() {
let _ = xcrate_unit_struct::StructWithFields;
//~^ ERROR: `xcrate_unit_struct::StructWithFields` is the name of a struct or struct variant
//~^ ERROR expected value, found struct `xcrate_unit_struct::StructWithFields`
let _ = xcrate_unit_struct::Struct;
}

View File

@ -1,8 +1,8 @@
error[E0425]: unresolved name `bar`
error[E0425]: unresolved value `bar`
--> $DIR/tab.rs:14:2
|
14 | \tbar;
| \t^^^ unresolved name
| \t^^^ no resolution found
error: aborting due to previous error

View File

@ -1,10 +1,8 @@
error[E0404]: `Bar` is not a trait
error[E0404]: expected trait, found type alias `Bar`
--> $DIR/two_files.rs:15:6
|
15 | impl Bar for Baz { }
| ^^^ expected trait, found type alias
|
= note: type aliases cannot be used for traits
| ^^^ type aliases cannot be used for traits
error: cannot continue compilation due to previous error

View File

@ -1,17 +1,17 @@
error[E0425]: unresolved name `fake`
error[E0425]: unresolved value `fake`
--> $DIR/macro-backtrace-nested.rs:15:12
|
15 | () => (fake)
| ^^^^ unresolved name
| ^^^^ no resolution found
...
27 | 1 + call_nested_expr!();
| ------------------- in this macro invocation
error[E0425]: unresolved name `fake`
error[E0425]: unresolved value `fake`
--> $DIR/macro-backtrace-nested.rs:15:12
|
15 | () => (fake)
| ^^^^ unresolved name
| ^^^^ no resolution found
...
28 | call_nested_expr_sum!();
| ------------------------ in this macro invocation

View File

@ -1,20 +1,29 @@
error[E0425]: unresolved name `namespaced_enums::A`
error[E0425]: unresolved value `namespaced_enums::A`
--> $DIR/enums-are-namespaced-xc.rs:15:13
|
15 | let _ = namespaced_enums::A;
| ^^^^^^^^^^^^^^^^^^^ unresolved name
| ^^^^^^^^^^^^^^^^^^^ no resolution found
|
= help: possible candidate is found in another module, you can import it into scope:
= help: `use namespaced_enums::Foo::A;`
error[E0425]: unresolved name `namespaced_enums::B`
error[E0425]: unresolved function `namespaced_enums::B`
--> $DIR/enums-are-namespaced-xc.rs:18:13
|
18 | let _ = namespaced_enums::B(10);
| ^^^^^^^^^^^^^^^^^^^ unresolved name
| ^^^^^^^^^^^^^^^^^^^ no resolution found
|
= help: possible candidate is found in another module, you can import it into scope:
= help: `use namespaced_enums::Foo::B;`
error[E0531]: unresolved struct, variant or union type `namespaced_enums::C`
error[E0422]: unresolved struct, variant or union type `namespaced_enums::C`
--> $DIR/enums-are-namespaced-xc.rs:21:13
|
21 | let _ = namespaced_enums::C { a: 10 };
| ^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^ no resolution found
|
= help: possible candidate is found in another module, you can import it into scope:
= help: `use namespaced_enums::Foo::C;`
error: aborting due to 3 previous errors

View File

@ -1,146 +1,146 @@
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:29:9
|
29 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `a`
error[E0425]: unresolved value `a`
--> $DIR/issue-14254.rs:32:9
|
32 | a;
| ^ unresolved name
| ^ no resolution found
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:40:9
|
40 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `x`
error[E0425]: unresolved value `x`
--> $DIR/issue-14254.rs:43:9
|
43 | x;
| ^ did you mean `self.x`?
error[E0425]: unresolved name `y`
error[E0425]: unresolved value `y`
--> $DIR/issue-14254.rs:46:9
|
46 | y;
| ^ did you mean `self.y`?
error[E0425]: unresolved name `a`
error[E0425]: unresolved value `a`
--> $DIR/issue-14254.rs:49:9
|
49 | a;
| ^ unresolved name
| ^ no resolution found
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:52:9
|
52 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `b`
error[E0425]: unresolved value `b`
--> $DIR/issue-14254.rs:55:9
|
55 | b;
| ^ unresolved name
| ^ no resolution found
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:63:9
|
63 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `x`
error[E0425]: unresolved value `x`
--> $DIR/issue-14254.rs:66:9
|
66 | x;
| ^ did you mean `self.x`?
error[E0425]: unresolved name `y`
error[E0425]: unresolved value `y`
--> $DIR/issue-14254.rs:69:9
|
69 | y;
| ^ did you mean `self.y`?
error[E0425]: unresolved name `a`
error[E0425]: unresolved value `a`
--> $DIR/issue-14254.rs:72:9
|
72 | a;
| ^ unresolved name
| ^ no resolution found
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:75:9
|
75 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `b`
error[E0425]: unresolved value `b`
--> $DIR/issue-14254.rs:78:9
|
78 | b;
| ^ unresolved name
| ^ no resolution found
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:86:9
|
86 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:89:9
|
89 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:97:9
|
97 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:100:9
|
100 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:108:9
|
108 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:111:9
|
111 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:119:9
|
119 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:122:9
|
122 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error[E0425]: unresolved name `baz`
error[E0425]: unresolved function `baz`
--> $DIR/issue-14254.rs:130:9
|
130 | baz();
| ^^^ did you mean to call `self.baz`?
| ^^^ did you mean `self.baz(...)`?
error[E0425]: unresolved name `bah`
error[E0425]: unresolved value `bah`
--> $DIR/issue-14254.rs:133:9
|
133 | bah;
| ^^^ did you mean to call `Foo::bah`?
| ^^^ did you mean `Self::bah`?
error: main function not found

View File

@ -1,8 +1,13 @@
error[E0532]: expected struct, variant or union type, found enum `Result`
error[E0574]: expected struct, variant or union type, found enum `Result`
--> $DIR/issue-16058.rs:19:9
|
19 | Result {
| ^^^^^^
| ^^^^^^ not a struct, variant or union type
|
= help: possible better candidates are found in other modules, you can import them into scope:
= help: `use std::fmt::Result;`
= help: `use std::io::Result;`
= help: `use std::thread::Result;`
error: aborting due to previous error

View File

@ -1,8 +1,11 @@
error[E0531]: unresolved struct, variant or union type `E`
error[E0422]: unresolved struct, variant or union type `E`
--> $DIR/issue-17518.rs:16:5
|
16 | E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E`
| ^
| ^ no resolution found
|
= help: possible candidate is found in another module, you can import it into scope:
= help: `use SomeEnum::E;`
error: aborting due to previous error

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