File tree 4 files changed +13
-11
lines changed
4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ declare_lint! {
43
43
/// }
44
44
/// ```
45
45
pub IMPLICIT_UNSAFE_AUTOREFS ,
46
- Deny ,
46
+ Warn ,
47
47
"implicit reference to a dereference of a raw pointer"
48
48
}
49
49
Original file line number Diff line number Diff line change
1
+ // check-pass
1
2
// run-rustfix
2
3
use std::ptr::{addr_of, addr_of_mut};
3
4
4
5
unsafe fn _test_mut(ptr: *mut [u8]) -> *mut [u8] {
5
6
addr_of_mut!((&mut (*ptr))[..16])
6
- //~^ error : implicit auto-ref creates a reference to a dereference of a raw pointer
7
+ //~^ warn : implicit auto-ref creates a reference to a dereference of a raw pointer
7
8
}
8
9
9
10
unsafe fn _test_const(ptr: *const [u8]) -> *const [u8] {
10
11
addr_of!((&(*ptr))[..16])
11
- //~^ error : implicit auto-ref creates a reference to a dereference of a raw pointer
12
+ //~^ warn : implicit auto-ref creates a reference to a dereference of a raw pointer
12
13
}
13
14
14
15
fn main() {}
Original file line number Diff line number Diff line change
1
+ // check-pass
1
2
// run-rustfix
2
3
use std:: ptr:: { addr_of, addr_of_mut} ;
3
4
4
5
unsafe fn _test_mut ( ptr : * mut [ u8 ] ) -> * mut [ u8 ] {
5
6
addr_of_mut ! ( ( * ptr) [ ..16 ] )
6
- //~^ error : implicit auto-ref creates a reference to a dereference of a raw pointer
7
+ //~^ warn : implicit auto-ref creates a reference to a dereference of a raw pointer
7
8
}
8
9
9
10
unsafe fn _test_const ( ptr : * const [ u8 ] ) -> * const [ u8 ] {
10
11
addr_of ! ( ( * ptr) [ ..16 ] )
11
- //~^ error : implicit auto-ref creates a reference to a dereference of a raw pointer
12
+ //~^ warn : implicit auto-ref creates a reference to a dereference of a raw pointer
12
13
}
13
14
14
15
fn main ( ) { }
Original file line number Diff line number Diff line change 1
- error : implicit auto-ref creates a reference to a dereference of a raw pointer
2
- --> $DIR/implicit_unsafe_autorefs.rs:5 :18
1
+ warning : implicit auto-ref creates a reference to a dereference of a raw pointer
2
+ --> $DIR/implicit_unsafe_autorefs.rs:6 :18
3
3
|
4
4
LL | addr_of_mut!((*ptr)[..16])
5
5
| ^^^^^^
6
6
|
7
7
= note: creating a reference requires the pointer to be valid and imposes aliasing requirements
8
- = note: `#[deny (implicit_unsafe_autorefs)]` on by default
8
+ = note: `#[warn (implicit_unsafe_autorefs)]` on by default
9
9
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
10
10
|
11
11
LL | addr_of_mut!((&mut (*ptr))[..16])
12
12
| +++++ +
13
13
14
- error : implicit auto-ref creates a reference to a dereference of a raw pointer
15
- --> $DIR/implicit_unsafe_autorefs.rs:10 :14
14
+ warning : implicit auto-ref creates a reference to a dereference of a raw pointer
15
+ --> $DIR/implicit_unsafe_autorefs.rs:11 :14
16
16
|
17
17
LL | addr_of!((*ptr)[..16])
18
18
| ^^^^^^
@@ -23,5 +23,5 @@ help: try using a raw pointer method instead; or if this reference is intentiona
23
23
LL | addr_of!((&(*ptr))[..16])
24
24
| ++ +
25
25
26
- error: aborting due to 2 previous errors
26
+ warning: 2 warnings emitted
27
27
You can’t perform that action at this time.
0 commit comments