From 2f4c31383fc4f42e78d2f2e188eecb308f18f9db Mon Sep 17 00:00:00 2001 From: Urgau Date: Thu, 9 Nov 2023 18:13:52 +0100 Subject: [PATCH] Adjust tests for newly added invalid_pointer_trait_comparisons lint --- library/alloc/tests/vec.rs | 2 +- src/tools/miri/tests/pass/pointers.rs | 1 + src/tools/miri/tests/pass/rc.rs | 1 + tests/ui/mir/mir_raw_fat_ptr.rs | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index d44dcfbf67301..497fff4df2ccf 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -1933,7 +1933,7 @@ fn vec_macro_repeating_null_raw_fat_pointer() { let vec = vec![null_raw_dyn; 1]; dbg!(ptr_metadata(vec[0])); - assert!(vec[0] == null_raw_dyn); + assert!(std::ptr::eq(vec[0], null_raw_dyn)); // Polyfill for https://github.com/rust-lang/rfcs/pull/2580 diff --git a/src/tools/miri/tests/pass/pointers.rs b/src/tools/miri/tests/pass/pointers.rs index 1525ded6151e8..f80bff3e057c6 100644 --- a/src/tools/miri/tests/pass/pointers.rs +++ b/src/tools/miri/tests/pass/pointers.rs @@ -2,6 +2,7 @@ //@[tree]compile-flags: -Zmiri-tree-borrows //@compile-flags: -Zmiri-permissive-provenance #![feature(ptr_metadata, const_raw_ptr_comparison)] +#![allow(invalid_pointer_trait_comparisons)] use std::mem::{self, transmute}; use std::ptr; diff --git a/src/tools/miri/tests/pass/rc.rs b/src/tools/miri/tests/pass/rc.rs index 6375abcd23286..1db49fd106c66 100644 --- a/src/tools/miri/tests/pass/rc.rs +++ b/src/tools/miri/tests/pass/rc.rs @@ -3,6 +3,7 @@ //@compile-flags: -Zmiri-strict-provenance #![feature(new_uninit)] #![feature(get_mut_unchecked)] +#![allow(invalid_pointer_trait_comparisons)] use std::cell::{Cell, RefCell}; use std::fmt::Debug; diff --git a/tests/ui/mir/mir_raw_fat_ptr.rs b/tests/ui/mir/mir_raw_fat_ptr.rs index 6aceefbe7159d..c7227c2ee3823 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.rs +++ b/tests/ui/mir/mir_raw_fat_ptr.rs @@ -1,7 +1,9 @@ // run-pass // check raw fat pointer ops in mir // FIXME: please improve this when we get monomorphization support + #![feature(raw_ref_op)] +#![allow(invalid_pointer_trait_comparisons)] use std::mem;