1
Fork 0

fix transmute-from-fn-item-types-lint

This test was relying on buggy behavior.
This commit is contained in:
Niko Matsakis 2016-04-21 04:51:29 -04:00
parent 906cc48d48
commit 399149ac7e

View file

@ -15,15 +15,15 @@ use std::mem;
unsafe fn foo() -> (isize, *const (), Option<fn()>) { unsafe fn foo() -> (isize, *const (), Option<fn()>) {
let i = mem::transmute(bar); let i = mem::transmute(bar);
//~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting //~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting
//~^^ ERROR was previously accepted //~^^ WARNING was previously accepted
let p = mem::transmute(foo); let p = mem::transmute(foo);
//~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting //~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting
//~^^ ERROR was previously accepted //~^^ WARNING was previously accepted
let of = mem::transmute(main); let of = mem::transmute(main);
//~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting //~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting
//~^^ ERROR was previously accepted //~^^ WARNING was previously accepted
(i, p, of) (i, p, of)
} }
@ -31,11 +31,11 @@ unsafe fn foo() -> (isize, *const (), Option<fn()>) {
unsafe fn bar() { unsafe fn bar() {
mem::transmute::<_, *mut ()>(foo); mem::transmute::<_, *mut ()>(foo);
//~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting //~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting
//~^^ ERROR was previously accepted //~^^ WARNING was previously accepted
mem::transmute::<_, fn()>(bar); mem::transmute::<_, fn()>(bar);
//~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting //~^ ERROR is now zero-sized and has to be cast to a pointer before transmuting
//~^^ ERROR was previously accepted //~^^ WARNING was previously accepted
// No error if a coercion would otherwise occur. // No error if a coercion would otherwise occur.
mem::transmute::<fn(), usize>(main); mem::transmute::<fn(), usize>(main);