File tree Expand file tree Collapse file tree 4 files changed +7
-8
lines changed
violations_coverage/unsafe_method/sneaked_unsafe Expand file tree Collapse file tree 4 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ macro_rules! internal_prudent_unsafe_method {
214214 // We **cannot** just move/take/assign $self by value, in case it's a non-Copy
215215 // **static** variable. See also comments in
216216 // unsafe_method_internal_build_accessors_check_args_call.
217- let rref = {
217+ let mref = {
218218 #[ rustfmt:: skip]
219219 #[ deny( unused_unsafe) ]
220220 // @TODO simplify once https://github.com/rust-lang/rust/issues/15701
@@ -230,10 +230,8 @@ macro_rules! internal_prudent_unsafe_method {
230230 #[ expect( unsafe_code) ]
231231 ) ?
232232 let rref = & ( $self ) ;
233- rref
233+ :: prudent :: unlinted :: shared_to_mut ( rref )
234234 } ;
235- //
236- let mref = :: prudent:: unlinted:: shared_to_mut( rref) ;
237235 #[ allow( unused_mut) ]
238236 #[ allow( invalid_value) ]
239237 let mut owned_receiver = :: core:: mem:: replace( mref, unsafe { :: core:: mem:: zeroed( ) } ) ;
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ pub use crate::linted_untested::PRUDENT_INTERNAL_LINTED_VERSION;
5656/// ```
5757/// test cfg test:
5858/// ```test_harness
59+ /// // test_harness -as per https://github.com/rust-lang/rust/issues/148942#issuecomment-3565011334
5960/// #[cfg(not(test))]
6061/// compile_error!("NOT DOCTEST!");
6162/// ```
@@ -195,13 +196,13 @@ pub use crate::linted_untested::internal_prudent_unsafe_method;
195196pub const _: ( ) = { } ;
196197
197198/// ```compile_fail,E0133
198- #[ doc = include_str ! ( "../violations_coverage/unsafe_method/sneaked_unsafe/self_some_args .rs" ) ]
199+ #[ doc = include_str ! ( "../violations_coverage/unsafe_method/sneaked_unsafe/self_zero_args .rs" ) ]
199200/// ```
200201#[ cfg( doctest) ]
201202pub const _: ( ) = { } ;
202203
203204/// ```compile_fail,E0133
204- #[ doc = include_str ! ( "../violations_coverage/unsafe_method/sneaked_unsafe/self_zero_args .rs" ) ]
205+ #[ doc = include_str ! ( "../violations_coverage/unsafe_method/sneaked_unsafe/self_some_args .rs" ) ]
205206/// ```
206207#[ cfg( doctest) ]
207208pub const _: ( ) = { } ;
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ macro_rules! allow_unsafe_expect_unsafe_is_correct {
316316/// NOT a part of public API. Pretend to get a mutable reference from a shared reference. For
317317/// internal/generated **compile-time** checks only.
318318#[ doc( hidden) ]
319- pub const fn shared_to_mut < T > ( _: & T ) -> & mut T {
319+ pub const fn shared_to_mut < T > ( _: & T ) -> & ' static mut T {
320320 unreachable ! ( )
321321}
322322
Original file line number Diff line number Diff line change 88}
99
1010unsafe fn new_receiver ( ) -> S {
11- unreachable ! ( ) ;
11+ unreachable ! ( )
1212}
1313
1414fn main ( ) {
You can’t perform that action at this time.
0 commit comments