Skip to content

Commit 8aa8f42

Browse files
committed
Auto merge of #5667 - djugei:master, r=flip1995
moved cast_ptr_alignment to pedantic and expanded documentation fixes: #5618 changelog: cast_ptr_alignment moved to pedantic
2 parents 8b191b5 + 18b5cee commit 8aa8f42

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clippy_lints/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11671167
LintId::of(&types::CAST_POSSIBLE_TRUNCATION),
11681168
LintId::of(&types::CAST_POSSIBLE_WRAP),
11691169
LintId::of(&types::CAST_PRECISION_LOSS),
1170+
LintId::of(&types::CAST_PTR_ALIGNMENT),
11701171
LintId::of(&types::CAST_SIGN_LOSS),
11711172
LintId::of(&types::IMPLICIT_HASHER),
11721173
LintId::of(&types::INVALID_UPCAST_COMPARISONS),
@@ -1413,7 +1414,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14131414
LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
14141415
LintId::of(&types::BORROWED_BOX),
14151416
LintId::of(&types::BOX_VEC),
1416-
LintId::of(&types::CAST_PTR_ALIGNMENT),
14171417
LintId::of(&types::CAST_REF_TO_MUT),
14181418
LintId::of(&types::CHAR_LIT_AS_U8),
14191419
LintId::of(&types::FN_TO_NUMERIC_CAST),
@@ -1673,7 +1673,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16731673
LintId::of(&transmute::WRONG_TRANSMUTE),
16741674
LintId::of(&transmuting_null::TRANSMUTING_NULL),
16751675
LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
1676-
LintId::of(&types::CAST_PTR_ALIGNMENT),
16771676
LintId::of(&types::CAST_REF_TO_MUT),
16781677
LintId::of(&types::UNIT_CMP),
16791678
LintId::of(&unicode::ZERO_WIDTH_SPACE),

clippy_lints/src/types.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,15 +974,16 @@ declare_clippy_lint! {
974974
/// behavior.
975975
///
976976
/// **Known problems:** Using `std::ptr::read_unaligned` and `std::ptr::write_unaligned` or similar
977-
/// on the resulting pointer is fine.
977+
/// on the resulting pointer is fine. Is over-zealous: Casts with manual alignment checks or casts like
978+
/// u64-> u8 -> u16 can be fine. Miri is able to do a more in-depth analysis.
978979
///
979980
/// **Example:**
980981
/// ```rust
981982
/// let _ = (&1u8 as *const u8) as *const u16;
982983
/// let _ = (&mut 1u8 as *mut u8) as *mut u16;
983984
/// ```
984985
pub CAST_PTR_ALIGNMENT,
985-
correctness,
986+
pedantic,
986987
"cast from a pointer to a more-strictly-aligned pointer"
987988
}
988989

src/lintlist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
166166
},
167167
Lint {
168168
name: "cast_ptr_alignment",
169-
group: "correctness",
169+
group: "pedantic",
170170
desc: "cast from a pointer to a more-strictly-aligned pointer",
171171
deprecation: None,
172172
module: "types",

0 commit comments

Comments
 (0)