Skip to content

Commit e46c459

Browse files
committed
test guesses
1 parent aea71bd commit e46c459

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+161
-38
lines changed

src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ extern crate macro_crate_test;
1515

1616
fn main() {
1717
assert_eq!(3, unexported_macro!()); //~ ERROR macro undefined: 'unexported_macro!'
18+
//~| GUESS exported_macro!
1819
}

src/test/compile-fail/E0423.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ fn main () {
1212
struct Foo { a: bool };
1313

1414
let f = Foo(); //~ ERROR E0423
15+
//~^ GUESS Foo { /* fields */ }
1516
}

src/test/compile-fail/E0559.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ enum Field {
1515
fn main() {
1616
let s = Field::Fool { joke: 0 };
1717
//~^ ERROR E0559
18-
//~| NOTE field does not exist - did you mean `x`?
18+
//~| HELP field does not exist - did you mean
19+
//~| GUESS x
1920
}

src/test/compile-fail/associated-types-eq-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ pub trait Foo {
1818

1919
fn foo2<I: Foo>(x: I) {
2020
let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope
21+
//~^ GUESS I
22+
// FIXME: should guess `I::A`
2123
}
2224

2325
pub fn main() {}

src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ fn main() {
2424
//~^ ERROR E0373
2525
//~| NOTE `books` is borrowed here
2626
//~| NOTE may outlive borrowed value `books`
27+
//~| GUESS move ||
2728
}

src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> {
2222
//~^ ERROR E0373
2323
//~| NOTE `books` is borrowed here
2424
//~| NOTE may outlive borrowed value `books`
25+
//~| GUESS move ||
2526
}
2627

2728
fn main() { }

src/test/compile-fail/cast-to-unsized-trait-object-suggestion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ fn main() {
1616
Box::new(1) as Send;
1717
//~^ ERROR cast to unsized type
1818
//~| HELP try casting to a `Box` instead:
19-
//~| SUGGESTION Box::new(1) as Box<Send>;
19+
//~| GUESS Box<Send>
2020
}

src/test/compile-fail/class-missing-self.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ impl cat {
1717
fn meow(&self) {
1818
println!("Meow");
1919
meows += 1; //~ ERROR cannot find value `meows` in this scope
20+
//~^ GUESS self.meows
2021
sleep(); //~ ERROR cannot find function `sleep` in this scope
2122
}
2223

src/test/compile-fail/empty-struct-braces-expr.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ enum E {
2323

2424
fn main() {
2525
let e1 = Empty1; //~ ERROR expected value, found struct `Empty1`
26+
//~^ GUESS Empty1 { /* fields */ }
2627
let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1`
28+
//~^ GUESS Empty1 { /* fields */ }
2729
let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3`
30+
//~^ GUESS E::Empty3 { /* fields */ }
2831
let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3`
32+
//~^ GUESS E::Empty3 { /* fields */ }
2933

3034
let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1`
35+
//~^ GUESS Empty1 { /* fields */ }
3136
let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1`
37+
//~^ GUESS Empty1 { /* fields */ }
3238
let xe3 = XE::Empty3; //~ ERROR no associated item named `Empty3` found for type
3339
let xe3 = XE::Empty3(); //~ ERROR no associated item named `Empty3` found for type
3440
}

src/test/compile-fail/empty-struct-braces-pat-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ fn main() {
3333
match e3 {
3434
E::Empty3 => ()
3535
//~^ ERROR expected unit struct/variant or constant, found struct variant `E::Empty3`
36+
//~| GUESS E::Empty3 { /* fields */ }
3637
}
3738
match xe1 {
3839
XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
3940
}
4041
match xe3 {
4142
XE::XEmpty3 => ()
4243
//~^ ERROR expected unit struct/variant or constant, found struct variant `XE::XEmpty3`
44+
//~| GUESS XE::XEmpty3 { /* fields */ }
4345
}
4446
}

src/test/compile-fail/empty-struct-braces-pat-2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ fn main() {
2323

2424
match e1 {
2525
Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
26+
//~^ GUESS Empty1 { /* fields */ }
2627
}
2728
match xe1 {
2829
XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
30+
//~^ GUESS XEmpty1 { /* fields */ }
2931
}
3032
match e1 {
3133
Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
34+
//~^ GUESS Empty1 { /* fields */ }
3235
}
3336
match xe1 {
3437
XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
38+
//~^ GUESS XEmpty1 { /* fields */ }
3539
}
3640
}

src/test/compile-fail/empty-struct-braces-pat-3.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ fn main() {
2626
match e3 {
2727
E::Empty3() => ()
2828
//~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3`
29+
//~| GUESS E::Empty3 { /* fields */ }
2930
}
3031
match xe3 {
3132
XE::XEmpty3() => ()
3233
//~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3`
34+
//~| GUESS XE::XEmpty3 { /* fields */ }
3335
}
3436
match e3 {
3537
E::Empty3(..) => ()
3638
//~^ ERROR expected tuple struct/variant, found struct variant `E::Empty3`
39+
//~| GUESS E::Empty3 { /* fields */ }
3740
}
3841
match xe3 {
3942
XE::XEmpty3(..) => ()
4043
//~^ ERROR expected tuple struct/variant, found struct variant `XE::XEmpty3
44+
//~| GUESS XE::XEmpty3 { /* fields */ }
4145
}
4246
}

src/test/compile-fail/empty-struct-tuple-pat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn main() {
4242
match xe5 {
4343
XE::XEmpty5 => (),
4444
//~^ ERROR expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
45+
//~| GUESS XE::XEmpty4
4546
_ => {},
4647
}
4748
}

src/test/compile-fail/empty-struct-unit-expr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ fn main() {
2525
let e2 = Empty2(); //~ ERROR expected function, found `Empty2`
2626
let e4 = E::Empty4();
2727
//~^ ERROR `E::Empty4` is being called, but it is not a function
28-
//~| HELP did you mean to write `E::Empty4`?
28+
//~| HELP did you mean to write
29+
//~| GUESS E::Empty4
2930
let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2`
3031
let xe4 = XE::XEmpty4();
3132
//~^ ERROR `XE::XEmpty4` is being called, but it is not a function
32-
//~| HELP did you mean to write `XE::XEmpty4`?
33+
//~| HELP did you mean to write
34+
//~| GUESS XE::XEmpty4
3335
}

src/test/compile-fail/empty-struct-unit-pat.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ fn main() {
2929

3030
match e2 {
3131
Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
32+
//~^ GUESS XEmpty6
3233
}
3334
match xe2 {
3435
XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
36+
//~^ GUESS XEmpty6
3537
}
3638
match e2 {
3739
Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
40+
//~^ GUESS XEmpty6
3841
}
3942
match xe2 {
4043
XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
44+
//~^ GUESS XEmpty6
4145
}
4246

4347
match e4 {
@@ -46,6 +50,7 @@ fn main() {
4650
match xe4 {
4751
XE::XEmpty4() => (),
4852
//~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
53+
//~| GUESS XE::XEmpty5
4954
_ => {},
5055
}
5156
match e4 {
@@ -54,6 +59,7 @@ fn main() {
5459
match xe4 {
5560
XE::XEmpty4(..) => (),
5661
//~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
62+
//~| GUESS XE::XEmpty5
5763
_ => {},
5864
}
5965
}

src/test/compile-fail/glob-resolve1.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ fn main() {
3636
import(); //~ ERROR: cannot find function `import` in this scope
3737

3838
foo::<A>(); //~ ERROR: cannot find type `A` in this scope
39+
//~^ GUESS B
3940
foo::<C>(); //~ ERROR: cannot find type `C` in this scope
41+
//~^ GUESS B
4042
foo::<D>(); //~ ERROR: cannot find type `D` in this scope
43+
//~^ GUESS B
4144
}

src/test/compile-fail/issue-10200.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fn foo(_: usize) -> Foo { Foo(false) }
1414
fn main() {
1515
match Foo(true) {
1616
foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
17+
//~| GUESS Foo
1718
=> ()
1819
}
1920
}

src/test/compile-fail/issue-11004.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ struct A { x: i32, y: f64 }
1515
#[cfg(not(works))]
1616
unsafe fn access(n:*mut A) -> (i32, f64) {
1717
let x : i32 = n.x; //~ no field `x` on type `*mut A`
18-
//~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).x`
18+
//~| HELP `n` is a raw pointer; perhaps you need to deref
19+
//~| GUESS (*n).x
1920
let y : f64 = n.y; //~ no field `y` on type `*mut A`
20-
//~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).y`
21+
//~| HELP `n` is a raw pointer; perhaps you need to deref
22+
//~| GUESS (*n).y
2123
(x, y)
2224
}
2325

src/test/compile-fail/issue-17441.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ fn main() {
1717
let _bar = Box::new(1_usize) as std::fmt::Debug;
1818
//~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug`
1919
//~^^ HELP try casting to a `Box` instead
20+
//~^^^ GUESS Box<std::fmt::Debug>
2021

2122
let _baz = 1_usize as std::fmt::Debug;
2223
//~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug`

src/test/compile-fail/issue-17546.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mod foo {
2121

2222
fn new() -> NoResult<MyEnum, String> {
2323
//~^ ERROR expected type, found variant `NoResult`
24+
//~| GUESS Result
2425
unimplemented!()
2526
}
2627
}
@@ -42,6 +43,7 @@ fn new() -> Result<foo::MyEnum, String> {
4243

4344
fn newer() -> NoResult<foo::MyEnum, String> {
4445
//~^ ERROR expected type, found variant `NoResult`
46+
//~| GUESS Result
4547
unimplemented!()
4648
}
4749

src/test/compile-fail/issue-18343.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ struct Obj<F> where F: FnMut() -> u32 {
1515
fn main() {
1616
let o = Obj { closure: || 42 };
1717
o.closure(); //~ ERROR no method named `closure` found
18-
//~^ NOTE use `(o.closure)(...)` if you meant to call the function stored in the `closure` field
18+
//~^ HELP did you mean to call the function stored in the `closure` field
19+
//~| GUESS (o.closure)
1920
}

src/test/compile-fail/issue-19086.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ fn main() {
1919
match f {
2020
FooB(a, b) => println!("{} {}", a, b),
2121
//~^ ERROR expected tuple struct/variant, found struct variant `FooB`
22+
//~| GUESS FooB { /* fields */ }
2223
}
2324
}

src/test/compile-fail/issue-19244-2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ const STRUCT: MyStruct = MyStruct { field: 42 };
1313

1414
fn main() {
1515
let a: [isize; STRUCT.nonexistent_field];
16-
//~^ no field `nonexistent_field` on type `MyStruct`
16+
//~^ ERROR no field `nonexistent_field` on type `MyStruct`
17+
//~| GUESS field
1718
}

src/test/compile-fail/issue-19922.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ enum Homura {
1515
fn main() {
1616
let homura = Homura::Akemi { kaname: () };
1717
//~^ ERROR variant `Homura::Akemi` has no field named `kaname`
18-
//~| NOTE field does not exist - did you mean `madoka`?
18+
//~| HELP field does not exist - did you mean
19+
//~| GUESS madoka
1920
}

src/test/compile-fail/issue-2392.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,45 +48,56 @@ fn main() {
4848

4949
let o_closure = Obj { closure: || 42, not_closure: 42 };
5050
o_closure.closure(); //~ ERROR no method named `closure` found
51-
//~^ NOTE use `(o_closure.closure)(...)` if you meant to call the function stored
51+
//~^ HELP did you mean to call the function stored in the `closure` field?
52+
//~| GUESS (o_closure.closure)
5253

5354
o_closure.not_closure(); //~ ERROR no method named `not_closure` found
54-
//~^ NOTE did you mean to write `o_closure.not_closure`?
55+
//~| HELP did you mean to write
56+
//~| GUESS o_closure.not_closure
5557

5658
let o_func = Obj { closure: func, not_closure: 5 };
5759
o_func.closure(); //~ ERROR no method named `closure` found
58-
//~^ NOTE use `(o_func.closure)(...)` if you meant to call the function stored
60+
//~^ HELP did you mean to call the function stored in the `closure` field?
61+
//~| GUESS (o_func.closure)
5962

6063
let boxed_fn = BoxedObj { boxed_closure: Box::new(func) };
6164
boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found
62-
//~^ NOTE use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored
65+
//~^ HELP did you mean to call the function stored in the `boxed_closure` field?
66+
//~| GUESS (boxed_fn.boxed_closure)
6367

6468
let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<FnBox() -> u32> };
6569
boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found
66-
//~^ NOTE use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored
70+
//~^ HELP did you mean to call the function stored in the `boxed_closure` field?
71+
//~| GUESS (boxed_closure.boxed_closure)
6772

6873
// test expression writing in the notes
6974

7075
let w = Wrapper { wrap: o_func };
7176
w.wrap.closure();//~ ERROR no method named `closure` found
72-
//~^ NOTE use `(w.wrap.closure)(...)` if you meant to call the function stored
77+
//~| HELP did you mean to call the function stored in
78+
//~| GUESS (w.wrap.closure)
7379

7480
w.wrap.not_closure();//~ ERROR no method named `not_closure` found
75-
//~^ NOTE did you mean to write `w.wrap.not_closure`?
81+
//~^ HELP did you mean to write
82+
//~| w.wrap.not_closure
7683

7784
check_expression().closure();//~ ERROR no method named `closure` found
78-
//~^ NOTE use `(check_expression().closure)(...)` if you meant to call the function stored
85+
//~| HELP did you mean to call the function stored in
86+
//~| GUESS (check_expression().closure)
7987
}
8088

8189
impl FuncContainerOuter {
8290
fn run(&self) {
8391
unsafe {
8492
(*self.container).f1(1); //~ ERROR no method named `f1` found
85-
//~^ NOTE use `((*self.container).f1)(...)`
93+
//~^ HELP did you mean to call the function stored in the `f1` field?
94+
//~| GUESS ((*self.container).f1)
8695
(*self.container).f2(1); //~ ERROR no method named `f2` found
87-
//~^ NOTE use `((*self.container).f2)(...)`
96+
//~^ HELP did you mean to call the function stored in the `f2` field?
97+
//~| GUESS ((*self.container).f2)
8898
(*self.container).f3(1); //~ ERROR no method named `f3` found
89-
//~^ NOTE use `((*self.container).f3)(...)`
99+
//~^ HELP did you mean to call the function stored in the `f3` field?
100+
//~| GUESS ((*self.container).f3)
90101
}
91102
}
92103
}

src/test/compile-fail/issue-31845.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Checks lexical scopes cannot see through normal module boundries
11+
// Checks lexical scopes cannot see through normal module boundaries
1212

1313
fn f() {
1414
fn g() {}
1515
mod foo {
1616
fn h() {
1717
g(); //~ ERROR cannot find function `g` in this scope
18+
//~^ GUESS h
1819
}
1920
}
2021
}

src/test/compile-fail/issue-32004.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn main() {
1919
match Foo::Baz {
2020
Foo::Bar => {}
2121
//~^ ERROR expected unit struct/variant or constant, found tuple variant `Foo::Bar`
22+
//~| GUESS Foo::Baz
2223
_ => {}
2324
}
2425

src/test/compile-fail/issue-32086.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ const C: S = S(10);
1313

1414
fn main() {
1515
let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
16+
//~^ GUESS S
1617
let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
18+
//~^ GUESS S
1719
}

src/test/compile-fail/issue-32128.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ fn main() {
2020
};
2121

2222
demo.example(1); //~ ERROR no method named `example`
23-
//~^ NOTE use `(demo.example)(...)`
23+
//~^ GUESS (demo.example)
2424
// (demo.example)(1);
2525
}

0 commit comments

Comments
 (0)