Skip to content

Commit b423eb9

Browse files
committed
Update error messages in UI tests
1 parent c7470de commit b423eb9

File tree

22 files changed

+53
-53
lines changed

22 files changed

+53
-53
lines changed

src/test/ui/asm/x86_64/type-check-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn main() {
6464
let mut r = &mut 0;
6565
asm!("{}", in(reg) f);
6666
asm!("{}", inout(reg) f);
67-
//~^ ERROR cannot use value of type `fn() {main}` for inline assembly
67+
//~^ ERROR cannot use value of type `[fn item {main}: fn()]` for inline assembly
6868
asm!("{}", in(reg) r);
6969
asm!("{}", inout(reg) r);
7070
//~^ ERROR cannot use value of type `&mut i32` for inline assembly

src/test/ui/associated-types/substs-ppaux.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ fn foo<'z>() where &'z (): Sized {
1616
let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
1717
//[verbose]~^ ERROR mismatched types
1818
//[verbose]~| expected unit type `()`
19-
//[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
19+
//[verbose]~| found fn item `[fn item {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}: fn()]`
2020
//[normal]~^^^^ ERROR mismatched types
2121
//[normal]~| expected unit type `()`
22-
//[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
22+
//[normal]~| found fn item `[fn item {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}: fn()]`
2323

2424

2525
let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
2626
//[verbose]~^ ERROR mismatched types
2727
//[verbose]~| expected unit type `()`
28-
//[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
28+
//[verbose]~| found fn item `[fn item {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}: fn()]`
2929
//[normal]~^^^^ ERROR mismatched types
3030
//[normal]~| expected unit type `()`
31-
//[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
31+
//[normal]~| found fn item `[fn item {<i8 as Foo<'static, 'static>>::bar::<'static, char>}: fn()]`
3232

3333
let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
3434
//[verbose]~^ ERROR mismatched types
3535
//[verbose]~| expected unit type `()`
36-
//[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
36+
//[verbose]~| found fn item `[fn item {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}: fn()]`
3737
//[normal]~^^^^ ERROR mismatched types
3838
//[normal]~| expected unit type `()`
39-
//[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
39+
//[normal]~| found fn item `[fn item {<i8 as Foo<'static, 'static, u8>>::baz}: fn()]`
4040

4141
let x: () = foo::<'static>;
4242
//[verbose]~^ ERROR mismatched types
4343
//[verbose]~| expected unit type `()`
44-
//[verbose]~| found fn item `fn() {foo::<ReStatic>}`
44+
//[verbose]~| found fn item `[fn item {foo::<ReStatic>}: fn()]`
4545
//[normal]~^^^^ ERROR mismatched types
4646
//[normal]~| expected unit type `()`
47-
//[normal]~| found fn item `fn() {foo::<'static>}`
47+
//[normal]~| found fn item `[fn item {foo::<'static>}: fn()]`
4848

4949
<str as Foo<u8>>::bar;
5050
//[verbose]~^ ERROR the size for values of type

src/test/ui/binop/issue-77910-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ fn main() {
77
// we shouldn't ice with the bound var here.
88
assert_eq!(foo, y);
99
//~^ ERROR binary operation `==` cannot be applied to type
10-
//~| ERROR `for<'r> fn(&'r i32) -> &'r i32 {foo}` doesn't implement `Debug`
10+
//~| ERROR `[fn item {foo}: for<'r> fn(&'r i32) -> &'r i32]` doesn't implement `Debug`
1111
}

src/test/ui/c-variadic/issue-32201.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn bar(_: *const u8) {}
77
fn main() {
88
unsafe {
99
foo(0, bar);
10-
//~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function
10+
//~^ ERROR can't pass `[fn item {bar}: fn(*const u8)]` to variadic function
1111
//~| HELP cast the value to `fn(*const u8)`
1212
}
1313
}

src/test/ui/error-codes/E0617.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
//~^ ERROR can't pass `u16` to variadic function
2121
//~| HELP cast the value to `c_uint`
2222
printf(::std::ptr::null(), printf);
23-
//~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
23+
//~^ ERROR can't pass `[fn item {printf}: unsafe extern "C" fn(*const i8, ...)]` to variadic function
2424
//~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
2525
}
2626
}

