mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Auto merge of #132262 - matthiaskrgr:rollup-pcphi6l, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #131391 (Stabilize `isqrt` feature) - #132248 (rustc_transmute: Directly use types from rustc_abi) - #132252 (compiler: rename LayoutS to LayoutData) - #132253 (Known-bug test for `keyword_idents` lint not propagating to other files) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
9f57edf2e2
@ -4496,6 +4496,7 @@ name = "rustc_transmute"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast_ir",
|
"rustc_ast_ir",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
@ -4503,7 +4504,6 @@ dependencies = [
|
|||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use tracing::debug;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Abi, AbiAndPrefAlign, Align, FieldsShape, HasDataLayout, IndexSlice, IndexVec, Integer,
|
Abi, AbiAndPrefAlign, Align, FieldsShape, HasDataLayout, IndexSlice, IndexVec, Integer,
|
||||||
LayoutS, Niche, NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding,
|
LayoutData, Niche, NonZeroUsize, Primitive, ReprOptions, Scalar, Size, StructKind, TagEncoding,
|
||||||
Variants, WrappingRange,
|
Variants, WrappingRange,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ fn absent<'a, FieldIdx, VariantIdx, F>(fields: &IndexSlice<FieldIdx, F>) -> bool
|
|||||||
where
|
where
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
|
||||||
{
|
{
|
||||||
let uninhabited = fields.iter().any(|f| f.abi.is_uninhabited());
|
let uninhabited = fields.iter().any(|f| f.abi.is_uninhabited());
|
||||||
// We cannot ignore alignment; that might lead us to entirely discard a variant and
|
// We cannot ignore alignment; that might lead us to entirely discard a variant and
|
||||||
@ -89,7 +89,7 @@ impl<F> LayoutCalculatorError<F> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LayoutCalculatorResult<FieldIdx, VariantIdx, F> =
|
type LayoutCalculatorResult<FieldIdx, VariantIdx, F> =
|
||||||
Result<LayoutS<FieldIdx, VariantIdx>, LayoutCalculatorError<F>>;
|
Result<LayoutData<FieldIdx, VariantIdx>, LayoutCalculatorError<F>>;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct LayoutCalculator<Cx> {
|
pub struct LayoutCalculator<Cx> {
|
||||||
@ -105,7 +105,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
&self,
|
&self,
|
||||||
a: Scalar,
|
a: Scalar,
|
||||||
b: Scalar,
|
b: Scalar,
|
||||||
) -> LayoutS<FieldIdx, VariantIdx> {
|
) -> LayoutData<FieldIdx, VariantIdx> {
|
||||||
let dl = self.cx.data_layout();
|
let dl = self.cx.data_layout();
|
||||||
let b_align = b.align(dl);
|
let b_align = b.align(dl);
|
||||||
let align = a.align(dl).max(b_align).max(dl.aggregate_align);
|
let align = a.align(dl).max(b_align).max(dl.aggregate_align);
|
||||||
@ -119,7 +119,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
.chain(Niche::from_scalar(dl, Size::ZERO, a))
|
.chain(Niche::from_scalar(dl, Size::ZERO, a))
|
||||||
.max_by_key(|niche| niche.available(dl));
|
.max_by_key(|niche| niche.available(dl));
|
||||||
|
|
||||||
LayoutS {
|
LayoutData {
|
||||||
variants: Variants::Single { index: VariantIdx::new(0) },
|
variants: Variants::Single { index: VariantIdx::new(0) },
|
||||||
fields: FieldsShape::Arbitrary {
|
fields: FieldsShape::Arbitrary {
|
||||||
offsets: [Size::ZERO, b_offset].into(),
|
offsets: [Size::ZERO, b_offset].into(),
|
||||||
@ -138,7 +138,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
fields: &IndexSlice<FieldIdx, F>,
|
fields: &IndexSlice<FieldIdx, F>,
|
||||||
@ -211,9 +211,9 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
|
|
||||||
pub fn layout_of_never_type<FieldIdx: Idx, VariantIdx: Idx>(
|
pub fn layout_of_never_type<FieldIdx: Idx, VariantIdx: Idx>(
|
||||||
&self,
|
&self,
|
||||||
) -> LayoutS<FieldIdx, VariantIdx> {
|
) -> LayoutData<FieldIdx, VariantIdx> {
|
||||||
let dl = self.cx.data_layout();
|
let dl = self.cx.data_layout();
|
||||||
LayoutS {
|
LayoutData {
|
||||||
variants: Variants::Single { index: VariantIdx::new(0) },
|
variants: Variants::Single { index: VariantIdx::new(0) },
|
||||||
fields: FieldsShape::Primitive,
|
fields: FieldsShape::Primitive,
|
||||||
abi: Abi::Uninhabited,
|
abi: Abi::Uninhabited,
|
||||||
@ -229,7 +229,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
repr: &ReprOptions,
|
repr: &ReprOptions,
|
||||||
@ -292,7 +292,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
repr: &ReprOptions,
|
repr: &ReprOptions,
|
||||||
@ -384,7 +384,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
return Err(LayoutCalculatorError::EmptyUnion);
|
return Err(LayoutCalculatorError::EmptyUnion);
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(LayoutS {
|
Ok(LayoutData {
|
||||||
variants: Variants::Single { index: only_variant_idx },
|
variants: Variants::Single { index: only_variant_idx },
|
||||||
fields: FieldsShape::Union(union_field_count),
|
fields: FieldsShape::Union(union_field_count),
|
||||||
abi,
|
abi,
|
||||||
@ -401,7 +401,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
repr: &ReprOptions,
|
repr: &ReprOptions,
|
||||||
@ -501,7 +501,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
repr: &ReprOptions,
|
repr: &ReprOptions,
|
||||||
@ -516,8 +516,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
// overall LayoutS. Store the overall LayoutS
|
// overall LayoutS. Store the overall LayoutS
|
||||||
// and the variant LayoutSs here until then.
|
// and the variant LayoutSs here until then.
|
||||||
struct TmpLayout<FieldIdx: Idx, VariantIdx: Idx> {
|
struct TmpLayout<FieldIdx: Idx, VariantIdx: Idx> {
|
||||||
layout: LayoutS<FieldIdx, VariantIdx>,
|
layout: LayoutData<FieldIdx, VariantIdx>,
|
||||||
variants: IndexVec<VariantIdx, LayoutS<FieldIdx, VariantIdx>>,
|
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
let dl = self.cx.data_layout();
|
let dl = self.cx.data_layout();
|
||||||
@ -649,7 +649,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
Abi::Aggregate { sized: true }
|
Abi::Aggregate { sized: true }
|
||||||
};
|
};
|
||||||
|
|
||||||
let layout = LayoutS {
|
let layout = LayoutData {
|
||||||
variants: Variants::Multiple {
|
variants: Variants::Multiple {
|
||||||
tag: niche_scalar,
|
tag: niche_scalar,
|
||||||
tag_encoding: TagEncoding::Niche {
|
tag_encoding: TagEncoding::Niche {
|
||||||
@ -958,7 +958,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
|
|
||||||
let largest_niche = Niche::from_scalar(dl, Size::ZERO, tag);
|
let largest_niche = Niche::from_scalar(dl, Size::ZERO, tag);
|
||||||
|
|
||||||
let tagged_layout = LayoutS {
|
let tagged_layout = LayoutData {
|
||||||
variants: Variants::Multiple {
|
variants: Variants::Multiple {
|
||||||
tag,
|
tag,
|
||||||
tag_encoding: TagEncoding::Direct,
|
tag_encoding: TagEncoding::Direct,
|
||||||
@ -1013,7 +1013,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug + Copy,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
fields: &IndexSlice<FieldIdx, F>,
|
fields: &IndexSlice<FieldIdx, F>,
|
||||||
@ -1341,7 +1341,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
unadjusted_abi_align
|
unadjusted_abi_align
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(LayoutS {
|
Ok(LayoutData {
|
||||||
variants: Variants::Single { index: VariantIdx::new(0) },
|
variants: Variants::Single { index: VariantIdx::new(0) },
|
||||||
fields: FieldsShape::Arbitrary { offsets, memory_index },
|
fields: FieldsShape::Arbitrary { offsets, memory_index },
|
||||||
abi,
|
abi,
|
||||||
@ -1357,10 +1357,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
|
|||||||
'a,
|
'a,
|
||||||
FieldIdx: Idx,
|
FieldIdx: Idx,
|
||||||
VariantIdx: Idx,
|
VariantIdx: Idx,
|
||||||
F: Deref<Target = &'a LayoutS<FieldIdx, VariantIdx>> + fmt::Debug,
|
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
|
||||||
>(
|
>(
|
||||||
&self,
|
&self,
|
||||||
layout: &LayoutS<FieldIdx, VariantIdx>,
|
layout: &LayoutData<FieldIdx, VariantIdx>,
|
||||||
fields: &IndexSlice<FieldIdx, F>,
|
fields: &IndexSlice<FieldIdx, F>,
|
||||||
) -> String {
|
) -> String {
|
||||||
let dl = self.cx.data_layout();
|
let dl = self.cx.data_layout();
|
||||||
|
@ -58,7 +58,7 @@ rustc_index::newtype_index! {
|
|||||||
}
|
}
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
|
||||||
#[rustc_pass_by_value]
|
#[rustc_pass_by_value]
|
||||||
pub struct Layout<'a>(pub Interned<'a, LayoutS<FieldIdx, VariantIdx>>);
|
pub struct Layout<'a>(pub Interned<'a, LayoutData<FieldIdx, VariantIdx>>);
|
||||||
|
|
||||||
impl<'a> fmt::Debug for Layout<'a> {
|
impl<'a> fmt::Debug for Layout<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
@ -68,8 +68,8 @@ impl<'a> fmt::Debug for Layout<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Deref for Layout<'a> {
|
impl<'a> Deref for Layout<'a> {
|
||||||
type Target = &'a LayoutS<FieldIdx, VariantIdx>;
|
type Target = &'a LayoutData<FieldIdx, VariantIdx>;
|
||||||
fn deref(&self) -> &&'a LayoutS<FieldIdx, VariantIdx> {
|
fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx> {
|
||||||
&self.0.0
|
&self.0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,8 +142,8 @@ impl<'a, Ty: fmt::Display> fmt::Debug for TyAndLayout<'a, Ty> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ty> Deref for TyAndLayout<'a, Ty> {
|
impl<'a, Ty> Deref for TyAndLayout<'a, Ty> {
|
||||||
type Target = &'a LayoutS<FieldIdx, VariantIdx>;
|
type Target = &'a LayoutData<FieldIdx, VariantIdx>;
|
||||||
fn deref(&self) -> &&'a LayoutS<FieldIdx, VariantIdx> {
|
fn deref(&self) -> &&'a LayoutData<FieldIdx, VariantIdx> {
|
||||||
&self.layout.0.0
|
&self.layout.0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1485,7 +1485,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
|
|||||||
tag: Scalar,
|
tag: Scalar,
|
||||||
tag_encoding: TagEncoding<VariantIdx>,
|
tag_encoding: TagEncoding<VariantIdx>,
|
||||||
tag_field: usize,
|
tag_field: usize,
|
||||||
variants: IndexVec<VariantIdx, LayoutS<FieldIdx, VariantIdx>>,
|
variants: IndexVec<VariantIdx, LayoutData<FieldIdx, VariantIdx>>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1603,7 +1603,7 @@ impl Niche {
|
|||||||
// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
|
// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
|
||||||
#[derive(PartialEq, Eq, Hash, Clone)]
|
#[derive(PartialEq, Eq, Hash, Clone)]
|
||||||
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
|
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
|
||||||
pub struct LayoutS<FieldIdx: Idx, VariantIdx: Idx> {
|
pub struct LayoutData<FieldIdx: Idx, VariantIdx: Idx> {
|
||||||
/// Says where the fields are located within the layout.
|
/// Says where the fields are located within the layout.
|
||||||
pub fields: FieldsShape<FieldIdx>,
|
pub fields: FieldsShape<FieldIdx>,
|
||||||
|
|
||||||
@ -1643,7 +1643,7 @@ pub struct LayoutS<FieldIdx: Idx, VariantIdx: Idx> {
|
|||||||
pub unadjusted_abi_align: Align,
|
pub unadjusted_abi_align: Align,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
|
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
|
||||||
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
|
/// Returns `true` if this is an aggregate type (including a ScalarPair!)
|
||||||
pub fn is_aggregate(&self) -> bool {
|
pub fn is_aggregate(&self) -> bool {
|
||||||
match self.abi {
|
match self.abi {
|
||||||
@ -1656,7 +1656,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
|
|||||||
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
|
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
|
||||||
let size = scalar.size(cx);
|
let size = scalar.size(cx);
|
||||||
let align = scalar.align(cx);
|
let align = scalar.align(cx);
|
||||||
LayoutS {
|
LayoutData {
|
||||||
variants: Variants::Single { index: VariantIdx::new(0) },
|
variants: Variants::Single { index: VariantIdx::new(0) },
|
||||||
fields: FieldsShape::Primitive,
|
fields: FieldsShape::Primitive,
|
||||||
abi: Abi::Scalar(scalar),
|
abi: Abi::Scalar(scalar),
|
||||||
@ -1669,7 +1669,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<FieldIdx: Idx, VariantIdx: Idx> fmt::Debug for LayoutS<FieldIdx, VariantIdx>
|
impl<FieldIdx: Idx, VariantIdx: Idx> fmt::Debug for LayoutData<FieldIdx, VariantIdx>
|
||||||
where
|
where
|
||||||
FieldsShape<FieldIdx>: fmt::Debug,
|
FieldsShape<FieldIdx>: fmt::Debug,
|
||||||
Variants<FieldIdx, VariantIdx>: fmt::Debug,
|
Variants<FieldIdx, VariantIdx>: fmt::Debug,
|
||||||
@ -1678,7 +1678,7 @@ where
|
|||||||
// This is how `Layout` used to print before it become
|
// This is how `Layout` used to print before it become
|
||||||
// `Interned<LayoutS>`. We print it like this to avoid having to update
|
// `Interned<LayoutS>`. We print it like this to avoid having to update
|
||||||
// expected output in a lot of tests.
|
// expected output in a lot of tests.
|
||||||
let LayoutS {
|
let LayoutData {
|
||||||
size,
|
size,
|
||||||
align,
|
align,
|
||||||
abi,
|
abi,
|
||||||
@ -1723,7 +1723,7 @@ pub struct PointeeInfo {
|
|||||||
pub safe: Option<PointerKind>,
|
pub safe: Option<PointerKind>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
|
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
|
||||||
/// Returns `true` if the layout corresponds to an unsized type.
|
/// Returns `true` if the layout corresponds to an unsized type.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_unsized(&self) -> bool {
|
pub fn is_unsized(&self) -> bool {
|
||||||
|
@ -79,7 +79,7 @@ pub(super) fn add_local_place_comments<'tcx>(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let TyAndLayout { ty, layout } = place.layout();
|
let TyAndLayout { ty, layout } = place.layout();
|
||||||
let rustc_target::abi::LayoutS { size, align, .. } = layout.0.0;
|
let rustc_abi::LayoutData { size, align, .. } = layout.0.0;
|
||||||
|
|
||||||
let (kind, extra) = place.debug_comment();
|
let (kind, extra) = place.debug_comment();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
macro_rules! arena_types {
|
macro_rules! arena_types {
|
||||||
($macro:path) => (
|
($macro:path) => (
|
||||||
$macro!([
|
$macro!([
|
||||||
[] layout: rustc_target::abi::LayoutS<rustc_target::abi::FieldIdx, rustc_target::abi::VariantIdx>,
|
[] layout: rustc_abi::LayoutData<rustc_abi::FieldIdx, rustc_abi::VariantIdx>,
|
||||||
[] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
|
[] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
|
||||||
// AdtDef are interned and compared by address
|
// AdtDef are interned and compared by address
|
||||||
[decode] adt_def: rustc_middle::ty::AdtDefData,
|
[decode] adt_def: rustc_middle::ty::AdtDefData,
|
||||||
|
@ -12,7 +12,7 @@ use std::marker::PhantomData;
|
|||||||
use std::ops::{Bound, Deref};
|
use std::ops::{Bound, Deref};
|
||||||
use std::{fmt, iter, mem};
|
use std::{fmt, iter, mem};
|
||||||
|
|
||||||
use rustc_abi::{FieldIdx, Layout, LayoutS, TargetDataLayout, VariantIdx};
|
use rustc_abi::{FieldIdx, Layout, LayoutData, TargetDataLayout, VariantIdx};
|
||||||
use rustc_ast::{self as ast, attr};
|
use rustc_ast::{self as ast, attr};
|
||||||
use rustc_data_structures::defer;
|
use rustc_data_structures::defer;
|
||||||
use rustc_data_structures::fingerprint::Fingerprint;
|
use rustc_data_structures::fingerprint::Fingerprint;
|
||||||
@ -766,7 +766,7 @@ pub struct CtxtInterners<'tcx> {
|
|||||||
pat: InternedSet<'tcx, PatternKind<'tcx>>,
|
pat: InternedSet<'tcx, PatternKind<'tcx>>,
|
||||||
const_allocation: InternedSet<'tcx, Allocation>,
|
const_allocation: InternedSet<'tcx, Allocation>,
|
||||||
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
|
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
|
||||||
layout: InternedSet<'tcx, LayoutS<FieldIdx, VariantIdx>>,
|
layout: InternedSet<'tcx, LayoutData<FieldIdx, VariantIdx>>,
|
||||||
adt_def: InternedSet<'tcx, AdtDefData>,
|
adt_def: InternedSet<'tcx, AdtDefData>,
|
||||||
external_constraints: InternedSet<'tcx, ExternalConstraintsData<TyCtxt<'tcx>>>,
|
external_constraints: InternedSet<'tcx, ExternalConstraintsData<TyCtxt<'tcx>>>,
|
||||||
predefined_opaques_in_body: InternedSet<'tcx, PredefinedOpaquesData<TyCtxt<'tcx>>>,
|
predefined_opaques_in_body: InternedSet<'tcx, PredefinedOpaquesData<TyCtxt<'tcx>>>,
|
||||||
@ -2469,7 +2469,7 @@ direct_interners! {
|
|||||||
region: pub(crate) intern_region(RegionKind<'tcx>): Region -> Region<'tcx>,
|
region: pub(crate) intern_region(RegionKind<'tcx>): Region -> Region<'tcx>,
|
||||||
pat: pub mk_pat(PatternKind<'tcx>): Pattern -> Pattern<'tcx>,
|
pat: pub mk_pat(PatternKind<'tcx>): Pattern -> Pattern<'tcx>,
|
||||||
const_allocation: pub mk_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
|
const_allocation: pub mk_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
|
||||||
layout: pub mk_layout(LayoutS<FieldIdx, VariantIdx>): Layout -> Layout<'tcx>,
|
layout: pub mk_layout(LayoutData<FieldIdx, VariantIdx>): Layout -> Layout<'tcx>,
|
||||||
adt_def: pub mk_adt_def_from_data(AdtDefData): AdtDef -> AdtDef<'tcx>,
|
adt_def: pub mk_adt_def_from_data(AdtDefData): AdtDef -> AdtDef<'tcx>,
|
||||||
external_constraints: pub mk_external_constraints(ExternalConstraintsData<TyCtxt<'tcx>>):
|
external_constraints: pub mk_external_constraints(ExternalConstraintsData<TyCtxt<'tcx>>):
|
||||||
ExternalConstraints -> ExternalConstraints<'tcx>,
|
ExternalConstraints -> ExternalConstraints<'tcx>,
|
||||||
|
@ -4,7 +4,7 @@ use std::{cmp, fmt};
|
|||||||
|
|
||||||
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
||||||
use rustc_abi::{
|
use rustc_abi::{
|
||||||
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutS,
|
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutData,
|
||||||
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
|
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
|
||||||
};
|
};
|
||||||
use rustc_error_messages::DiagMessage;
|
use rustc_error_messages::DiagMessage;
|
||||||
@ -751,7 +751,7 @@ where
|
|||||||
ty::Adt(def, _) => def.variant(variant_index).fields.len(),
|
ty::Adt(def, _) => def.variant(variant_index).fields.len(),
|
||||||
_ => bug!("`ty_and_layout_for_variant` on unexpected type {}", this.ty),
|
_ => bug!("`ty_and_layout_for_variant` on unexpected type {}", this.ty),
|
||||||
};
|
};
|
||||||
tcx.mk_layout(LayoutS {
|
tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Single { index: variant_index },
|
variants: Variants::Single { index: variant_index },
|
||||||
fields: match NonZero::new(fields) {
|
fields: match NonZero::new(fields) {
|
||||||
Some(fields) => FieldsShape::Union(fields),
|
Some(fields) => FieldsShape::Union(fields),
|
||||||
@ -788,7 +788,7 @@ where
|
|||||||
let tcx = cx.tcx();
|
let tcx = cx.tcx();
|
||||||
let tag_layout = |tag: Scalar| -> TyAndLayout<'tcx> {
|
let tag_layout = |tag: Scalar| -> TyAndLayout<'tcx> {
|
||||||
TyAndLayout {
|
TyAndLayout {
|
||||||
layout: tcx.mk_layout(LayoutS::scalar(cx, tag)),
|
layout: tcx.mk_layout(LayoutData::scalar(cx, tag)),
|
||||||
ty: tag.primitive().to_ty(tcx),
|
ty: tag.primitive().to_ty(tcx),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -50,7 +50,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::Layout<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Stable<'tcx>
|
impl<'tcx> Stable<'tcx>
|
||||||
for rustc_abi::LayoutS<rustc_target::abi::FieldIdx, rustc_target::abi::VariantIdx>
|
for rustc_abi::LayoutData<rustc_target::abi::FieldIdx, rustc_target::abi::VariantIdx>
|
||||||
{
|
{
|
||||||
type T = LayoutShape;
|
type T = LayoutShape;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
rustc_abi = { path = "../rustc_abi", optional = true }
|
||||||
rustc_ast_ir = { path = "../rustc_ast_ir", optional = true }
|
rustc_ast_ir = { path = "../rustc_ast_ir", optional = true }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_hir = { path = "../rustc_hir", optional = true }
|
rustc_hir = { path = "../rustc_hir", optional = true }
|
||||||
@ -12,19 +13,18 @@ rustc_infer = { path = "../rustc_infer", optional = true }
|
|||||||
rustc_macros = { path = "../rustc_macros", optional = true }
|
rustc_macros = { path = "../rustc_macros", optional = true }
|
||||||
rustc_middle = { path = "../rustc_middle", optional = true }
|
rustc_middle = { path = "../rustc_middle", optional = true }
|
||||||
rustc_span = { path = "../rustc_span", optional = true }
|
rustc_span = { path = "../rustc_span", optional = true }
|
||||||
rustc_target = { path = "../rustc_target", optional = true }
|
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
rustc = [
|
rustc = [
|
||||||
|
"dep:rustc_abi",
|
||||||
|
"dep:rustc_ast_ir",
|
||||||
"dep:rustc_hir",
|
"dep:rustc_hir",
|
||||||
"dep:rustc_infer",
|
"dep:rustc_infer",
|
||||||
"dep:rustc_macros",
|
"dep:rustc_macros",
|
||||||
"dep:rustc_middle",
|
"dep:rustc_middle",
|
||||||
"dep:rustc_span",
|
"dep:rustc_span",
|
||||||
"dep:rustc_target",
|
|
||||||
"dep:rustc_ast_ir",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -62,10 +62,10 @@ impl Ref for ! {
|
|||||||
pub mod rustc {
|
pub mod rustc {
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
|
||||||
|
use rustc_abi::Layout;
|
||||||
use rustc_middle::mir::Mutability;
|
use rustc_middle::mir::Mutability;
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_target::abi::Layout;
|
|
||||||
|
|
||||||
/// A reference in the layout.
|
/// A reference in the layout.
|
||||||
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]
|
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]
|
||||||
|
@ -171,12 +171,12 @@ where
|
|||||||
|
|
||||||
#[cfg(feature = "rustc")]
|
#[cfg(feature = "rustc")]
|
||||||
pub(crate) mod rustc {
|
pub(crate) mod rustc {
|
||||||
|
use rustc_abi::{
|
||||||
|
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
|
||||||
|
};
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
|
||||||
use rustc_middle::ty::{self, AdtDef, AdtKind, List, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
|
use rustc_middle::ty::{self, AdtDef, AdtKind, List, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
|
||||||
use rustc_span::ErrorGuaranteed;
|
use rustc_span::ErrorGuaranteed;
|
||||||
use rustc_target::abi::{
|
|
||||||
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::Tree;
|
use super::Tree;
|
||||||
use crate::layout::rustc::{Def, Ref, layout_of};
|
use crate::layout::rustc::{Def, Ref, layout_of};
|
||||||
@ -206,7 +206,7 @@ pub(crate) mod rustc {
|
|||||||
|
|
||||||
impl<'tcx> Tree<Def<'tcx>, Ref<'tcx>> {
|
impl<'tcx> Tree<Def<'tcx>, Ref<'tcx>> {
|
||||||
pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx>) -> Result<Self, Err> {
|
pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx>) -> Result<Self, Err> {
|
||||||
use rustc_target::abi::HasDataLayout;
|
use rustc_abi::HasDataLayout;
|
||||||
let layout = layout_of(cx, ty)?;
|
let layout = layout_of(cx, ty)?;
|
||||||
|
|
||||||
if let Err(e) = ty.error_reported() {
|
if let Err(e) = ty.error_reported() {
|
||||||
@ -446,7 +446,7 @@ pub(crate) mod rustc {
|
|||||||
|
|
||||||
/// Constructs a `Tree` representing the value of a enum tag.
|
/// Constructs a `Tree` representing the value of a enum tag.
|
||||||
fn from_tag(tag: ScalarInt, tcx: TyCtxt<'tcx>) -> Self {
|
fn from_tag(tag: ScalarInt, tcx: TyCtxt<'tcx>) -> Self {
|
||||||
use rustc_target::abi::Endian;
|
use rustc_abi::Endian;
|
||||||
let size = tag.size();
|
let size = tag.size();
|
||||||
let bits = tag.to_bits(size);
|
let bits = tag.to_bits(size);
|
||||||
let bytes: [u8; 16];
|
let bytes: [u8; 16];
|
||||||
|
@ -6,7 +6,7 @@ use rustc_abi::Integer::{I8, I32};
|
|||||||
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
||||||
use rustc_abi::{
|
use rustc_abi::{
|
||||||
Abi, AbiAndPrefAlign, AddressSpace, Align, FieldsShape, HasDataLayout, LayoutCalculatorError,
|
Abi, AbiAndPrefAlign, AddressSpace, Align, FieldsShape, HasDataLayout, LayoutCalculatorError,
|
||||||
LayoutS, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, Variants, WrappingRange,
|
LayoutData, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, Variants, WrappingRange,
|
||||||
};
|
};
|
||||||
use rustc_index::bit_set::BitSet;
|
use rustc_index::bit_set::BitSet;
|
||||||
use rustc_index::{IndexSlice, IndexVec};
|
use rustc_index::{IndexSlice, IndexVec};
|
||||||
@ -131,7 +131,7 @@ fn univariant_uninterned<'tcx>(
|
|||||||
fields: &IndexSlice<FieldIdx, TyAndLayout<'tcx>>,
|
fields: &IndexSlice<FieldIdx, TyAndLayout<'tcx>>,
|
||||||
repr: &ReprOptions,
|
repr: &ReprOptions,
|
||||||
kind: StructKind,
|
kind: StructKind,
|
||||||
) -> Result<LayoutS<FieldIdx, VariantIdx>, &'tcx LayoutError<'tcx>> {
|
) -> Result<LayoutData<FieldIdx, VariantIdx>, &'tcx LayoutError<'tcx>> {
|
||||||
let pack = repr.pack;
|
let pack = repr.pack;
|
||||||
if pack.is_some() && repr.align.is_some() {
|
if pack.is_some() && repr.align.is_some() {
|
||||||
cx.tcx().dcx().bug("struct cannot be packed and aligned");
|
cx.tcx().dcx().bug("struct cannot be packed and aligned");
|
||||||
@ -159,7 +159,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
assert!(size.bits() <= 128);
|
assert!(size.bits() <= 128);
|
||||||
Scalar::Initialized { value, valid_range: WrappingRange::full(size) }
|
Scalar::Initialized { value, valid_range: WrappingRange::full(size) }
|
||||||
};
|
};
|
||||||
let scalar = |value: Primitive| tcx.mk_layout(LayoutS::scalar(cx, scalar_unit(value)));
|
let scalar = |value: Primitive| tcx.mk_layout(LayoutData::scalar(cx, scalar_unit(value)));
|
||||||
|
|
||||||
let univariant =
|
let univariant =
|
||||||
|fields: &IndexSlice<FieldIdx, TyAndLayout<'tcx>>, repr: &ReprOptions, kind| {
|
|fields: &IndexSlice<FieldIdx, TyAndLayout<'tcx>>, repr: &ReprOptions, kind| {
|
||||||
@ -170,7 +170,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
Ok(match *ty.kind() {
|
Ok(match *ty.kind() {
|
||||||
ty::Pat(ty, pat) => {
|
ty::Pat(ty, pat) => {
|
||||||
let layout = cx.layout_of(ty)?.layout;
|
let layout = cx.layout_of(ty)?.layout;
|
||||||
let mut layout = LayoutS::clone(&layout.0);
|
let mut layout = LayoutData::clone(&layout.0);
|
||||||
match *pat {
|
match *pat {
|
||||||
ty::PatternKind::Range { start, end, include_end } => {
|
ty::PatternKind::Range { start, end, include_end } => {
|
||||||
if let Abi::Scalar(scalar) | Abi::ScalarPair(scalar, _) = &mut layout.abi {
|
if let Abi::Scalar(scalar) | Abi::ScalarPair(scalar, _) = &mut layout.abi {
|
||||||
@ -206,11 +206,11 @@ fn layout_of_uncached<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Basic scalars.
|
// Basic scalars.
|
||||||
ty::Bool => tcx.mk_layout(LayoutS::scalar(cx, Scalar::Initialized {
|
ty::Bool => tcx.mk_layout(LayoutData::scalar(cx, Scalar::Initialized {
|
||||||
value: Int(I8, false),
|
value: Int(I8, false),
|
||||||
valid_range: WrappingRange { start: 0, end: 1 },
|
valid_range: WrappingRange { start: 0, end: 1 },
|
||||||
})),
|
})),
|
||||||
ty::Char => tcx.mk_layout(LayoutS::scalar(cx, Scalar::Initialized {
|
ty::Char => tcx.mk_layout(LayoutData::scalar(cx, Scalar::Initialized {
|
||||||
value: Int(I32, false),
|
value: Int(I32, false),
|
||||||
valid_range: WrappingRange { start: 0, end: 0x10FFFF },
|
valid_range: WrappingRange { start: 0, end: 0x10FFFF },
|
||||||
})),
|
})),
|
||||||
@ -220,7 +220,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
ty::FnPtr(..) => {
|
ty::FnPtr(..) => {
|
||||||
let mut ptr = scalar_unit(Pointer(dl.instruction_address_space));
|
let mut ptr = scalar_unit(Pointer(dl.instruction_address_space));
|
||||||
ptr.valid_range_mut().start = 1;
|
ptr.valid_range_mut().start = 1;
|
||||||
tcx.mk_layout(LayoutS::scalar(cx, ptr))
|
tcx.mk_layout(LayoutData::scalar(cx, ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// The never type.
|
// The never type.
|
||||||
@ -235,7 +235,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
|
|
||||||
let pointee = tcx.normalize_erasing_regions(param_env, pointee);
|
let pointee = tcx.normalize_erasing_regions(param_env, pointee);
|
||||||
if pointee.is_sized(tcx, param_env) {
|
if pointee.is_sized(tcx, param_env) {
|
||||||
return Ok(tcx.mk_layout(LayoutS::scalar(cx, data_ptr)));
|
return Ok(tcx.mk_layout(LayoutData::scalar(cx, data_ptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let metadata = if let Some(metadata_def_id) = tcx.lang_items().metadata_type()
|
let metadata = if let Some(metadata_def_id) = tcx.lang_items().metadata_type()
|
||||||
@ -272,7 +272,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
let metadata_layout = cx.layout_of(metadata_ty)?;
|
let metadata_layout = cx.layout_of(metadata_ty)?;
|
||||||
// If the metadata is a 1-zst, then the pointer is thin.
|
// If the metadata is a 1-zst, then the pointer is thin.
|
||||||
if metadata_layout.is_1zst() {
|
if metadata_layout.is_1zst() {
|
||||||
return Ok(tcx.mk_layout(LayoutS::scalar(cx, data_ptr)));
|
return Ok(tcx.mk_layout(LayoutData::scalar(cx, data_ptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let Abi::Scalar(metadata) = metadata_layout.abi else {
|
let Abi::Scalar(metadata) = metadata_layout.abi else {
|
||||||
@ -285,7 +285,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
|
|
||||||
match unsized_part.kind() {
|
match unsized_part.kind() {
|
||||||
ty::Foreign(..) => {
|
ty::Foreign(..) => {
|
||||||
return Ok(tcx.mk_layout(LayoutS::scalar(cx, data_ptr)));
|
return Ok(tcx.mk_layout(LayoutData::scalar(cx, data_ptr)));
|
||||||
}
|
}
|
||||||
ty::Slice(_) | ty::Str => scalar_unit(Int(dl.ptr_sized_integer(), false)),
|
ty::Slice(_) | ty::Str => scalar_unit(Int(dl.ptr_sized_integer(), false)),
|
||||||
ty::Dynamic(..) => {
|
ty::Dynamic(..) => {
|
||||||
@ -337,7 +337,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
|
|
||||||
let largest_niche = if count != 0 { element.largest_niche } else { None };
|
let largest_niche = if count != 0 { element.largest_niche } else { None };
|
||||||
|
|
||||||
tcx.mk_layout(LayoutS {
|
tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Single { index: FIRST_VARIANT },
|
variants: Variants::Single { index: FIRST_VARIANT },
|
||||||
fields: FieldsShape::Array { stride: element.size, count },
|
fields: FieldsShape::Array { stride: element.size, count },
|
||||||
abi,
|
abi,
|
||||||
@ -350,7 +350,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
}
|
}
|
||||||
ty::Slice(element) => {
|
ty::Slice(element) => {
|
||||||
let element = cx.layout_of(element)?;
|
let element = cx.layout_of(element)?;
|
||||||
tcx.mk_layout(LayoutS {
|
tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Single { index: FIRST_VARIANT },
|
variants: Variants::Single { index: FIRST_VARIANT },
|
||||||
fields: FieldsShape::Array { stride: element.size, count: 0 },
|
fields: FieldsShape::Array { stride: element.size, count: 0 },
|
||||||
abi: Abi::Aggregate { sized: false },
|
abi: Abi::Aggregate { sized: false },
|
||||||
@ -361,7 +361,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
unadjusted_abi_align: element.align.abi,
|
unadjusted_abi_align: element.align.abi,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ty::Str => tcx.mk_layout(LayoutS {
|
ty::Str => tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Single { index: FIRST_VARIANT },
|
variants: Variants::Single { index: FIRST_VARIANT },
|
||||||
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
|
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
|
||||||
abi: Abi::Aggregate { sized: false },
|
abi: Abi::Aggregate { sized: false },
|
||||||
@ -532,7 +532,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
FieldsShape::Array { stride: e_ly.size, count: e_len }
|
FieldsShape::Array { stride: e_ly.size, count: e_len }
|
||||||
};
|
};
|
||||||
|
|
||||||
tcx.mk_layout(LayoutS {
|
tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Single { index: FIRST_VARIANT },
|
variants: Variants::Single { index: FIRST_VARIANT },
|
||||||
fields,
|
fields,
|
||||||
abi,
|
abi,
|
||||||
@ -835,7 +835,7 @@ fn coroutine_layout<'tcx>(
|
|||||||
};
|
};
|
||||||
let tag_layout = TyAndLayout {
|
let tag_layout = TyAndLayout {
|
||||||
ty: discr_int.to_ty(tcx, /* signed = */ false),
|
ty: discr_int.to_ty(tcx, /* signed = */ false),
|
||||||
layout: tcx.mk_layout(LayoutS::scalar(cx, tag)),
|
layout: tcx.mk_layout(LayoutData::scalar(cx, tag)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let promoted_layouts = ineligible_locals.iter().map(|local| {
|
let promoted_layouts = ineligible_locals.iter().map(|local| {
|
||||||
@ -991,7 +991,7 @@ fn coroutine_layout<'tcx>(
|
|||||||
Abi::Aggregate { sized: true }
|
Abi::Aggregate { sized: true }
|
||||||
};
|
};
|
||||||
|
|
||||||
let layout = tcx.mk_layout(LayoutS {
|
let layout = tcx.mk_layout(LayoutData {
|
||||||
variants: Variants::Multiple {
|
variants: Variants::Multiple {
|
||||||
tag,
|
tag,
|
||||||
tag_encoding: TagEncoding::Direct,
|
tag_encoding: TagEncoding::Direct,
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#![feature(iter_array_chunks)]
|
#![feature(iter_array_chunks)]
|
||||||
#![feature(iter_next_chunk)]
|
#![feature(iter_next_chunk)]
|
||||||
#![feature(iter_advance_by)]
|
#![feature(iter_advance_by)]
|
||||||
#![feature(isqrt)]
|
|
||||||
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
|
@ -150,7 +150,6 @@
|
|||||||
#![feature(ip)]
|
#![feature(ip)]
|
||||||
#![feature(is_ascii_octdigit)]
|
#![feature(is_ascii_octdigit)]
|
||||||
#![feature(is_val_statically_known)]
|
#![feature(is_val_statically_known)]
|
||||||
#![feature(isqrt)]
|
|
||||||
#![feature(lazy_get)]
|
#![feature(lazy_get)]
|
||||||
#![feature(link_cfg)]
|
#![feature(link_cfg)]
|
||||||
#![feature(non_null_from_ref)]
|
#![feature(non_null_from_ref)]
|
||||||
|
@ -1629,11 +1629,10 @@ macro_rules! int_impl {
|
|||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(isqrt)]
|
|
||||||
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".checked_isqrt(), Some(3));")]
|
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".checked_isqrt(), Some(3));")]
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "isqrt", issue = "116226")]
|
#[stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[rustc_const_unstable(feature = "isqrt", issue = "116226")]
|
#[rustc_const_stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -2880,11 +2879,10 @@ macro_rules! int_impl {
|
|||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(isqrt)]
|
|
||||||
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".isqrt(), 3);")]
|
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".isqrt(), 3);")]
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "isqrt", issue = "116226")]
|
#[stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[rustc_const_unstable(feature = "isqrt", issue = "116226")]
|
#[rustc_const_stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1527,7 +1527,6 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
|
|||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(isqrt)]
|
|
||||||
/// # use std::num::NonZero;
|
/// # use std::num::NonZero;
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() { test().unwrap(); }
|
/// # fn main() { test().unwrap(); }
|
||||||
@ -1539,8 +1538,8 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
|
|||||||
/// # Some(())
|
/// # Some(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "isqrt", issue = "116226")]
|
#[stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[rustc_const_unstable(feature = "isqrt", issue = "116226")]
|
#[rustc_const_stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -2753,11 +2753,10 @@ macro_rules! uint_impl {
|
|||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(isqrt)]
|
|
||||||
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".isqrt(), 3);")]
|
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".isqrt(), 3);")]
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "isqrt", issue = "116226")]
|
#[stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[rustc_const_unstable(feature = "isqrt", issue = "116226")]
|
#[rustc_const_stable(feature = "isqrt", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[must_use = "this returns the result of the operation, \
|
#[must_use = "this returns the result of the operation, \
|
||||||
without modifying the original"]
|
without modifying the original"]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#![feature(ip)]
|
#![feature(ip)]
|
||||||
#![feature(ip_from)]
|
#![feature(ip_from)]
|
||||||
#![feature(is_ascii_octdigit)]
|
#![feature(is_ascii_octdigit)]
|
||||||
#![feature(isqrt)]
|
|
||||||
#![feature(iter_advance_by)]
|
#![feature(iter_advance_by)]
|
||||||
#![feature(iter_array_chunks)]
|
#![feature(iter_array_chunks)]
|
||||||
#![feature(iter_chain)]
|
#![feature(iter_chain)]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//@no-rustfix
|
//@no-rustfix
|
||||||
|
|
||||||
#![feature(repr128)]
|
#![feature(repr128)]
|
||||||
#![feature(isqrt)]
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![warn(
|
#![warn(
|
||||||
clippy::cast_precision_loss,
|
clippy::cast_precision_loss,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||||
--> tests/ui/cast.rs:26:5
|
--> tests/ui/cast.rs:25:5
|
||||||
|
|
|
|
||||||
LL | x0 as f32;
|
LL | x0 as f32;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
@ -8,37 +8,37 @@ LL | x0 as f32;
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||||
|
|
||||||
error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||||
--> tests/ui/cast.rs:30:5
|
--> tests/ui/cast.rs:29:5
|
||||||
|
|
|
|
||||||
LL | x1 as f32;
|
LL | x1 as f32;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i64` to `f64` causes a loss of precision (`i64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
error: casting `i64` to `f64` causes a loss of precision (`i64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||||
--> tests/ui/cast.rs:32:5
|
--> tests/ui/cast.rs:31:5
|
||||||
|
|
|
|
||||||
LL | x1 as f64;
|
LL | x1 as f64;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u32` to `f32` causes a loss of precision (`u32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
error: casting `u32` to `f32` causes a loss of precision (`u32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||||
--> tests/ui/cast.rs:35:5
|
--> tests/ui/cast.rs:34:5
|
||||||
|
|
|
|
||||||
LL | x2 as f32;
|
LL | x2 as f32;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u64` to `f32` causes a loss of precision (`u64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
error: casting `u64` to `f32` causes a loss of precision (`u64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||||
--> tests/ui/cast.rs:38:5
|
--> tests/ui/cast.rs:37:5
|
||||||
|
|
|
|
||||||
LL | x3 as f32;
|
LL | x3 as f32;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u64` to `f64` causes a loss of precision (`u64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
error: casting `u64` to `f64` causes a loss of precision (`u64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||||
--> tests/ui/cast.rs:40:5
|
--> tests/ui/cast.rs:39:5
|
||||||
|
|
|
|
||||||
LL | x3 as f64;
|
LL | x3 as f64;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: casting `f32` to `i32` may truncate the value
|
error: casting `f32` to `i32` may truncate the value
|
||||||
--> tests/ui/cast.rs:43:5
|
--> tests/ui/cast.rs:42:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as i32;
|
LL | 1f32 as i32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -48,7 +48,7 @@ LL | 1f32 as i32;
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
||||||
|
|
||||||
error: casting `f32` to `u32` may truncate the value
|
error: casting `f32` to `u32` may truncate the value
|
||||||
--> tests/ui/cast.rs:45:5
|
--> tests/ui/cast.rs:44:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as u32;
|
LL | 1f32 as u32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -56,7 +56,7 @@ LL | 1f32 as u32;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f32` to `u32` may lose the sign of the value
|
error: casting `f32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:45:5
|
--> tests/ui/cast.rs:44:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as u32;
|
LL | 1f32 as u32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -65,7 +65,7 @@ LL | 1f32 as u32;
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
|
= help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
|
||||||
|
|
||||||
error: casting `f64` to `f32` may truncate the value
|
error: casting `f64` to `f32` may truncate the value
|
||||||
--> tests/ui/cast.rs:49:5
|
--> tests/ui/cast.rs:48:5
|
||||||
|
|
|
|
||||||
LL | 1f64 as f32;
|
LL | 1f64 as f32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -73,7 +73,7 @@ LL | 1f64 as f32;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `i32` to `i8` may truncate the value
|
error: casting `i32` to `i8` may truncate the value
|
||||||
--> tests/ui/cast.rs:51:5
|
--> tests/ui/cast.rs:50:5
|
||||||
|
|
|
|
||||||
LL | 1i32 as i8;
|
LL | 1i32 as i8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -85,7 +85,7 @@ LL | i8::try_from(1i32);
|
|||||||
| ~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `i32` to `u8` may truncate the value
|
error: casting `i32` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:53:5
|
--> tests/ui/cast.rs:52:5
|
||||||
|
|
|
|
||||||
LL | 1i32 as u8;
|
LL | 1i32 as u8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -97,7 +97,7 @@ LL | u8::try_from(1i32);
|
|||||||
| ~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `f64` to `isize` may truncate the value
|
error: casting `f64` to `isize` may truncate the value
|
||||||
--> tests/ui/cast.rs:55:5
|
--> tests/ui/cast.rs:54:5
|
||||||
|
|
|
|
||||||
LL | 1f64 as isize;
|
LL | 1f64 as isize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -105,7 +105,7 @@ LL | 1f64 as isize;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f64` to `usize` may truncate the value
|
error: casting `f64` to `usize` may truncate the value
|
||||||
--> tests/ui/cast.rs:57:5
|
--> tests/ui/cast.rs:56:5
|
||||||
|
|
|
|
||||||
LL | 1f64 as usize;
|
LL | 1f64 as usize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -113,13 +113,13 @@ LL | 1f64 as usize;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f64` to `usize` may lose the sign of the value
|
error: casting `f64` to `usize` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:57:5
|
--> tests/ui/cast.rs:56:5
|
||||||
|
|
|
|
||||||
LL | 1f64 as usize;
|
LL | 1f64 as usize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u32` to `u16` may truncate the value
|
error: casting `u32` to `u16` may truncate the value
|
||||||
--> tests/ui/cast.rs:60:5
|
--> tests/ui/cast.rs:59:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as u32 as u16;
|
LL | 1f32 as u32 as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
@ -131,7 +131,7 @@ LL | u16::try_from(1f32 as u32);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `f32` to `u32` may truncate the value
|
error: casting `f32` to `u32` may truncate the value
|
||||||
--> tests/ui/cast.rs:60:5
|
--> tests/ui/cast.rs:59:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as u32 as u16;
|
LL | 1f32 as u32 as u16;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -139,13 +139,13 @@ LL | 1f32 as u32 as u16;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f32` to `u32` may lose the sign of the value
|
error: casting `f32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:60:5
|
--> tests/ui/cast.rs:59:5
|
||||||
|
|
|
|
||||||
LL | 1f32 as u32 as u16;
|
LL | 1f32 as u32 as u16;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `i8` may truncate the value
|
error: casting `i32` to `i8` may truncate the value
|
||||||
--> tests/ui/cast.rs:65:22
|
--> tests/ui/cast.rs:64:22
|
||||||
|
|
|
|
||||||
LL | let _x: i8 = 1i32 as _;
|
LL | let _x: i8 = 1i32 as _;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
@ -157,7 +157,7 @@ LL | let _x: i8 = 1i32.try_into();
|
|||||||
| ~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `f32` to `i32` may truncate the value
|
error: casting `f32` to `i32` may truncate the value
|
||||||
--> tests/ui/cast.rs:67:9
|
--> tests/ui/cast.rs:66:9
|
||||||
|
|
|
|
||||||
LL | 1f32 as i32;
|
LL | 1f32 as i32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -165,7 +165,7 @@ LL | 1f32 as i32;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f64` to `i32` may truncate the value
|
error: casting `f64` to `i32` may truncate the value
|
||||||
--> tests/ui/cast.rs:69:9
|
--> tests/ui/cast.rs:68:9
|
||||||
|
|
|
|
||||||
LL | 1f64 as i32;
|
LL | 1f64 as i32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -173,7 +173,7 @@ LL | 1f64 as i32;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f32` to `u8` may truncate the value
|
error: casting `f32` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:71:9
|
--> tests/ui/cast.rs:70:9
|
||||||
|
|
|
|
||||||
LL | 1f32 as u8;
|
LL | 1f32 as u8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -181,13 +181,13 @@ LL | 1f32 as u8;
|
|||||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||||
|
|
||||||
error: casting `f32` to `u8` may lose the sign of the value
|
error: casting `f32` to `u8` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:71:9
|
--> tests/ui/cast.rs:70:9
|
||||||
|
|
|
|
||||||
LL | 1f32 as u8;
|
LL | 1f32 as u8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u8` to `i8` may wrap around the value
|
error: casting `u8` to `i8` may wrap around the value
|
||||||
--> tests/ui/cast.rs:76:5
|
--> tests/ui/cast.rs:75:5
|
||||||
|
|
|
|
||||||
LL | 1u8 as i8;
|
LL | 1u8 as i8;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
@ -196,31 +196,31 @@ LL | 1u8 as i8;
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||||
|
|
||||||
error: casting `u16` to `i16` may wrap around the value
|
error: casting `u16` to `i16` may wrap around the value
|
||||||
--> tests/ui/cast.rs:79:5
|
--> tests/ui/cast.rs:78:5
|
||||||
|
|
|
|
||||||
LL | 1u16 as i16;
|
LL | 1u16 as i16;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u32` to `i32` may wrap around the value
|
error: casting `u32` to `i32` may wrap around the value
|
||||||
--> tests/ui/cast.rs:81:5
|
--> tests/ui/cast.rs:80:5
|
||||||
|
|
|
|
||||||
LL | 1u32 as i32;
|
LL | 1u32 as i32;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u64` to `i64` may wrap around the value
|
error: casting `u64` to `i64` may wrap around the value
|
||||||
--> tests/ui/cast.rs:83:5
|
--> tests/ui/cast.rs:82:5
|
||||||
|
|
|
|
||||||
LL | 1u64 as i64;
|
LL | 1u64 as i64;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `usize` to `isize` may wrap around the value
|
error: casting `usize` to `isize` may wrap around the value
|
||||||
--> tests/ui/cast.rs:85:5
|
--> tests/ui/cast.rs:84:5
|
||||||
|
|
|
|
||||||
LL | 1usize as isize;
|
LL | 1usize as isize;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `usize` to `i8` may truncate the value
|
error: casting `usize` to `i8` may truncate the value
|
||||||
--> tests/ui/cast.rs:88:5
|
--> tests/ui/cast.rs:87:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i8;
|
LL | 1usize as i8;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
@ -232,7 +232,7 @@ LL | i8::try_from(1usize);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `usize` to `i16` may truncate the value
|
error: casting `usize` to `i16` may truncate the value
|
||||||
--> tests/ui/cast.rs:91:5
|
--> tests/ui/cast.rs:90:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i16;
|
LL | 1usize as i16;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -244,7 +244,7 @@ LL | i16::try_from(1usize);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `usize` to `i16` may wrap around the value on targets with 16-bit wide pointers
|
error: casting `usize` to `i16` may wrap around the value on targets with 16-bit wide pointers
|
||||||
--> tests/ui/cast.rs:91:5
|
--> tests/ui/cast.rs:90:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i16;
|
LL | 1usize as i16;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -253,7 +253,7 @@ LL | 1usize as i16;
|
|||||||
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
||||||
|
|
||||||
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
|
||||||
--> tests/ui/cast.rs:96:5
|
--> tests/ui/cast.rs:95:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i32;
|
LL | 1usize as i32;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -265,19 +265,19 @@ LL | i32::try_from(1usize);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
|
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
|
||||||
--> tests/ui/cast.rs:96:5
|
--> tests/ui/cast.rs:95:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i32;
|
LL | 1usize as i32;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `usize` to `i64` may wrap around the value on targets with 64-bit wide pointers
|
error: casting `usize` to `i64` may wrap around the value on targets with 64-bit wide pointers
|
||||||
--> tests/ui/cast.rs:100:5
|
--> tests/ui/cast.rs:99:5
|
||||||
|
|
|
|
||||||
LL | 1usize as i64;
|
LL | 1usize as i64;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u16` to `isize` may wrap around the value on targets with 16-bit wide pointers
|
error: casting `u16` to `isize` may wrap around the value on targets with 16-bit wide pointers
|
||||||
--> tests/ui/cast.rs:105:5
|
--> tests/ui/cast.rs:104:5
|
||||||
|
|
|
|
||||||
LL | 1u16 as isize;
|
LL | 1u16 as isize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -286,13 +286,13 @@ LL | 1u16 as isize;
|
|||||||
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
= note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
|
||||||
|
|
||||||
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
|
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
|
||||||
--> tests/ui/cast.rs:109:5
|
--> tests/ui/cast.rs:108:5
|
||||||
|
|
|
|
||||||
LL | 1u32 as isize;
|
LL | 1u32 as isize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||||
--> tests/ui/cast.rs:112:5
|
--> tests/ui/cast.rs:111:5
|
||||||
|
|
|
|
||||||
LL | 1u64 as isize;
|
LL | 1u64 as isize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -304,55 +304,55 @@ LL | isize::try_from(1u64);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
|
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
|
||||||
--> tests/ui/cast.rs:112:5
|
--> tests/ui/cast.rs:111:5
|
||||||
|
|
|
|
||||||
LL | 1u64 as isize;
|
LL | 1u64 as isize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:117:5
|
--> tests/ui/cast.rs:116:5
|
||||||
|
|
|
|
||||||
LL | -1i32 as u32;
|
LL | -1i32 as u32;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `isize` to `usize` may lose the sign of the value
|
error: casting `isize` to `usize` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:120:5
|
--> tests/ui/cast.rs:119:5
|
||||||
|
|
|
|
||||||
LL | -1isize as usize;
|
LL | -1isize as usize;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i8` to `u8` may lose the sign of the value
|
error: casting `i8` to `u8` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:131:5
|
--> tests/ui/cast.rs:130:5
|
||||||
|
|
|
|
||||||
LL | (i8::MIN).abs() as u8;
|
LL | (i8::MIN).abs() as u8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i64` to `u64` may lose the sign of the value
|
error: casting `i64` to `u64` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:135:5
|
--> tests/ui/cast.rs:134:5
|
||||||
|
|
|
|
||||||
LL | (-1i64).abs() as u64;
|
LL | (-1i64).abs() as u64;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `isize` to `usize` may lose the sign of the value
|
error: casting `isize` to `usize` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:136:5
|
--> tests/ui/cast.rs:135:5
|
||||||
|
|
|
|
||||||
LL | (-1isize).abs() as usize;
|
LL | (-1isize).abs() as usize;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i64` to `u64` may lose the sign of the value
|
error: casting `i64` to `u64` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:143:5
|
--> tests/ui/cast.rs:142:5
|
||||||
|
|
|
|
||||||
LL | (unsafe { (-1i64).checked_abs().unwrap_unchecked() }) as u64;
|
LL | (unsafe { (-1i64).checked_abs().unwrap_unchecked() }) as u64;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i64` to `u64` may lose the sign of the value
|
error: casting `i64` to `u64` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:158:5
|
--> tests/ui/cast.rs:157:5
|
||||||
|
|
|
|
||||||
LL | (unsafe { (-1i64).checked_isqrt().unwrap_unchecked() }) as u64;
|
LL | (unsafe { (-1i64).checked_isqrt().unwrap_unchecked() }) as u64;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i64` to `i8` may truncate the value
|
error: casting `i64` to `i8` may truncate the value
|
||||||
--> tests/ui/cast.rs:209:5
|
--> tests/ui/cast.rs:208:5
|
||||||
|
|
|
|
||||||
LL | (-99999999999i64).min(1) as i8;
|
LL | (-99999999999i64).min(1) as i8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -364,7 +364,7 @@ LL | i8::try_from((-99999999999i64).min(1));
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `u64` to `u8` may truncate the value
|
error: casting `u64` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:223:5
|
--> tests/ui/cast.rs:222:5
|
||||||
|
|
|
|
||||||
LL | 999999u64.clamp(0, 256) as u8;
|
LL | 999999u64.clamp(0, 256) as u8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -376,7 +376,7 @@ LL | u8::try_from(999999u64.clamp(0, 256));
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `main::E2` to `u8` may truncate the value
|
error: casting `main::E2` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:246:21
|
--> tests/ui/cast.rs:245:21
|
||||||
|
|
|
|
||||||
LL | let _ = self as u8;
|
LL | let _ = self as u8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -388,7 +388,7 @@ LL | let _ = u8::try_from(self);
|
|||||||
| ~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `main::E2::B` to `u8` will truncate the value
|
error: casting `main::E2::B` to `u8` will truncate the value
|
||||||
--> tests/ui/cast.rs:248:21
|
--> tests/ui/cast.rs:247:21
|
||||||
|
|
|
|
||||||
LL | let _ = Self::B as u8;
|
LL | let _ = Self::B as u8;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -397,7 +397,7 @@ LL | let _ = Self::B as u8;
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
|
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
|
||||||
|
|
||||||
error: casting `main::E5` to `i8` may truncate the value
|
error: casting `main::E5` to `i8` may truncate the value
|
||||||
--> tests/ui/cast.rs:290:21
|
--> tests/ui/cast.rs:289:21
|
||||||
|
|
|
|
||||||
LL | let _ = self as i8;
|
LL | let _ = self as i8;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -409,13 +409,13 @@ LL | let _ = i8::try_from(self);
|
|||||||
| ~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `main::E5::A` to `i8` will truncate the value
|
error: casting `main::E5::A` to `i8` will truncate the value
|
||||||
--> tests/ui/cast.rs:292:21
|
--> tests/ui/cast.rs:291:21
|
||||||
|
|
|
|
||||||
LL | let _ = Self::A as i8;
|
LL | let _ = Self::A as i8;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `main::E6` to `i16` may truncate the value
|
error: casting `main::E6` to `i16` may truncate the value
|
||||||
--> tests/ui/cast.rs:309:21
|
--> tests/ui/cast.rs:308:21
|
||||||
|
|
|
|
||||||
LL | let _ = self as i16;
|
LL | let _ = self as i16;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -427,7 +427,7 @@ LL | let _ = i16::try_from(self);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `main::E7` to `usize` may truncate the value on targets with 32-bit wide pointers
|
error: casting `main::E7` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||||
--> tests/ui/cast.rs:328:21
|
--> tests/ui/cast.rs:327:21
|
||||||
|
|
|
|
||||||
LL | let _ = self as usize;
|
LL | let _ = self as usize;
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
@ -439,7 +439,7 @@ LL | let _ = usize::try_from(self);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `main::E10` to `u16` may truncate the value
|
error: casting `main::E10` to `u16` may truncate the value
|
||||||
--> tests/ui/cast.rs:375:21
|
--> tests/ui/cast.rs:374:21
|
||||||
|
|
|
|
||||||
LL | let _ = self as u16;
|
LL | let _ = self as u16;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
@ -451,7 +451,7 @@ LL | let _ = u16::try_from(self);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `u32` to `u8` may truncate the value
|
error: casting `u32` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:386:13
|
--> tests/ui/cast.rs:385:13
|
||||||
|
|
|
|
||||||
LL | let c = (q >> 16) as u8;
|
LL | let c = (q >> 16) as u8;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
@ -463,7 +463,7 @@ LL | let c = u8::try_from(q >> 16);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `u32` to `u8` may truncate the value
|
error: casting `u32` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:390:13
|
--> tests/ui/cast.rs:389:13
|
||||||
|
|
|
|
||||||
LL | let c = (q / 1000) as u8;
|
LL | let c = (q / 1000) as u8;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
@ -475,85 +475,85 @@ LL | let c = u8::try_from(q / 1000);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:402:9
|
--> tests/ui/cast.rs:401:9
|
||||||
|
|
|
|
||||||
LL | (x * x) as u32;
|
LL | (x * x) as u32;
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:407:32
|
--> tests/ui/cast.rs:406:32
|
||||||
|
|
|
|
||||||
LL | let _a = |x: i32| -> u32 { (x * x * x * x) as u32 };
|
LL | let _a = |x: i32| -> u32 { (x * x * x * x) as u32 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:409:5
|
--> tests/ui/cast.rs:408:5
|
||||||
|
|
|
|
||||||
LL | (2_i32).checked_pow(3).unwrap() as u32;
|
LL | (2_i32).checked_pow(3).unwrap() as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:410:5
|
--> tests/ui/cast.rs:409:5
|
||||||
|
|
|
|
||||||
LL | (-2_i32).pow(3) as u32;
|
LL | (-2_i32).pow(3) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:415:5
|
--> tests/ui/cast.rs:414:5
|
||||||
|
|
|
|
||||||
LL | (-5_i32 % 2) as u32;
|
LL | (-5_i32 % 2) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:417:5
|
--> tests/ui/cast.rs:416:5
|
||||||
|
|
|
|
||||||
LL | (-5_i32 % -2) as u32;
|
LL | (-5_i32 % -2) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:420:5
|
--> tests/ui/cast.rs:419:5
|
||||||
|
|
|
|
||||||
LL | (-2_i32 >> 1) as u32;
|
LL | (-2_i32 >> 1) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:424:5
|
--> tests/ui/cast.rs:423:5
|
||||||
|
|
|
|
||||||
LL | (x * x) as u32;
|
LL | (x * x) as u32;
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:425:5
|
--> tests/ui/cast.rs:424:5
|
||||||
|
|
|
|
||||||
LL | (x * x * x) as u32;
|
LL | (x * x * x) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:429:5
|
--> tests/ui/cast.rs:428:5
|
||||||
|
|
|
|
||||||
LL | (y * y * y * y * -2) as u16;
|
LL | (y * y * y * y * -2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:431:5
|
--> tests/ui/cast.rs:430:5
|
||||||
|
|
|
|
||||||
LL | (y * y * y / y * 2) as u16;
|
LL | (y * y * y / y * 2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:432:5
|
--> tests/ui/cast.rs:431:5
|
||||||
|
|
|
|
||||||
LL | (y * y / y * 2) as u16;
|
LL | (y * y / y * 2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:434:5
|
--> tests/ui/cast.rs:433:5
|
||||||
|
|
|
|
||||||
LL | (y / y * y * -2) as u16;
|
LL | (y / y * y * -2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `/`
|
error: equal expressions as operands to `/`
|
||||||
--> tests/ui/cast.rs:434:6
|
--> tests/ui/cast.rs:433:6
|
||||||
|
|
|
|
||||||
LL | (y / y * y * -2) as u16;
|
LL | (y / y * y * -2) as u16;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
@ -561,97 +561,97 @@ LL | (y / y * y * -2) as u16;
|
|||||||
= note: `#[deny(clippy::eq_op)]` on by default
|
= note: `#[deny(clippy::eq_op)]` on by default
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:437:5
|
--> tests/ui/cast.rs:436:5
|
||||||
|
|
|
|
||||||
LL | (y + y + y + -2) as u16;
|
LL | (y + y + y + -2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:439:5
|
--> tests/ui/cast.rs:438:5
|
||||||
|
|
|
|
||||||
LL | (y + y + y + 2) as u16;
|
LL | (y + y + y + 2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:443:5
|
--> tests/ui/cast.rs:442:5
|
||||||
|
|
|
|
||||||
LL | (z + -2) as u16;
|
LL | (z + -2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i16` to `u16` may lose the sign of the value
|
error: casting `i16` to `u16` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:445:5
|
--> tests/ui/cast.rs:444:5
|
||||||
|
|
|
|
||||||
LL | (z + z + 2) as u16;
|
LL | (z + z + 2) as u16;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:448:9
|
--> tests/ui/cast.rs:447:9
|
||||||
|
|
|
|
||||||
LL | (a * a * b * b * c * c) as u32;
|
LL | (a * a * b * b * c * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:449:9
|
--> tests/ui/cast.rs:448:9
|
||||||
|
|
|
|
||||||
LL | (a * b * c) as u32;
|
LL | (a * b * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:451:9
|
--> tests/ui/cast.rs:450:9
|
||||||
|
|
|
|
||||||
LL | (a * -b * c) as u32;
|
LL | (a * -b * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:453:9
|
--> tests/ui/cast.rs:452:9
|
||||||
|
|
|
|
||||||
LL | (a * b * c * c) as u32;
|
LL | (a * b * c * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:454:9
|
--> tests/ui/cast.rs:453:9
|
||||||
|
|
|
|
||||||
LL | (a * -2) as u32;
|
LL | (a * -2) as u32;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:456:9
|
--> tests/ui/cast.rs:455:9
|
||||||
|
|
|
|
||||||
LL | (a * b * c * -2) as u32;
|
LL | (a * b * c * -2) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:458:9
|
--> tests/ui/cast.rs:457:9
|
||||||
|
|
|
|
||||||
LL | (a / b) as u32;
|
LL | (a / b) as u32;
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:459:9
|
--> tests/ui/cast.rs:458:9
|
||||||
|
|
|
|
||||||
LL | (a / b * c) as u32;
|
LL | (a / b * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:461:9
|
--> tests/ui/cast.rs:460:9
|
||||||
|
|
|
|
||||||
LL | (a / b + b * c) as u32;
|
LL | (a / b + b * c) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:463:9
|
--> tests/ui/cast.rs:462:9
|
||||||
|
|
|
|
||||||
LL | a.saturating_pow(3) as u32;
|
LL | a.saturating_pow(3) as u32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:465:9
|
--> tests/ui/cast.rs:464:9
|
||||||
|
|
|
|
||||||
LL | (a.abs() * b.pow(2) / c.abs()) as u32
|
LL | (a.abs() * b.pow(2) / c.abs()) as u32
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `i32` to `u32` may lose the sign of the value
|
error: casting `i32` to `u32` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:473:21
|
--> tests/ui/cast.rs:472:21
|
||||||
|
|
|
|
||||||
LL | let _ = i32::MIN as u32; // cast_sign_loss
|
LL | let _ = i32::MIN as u32; // cast_sign_loss
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
@ -662,7 +662,7 @@ LL | m!();
|
|||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: casting `u32` to `u8` may truncate the value
|
error: casting `u32` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:474:21
|
--> tests/ui/cast.rs:473:21
|
||||||
|
|
|
|
||||||
LL | let _ = u32::MAX as u8; // cast_possible_truncation
|
LL | let _ = u32::MAX as u8; // cast_possible_truncation
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
@ -678,7 +678,7 @@ LL | let _ = u8::try_from(u32::MAX); // cast_possible_truncation
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `f64` to `f32` may truncate the value
|
error: casting `f64` to `f32` may truncate the value
|
||||||
--> tests/ui/cast.rs:475:21
|
--> tests/ui/cast.rs:474:21
|
||||||
|
|
|
|
||||||
LL | let _ = std::f64::consts::PI as f32; // cast_possible_truncation
|
LL | let _ = std::f64::consts::PI as f32; // cast_possible_truncation
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -690,7 +690,7 @@ LL | m!();
|
|||||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
|
||||||
--> tests/ui/cast.rs:484:5
|
--> tests/ui/cast.rs:483:5
|
||||||
|
|
|
|
||||||
LL | bar.unwrap().unwrap() as usize
|
LL | bar.unwrap().unwrap() as usize
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -702,13 +702,13 @@ LL | usize::try_from(bar.unwrap().unwrap())
|
|||||||
|
|
|
|
||||||
|
|
||||||
error: casting `i64` to `usize` may lose the sign of the value
|
error: casting `i64` to `usize` may lose the sign of the value
|
||||||
--> tests/ui/cast.rs:484:5
|
--> tests/ui/cast.rs:483:5
|
||||||
|
|
|
|
||||||
LL | bar.unwrap().unwrap() as usize
|
LL | bar.unwrap().unwrap() as usize
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: casting `u64` to `u8` may truncate the value
|
error: casting `u64` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:499:5
|
--> tests/ui/cast.rs:498:5
|
||||||
|
|
|
|
||||||
LL | (256 & 999999u64) as u8;
|
LL | (256 & 999999u64) as u8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -720,7 +720,7 @@ LL | u8::try_from(256 & 999999u64);
|
|||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: casting `u64` to `u8` may truncate the value
|
error: casting `u64` to `u8` may truncate the value
|
||||||
--> tests/ui/cast.rs:501:5
|
--> tests/ui/cast.rs:500:5
|
||||||
|
|
|
|
||||||
LL | (255 % 999999u64) as u8;
|
LL | (255 % 999999u64) as u8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -6,7 +6,7 @@ use base_db::ra_salsa::Cycle;
|
|||||||
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
|
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
|
||||||
use hir_def::{
|
use hir_def::{
|
||||||
layout::{
|
layout::{
|
||||||
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutS,
|
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutData,
|
||||||
Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
|
Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
|
||||||
},
|
},
|
||||||
LocalFieldId, StructId,
|
LocalFieldId, StructId,
|
||||||
@ -66,7 +66,7 @@ impl rustc_index::Idx for RustcFieldIdx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Layout = LayoutS<RustcFieldIdx, RustcEnumVariantIdx>;
|
pub type Layout = LayoutData<RustcFieldIdx, RustcEnumVariantIdx>;
|
||||||
pub type TagEncoding = hir_def::layout::TagEncoding<RustcEnumVariantIdx>;
|
pub type TagEncoding = hir_def::layout::TagEncoding<RustcEnumVariantIdx>;
|
||||||
pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
|
pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
|
||||||
|
|
||||||
|
10
tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs
Normal file
10
tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Submodule file used by test `../multi-file.rs`.
|
||||||
|
|
||||||
|
// Keywords reserved from Rust 2018:
|
||||||
|
fn async() {}
|
||||||
|
fn await() {}
|
||||||
|
fn try() {}
|
||||||
|
fn dyn() {}
|
||||||
|
|
||||||
|
// Keywords reserved from Rust 2024:
|
||||||
|
fn gen() {}
|
14
tests/ui/lint/keyword-idents/multi-file.rs
Normal file
14
tests/ui/lint/keyword-idents/multi-file.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#![deny(keyword_idents)] // Should affect the submodule, but doesn't.
|
||||||
|
//@ edition: 2015
|
||||||
|
//@ known-bug: #132218
|
||||||
|
//@ check-pass (known bug; should be check-fail)
|
||||||
|
|
||||||
|
// Because `keyword_idents_2018` and `keyword_idents_2024` are pre-expansion
|
||||||
|
// lints, configuring them via lint attributes doesn't propagate to submodules
|
||||||
|
// in other files.
|
||||||
|
// <https://github.com/rust-lang/rust/issues/132218>
|
||||||
|
|
||||||
|
#[path = "./auxiliary/multi_file_submod.rs"]
|
||||||
|
mod multi_file_submod;
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user