Skip to content

Commit f4e2b5c

Browse files
committed
compiler: Parse p- specs in datalayout string, allow definition of custom default data address space
1 parent daf9adb commit f4e2b5c

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

clippy_lints/src/casts/fn_to_numeric_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1717
ty::FnDef(..) | ty::FnPtr(..) => {
1818
let mut applicability = Applicability::MaybeIncorrect;
1919

20-
if to_nbits >= cx.tcx.data_layout.pointer_size.bits() && !cast_to.is_usize() {
20+
if to_nbits >= cx.tcx.data_layout.pointer_size().bits() && !cast_to.is_usize() {
2121
let from_snippet = snippet_with_applicability(cx, cast_expr.span, "x", &mut applicability);
2222
span_lint_and_sugg(
2323
cx,

clippy_lints/src/casts/fn_to_numeric_cast_with_truncation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1717
let mut applicability = Applicability::MaybeIncorrect;
1818
let from_snippet = snippet_with_applicability(cx, cast_expr.span, "x", &mut applicability);
1919

20-
if to_nbits < cx.tcx.data_layout.pointer_size.bits() {
20+
if to_nbits < cx.tcx.data_layout.pointer_size().bits() {
2121
span_lint_and_sugg(
2222
cx,
2323
FN_TO_NUMERIC_CAST_WITH_TRUNCATION,

clippy_lints/src/casts/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::ty::{self, AdtDef, IntTy, Ty, TyCtxt, UintTy, VariantDiscr};
55
/// integral type.
66
pub(super) fn int_ty_to_nbits(tcx: TyCtxt<'_>, ty: Ty<'_>) -> Option<u64> {
77
match ty.kind() {
8-
ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Some(tcx.data_layout.pointer_size.bits()),
8+
ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Some(tcx.data_layout.pointer_size().bits()),
99
ty::Int(i) => i.bit_width(),
1010
ty::Uint(i) => i.bit_width(),
1111
_ => None,

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ declare_lint_pass!(UnportableVariant => [ENUM_CLIKE_UNPORTABLE_VARIANT]);
3535
impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
3636
#[expect(clippy::cast_possible_wrap)]
3737
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
38-
if cx.tcx.data_layout.pointer_size.bits() != 64 {
38+
if cx.tcx.data_layout.pointer_size().bits() != 64 {
3939
return;
4040
}
4141
if let ItemKind::Enum(_, _, def) = &item.kind {

clippy_utils/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ fn mir_is_empty<'tcx>(tcx: TyCtxt<'tcx>, result: mir::Const<'tcx>) -> Option<boo
918918
// Get the length from the slice, using the same formula as
919919
// [`ConstValue::try_get_slice_bytes_for_diagnostics`].
920920
let a = tcx.global_alloc(alloc_id).unwrap_memory().inner();
921-
let ptr_size = tcx.data_layout.pointer_size;
921+
let ptr_size = tcx.data_layout.pointer_size();
922922
if a.size() < offset + 2 * ptr_size {
923923
// (partially) dangling reference
924924
return None;

0 commit comments

Comments
 (0)