mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 12:33:57 +00:00
Move some compile-fail tests into UI directory
This commit is contained in:
parent
5752eae5f5
commit
3fb676afb0
|
@ -1,137 +0,0 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
trait Foo {
|
||||
fn bar(&self);
|
||||
fn baz(&self) { }
|
||||
fn bah(_: Option<&Self>) { }
|
||||
}
|
||||
|
||||
struct BarTy {
|
||||
x : isize,
|
||||
y : f64,
|
||||
}
|
||||
|
||||
impl BarTy {
|
||||
fn a() {}
|
||||
fn b(&self) {}
|
||||
}
|
||||
|
||||
impl Foo for *const BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
x;
|
||||
//~^ ERROR: unresolved name `x`
|
||||
//~| NOTE did you mean `self.x`?
|
||||
y;
|
||||
//~^ ERROR: unresolved name `y`
|
||||
//~| NOTE did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`
|
||||
//~| NOTE unresolved name
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
b;
|
||||
//~^ ERROR: unresolved name `b`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a mut BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
x;
|
||||
//~^ ERROR: unresolved name `x`
|
||||
//~| NOTE did you mean `self.x`?
|
||||
y;
|
||||
//~^ ERROR: unresolved name `y`
|
||||
//~| NOTE did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`
|
||||
//~| NOTE unresolved name
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
b;
|
||||
//~^ ERROR: unresolved name `b`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for Box<BarTy> {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for *const isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a mut isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for Box<isize> {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR: unresolved name `baz`
|
||||
//~| NOTE did you mean to call `self.baz`?
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`
|
||||
//~| NOTE did you mean to call `Foo::bah`?
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
// Copyright 2012-2014 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.
|
||||
|
||||
trait Groom {
|
||||
fn shave(other: usize);
|
||||
}
|
||||
|
||||
pub struct cat {
|
||||
whiskers: isize,
|
||||
}
|
||||
|
||||
pub enum MaybeDog {
|
||||
Dog,
|
||||
NoDog
|
||||
}
|
||||
|
||||
impl MaybeDog {
|
||||
fn bark() {
|
||||
// If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom
|
||||
shave();
|
||||
//~^ ERROR: unresolved name `shave`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl Groom for cat {
|
||||
fn shave(other: usize) {
|
||||
whiskers -= other;
|
||||
//~^ ERROR: unresolved name `whiskers`
|
||||
//~| NOTE unresolved name
|
||||
//~| HELP this is an associated function
|
||||
shave(4);
|
||||
//~^ ERROR: unresolved name `shave`
|
||||
//~| NOTE did you mean to call `Groom::shave`?
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl cat {
|
||||
fn static_method() {}
|
||||
|
||||
fn purr_louder() {
|
||||
static_method();
|
||||
//~^ ERROR: unresolved name `static_method`
|
||||
//~| NOTE unresolved name
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
//~| NOTE unresolved name
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
//~| NOTE unresolved name
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
impl cat {
|
||||
fn meow() {
|
||||
if self.whiskers > 3 {
|
||||
//~^ ERROR `self` is not available in a static method [E0424]
|
||||
//~| NOTE not available in static method
|
||||
//~| NOTE maybe a `self` argument is missing?
|
||||
println!("MEOW");
|
||||
}
|
||||
}
|
||||
|
||||
fn purr(&self) {
|
||||
grow_older();
|
||||
//~^ ERROR: unresolved name `grow_older`
|
||||
//~| NOTE unresolved name
|
||||
shave();
|
||||
//~^ ERROR: unresolved name `shave`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
|
||||
fn burn_whiskers(&mut self) {
|
||||
whiskers = 0;
|
||||
//~^ ERROR: unresolved name `whiskers`
|
||||
//~| NOTE did you mean `self.whiskers`?
|
||||
}
|
||||
|
||||
pub fn grow_older(other:usize) {
|
||||
whiskers = 4;
|
||||
//~^ ERROR: unresolved name `whiskers`
|
||||
//~| NOTE unresolved name
|
||||
//~| HELP this is an associated function
|
||||
purr_louder();
|
||||
//~^ ERROR: unresolved name `purr_louder`
|
||||
//~| NOTE unresolved name
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
self += 1;
|
||||
//~^ ERROR: unresolved name `self`
|
||||
//~| NOTE unresolved name
|
||||
//~| HELP: module `self`
|
||||
// it's a bug if this suggests a missing `self` as we're not in a method
|
||||
}
|
|
@ -8,10 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR trait `Nonexist` is not in scope
|
||||
pub enum Foo {
|
||||
A,
|
||||
B(isize),
|
||||
C { a: isize },
|
||||
}
|
||||
|
||||
type Typedef = isize;
|
||||
|
||||
fn g<F:Typedef(isize) -> isize>(x: F) {} //~ ERROR `Typedef` is not a trait
|
||||
|
||||
fn main() {}
|
||||
impl Foo {
|
||||
pub fn foo() {}
|
||||
pub fn bar(&self) {}
|
||||
}
|
|
@ -12,8 +12,13 @@
|
|||
extern crate namespaced_enums;
|
||||
|
||||
fn main() {
|
||||
let _ = namespaced_enums::A; //~ ERROR unresolved name
|
||||
let _ = namespaced_enums::B(10); //~ ERROR unresolved name
|
||||
let _ = namespaced_enums::A;
|
||||
//~^ ERROR unresolved value `namespaced_enums::A`
|
||||
//~| HELP you can import it into scope: `use namespaced_enums::Foo::A;`
|
||||
let _ = namespaced_enums::B(10);
|
||||
//~^ ERROR unresolved function `namespaced_enums::B`
|
||||
//~| HELP you can import it into scope: `use namespaced_enums::Foo::B;`
|
||||
let _ = namespaced_enums::C { a: 10 };
|
||||
//~^ ERROR unresolved struct, variant or union type `namespaced_enums::C`
|
||||
//~| HELP you can import it into scope: `use namespaced_enums::Foo::C;`
|
||||
}
|
20
src/test/ui/resolve/enums-are-namespaced-xc.stderr
Normal file
20
src/test/ui/resolve/enums-are-namespaced-xc.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
error[E0425]: unresolved name `namespaced_enums::A`
|
||||
--> $DIR/enums-are-namespaced-xc.rs:15:13
|
||||
|
|
||||
15 | let _ = namespaced_enums::A;
|
||||
| ^^^^^^^^^^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `namespaced_enums::B`
|
||||
--> $DIR/enums-are-namespaced-xc.rs:18:13
|
||||
|
|
||||
18 | let _ = namespaced_enums::B(10);
|
||||
| ^^^^^^^^^^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0531]: unresolved struct, variant or union type `namespaced_enums::C`
|
||||
--> $DIR/enums-are-namespaced-xc.rs:21:13
|
||||
|
|
||||
21 | let _ = namespaced_enums::C { a: 10 };
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
137
src/test/ui/resolve/issue-14254.rs
Normal file
137
src/test/ui/resolve/issue-14254.rs
Normal file
|
@ -0,0 +1,137 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
trait Foo {
|
||||
fn bar(&self);
|
||||
fn baz(&self) { }
|
||||
fn bah(_: Option<&Self>) { }
|
||||
}
|
||||
|
||||
struct BarTy {
|
||||
x : isize,
|
||||
y : f64,
|
||||
}
|
||||
|
||||
impl BarTy {
|
||||
fn a() {}
|
||||
fn b(&self) {}
|
||||
}
|
||||
|
||||
impl Foo for *const BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
a;
|
||||
//~^ ERROR unresolved value `a`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
x;
|
||||
//~^ ERROR unresolved value `x`
|
||||
//~| NOTE did you mean `self.x`?
|
||||
y;
|
||||
//~^ ERROR unresolved value `y`
|
||||
//~| NOTE did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR unresolved value `a`
|
||||
//~| NOTE no resolution found
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
b;
|
||||
//~^ ERROR unresolved value `b`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a mut BarTy {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
x;
|
||||
//~^ ERROR unresolved value `x`
|
||||
//~| NOTE did you mean `self.x`?
|
||||
y;
|
||||
//~^ ERROR unresolved value `y`
|
||||
//~| NOTE did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR unresolved value `a`
|
||||
//~| NOTE no resolution found
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
b;
|
||||
//~^ ERROR unresolved value `b`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for Box<BarTy> {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for *const isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Foo for &'a mut isize {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo for Box<isize> {
|
||||
fn bar(&self) {
|
||||
baz();
|
||||
//~^ ERROR unresolved function `baz`
|
||||
//~| NOTE did you mean `self.baz(...)`?
|
||||
bah;
|
||||
//~^ ERROR unresolved value `bah`
|
||||
//~| NOTE did you mean `Self::bah`?
|
||||
}
|
||||
}
|
148
src/test/ui/resolve/issue-14254.stderr
Normal file
148
src/test/ui/resolve/issue-14254.stderr
Normal file
|
@ -0,0 +1,148 @@
|
|||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:29:9
|
||||
|
|
||||
29 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/issue-14254.rs:32:9
|
||||
|
|
||||
32 | a;
|
||||
| ^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:40:9
|
||||
|
|
||||
40 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `x`
|
||||
--> $DIR/issue-14254.rs:43:9
|
||||
|
|
||||
43 | x;
|
||||
| ^ did you mean `self.x`?
|
||||
|
||||
error[E0425]: unresolved name `y`
|
||||
--> $DIR/issue-14254.rs:46:9
|
||||
|
|
||||
46 | y;
|
||||
| ^ did you mean `self.y`?
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/issue-14254.rs:49:9
|
||||
|
|
||||
49 | a;
|
||||
| ^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:52:9
|
||||
|
|
||||
52 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `b`
|
||||
--> $DIR/issue-14254.rs:55:9
|
||||
|
|
||||
55 | b;
|
||||
| ^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:63:9
|
||||
|
|
||||
63 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `x`
|
||||
--> $DIR/issue-14254.rs:66:9
|
||||
|
|
||||
66 | x;
|
||||
| ^ did you mean `self.x`?
|
||||
|
||||
error[E0425]: unresolved name `y`
|
||||
--> $DIR/issue-14254.rs:69:9
|
||||
|
|
||||
69 | y;
|
||||
| ^ did you mean `self.y`?
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/issue-14254.rs:72:9
|
||||
|
|
||||
72 | a;
|
||||
| ^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:75:9
|
||||
|
|
||||
75 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `b`
|
||||
--> $DIR/issue-14254.rs:78:9
|
||||
|
|
||||
78 | b;
|
||||
| ^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:86:9
|
||||
|
|
||||
86 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:89:9
|
||||
|
|
||||
89 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:97:9
|
||||
|
|
||||
97 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:100:9
|
||||
|
|
||||
100 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:108:9
|
||||
|
|
||||
108 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:111:9
|
||||
|
|
||||
111 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:119:9
|
||||
|
|
||||
119 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:122:9
|
||||
|
|
||||
122 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error[E0425]: unresolved name `baz`
|
||||
--> $DIR/issue-14254.rs:130:9
|
||||
|
|
||||
130 | baz();
|
||||
| ^^^ did you mean to call `self.baz`?
|
||||
|
||||
error[E0425]: unresolved name `bah`
|
||||
--> $DIR/issue-14254.rs:133:9
|
||||
|
|
||||
133 | bah;
|
||||
| ^^^ did you mean to call `Foo::bah`?
|
||||
|
||||
error: main function not found
|
||||
|
||||
error: aborting due to 25 previous errors
|
||||
|
|
@ -16,7 +16,12 @@ pub struct GslResult {
|
|||
|
||||
impl GslResult {
|
||||
pub fn new() -> GslResult {
|
||||
Result { //~ ERROR: expected struct, variant or union type, found enum `Result`
|
||||
Result {
|
||||
//~^ ERROR expected struct, variant or union type, found enum `Result`
|
||||
//~| HELP possible better candidates are found in other modules, you can import them into scope
|
||||
//~| HELP std::fmt::Result
|
||||
//~| HELP std::io::Result
|
||||
//~| HELP std::thread::Result
|
||||
val: 0f64,
|
||||
err: 0f64
|
||||
}
|
8
src/test/ui/resolve/issue-16058.stderr
Normal file
8
src/test/ui/resolve/issue-16058.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error[E0532]: expected struct, variant or union type, found enum `Result`
|
||||
--> $DIR/issue-16058.rs:19:9
|
||||
|
|
||||
19 | Result {
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -14,4 +14,5 @@ enum SomeEnum {
|
|||
|
||||
fn main() {
|
||||
E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E`
|
||||
//~^ HELP you can import it into scope: `use SomeEnum::E;`
|
||||
}
|
8
src/test/ui/resolve/issue-17518.stderr
Normal file
8
src/test/ui/resolve/issue-17518.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error[E0531]: 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`
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -14,6 +14,5 @@ enum Foo {
|
|||
|
||||
fn main() {
|
||||
let f = Foo::Variant(42);
|
||||
//~^ ERROR uses it like a function
|
||||
//~| struct called like a function
|
||||
//~^ ERROR expected function, found struct variant `Foo::Variant`
|
||||
}
|
10
src/test/ui/resolve/issue-18252.stderr
Normal file
10
src/test/ui/resolve/issue-18252.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0423]: `Foo::Variant` is the name of a struct or struct variant, but this expression uses it like a function name
|
||||
--> $DIR/issue-18252.rs:16:13
|
||||
|
|
||||
16 | let f = Foo::Variant(42);
|
||||
| ^^^^^^^^^^^^ struct called like a function
|
||||
|
|
||||
= help: did you mean to write: `Foo::Variant { /* fields */ }`?
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -17,10 +17,8 @@ enum Homura {
|
|||
|
||||
fn main() {
|
||||
let homura = Homura::Madoka;
|
||||
//~^ ERROR uses it like a function
|
||||
//~| struct called like a function
|
||||
//~^ ERROR expected value, found struct variant `Homura::Madoka`
|
||||
|
||||
let homura = issue_19452_aux::Homura::Madoka;
|
||||
//~^ ERROR uses it like a function
|
||||
//~| struct called like a function
|
||||
//~^ ERROR expected value, found struct variant `issue_19452_aux::Homura::Madoka`
|
||||
}
|
18
src/test/ui/resolve/issue-19452.stderr
Normal file
18
src/test/ui/resolve/issue-19452.stderr
Normal file
|
@ -0,0 +1,18 @@
|
|||
error[E0423]: `Homura::Madoka` is the name of a struct or struct variant, but this expression uses it like a function name
|
||||
--> $DIR/issue-19452.rs:19:18
|
||||
|
|
||||
19 | let homura = Homura::Madoka;
|
||||
| ^^^^^^^^^^^^^^ struct called like a function
|
||||
|
|
||||
= help: did you mean to write: `Homura::Madoka { /* fields */ }`?
|
||||
|
||||
error[E0423]: `issue_19452_aux::Homura::Madoka` is the name of a struct or struct variant, but this expression uses it like a function name
|
||||
--> $DIR/issue-19452.rs:22:18
|
||||
|
|
||||
22 | let homura = issue_19452_aux::Homura::Madoka;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ struct called like a function
|
||||
|
|
||||
= help: did you mean to write: `issue_19452_aux::Homura::Madoka { /* fields */ }`?
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
@ -51,11 +51,11 @@ struct Mul{
|
|||
// help: `std::ops::Mul`
|
||||
|
||||
impl Mul for Foo {
|
||||
//~^ ERROR trait `Mul` is not in scope
|
||||
//~^ ERROR unresolved trait `Mul`
|
||||
//~| HELP possible candidates are found in other modules, you can import them into scope
|
||||
//~| HELP `mul1::Mul`
|
||||
//~| HELP `mul2::Mul`
|
||||
//~| HELP `std::ops::Mul`
|
||||
//~| HELP you can import several candidates into scope (`use ...;`):
|
||||
}
|
||||
|
||||
// BEFORE, we got:
|
||||
|
@ -70,24 +70,23 @@ impl Mul for Foo {
|
|||
// help: `mul4::Mul`
|
||||
// help: and 2 other candidates
|
||||
fn getMul() -> Mul {
|
||||
//~^ ERROR type name `Mul` is undefined or not in scope
|
||||
//~^ ERROR unresolved type `Mul`
|
||||
//~| HELP possible candidates are found in other modules, you can import them into scope
|
||||
//~| HELP `mul1::Mul`
|
||||
//~| HELP `mul2::Mul`
|
||||
//~| HELP `mul3::Mul`
|
||||
//~| HELP `mul4::Mul`
|
||||
//~| HELP and 2 other candidates
|
||||
//~| HELP you can import several candidates into scope (`use ...;`):
|
||||
}
|
||||
|
||||
// Let's also test what happens if the trait doesn't exist:
|
||||
impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
|
||||
//~^ ERROR trait `ThisTraitReallyDoesntExistInAnyModuleReally` is not in scope
|
||||
//~| HELP no candidates by the name of `ThisTraitReallyDoesntExistInAnyModuleReally` found
|
||||
//~^ ERROR unresolved trait `ThisTraitReallyDoesntExistInAnyModuleReally`
|
||||
}
|
||||
|
||||
// Let's also test what happens if there's just one alternative:
|
||||
impl Div for Foo {
|
||||
//~^ ERROR trait `Div` is not in scope
|
||||
//~^ ERROR unresolved trait `Div`
|
||||
//~| HELP `use std::ops::Div;`
|
||||
}
|
||||
|
42
src/test/ui/resolve/issue-21221-1.stderr
Normal file
42
src/test/ui/resolve/issue-21221-1.stderr
Normal file
|
@ -0,0 +1,42 @@
|
|||
error[E0405]: trait `Mul` is not in scope
|
||||
--> $DIR/issue-21221-1.rs:53:6
|
||||
|
|
||||
53 | impl Mul for Foo {
|
||||
| ^^^ `Mul` is not in scope
|
||||
|
|
||||
= help: you can import several candidates into scope (`use ...;`):
|
||||
= help: `mul1::Mul`
|
||||
= help: `mul2::Mul`
|
||||
= help: `std::ops::Mul`
|
||||
|
||||
error[E0412]: type name `Mul` is undefined or not in scope
|
||||
--> $DIR/issue-21221-1.rs:72:16
|
||||
|
|
||||
72 | fn getMul() -> Mul {
|
||||
| ^^^ undefined or not in scope
|
||||
|
|
||||
= help: you can import several candidates into scope (`use ...;`):
|
||||
= help: `mul1::Mul`
|
||||
= help: `mul2::Mul`
|
||||
= help: `mul3::Mul`
|
||||
= help: `mul4::Mul`
|
||||
= help: and 2 other candidates
|
||||
|
||||
error[E0405]: trait `ThisTraitReallyDoesntExistInAnyModuleReally` is not in scope
|
||||
--> $DIR/issue-21221-1.rs:83:6
|
||||
|
|
||||
83 | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ThisTraitReallyDoesntExistInAnyModuleReally` is not in scope
|
||||
|
|
||||
= help: no candidates by the name of `ThisTraitReallyDoesntExistInAnyModuleReally` found in your project; maybe you misspelled the name or forgot to import an external crate?
|
||||
|
||||
error[E0405]: trait `Div` is not in scope
|
||||
--> $DIR/issue-21221-1.rs:88:6
|
||||
|
|
||||
88 | impl Div for Foo {
|
||||
| ^^^ `Div` is not in scope
|
||||
|
|
||||
= help: you can import it into scope: `use std::ops::Div;`.
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -26,5 +26,5 @@ pub mod baz {
|
|||
|
||||
struct Foo;
|
||||
impl T for Foo { }
|
||||
//~^ ERROR trait `T` is not in scope
|
||||
//~| HELP you can import it into scope: `use foo::bar::T;`.
|
||||
//~^ ERROR unresolved trait `T`
|
||||
//~| HELP you can import it into scope: `use foo::bar::T;`
|
12
src/test/ui/resolve/issue-21221-2.stderr
Normal file
12
src/test/ui/resolve/issue-21221-2.stderr
Normal file
|
@ -0,0 +1,12 @@
|
|||
error[E0405]: trait `T` is not in scope
|
||||
--> $DIR/issue-21221-2.rs:28:6
|
||||
|
|
||||
28 | impl T for Foo { }
|
||||
| ^ `T` is not in scope
|
||||
|
|
||||
= help: you can import it into scope: `use foo::bar::T;`.
|
||||
|
||||
error: main function not found
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
// `issue_21221_3::outer::public_module::OuterTrait`
|
||||
// are hidden from the view.
|
||||
impl OuterTrait for Foo {}
|
||||
//~^ ERROR trait `OuterTrait` is not in scope
|
||||
//~| HELP you can import it into scope: `use issue_21221_3::outer::OuterTrait;`.
|
||||
//~^ ERROR unresolved trait `OuterTrait`
|
||||
//~| HELP you can import it into scope: `use issue_21221_3::outer::OuterTrait;`
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
10
src/test/ui/resolve/issue-21221-3.stderr
Normal file
10
src/test/ui/resolve/issue-21221-3.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0405]: trait `OuterTrait` is not in scope
|
||||
--> $DIR/issue-21221-3.rs:25:6
|
||||
|
|
||||
25 | impl OuterTrait for Foo {}
|
||||
| ^^^^^^^^^^ `OuterTrait` is not in scope
|
||||
|
|
||||
= help: you can import it into scope: `use issue_21221_3::outer::OuterTrait;`.
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
struct Foo;
|
||||
|
||||
impl T for Foo {}
|
||||
//~^ ERROR trait `T` is not in scope
|
||||
//~| HELP you can import it into scope: `use issue_21221_4::T;`.
|
||||
//~^ ERROR unresolved trait `T`
|
||||
//~| HELP you can import it into scope: `use issue_21221_4::T;`
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
10
src/test/ui/resolve/issue-21221-4.stderr
Normal file
10
src/test/ui/resolve/issue-21221-4.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0405]: trait `T` is not in scope
|
||||
--> $DIR/issue-21221-4.rs:20:6
|
||||
|
|
||||
20 | impl T for Foo {}
|
||||
| ^ `T` is not in scope
|
||||
|
|
||||
= help: you can import it into scope: `use issue_21221_4::T;`.
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -12,7 +12,11 @@ pub trait ToNbt<T> {
|
|||
fn new(val: T) -> Self;
|
||||
}
|
||||
|
||||
impl ToNbt<Self> {} //~ ERROR use of `Self` outside of an impl or trait
|
||||
//~^ ERROR the trait `ToNbt` cannot be made into an object
|
||||
impl ToNbt<Self> {}
|
||||
//~^ ERROR unresolved type `Self`
|
||||
//~| NOTE `Self` is only available in traits and impls
|
||||
//~| ERROR the trait `ToNbt` cannot be made into an object
|
||||
//~| NOTE the trait `ToNbt` cannot be made into an object
|
||||
//~| NOTE method `new` has no receiver
|
||||
|
||||
fn main() {}
|
16
src/test/ui/resolve/issue-23305.stderr
Normal file
16
src/test/ui/resolve/issue-23305.stderr
Normal file
|
@ -0,0 +1,16 @@
|
|||
error[E0411]: use of `Self` outside of an impl or trait
|
||||
--> $DIR/issue-23305.rs:15:12
|
||||
|
|
||||
15 | impl ToNbt<Self> {}
|
||||
| ^^^^ used outside of impl or trait
|
||||
|
||||
error[E0038]: the trait `ToNbt` cannot be made into an object
|
||||
--> $DIR/issue-23305.rs:15:6
|
||||
|
|
||||
15 | impl ToNbt<Self> {}
|
||||
| ^^^^^^^^^^^ the trait `ToNbt` cannot be made into an object
|
||||
|
|
||||
= note: method `new` has no receiver
|
||||
|
||||
error: aborting due to previous error
|
||||
|
125
src/test/ui/resolve/issue-2356.rs
Normal file
125
src/test/ui/resolve/issue-2356.rs
Normal file
|
@ -0,0 +1,125 @@
|
|||
// Copyright 2012-2014 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.
|
||||
|
||||
trait Groom {
|
||||
fn shave(other: usize);
|
||||
}
|
||||
|
||||
pub struct cat {
|
||||
whiskers: isize,
|
||||
}
|
||||
|
||||
pub enum MaybeDog {
|
||||
Dog,
|
||||
NoDog
|
||||
}
|
||||
|
||||
impl MaybeDog {
|
||||
fn bark() {
|
||||
// If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom
|
||||
shave();
|
||||
//~^ ERROR unresolved function `shave`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for cat {
|
||||
fn clone(&self) -> Self {
|
||||
clone();
|
||||
//~^ ERROR unresolved function `clone`
|
||||
//~| NOTE did you mean `self.clone(...)`?
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
impl Default for cat {
|
||||
fn default() -> Self {
|
||||
default();
|
||||
//~^ ERROR unresolved function `default`
|
||||
//~| NOTE did you mean `Self::default`?
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Groom for cat {
|
||||
fn shave(other: usize) {
|
||||
whiskers -= other;
|
||||
//~^ ERROR unresolved value `whiskers`
|
||||
//~| ERROR unresolved value `whiskers`
|
||||
//~| NOTE did you mean `self.whiskers`?
|
||||
//~| NOTE `self` value is only available in methods with `self` parameter
|
||||
shave(4);
|
||||
//~^ ERROR unresolved function `shave`
|
||||
//~| NOTE did you mean `Self::shave`?
|
||||
purr();
|
||||
//~^ ERROR unresolved function `purr`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl cat {
|
||||
fn static_method() {}
|
||||
|
||||
fn purr_louder() {
|
||||
static_method();
|
||||
//~^ ERROR unresolved function `static_method`
|
||||
//~| NOTE no resolution found
|
||||
purr();
|
||||
//~^ ERROR unresolved function `purr`
|
||||
//~| NOTE no resolution found
|
||||
purr();
|
||||
//~^ ERROR unresolved function `purr`
|
||||
//~| NOTE no resolution found
|
||||
purr();
|
||||
//~^ ERROR unresolved function `purr`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
impl cat {
|
||||
fn meow() {
|
||||
if self.whiskers > 3 {
|
||||
//~^ ERROR expected value, found module `self`
|
||||
//~| NOTE `self` value is only available in methods with `self` parameter
|
||||
println!("MEOW");
|
||||
}
|
||||
}
|
||||
|
||||
fn purr(&self) {
|
||||
grow_older();
|
||||
//~^ ERROR unresolved function `grow_older`
|
||||
//~| NOTE no resolution found
|
||||
shave();
|
||||
//~^ ERROR unresolved function `shave`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
|
||||
fn burn_whiskers(&mut self) {
|
||||
whiskers = 0;
|
||||
//~^ ERROR unresolved value `whiskers`
|
||||
//~| NOTE did you mean `self.whiskers`?
|
||||
}
|
||||
|
||||
pub fn grow_older(other:usize) {
|
||||
whiskers = 4;
|
||||
//~^ ERROR unresolved value `whiskers`
|
||||
//~| ERROR unresolved value `whiskers`
|
||||
//~| NOTE did you mean `self.whiskers`?
|
||||
//~| NOTE `self` value is only available in methods with `self` parameter
|
||||
purr_louder();
|
||||
//~^ ERROR unresolved function `purr_louder`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
self += 1;
|
||||
//~^ ERROR expected value, found module `self`
|
||||
//~| NOTE `self` value is only available in methods with `self` parameter
|
||||
}
|
112
src/test/ui/resolve/issue-2356.stderr
Normal file
112
src/test/ui/resolve/issue-2356.stderr
Normal file
|
@ -0,0 +1,112 @@
|
|||
error[E0425]: unresolved name `shave`
|
||||
--> $DIR/issue-2356.rs:27:5
|
||||
|
|
||||
27 | shave();
|
||||
| ^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `clone`
|
||||
--> $DIR/issue-2356.rs:35:5
|
||||
|
|
||||
35 | clone();
|
||||
| ^^^^^ did you mean to call `self.clone`?
|
||||
|
||||
error[E0425]: unresolved name `default`
|
||||
--> $DIR/issue-2356.rs:43:5
|
||||
|
|
||||
43 | default();
|
||||
| ^^^^^^^ did you mean to call `self.default`?
|
||||
|
||||
error[E0425]: unresolved name `whiskers`
|
||||
--> $DIR/issue-2356.rs:52:5
|
||||
|
|
||||
52 | whiskers -= other;
|
||||
| ^^^^^^^^ unresolved name
|
||||
|
|
||||
= help: this is an associated function, you don't have access to this type's fields or methods
|
||||
|
||||
error[E0425]: unresolved name `shave`
|
||||
--> $DIR/issue-2356.rs:57:5
|
||||
|
|
||||
57 | shave(4);
|
||||
| ^^^^^ did you mean to call `Groom::shave`?
|
||||
|
||||
error[E0425]: unresolved name `purr`
|
||||
--> $DIR/issue-2356.rs:60:5
|
||||
|
|
||||
60 | purr();
|
||||
| ^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `static_method`
|
||||
--> $DIR/issue-2356.rs:70:9
|
||||
|
|
||||
70 | static_method();
|
||||
| ^^^^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `purr`
|
||||
--> $DIR/issue-2356.rs:73:9
|
||||
|
|
||||
73 | purr();
|
||||
| ^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `purr`
|
||||
--> $DIR/issue-2356.rs:76:9
|
||||
|
|
||||
76 | purr();
|
||||
| ^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `purr`
|
||||
--> $DIR/issue-2356.rs:79:9
|
||||
|
|
||||
79 | purr();
|
||||
| ^^^^ unresolved name
|
||||
|
||||
error[E0424]: `self` is not available in a static method
|
||||
--> $DIR/issue-2356.rs:87:8
|
||||
|
|
||||
87 | if self.whiskers > 3 {
|
||||
| ^^^^ not available in static method
|
||||
|
|
||||
= note: maybe a `self` argument is missing?
|
||||
|
||||
error[E0425]: unresolved name `grow_older`
|
||||
--> $DIR/issue-2356.rs:95:5
|
||||
|
|
||||
95 | grow_older();
|
||||
| ^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `shave`
|
||||
--> $DIR/issue-2356.rs:98:5
|
||||
|
|
||||
98 | shave();
|
||||
| ^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `whiskers`
|
||||
--> $DIR/issue-2356.rs:104:5
|
||||
|
|
||||
104 | whiskers = 0;
|
||||
| ^^^^^^^^ did you mean `self.whiskers`?
|
||||
|
||||
error[E0425]: unresolved name `whiskers`
|
||||
--> $DIR/issue-2356.rs:110:5
|
||||
|
|
||||
110 | whiskers = 4;
|
||||
| ^^^^^^^^ unresolved name
|
||||
|
|
||||
= help: this is an associated function, you don't have access to this type's fields or methods
|
||||
|
||||
error[E0425]: unresolved name `purr_louder`
|
||||
--> $DIR/issue-2356.rs:115:5
|
||||
|
|
||||
115 | purr_louder();
|
||||
| ^^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `self`
|
||||
--> $DIR/issue-2356.rs:122:5
|
||||
|
|
||||
122 | self += 1;
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: module `self` cannot be used as an expression
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
|
@ -9,7 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn foo(_: Self) {
|
||||
//~^ ERROR use of `Self` outside of an impl or trait
|
||||
//~^ ERROR unresolved type `Self`
|
||||
//~| NOTE `Self` is only available in traits and impls
|
||||
}
|
||||
|
||||
fn main() {}
|
8
src/test/ui/resolve/issue-24968.stderr
Normal file
8
src/test/ui/resolve/issue-24968.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error[E0411]: use of `Self` outside of an impl or trait
|
||||
--> $DIR/issue-24968.rs:11:11
|
||||
|
|
||||
11 | fn foo(_: Self) {
|
||||
| ^^^^ used outside of impl or trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -17,7 +17,6 @@ trait Bar {}
|
|||
impl Bar for Foo {}
|
||||
|
||||
fn main() {
|
||||
let any: &Any = &Bar; //~ ERROR E0425
|
||||
//~| HELP trait `Bar`
|
||||
let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar`
|
||||
if any.is::<u32>() { println!("u32"); }
|
||||
}
|
10
src/test/ui/resolve/issue-33876.stderr
Normal file
10
src/test/ui/resolve/issue-33876.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0425]: unresolved name `Bar`
|
||||
--> $DIR/issue-33876.rs:20:22
|
||||
|
|
||||
20 | let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar`
|
||||
| ^^^ unresolved name
|
||||
|
|
||||
= help: trait `Bar` cannot be used as an expression
|
||||
|
||||
error: aborting due to previous error
|
||||
|
10
src/test/ui/resolve/issue-3907-2.stderr
Normal file
10
src/test/ui/resolve/issue-3907-2.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
|
||||
--> $DIR/issue-3907-2.rs:20:1
|
||||
|
|
||||
20 | fn bar(_x: Foo) {}
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object
|
||||
|
|
||||
= note: method `bar` has no receiver
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -17,9 +17,7 @@ struct S {
|
|||
name: isize
|
||||
}
|
||||
|
||||
impl Foo for S { //~ ERROR: `Foo` is not a trait
|
||||
//~| NOTE: expected trait, found type alias
|
||||
//~| NOTE: type aliases cannot be used for traits
|
||||
impl Foo for S { //~ ERROR expected trait, found type alias `Foo`
|
||||
fn bar() { }
|
||||
}
|
||||
|
10
src/test/ui/resolve/issue-3907.stderr
Normal file
10
src/test/ui/resolve/issue-3907.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0404]: `Foo` is not a trait
|
||||
--> $DIR/issue-3907.rs:20:6
|
||||
|
|
||||
20 | impl Foo for S { //~ ERROR expected trait, found type alias `Foo`
|
||||
| ^^^ expected trait, found type alias
|
||||
|
|
||||
= note: type aliases cannot be used for traits
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
11
src/test/ui/resolve/issue-5035-2.stderr
Normal file
11
src/test/ui/resolve/issue-5035-2.stderr
Normal file
|
@ -0,0 +1,11 @@
|
|||
error[E0277]: the trait bound `I + 'static: std::marker::Sized` is not satisfied
|
||||
--> $DIR/issue-5035-2.rs:14:8
|
||||
|
|
||||
14 | fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied
|
||||
| ^^ the trait `std::marker::Sized` is not implemented for `I + 'static`
|
||||
|
|
||||
= note: `I + 'static` does not have a constant size known at compile-time
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
trait I {}
|
||||
type K = I;
|
||||
impl K for isize {} //~ ERROR: `K` is not a trait
|
||||
//~| NOTE: expected trait, found type alias
|
||||
//~| NOTE: aliases cannot be used for traits
|
||||
impl K for isize {} //~ ERROR expected trait, found type alias `K`
|
||||
//~| NOTE type aliases cannot be used for traits
|
||||
|
||||
use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
|
||||
//~^ no `ImportError` in the root
|
16
src/test/ui/resolve/issue-5035.stderr
Normal file
16
src/test/ui/resolve/issue-5035.stderr
Normal file
|
@ -0,0 +1,16 @@
|
|||
error[E0432]: unresolved import `ImportError`
|
||||
--> $DIR/issue-5035.rs:16:5
|
||||
|
|
||||
16 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
|
||||
| ^^^^^^^^^^^ no `ImportError` in the root
|
||||
|
||||
error[E0404]: `K` is not a trait
|
||||
--> $DIR/issue-5035.rs:13:6
|
||||
|
|
||||
13 | impl K for isize {} //~ ERROR expected trait, found type alias `K`
|
||||
| ^ expected trait, found type alias
|
||||
|
|
||||
= note: type aliases cannot be used for traits
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -14,6 +14,6 @@ struct Monster {
|
|||
|
||||
|
||||
fn main() {
|
||||
let _m = Monster(); //~ ERROR `Monster` is the name of a struct or
|
||||
//~^ HELP did you mean to write: `Monster { /* fields */ }`?
|
||||
let _m = Monster(); //~ ERROR expected function, found struct `Monster`
|
||||
//~^ NOTE did you mean `Monster { /* fields */ }`?
|
||||
}
|
10
src/test/ui/resolve/issue-6702.stderr
Normal file
10
src/test/ui/resolve/issue-6702.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0423]: `Monster` is the name of a struct or struct variant, but this expression uses it like a function name
|
||||
--> $DIR/issue-6702.rs:17:14
|
||||
|
|
||||
17 | let _m = Monster(); //~ ERROR expected function, found struct `Monster`
|
||||
| ^^^^^^^ struct called like a function
|
||||
|
|
||||
= help: did you mean to write: `Monster { /* fields */ }`?
|
||||
|
||||
error: aborting due to previous error
|
||||
|
58
src/test/ui/resolve/resolve-assoc-suggestions.rs
Normal file
58
src/test/ui/resolve/resolve-assoc-suggestions.rs
Normal file
|
@ -0,0 +1,58 @@
|
|||
// 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.
|
||||
|
||||
// Make sure associated items are recommended only in appropriate contexts.
|
||||
|
||||
struct S {
|
||||
field: u8,
|
||||
}
|
||||
|
||||
trait Tr {
|
||||
fn method(&self);
|
||||
type Type;
|
||||
}
|
||||
|
||||
impl Tr for S {
|
||||
type Type = u8;
|
||||
|
||||
fn method(&self) {
|
||||
let _: field;
|
||||
//~^ ERROR unresolved type `field`
|
||||
//~| NOTE no resolution found
|
||||
let field(..);
|
||||
//~^ ERROR unresolved tuple struct/variant `field`
|
||||
//~| NOTE no resolution found
|
||||
field;
|
||||
//~^ ERROR unresolved value `field`
|
||||
//~| NOTE did you mean `self.field`?
|
||||
|
||||
let _: Type;
|
||||
//~^ ERROR unresolved type `Type`
|
||||
//~| NOTE did you mean `Self::Type`?
|
||||
let Type(..);
|
||||
//~^ ERROR unresolved tuple struct/variant `Type`
|
||||
//~| NOTE no resolution found
|
||||
Type;
|
||||
//~^ ERROR unresolved value `Type`
|
||||
//~| NOTE no resolution found
|
||||
|
||||
let _: method;
|
||||
//~^ ERROR unresolved type `method`
|
||||
//~| NOTE no resolution found
|
||||
let method(..);
|
||||
//~^ ERROR unresolved tuple struct/variant `method`
|
||||
//~| NOTE no resolution found
|
||||
method;
|
||||
//~^ ERROR unresolved value `method`
|
||||
//~| NOTE did you mean `self.method(...)`?
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
62
src/test/ui/resolve/resolve-assoc-suggestions.stderr
Normal file
62
src/test/ui/resolve/resolve-assoc-suggestions.stderr
Normal file
|
@ -0,0 +1,62 @@
|
|||
error[E0412]: type name `field` is undefined or not in scope
|
||||
--> $DIR/resolve-assoc-suggestions.rs:26:16
|
||||
|
|
||||
26 | let _: field;
|
||||
| ^^^^^ undefined or not in scope
|
||||
|
|
||||
= help: no candidates by the name of `field` found in your project; maybe you misspelled the name or forgot to import an external crate?
|
||||
|
||||
error[E0531]: unresolved tuple struct/variant `field`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:29:13
|
||||
|
|
||||
29 | let field(..);
|
||||
| ^^^^^
|
||||
|
||||
error[E0425]: unresolved name `field`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:32:9
|
||||
|
|
||||
32 | field;
|
||||
| ^^^^^ did you mean `self.field`?
|
||||
|
||||
error[E0412]: type name `Type` is undefined or not in scope
|
||||
--> $DIR/resolve-assoc-suggestions.rs:36:16
|
||||
|
|
||||
36 | let _: Type;
|
||||
| ^^^^ undefined or not in scope
|
||||
|
|
||||
= help: no candidates by the name of `Type` found in your project; maybe you misspelled the name or forgot to import an external crate?
|
||||
|
||||
error[E0531]: unresolved tuple struct/variant `Type`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:39:13
|
||||
|
|
||||
39 | let Type(..);
|
||||
| ^^^^
|
||||
|
||||
error[E0425]: unresolved name `Type`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:42:9
|
||||
|
|
||||
42 | Type;
|
||||
| ^^^^ did you mean to call `self.Type`?
|
||||
|
||||
error[E0412]: type name `method` is undefined or not in scope
|
||||
--> $DIR/resolve-assoc-suggestions.rs:46:16
|
||||
|
|
||||
46 | let _: method;
|
||||
| ^^^^^^ undefined or not in scope
|
||||
|
|
||||
= help: no candidates by the name of `method` found in your project; maybe you misspelled the name or forgot to import an external crate?
|
||||
|
||||
error[E0531]: unresolved tuple struct/variant `method`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:49:13
|
||||
|
|
||||
49 | let method(..);
|
||||
| ^^^^^^
|
||||
|
||||
error[E0425]: unresolved name `method`
|
||||
--> $DIR/resolve-assoc-suggestions.rs:52:9
|
||||
|
|
||||
52 | method;
|
||||
| ^^^^^^ did you mean to call `self.method`?
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
fn main() {
|
||||
assert(true);
|
||||
//~^ ERROR unresolved name `assert`
|
||||
//~| NOTE did you mean the macro `assert!`?
|
||||
//~^ ERROR expected function, found macro `assert`
|
||||
//~| NOTE did you mean `assert!(...)`?
|
||||
}
|
8
src/test/ui/resolve/resolve-hint-macro.stderr
Normal file
8
src/test/ui/resolve/resolve-hint-macro.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error[E0425]: unresolved name `assert`
|
||||
--> $DIR/resolve-hint-macro.rs:12:5
|
||||
|
|
||||
12 | assert(true);
|
||||
| ^^^^^^ did you mean the macro `assert!`?
|
||||
|
||||
error: aborting due to previous error
|
||||
|
44
src/test/ui/resolve/resolve-speculative-adjustment.rs
Normal file
44
src/test/ui/resolve/resolve-speculative-adjustment.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
// 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.
|
||||
|
||||
// Make sure speculative path resolution works properly when resolution
|
||||
// adjustment happens and no extra errors is reported.
|
||||
|
||||
struct S {
|
||||
field: u8,
|
||||
}
|
||||
|
||||
trait Tr {
|
||||
fn method(&self);
|
||||
}
|
||||
|
||||
impl Tr for S {
|
||||
fn method(&self) {
|
||||
fn g() {
|
||||
// Speculative resolution of `Self` and `self` silently fails,
|
||||
// "did you mean" messages are not printed.
|
||||
field;
|
||||
//~^ ERROR unresolved value `field`
|
||||
//~| NOTE no resolution found
|
||||
method();
|
||||
//~^ ERROR unresolved function `method`
|
||||
//~| NOTE no resolution found
|
||||
}
|
||||
|
||||
field;
|
||||
//~^ ERROR unresolved value `field`
|
||||
//~| NOTE did you mean `self.field`?
|
||||
method();
|
||||
//~^ ERROR unresolved function `method`
|
||||
//~| NOTE did you mean `self.method(...)`?
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
26
src/test/ui/resolve/resolve-speculative-adjustment.stderr
Normal file
26
src/test/ui/resolve/resolve-speculative-adjustment.stderr
Normal file
|
@ -0,0 +1,26 @@
|
|||
error[E0425]: unresolved name `field`
|
||||
--> $DIR/resolve-speculative-adjustment.rs:27:13
|
||||
|
|
||||
27 | field;
|
||||
| ^^^^^ did you mean `self.field`?
|
||||
|
||||
error[E0425]: unresolved name `method`
|
||||
--> $DIR/resolve-speculative-adjustment.rs:30:13
|
||||
|
|
||||
30 | method();
|
||||
| ^^^^^^ did you mean to call `self.method`?
|
||||
|
||||
error[E0425]: unresolved name `field`
|
||||
--> $DIR/resolve-speculative-adjustment.rs:35:9
|
||||
|
|
||||
35 | field;
|
||||
| ^^^^^ did you mean `self.field`?
|
||||
|
||||
error[E0425]: unresolved name `method`
|
||||
--> $DIR/resolve-speculative-adjustment.rs:38:9
|
||||
|
|
||||
38 | method();
|
||||
| ^^^^^^ did you mean to call `self.method`?
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
@ -25,52 +25,52 @@ pub fn g() -> i32 { 4 }
|
|||
|
||||
fn h1() -> i32 {
|
||||
a.I
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to reference an item from the `a` module, use `a::I`
|
||||
//~^ ERROR expected value, found module `a`
|
||||
//~| NOTE did you mean `a::I`?
|
||||
}
|
||||
|
||||
fn h2() -> i32 {
|
||||
a.g()
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to call a function from the `a` module, use `a::g(..)`
|
||||
//~^ ERROR expected value, found module `a`
|
||||
//~| NOTE did you mean `a::g(...)`?
|
||||
}
|
||||
|
||||
fn h3() -> i32 {
|
||||
a.b.J
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to reference an item from the `a` module, use `a::b`
|
||||
//~^ ERROR expected value, found module `a`
|
||||
//~| NOTE did you mean `a::b`?
|
||||
}
|
||||
|
||||
fn h4() -> i32 {
|
||||
a::b.J
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to reference an item from the `a::b` module, use `a::b::J`
|
||||
//~^ ERROR expected value, found module `a::b`
|
||||
//~| NOTE did you mean `a::b::J`?
|
||||
}
|
||||
|
||||
fn h5() {
|
||||
a.b.f();
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to reference an item from the `a` module, use `a::b`
|
||||
//~^ ERROR expected value, found module `a`
|
||||
//~| NOTE did you mean `a::b`?
|
||||
let v = Vec::new();
|
||||
v.push(a::b);
|
||||
//~^ ERROR E0425
|
||||
//~| HELP module `a::b` cannot be used as an expression
|
||||
//~^ ERROR expected value, found module `a::b`
|
||||
//~| NOTE not a value
|
||||
}
|
||||
|
||||
fn h6() -> i32 {
|
||||
a::b.f()
|
||||
//~^ ERROR E0425
|
||||
//~| HELP to call a function from the `a::b` module, use `a::b::f(..)`
|
||||
//~^ ERROR expected value, found module `a::b`
|
||||
//~| NOTE did you mean `a::b::f(...)`?
|
||||
}
|
||||
|
||||
fn h7() {
|
||||
a::b
|
||||
//~^ ERROR E0425
|
||||
//~| HELP module `a::b` cannot be used as an expression
|
||||
//~^ ERROR expected value, found module `a::b`
|
||||
//~| NOTE not a value
|
||||
}
|
||||
|
||||
fn h8() -> i32 {
|
||||
a::b()
|
||||
//~^ ERROR E0425
|
||||
//~| HELP module `a::b` cannot be used as an expression
|
||||
//~^ ERROR expected function, found module `a::b`
|
||||
//~| NOTE not a function
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:27:5
|
||||
|
|
||||
27 | a.I
|
||||
| ^ unresolved name
|
||||
|
|
||||
= help: to reference an item from the `a` module, use `a::I`
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:33:5
|
||||
|
|
||||
33 | a.g()
|
||||
| ^ unresolved name
|
||||
|
|
||||
= help: to call a function from the `a` module, use `a::g(..)`
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:39:5
|
||||
|
|
||||
39 | a.b.J
|
||||
| ^ unresolved name
|
||||
|
|
||||
= help: to reference an item from the `a` module, use `a::b`
|
||||
|
||||
error[E0425]: unresolved name `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5
|
||||
|
|
||||
45 | a::b.J
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: to reference an item from the `a::b` module, use `a::b::J`
|
||||
|
||||
error[E0425]: unresolved name `a`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:51:5
|
||||
|
|
||||
51 | a.b.f();
|
||||
| ^ unresolved name
|
||||
|
|
||||
= help: to reference an item from the `a` module, use `a::b`
|
||||
|
||||
error[E0425]: unresolved name `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:12
|
||||
|
|
||||
55 | v.push(a::b);
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: module `a::b` cannot be used as an expression
|
||||
|
||||
error[E0425]: unresolved name `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:61:5
|
||||
|
|
||||
61 | a::b.f()
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: to call a function from the `a::b` module, use `a::b::f(..)`
|
||||
|
||||
error[E0425]: unresolved name `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:67:5
|
||||
|
|
||||
67 | a::b
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: module `a::b` cannot be used as an expression
|
||||
|
||||
error[E0425]: unresolved name `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:73:5
|
||||
|
|
||||
73 | a::b()
|
||||
| ^^^^ unresolved name
|
||||
|
|
||||
= help: module `a::b` cannot be used as an expression
|
||||
|
||||
error: main function not found
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
|
@ -11,8 +11,9 @@
|
|||
// Test that we do some basic error correcton in the tokeniser (and don't ICE).
|
||||
|
||||
fn main() {
|
||||
if foo { //~ NOTE: unclosed delimiter
|
||||
//~^ ERROR: unresolved name `foo`
|
||||
//~| NOTE unresolved name
|
||||
if foo {
|
||||
//~^ NOTE: unclosed delimiter
|
||||
//~| ERROR: unresolved value `foo`
|
||||
//~| NOTE: no resolution found
|
||||
) //~ ERROR: incorrect close delimiter: `)`
|
||||
}
|
20
src/test/ui/resolve/token-error-correct-2.stderr
Normal file
20
src/test/ui/resolve/token-error-correct-2.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
error: incorrect close delimiter: `)`
|
||||
--> $DIR/token-error-correct-2.rs:18:5
|
||||
|
|
||||
18 | ) //~ ERROR: incorrect close delimiter: `)`
|
||||
| ^
|
||||
|
|
||||
note: unclosed delimiter
|
||||
--> $DIR/token-error-correct-2.rs:14:12
|
||||
|
|
||||
14 | if foo {
|
||||
| ^
|
||||
|
||||
error[E0425]: unresolved name `foo`
|
||||
--> $DIR/token-error-correct-2.rs:14:8
|
||||
|
|
||||
14 | if foo {
|
||||
| ^^^ unresolved name
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
@ -18,8 +18,8 @@ pub mod raw {
|
|||
pub fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(path: P,
|
||||
callback: F)
|
||||
-> io::Result<bool> {
|
||||
if !is_directory(path.as_ref()) { //~ ERROR: unresolved name `is_directory`
|
||||
//~| NOTE unresolved name
|
||||
if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory`
|
||||
//~^ NOTE: no resolution found
|
||||
callback(path.as_ref(); //~ NOTE: unclosed delimiter
|
||||
//~^ ERROR: expected one of
|
||||
fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
|
41
src/test/ui/resolve/token-error-correct-3.stderr
Normal file
41
src/test/ui/resolve/token-error-correct-3.stderr
Normal file
|
@ -0,0 +1,41 @@
|
|||
error: incorrect close delimiter: `}`
|
||||
--> $DIR/token-error-correct-3.rs:29:9
|
||||
|
|
||||
29 | } else { //~ ERROR: incorrect close delimiter: `}`
|
||||
| ^
|
||||
|
|
||||
note: unclosed delimiter
|
||||
--> $DIR/token-error-correct-3.rs:23:21
|
||||
|
|
||||
23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter
|
||||
| ^
|
||||
|
||||
error: expected one of `,`, `.`, `?`, or an operator, found `;`
|
||||
--> $DIR/token-error-correct-3.rs:23:35
|
||||
|
|
||||
23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter
|
||||
| ^
|
||||
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)`
|
||||
--> $DIR/token-error-correct-3.rs:29:9
|
||||
|
|
||||
29 | } else { //~ ERROR: incorrect close delimiter: `}`
|
||||
| ^
|
||||
|
||||
error[E0425]: unresolved name `is_directory`
|
||||
--> $DIR/token-error-correct-3.rs:21:13
|
||||
|
|
||||
21 | if !is_directory(path.as_ref()) { //~ ERROR: unresolved function `is_directory`
|
||||
| ^^^^^^^^^^^^ unresolved name
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/token-error-correct-3.rs:25:13
|
||||
|
|
||||
25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result`
|
||||
|
|
||||
= note: expected type `()`
|
||||
= note: found type `std::result::Result<bool, std::io::Error>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -11,14 +11,16 @@
|
|||
// Test that we do some basic error correcton in the tokeniser.
|
||||
|
||||
fn main() {
|
||||
foo(bar(; //~ NOTE: unclosed delimiter
|
||||
foo(bar(;
|
||||
//~^ NOTE: unclosed delimiter
|
||||
//~^^ ERROR: expected expression, found `;`
|
||||
//~^^^ ERROR: unresolved name `bar`
|
||||
//~^^^^ ERROR: unresolved name `foo`
|
||||
//~^^^^^ ERROR: expected one of `)`, `,`, `.`, `<`, `?`
|
||||
//~| NOTE unresolved name
|
||||
//~| NOTE unresolved name
|
||||
} //~ ERROR: incorrect close delimiter: `}`
|
||||
//~| NOTE: unclosed delimiter
|
||||
//~| ERROR: expected expression, found `;`
|
||||
//~| ERROR: unresolved function `foo`
|
||||
//~| NOTE: no resolution found
|
||||
//~| ERROR: unresolved function `bar`
|
||||
//~| NOTE: no resolution found
|
||||
//~| ERROR: expected one of `)`, `,`, `.`, `<`, `?`
|
||||
}
|
||||
//~^ ERROR: incorrect close delimiter: `}`
|
||||
//~^^ ERROR: expected expression, found `)`
|
||||
//~| ERROR: incorrect close delimiter: `}`
|
||||
//~| ERROR: expected expression, found `)`
|
56
src/test/ui/resolve/token-error-correct.stderr
Normal file
56
src/test/ui/resolve/token-error-correct.stderr
Normal file
|
@ -0,0 +1,56 @@
|
|||
error: incorrect close delimiter: `}`
|
||||
--> $DIR/token-error-correct.rs:23:1
|
||||
|
|
||||
23 | }
|
||||
| ^
|
||||
|
|
||||
note: unclosed delimiter
|
||||
--> $DIR/token-error-correct.rs:14:12
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^
|
||||
|
||||
error: incorrect close delimiter: `}`
|
||||
--> $DIR/token-error-correct.rs:23:1
|
||||
|
|
||||
23 | }
|
||||
| ^
|
||||
|
|
||||
note: unclosed delimiter
|
||||
--> $DIR/token-error-correct.rs:14:8
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^
|
||||
|
||||
error: expected expression, found `;`
|
||||
--> $DIR/token-error-correct.rs:14:13
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^
|
||||
|
||||
error: expected one of `)`, `,`, `.`, `<`, `?`, `break`, `continue`, `false`, `for`, `if`, `loop`, `match`, `move`, `return`, `true`, `unsafe`, `while`, or an operator, found `;`
|
||||
--> $DIR/token-error-correct.rs:14:13
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^
|
||||
|
||||
error: expected expression, found `)`
|
||||
--> $DIR/token-error-correct.rs:23:1
|
||||
|
|
||||
23 | }
|
||||
| ^
|
||||
|
||||
error[E0425]: unresolved name `foo`
|
||||
--> $DIR/token-error-correct.rs:14:5
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^^^ unresolved name
|
||||
|
||||
error[E0425]: unresolved name `bar`
|
||||
--> $DIR/token-error-correct.rs:14:9
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^^^ unresolved name
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2014 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.
|
||||
|
||||
fn f<F:Nonexist(isize) -> isize>(x: F) {}
|
||||
//~^ ERROR unresolved trait `Nonexist`
|
||||
//~| NOTE no resolution found
|
||||
|
||||
type Typedef = isize;
|
||||
|
||||
fn g<F:Typedef(isize) -> isize>(x: F) {}
|
||||
//~^ ERROR expected trait, found type alias `Typedef`
|
||||
//~| NOTE type aliases cannot be used for traits
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,18 @@
|
|||
error[E0405]: trait `Nonexist` is not in scope
|
||||
--> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:11:8
|
||||
|
|
||||
11 | fn f<F:Nonexist(isize) -> isize>(x: F) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ `Nonexist` is not in scope
|
||||
|
|
||||
= help: no candidates by the name of `Nonexist` found in your project; maybe you misspelled the name or forgot to import an external crate?
|
||||
|
||||
error[E0404]: `Typedef` is not a trait
|
||||
--> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:17:8
|
||||
|
|
||||
17 | fn g<F:Typedef(isize) -> isize>(x: F) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait, found type alias
|
||||
|
|
||||
= note: type aliases cannot be used for traits
|
||||
|
||||
error: cannot continue compilation due to previous error
|
||||
|
|
@ -16,8 +16,11 @@ struct Foo {
|
|||
|
||||
impl Foo {
|
||||
fn bar() {
|
||||
f(cx); //~ ERROR E0425
|
||||
//~| HELP this is an associated function
|
||||
f(cx);
|
||||
//~^ ERROR unresolved value `cx`
|
||||
//~| ERROR unresolved value `cx`
|
||||
//~| NOTE did you mean `self.cx`?
|
||||
//~| NOTE `self` value is only available in methods with `self` parameter
|
||||
}
|
||||
}
|
||||
|
10
src/test/ui/resolve/unresolved_static_type_field.stderr
Normal file
10
src/test/ui/resolve/unresolved_static_type_field.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0425]: unresolved name `cx`
|
||||
--> $DIR/unresolved_static_type_field.rs:19:11
|
||||
|
|
||||
19 | f(cx);
|
||||
| ^^ unresolved name
|
||||
|
|
||||
= help: this is an associated function, you don't have access to this type's fields or methods
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in a new issue