src/test/ui/extern/extern-wrong-value-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ fn main() {
77
// extern functions are extern "C" fn
88
let _x: extern "C" fn() = f; // OK
99
is_fn(f);
10-
//~^ ERROR expected a `Fn<()>` closure, found `extern "C" fn() {f}`
10+
//~^ ERROR expected a `Fn<()>` closure, found `[fn item {f}: extern "C" fn()]`
1111
}

src/test/ui/fn/fn-item-type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ impl<T> Foo for T { /* `foo` is still default here */ }
1212
fn main() {
1313
eq(foo::<u8>, bar::<u8>);
1414
//~^ ERROR mismatched types
15-
//~| expected fn item `fn(_) -> _ {foo::<u8>}`
16-
//~| found fn item `fn(_) -> _ {bar::<u8>}`
15+
//~| expected fn item `[fn item {foo::<u8>}: fn(_) -> _]`
16+
//~| found fn item `[fn item {bar::<u8>}: fn(_) -> _]`
1717
//~| expected fn item, found a different fn item
1818
//~| different `fn` items always have unique types, even if their signatures are the same
1919
//~| change the expected type to be function pointer
@@ -28,7 +28,7 @@ fn main() {
2828

2929
eq(bar::<String>, bar::<Vec<u8>>);
3030
//~^ ERROR mismatched types
31-
//~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
31+
//~| found fn item `[fn item {bar::<Vec<u8>>}: fn(_) -> _]`
3232
//~| expected struct `String`, found struct `Vec`
3333
//~| different `fn` items always have unique types, even if their signatures are the same
3434
//~| change the expected type to be function pointer

src/test/ui/hygiene/impl_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod foo {
99
}
1010

1111
pub macro m() {
12-
let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private
12+
let _: () = S.f(); //~ ERROR type `[fn item {foo::S::f}: for<'r> fn(&'r foo::S)]` is private
1313
}
1414
}
1515

src/test/ui/hygiene/intercrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ extern crate intercrate;
88

99
fn main() {
1010
assert_eq!(intercrate::foo::m!(), 1);
11-
//~^ ERROR type `fn() -> u32 {foo::bar::f}` is private
11+
//~^ ERROR type `[fn item {foo::bar::f}: fn() -> u32]` is private
1212
}

src/test/ui/issues/issue-59488.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ enum Foo {
1212

1313
fn main() {
1414
foo > 12;
15-
//~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369]
15+
//~^ ERROR binary operation `>` cannot be applied to type `[fn item {foo}: fn() -> i32]` [E0369]
1616
//~| ERROR mismatched types [E0308]
1717

1818
bar > 13;
19-
//~^ ERROR binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` [E0369]
19+
//~^ ERROR binary operation `>` cannot be applied to type `[fn item {bar}: fn(i64) -> i64]` [E0369]
2020
//~| ERROR mismatched types [E0308]
2121

2222
foo > foo;
23-
//~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369]
23+
//~^ ERROR binary operation `>` cannot be applied to type `[fn item {foo}: fn() -> i32]` [E0369]
2424

2525
foo > bar;
26-
//~^ ERROR binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369]
26+
//~^ ERROR binary operation `>` cannot be applied to type `[fn item {foo}: fn() -> i32]` [E0369]
2727
//~| ERROR mismatched types [E0308]
2828

2929
let i = Foo::Bar;
3030
assert_eq!(Foo::Bar, i);
31-
//~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369]
32-
//~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277]
31+
//~^ ERROR binary operation `==` cannot be applied to type `[fn item {Foo::Bar}: fn(usize) -> Foo]` [E0369]
32+
//~| ERROR `[fn item {Foo::Bar}: fn(usize) -> Foo]` doesn't implement `Debug` [E0277]
3333
}

src/test/ui/lint/trivial_casts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn main() {
6767

6868
// functions
6969
fn baz(_x: i32) {}
70-
let _ = &baz as &dyn Fn(i32); //~ERROR `&fn(i32) {baz}` as `&dyn Fn(i32)`
70+
let _ = &baz as &dyn Fn(i32); //~ERROR `&[fn item {baz}: fn(i32)]` as `&dyn Fn(i32)`
7171
let _: &dyn Fn(i32) = &baz;
7272
let x = |_x: i32| {};
7373
let _ = &x as &dyn Fn(i32); //~ERROR trivial cast

src/test/ui/privacy/associated-item-privacy-inherent.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ mod priv_nominal {
1111

1212
pub macro mac() {
1313
let value = Pub::method;
14-
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
14+
//~^ ERROR type `[fn item {priv_nominal::Pub::method}: for<'r> fn(&'r priv_nominal::Pub)]` is private
1515
value;
16-
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
16+
//~^ ERROR type `[fn item {priv_nominal::Pub::method}: for<'r> fn(&'r priv_nominal::Pub)]` is private
1717
Pub.method();
18-
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
18+
//~^ ERROR type `[fn item {priv_nominal::Pub::method}: for<'r> fn(&'r priv_nominal::Pub)]` is private
1919
Pub::CONST;
2020
//~^ ERROR associated constant `CONST` is private
2121
// let _: Pub::AssocTy;

src/test/ui/privacy/associated-item-privacy-trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ mod priv_trait {
1313

1414
pub macro mac() {
1515
let value = <Pub as PrivTr>::method;
16-
//~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
16+
//~^ ERROR type `[fn item {<priv_trait::Pub as PrivTr>::method}: for<'r> fn(&'r priv_trait::Pub)]` is private
1717
value;
18-
//~^ ERROR type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as PrivTr>::method}` is private
18+
//~^ ERROR type `[fn item {<priv_trait::Pub as PrivTr>::method}: for<'r> fn(&'r priv_trait::Pub)]` is private
1919
Pub.method();
20-
//~^ ERROR type `for<'r> fn(&'r Self) {<Self as PrivTr>::method}` is private
20+
//~^ ERROR type `[fn item {<Self as PrivTr>::method}: for<'r> fn(&'r Self)]` is private
2121
<Pub as PrivTr>::CONST;
2222
//~^ ERROR associated constant `<Pub as PrivTr>::CONST` is private
2323
let _: <Pub as PrivTr>::AssocTy;

src/test/ui/privacy/private-inferred-type-3.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// aux-build:private-inferred-type.rs
22

3-
// error-pattern:type `fn() {ext::priv_fn}` is private
3+
// error-pattern:type `[fn item {ext::priv_fn}: fn()]` is private
44
// error-pattern:static `PRIV_STATIC` is private
55
// error-pattern:type `ext::PrivEnum` is private
6-
// error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
7-
// error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
8-
// error-pattern:type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
9-
// error-pattern:type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
6+
// error-pattern:type `[fn item {<u8 as ext::PrivTrait>::method}: fn()]` is private
7+
// error-pattern:type `[fn item {ext::PrivTupleStruct}: fn(u8) -> ext::PrivTupleStruct]` is private
8+
// error-pattern:type `[fn item {PubTupleStruct}: fn(u8) -> PubTupleStruct]` is private
9+
// error-pattern:type `[fn item {Pub::<u8>::priv_method}: for<'r> fn(&'r Pub<u8>)]` is private
1010

1111
#![feature(decl_macro)]
1212

src/test/ui/privacy/private-inferred-type.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ mod m {
3636
impl TraitWithAssocTy for Priv { type AssocTy = u8; }
3737

3838
pub macro m() {
39-
priv_fn; //~ ERROR type `fn() {priv_fn}` is private
39+
priv_fn; //~ ERROR type `[fn item {priv_fn}: fn()]` is private
4040
PRIV_STATIC; // OK, not cross-crate
4141
PrivEnum::Variant; //~ ERROR type `PrivEnum` is private
4242
PubEnum::Variant; // OK
43-
<u8 as PrivTrait>::method; //~ ERROR type `fn() {<u8 as PrivTrait>::method}` is private
43+
<u8 as PrivTrait>::method; //~ ERROR type `[fn item {<u8 as PrivTrait>::method}: fn()]` is private
4444
<u8 as PubTrait>::method; // OK
4545
PrivTupleStruct;
46-
//~^ ERROR type `fn(u8) -> PrivTupleStruct {PrivTupleStruct}` is private
46+
//~^ ERROR type `[fn item {PrivTupleStruct}: fn(u8) -> PrivTupleStruct]` is private
4747
PubTupleStruct;
48-
//~^ ERROR type `fn(u8) -> PubTupleStruct {PubTupleStruct}` is private
48+
//~^ ERROR type `[fn item {PubTupleStruct}: fn(u8) -> PubTupleStruct]` is private
4949
Pub(0u8).priv_method();
50-
//~^ ERROR type `for<'r> fn(&'r Pub<u8>) {Pub::<u8>::priv_method}` is private
50+
//~^ ERROR type `[fn item {Pub::<u8>::priv_method}: for<'r> fn(&'r Pub<u8>)]` is private
5151
}
5252

5353
trait Trait {}

src/test/ui/proc-macro/signature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ extern crate proc_macro;
88

99
#[proc_macro_derive(A)]
1010
pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 {
11-
//~^ ERROR: expected a `Fn<(proc_macro::TokenStream,)>` closure, found `unsafe extern "C" fn
11+
//~^ ERROR: expected a `Fn<(proc_macro::TokenStream,)>` closure, found `[fn item {foo}: unsafe extern "C" fn
1212
loop {}
1313
}

src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ fn call_once(f: impl FnOnce()) {
2121
}
2222

2323
fn main() {
24-
call(foo); //~ ERROR expected a `Fn<()>` closure, found `fn() {foo}`
25-
call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `fn() {foo}`
26-
call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `fn() {foo}`
24+
call(foo); //~ ERROR expected a `Fn<()>` closure, found `[fn item {foo}: fn()]`
25+
call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `[fn item {foo}: fn()]`
26+
call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `[fn item {foo}: fn()]`
2727

2828
call(foo_unsafe);
29-
//~^ ERROR expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
29+
//~^ ERROR expected a `Fn<()>` closure, found `[fn item {foo_unsafe}: unsafe fn()]`
3030
call_mut(foo_unsafe);
31-
//~^ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
31+
//~^ ERROR expected a `FnMut<()>` closure, found `[fn item {foo_unsafe}: unsafe fn()]`
3232
call_once(foo_unsafe);
33-
//~^ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
33+
//~^ ERROR expected a `FnOnce<()>` closure, found `[fn item {foo_unsafe}: unsafe fn()]`
3434
}

src/test/ui/type-alias-impl-trait/issue-98608.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fn hi() -> impl Sized { std::ptr::null::<u8>() }
22

33
fn main() {
44
let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
5-
//~^ ERROR type mismatch resolving `<fn() -> impl Sized {hi} as FnOnce<()>>::Output == Box<u8>`
5+
//~^ ERROR type mismatch resolving `<[fn item {hi}: fn() -> impl Sized] as FnOnce<()>>::Output == Box<u8>`
66
let boxed = b();
77
let null = *boxed;
88
println!("{null:?}");

src/test/ui/typeck/issue-87181/empty-tuple-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ impl Foo {
1010
fn main() {
1111
let thing = Bar { bar: Foo };
1212
thing.bar.foo();
13-
//~^ ERROR no method named `foo` found for fn item `fn() -> Foo {Foo}` in the current scope [E0599]
13+
//~^ ERROR no method named `foo` found for fn item `[fn item {Foo}: fn() -> Foo]` in the current scope [E0599]
1414
}

src/test/ui/typeck/issue-87181/enum-variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ impl Foo {
1212
fn main() {
1313
let thing = Bar { bar: Foo::Tup };
1414
thing.bar.foo();
15-
//~^ ERROR no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` in the current scope [E0599]
15+
//~^ ERROR no method named `foo` found for fn item `[fn item {Foo::Tup}: fn() -> Foo]` in the current scope [E0599]
1616
}

src/test/ui/typeck/issue-87181/tuple-field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ impl Foo {
1010
fn main() {
1111
let thing = Bar { bar: Foo };
1212
thing.bar.0;
13-
//~^ ERROR no field `0` on type `fn(char, u16) -> Foo {Foo}` [E0609]
13+
//~^ ERROR no field `0` on type `[fn item {Foo}: fn(char, u16) -> Foo]` [E0609]
1414
}

src/test/ui/typeck/issue-87181/tuple-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ impl Foo {
1010
fn main() {
1111
let thing = Bar { bar: Foo };
1212
thing.bar.foo();
13-
//~^ ERROR no method named `foo` found for fn item `fn(u8, i32) -> Foo {Foo}` in the current scope [E0599]
13+
//~^ ERROR no method named `foo` found for fn item `[fn item {Foo}: fn(u8, i32) -> Foo]` in the current scope [E0599]
1414
}

0 commit comments

Comments
 (0)