1
Fork 0

Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #126380 (Add std Xtensa targets support)
 - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s )
 - #126659 (More status-quo tests for the `#[coverage(..)]` attribute)
 - #126711 (Make Option::as_[mut_]slice const)
 - #126717 (Clean up some comments near `use` declarations)
 - #126719 (Fix assertion failure for some `Expect` diagnostics.)
 - #126730 (Add opaque type corner case test)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-20 13:36:42 +00:00
commit 1ca578e68e
156 changed files with 1731 additions and 664 deletions

View file

@ -709,6 +709,7 @@ dependencies = [
"clippy_config", "clippy_config",
"itertools 0.12.1", "itertools 0.12.1",
"rustc-semver", "rustc-semver",
"rustc_apfloat",
] ]
[[package]] [[package]]

View file

@ -1,6 +1,7 @@
//! The expansion from a test function to the appropriate test struct for libtest
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
use crate::errors; use crate::errors;
/// The expansion from a test function to the appropriate test struct for libtest
/// Ideally, this code would be in libtest but for efficiency and error messages it lives here.
use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute}; use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};
use rustc_ast::ptr::P; use rustc_ast::ptr::P;
use rustc_ast::{self as ast, attr, GenericParamKind}; use rustc_ast::{self as ast, attr, GenericParamKind};

View file

@ -1,4 +1,5 @@
//! The common code for `tests/lang_tests_*.rs` //! The common code for `tests/lang_tests_*.rs`
use std::{ use std::{
env::{self, current_dir}, env::{self, current_dir},
path::{Path, PathBuf}, path::{Path, PathBuf},

View file

@ -1,6 +1,7 @@
//! Locals are in a private module as updating `LocalRef::Operand` has to //! Locals are in a private module as updating `LocalRef::Operand` has to
//! be careful wrt to subtyping. To deal with this we only allow updates by using //! be careful wrt to subtyping. To deal with this we only allow updates by using
//! `FunctionCx::overwrite_local` which handles it automatically. //! `FunctionCx::overwrite_local` which handles it automatically.
use crate::mir::{FunctionCx, LocalRef}; use crate::mir::{FunctionCx, LocalRef};
use crate::traits::BuilderMethods; use crate::traits::BuilderMethods;
use rustc_index::IndexVec; use rustc_index::IndexVec;

View file

@ -1,5 +1,6 @@
/// Converts unsigned integers into a string representation with some base. //! Converts unsigned integers into a string representation with some base.
/// Bases up to and including 36 can be used for case-insensitive things. //! Bases up to and including 36 can be used for case-insensitive things.
use std::ascii; use std::ascii;
use std::fmt; use std::fmt;

View file

@ -1437,6 +1437,24 @@ impl DiagCtxtInner {
// Return value is only `Some` if the level is `Error` or `DelayedBug`. // Return value is only `Some` if the level is `Error` or `DelayedBug`.
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> { fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
match diagnostic.level {
Expect(expect_id) | ForceWarning(Some(expect_id)) => {
// The `LintExpectationId` can be stable or unstable depending on when it was
// created. Diagnostics created before the definition of `HirId`s are unstable and
// can not yet be stored. Instead, they are buffered until the `LintExpectationId`
// is replaced by a stable one by the `LintLevelsBuilder`.
if let LintExpectationId::Unstable { .. } = expect_id {
// We don't call TRACK_DIAGNOSTIC because we wait for the
// unstable ID to be updated, whereupon the diagnostic will be
// passed into this method again.
self.unstable_expect_diagnostics.push(diagnostic);
return None;
}
// Continue through to the `Expect`/`ForceWarning` case below.
}
_ => {}
}
if diagnostic.has_future_breakage() { if diagnostic.has_future_breakage() {
// Future breakages aren't emitted if they're `Level::Allow`, // Future breakages aren't emitted if they're `Level::Allow`,
// but they still need to be constructed and stashed below, // but they still need to be constructed and stashed below,
@ -1512,16 +1530,8 @@ impl DiagCtxtInner {
return None; return None;
} }
Expect(expect_id) | ForceWarning(Some(expect_id)) => { Expect(expect_id) | ForceWarning(Some(expect_id)) => {
// Diagnostics created before the definition of `HirId`s are
// unstable and can not yet be stored. Instead, they are
// buffered until the `LintExpectationId` is replaced by a
// stable one by the `LintLevelsBuilder`.
if let LintExpectationId::Unstable { .. } = expect_id { if let LintExpectationId::Unstable { .. } = expect_id {
// We don't call TRACK_DIAGNOSTIC because we wait for the unreachable!(); // this case was handled at the top of this function
// unstable ID to be updated, whereupon the diagnostic will
// be passed into this method again.
self.unstable_expect_diagnostics.push(diagnostic);
return None;
} }
self.fulfilled_expectations.insert(expect_id.normalize()); self.fulfilled_expectations.insert(expect_id.normalize());
if let Expect(_) = diagnostic.level { if let Expect(_) = diagnostic.level {

View file

@ -1,6 +1,7 @@
//! A simple markdown parser that can write formatted text to the terminal //! A simple markdown parser that can write formatted text to the terminal
//! //!
//! Entrypoint is `MdStream::parse_str(...)` //! Entrypoint is `MdStream::parse_str(...)`
use std::io; use std::io;
use termcolor::{Buffer, BufferWriter, ColorChoice}; use termcolor::{Buffer, BufferWriter, ColorChoice};

View file

@ -104,6 +104,7 @@
//! Kleene operators under which a meta-variable is repeating is the concatenation of the stacks //! Kleene operators under which a meta-variable is repeating is the concatenation of the stacks
//! stored when entering a macro definition starting from the state in which the meta-variable is //! stored when entering a macro definition starting from the state in which the meta-variable is
//! bound. //! bound.
use crate::errors; use crate::errors;
use crate::mbe::{KleeneToken, TokenTree}; use crate::mbe::{KleeneToken, TokenTree};

View file

@ -1,9 +1,7 @@
// tidy-alphabetical-start
use std::ffi::CString; use std::ffi::CString;
use std::fs; use std::fs;
use std::io; use std::io;
use std::path::{absolute, Path, PathBuf}; use std::path::{absolute, Path, PathBuf};
// tidy-alphabetical-end
// Unfortunately, on windows, it looks like msvcrt.dll is silently translating // Unfortunately, on windows, it looks like msvcrt.dll is silently translating
// verbatim paths under the hood to non-verbatim paths! This manifests itself as // verbatim paths under the hood to non-verbatim paths! This manifests itself as

View file

@ -1,6 +1,7 @@
// FIXME(@lcnr): Move this module out of `rustc_hir_analysis`. // FIXME(@lcnr): Move this module out of `rustc_hir_analysis`.
// //
// We don't do any drop checking during hir typeck. // We don't do any drop checking during hir typeck.
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed}; use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
use rustc_infer::infer::outlives::env::OutlivesEnvironment; use rustc_infer::infer::outlives::env::OutlivesEnvironment;

View file

@ -1,4 +1,5 @@
//! Some helper functions for `AutoDeref` //! Some helper functions for `AutoDeref`.
use super::method::MethodCallee; use super::method::MethodCallee;
use super::{FnCtxt, PlaceOp}; use super::{FnCtxt, PlaceOp};

View file

@ -1,4 +1,5 @@
//! Errors emitted by `rustc_hir_typeck`. //! Errors emitted by `rustc_hir_typeck`.
use std::borrow::Cow; use std::borrow::Cow;
use crate::fluent_generated as fluent; use crate::fluent_generated as fluent;

View file

@ -1,4 +1,5 @@
//! A utility module to inspect currently ambiguous obligations in the current context. //! A utility module to inspect currently ambiguous obligations in the current context.
use crate::FnCtxt; use crate::FnCtxt;
use rustc_infer::traits::{self, ObligationCause}; use rustc_infer::traits::{self, ObligationCause};
use rustc_middle::traits::solve::Goal; use rustc_middle::traits::solve::Goal;

View file

@ -1,5 +1,6 @@
//! Error Reporting for Anonymous Region Lifetime Errors //! Error Reporting for Anonymous Region Lifetime Errors
//! where one region is named and the other is anonymous. //! where one region is named and the other is anonymous.
use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::{ use crate::{
errors::ExplicitLifetimeRequired, errors::ExplicitLifetimeRequired,

View file

@ -30,6 +30,7 @@
//! solving a set of constraints. In contrast, the type inferencer assigns a value to each type //! solving a set of constraints. In contrast, the type inferencer assigns a value to each type
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type //! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
//! inferencer knows "so far". //! inferencer knows "so far".
use super::InferCtxt; use super::InferCtxt;
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_middle::bug; use rustc_middle::bug;

View file

@ -1,4 +1,5 @@
//! Various code related to computing outlives relations. //! Various code related to computing outlives relations.
use self::env::OutlivesEnvironment; use self::env::OutlivesEnvironment;
use super::region_constraints::RegionConstraintData; use super::region_constraints::RegionConstraintData;
use super::{InferCtxt, RegionResolutionError, SubregionOrigin}; use super::{InferCtxt, RegionResolutionError, SubregionOrigin};

View file

@ -1,4 +1,3 @@
// tidy-alphabetical-start
pub use self::Level::*; pub use self::Level::*;
use rustc_ast::node_id::NodeId; use rustc_ast::node_id::NodeId;
use rustc_ast::{AttrId, Attribute}; use rustc_ast::{AttrId, Attribute};
@ -15,7 +14,6 @@ use rustc_span::edition::Edition;
use rustc_span::symbol::MacroRulesNormalizedIdent; use rustc_span::symbol::MacroRulesNormalizedIdent;
use rustc_span::{sym, symbol::Ident, Span, Symbol}; use rustc_span::{sym, symbol::Ident, Span, Symbol};
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
// tidy-alphabetical-end
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,6 +1,7 @@
//! A pass that checks to make sure private fields and methods aren't used //! A pass that checks to make sure private fields and methods aren't used
//! outside their scopes. This pass will also generate a set of exported items //! outside their scopes. This pass will also generate a set of exported items
//! which are available for use externally when compiled as a library. //! which are available for use externally when compiled as a library.
use crate::ty::{TyCtxt, Visibility}; use crate::ty::{TyCtxt, Visibility};
use rustc_data_structures::fx::{FxIndexMap, IndexEntry}; use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};

View file

@ -1,4 +1,5 @@
/// Functionality for statements, operands, places, and things that appear in them. //! Functionality for statements, operands, places, and things that appear in them.
use super::{interpret::GlobalAlloc, *}; use super::{interpret::GlobalAlloc, *};
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View file

@ -1,4 +1,5 @@
/// Functionality for terminators and helper types that appear in terminators. //! Functionality for terminators and helper types that appear in terminators.
use rustc_hir::LangItem; use rustc_hir::LangItem;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};

View file

@ -1,4 +1,5 @@
//! A subset of a mir body used for const evaluability checking. //! A subset of a mir body used for const evaluability checking.
use crate::ty::{ use crate::ty::{
self, Const, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, self, Const, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
TypeVisitableExt, TypeVisitableExt,

View file

@ -1,5 +1,6 @@
//! A pass that inserts the `ConstEvalCounter` instruction into any blocks that have a back edge //! A pass that inserts the `ConstEvalCounter` instruction into any blocks that have a back edge
//! (thus indicating there is a loop in the CFG), or whose terminator is a function call. //! (thus indicating there is a loop in the CFG), or whose terminator is a function call.
use crate::MirPass; use crate::MirPass;
use rustc_data_structures::graph::dominators::Dominators; use rustc_data_structures::graph::dominators::Dominators;

View file

@ -1,4 +1,5 @@
//! Inlining pass for MIR functions //! Inlining pass for MIR functions.
use crate::deref_separator::deref_finder; use crate::deref_separator::deref_finder;
use rustc_attr::InlineAttr; use rustc_attr::InlineAttr;
use rustc_hir::def::DefKind; use rustc_hir::def::DefKind;

View file

@ -1,6 +1,7 @@
//! This pass statically detects code which has undefined behaviour or is likely to be erroneous. //! This pass statically detects code which has undefined behaviour or is likely to be erroneous.
//! It can be used to locate problems in MIR building or optimizations. It assumes that all code //! It can be used to locate problems in MIR building or optimizations. It assumes that all code
//! can be executed, so it has false positives. //! can be executed, so it has false positives.
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_index::bit_set::BitSet; use rustc_index::bit_set::BitSet;
use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::visit::{PlaceContext, Visitor};

View file

@ -1,4 +1,5 @@
// ignore-tidy-filelength // ignore-tidy-filelength
use super::diagnostics::SnapshotParser; use super::diagnostics::SnapshotParser;
use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma}; use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma};
use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};

View file

@ -1,5 +1,6 @@
//! As explained in [`crate::usefulness`], values and patterns are made from constructors applied to //! As explained in [`crate::usefulness`], values and patterns are made from constructors applied to
//! fields. This file defines types that represent patterns in this way. //! fields. This file defines types that represent patterns in this way.
use std::fmt; use std::fmt;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};

View file

@ -1,4 +1,5 @@
//! Test the pattern complexity limit. //! Test the pattern complexity limit.
use common::*; use common::*;
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm}; use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};

View file

@ -1,4 +1,5 @@
//! Test exhaustiveness checking. //! Test exhaustiveness checking.
use common::*; use common::*;
use rustc_pattern_analysis::{ use rustc_pattern_analysis::{
pat::{DeconstructedPat, WitnessPat}, pat::{DeconstructedPat, WitnessPat},

View file

@ -1,4 +1,5 @@
//! Test the computation of arm intersections. //! Test the computation of arm intersections.
use common::*; use common::*;
use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm}; use rustc_pattern_analysis::{pat::DeconstructedPat, usefulness::PlaceValidity, MatchArm};

View file

@ -4,6 +4,7 @@
//! //!
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, //! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
//! see design document in the tracking issue #89653. //! see design document in the tracking issue #89653.
use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::ToBaseN;
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY; use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
use rustc_data_structures::base_n::CASE_INSENSITIVE; use rustc_data_structures::base_n::CASE_INSENSITIVE;

View file

@ -3,6 +3,7 @@
//! //!
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, //! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
//! see design document in the tracking issue #89653. //! see design document in the tracking issue #89653.
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable};

View file

@ -3,6 +3,7 @@
//! //!
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, //! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
//! see design document in the tracking issue #89653. //! see design document in the tracking issue #89653.
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::LangItem; use rustc_hir::LangItem;
use rustc_middle::bug; use rustc_middle::bug;

View file

@ -3,6 +3,7 @@
//! //!
//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, //! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
//! see design document in the tracking issue #89653. //! see design document in the tracking issue #89653.
use bitflags::bitflags; use bitflags::bitflags;
use rustc_middle::ty::{Instance, Ty, TyCtxt}; use rustc_middle::ty::{Instance, Ty, TyCtxt};
use rustc_target::abi::call::FnAbi; use rustc_target::abi::call::FnAbi;

View file

@ -3,6 +3,7 @@
//! //!
//! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler, //! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler,
//! see the tracking issue #123479. //! see the tracking issue #123479.
use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt}; use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt};
use rustc_target::abi::call::FnAbi; use rustc_target::abi::call::FnAbi;
use std::hash::Hasher; use std::hash::Hasher;

View file

@ -1,4 +1,5 @@
//! Related to out filenames of compilation (e.g. binaries). //! Related to out filenames of compilation (e.g. binaries).
use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType}; use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType};
use crate::errors::{ use crate::errors::{
self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable, self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable,

View file

@ -3,6 +3,7 @@
//! We first retrieve and monomorphize the rustc body representation, i.e., we generate a //! We first retrieve and monomorphize the rustc body representation, i.e., we generate a
//! monomorphic body using internal representation. //! monomorphic body using internal representation.
//! After that, we convert the internal representation into a stable one. //! After that, we convert the internal representation into a stable one.
use crate::rustc_smir::{Stable, Tables}; use crate::rustc_smir::{Stable, Tables};
use rustc_hir::def::DefKind; use rustc_hir::def::DefKind;
use rustc_middle::mir; use rustc_middle::mir;

View file

@ -1,6 +1,7 @@
//! Handle the conversion of different internal errors into a stable version. //! Handle the conversion of different internal errors into a stable version.
//! //!
//! Currently we encode everything as [stable_mir::Error], which is represented as a string. //! Currently we encode everything as [stable_mir::Error], which is represented as a string.
use crate::rustc_smir::{Stable, Tables}; use crate::rustc_smir::{Stable, Tables};
use rustc_middle::mir::interpret::AllocError; use rustc_middle::mir::interpret::AllocError;
use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::layout::LayoutError;

View file

@ -1768,8 +1768,11 @@ supported_targets! {
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda), ("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
("xtensa-esp32-none-elf", xtensa_esp32_none_elf), ("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
("xtensa-esp32-espidf", xtensa_esp32_espidf),
("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf), ("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf),
("xtensa-esp32s2-espidf", xtensa_esp32s2_espidf),
("xtensa-esp32s3-none-elf", xtensa_esp32s3_none_elf), ("xtensa-esp32s3-none-elf", xtensa_esp32s3_none_elf),
("xtensa-esp32s3-espidf", xtensa_esp32s3_espidf),
("i686-wrs-vxworks", i686_wrs_vxworks), ("i686-wrs-vxworks", i686_wrs_vxworks),
("x86_64-wrs-vxworks", x86_64_wrs_vxworks), ("x86_64-wrs-vxworks", x86_64_wrs_vxworks),

View file

@ -1,5 +1,5 @@
/// A target tuple for OpenWrt MIPS64 targets //! A target tuple for OpenWrt MIPS64 targets.
///
use crate::abi::Endian; use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions}; use crate::spec::{base, Target, TargetOptions};

View file

@ -0,0 +1,36 @@
use crate::abi::Endian;
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
arch: "xtensa".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
},
options: TargetOptions {
endian: Endian::Little,
c_int_width: "32".into(),
families: cvs!["unix"],
os: "espidf".into(),
env: "newlib".into(),
vendor: "espressif".into(),
executables: true,
cpu: "esp32".into(),
linker: Some("xtensa-esp32-elf-gcc".into()),
// The esp32 only supports native 32bit atomics.
max_atomic_width: Some(32),
atomic_cas: true,
..xtensa::opts()
},
}
}

View file

@ -0,0 +1,43 @@
use crate::abi::Endian;
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
arch: "xtensa".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
},
options: TargetOptions {
endian: Endian::Little,
c_int_width: "32".into(),
families: cvs!["unix"],
os: "espidf".into(),
env: "newlib".into(),
vendor: "espressif".into(),
executables: true,
cpu: "esp32-s2".into(),
linker: Some("xtensa-esp32s2-elf-gcc".into()),
// See https://github.com/espressif/rust-esp32-example/issues/3#issuecomment-861054477
//
// While the ESP32-S2 chip does not natively support atomics, ESP-IDF does support
// the __atomic* and __sync* compiler builtins. Setting `max_atomic_width` and `atomic_cas`
// and `atomic_cas: true` will cause the compiler to emit libcalls to these builtins. On the
// ESP32-S2, these are guaranteed to be lock-free.
//
// Support for atomics is necessary for the Rust STD library, which is supported by ESP-IDF.
max_atomic_width: Some(32),
atomic_cas: true,
..xtensa::opts()
},
}
}

View file

@ -0,0 +1,36 @@
use crate::abi::Endian;
use crate::spec::{base::xtensa, cvs, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(),
arch: "xtensa".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
host_tools: None,
std: None,
},
options: TargetOptions {
endian: Endian::Little,
c_int_width: "32".into(),
families: cvs!["unix"],
os: "espidf".into(),
env: "newlib".into(),
vendor: "espressif".into(),
executables: true,
cpu: "esp32-s3".into(),
linker: Some("xtensa-esp32s3-elf-gcc".into()),
// The esp32s3 only supports native 32bit atomics.
max_atomic_width: Some(32),
atomic_cas: true,
..xtensa::opts()
},
}
}

View file

@ -1,4 +1,5 @@
//! Deeply normalize types using the old trait solver. //! Deeply normalize types using the old trait solver.
use super::error_reporting::OverflowCause; use super::error_reporting::OverflowCause;
use super::error_reporting::TypeErrCtxtExt; use super::error_reporting::TypeErrCtxtExt;
use super::SelectionContext; use super::SelectionContext;

View file

@ -6,6 +6,7 @@
//! //!
//! [rustc dev guide]: //! [rustc dev guide]:
//! https://rustc-dev-guide.rust-lang.org/traits/resolution.html#confirmation //! https://rustc-dev-guide.rust-lang.org/traits/resolution.html#confirmation
use rustc_ast::Mutability; use rustc_ast::Mutability;
use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;

View file

@ -1,4 +1,5 @@
//! This module provides methods to retrieve allocation information, such as static variables. //! This module provides methods to retrieve allocation information, such as static variables.
use crate::mir::mono::{Instance, StaticDef}; use crate::mir::mono::{Instance, StaticDef};
use crate::target::{Endian, MachineInfo}; use crate::target::{Endian, MachineInfo};
use crate::ty::{Allocation, Binder, ExistentialTraitRef, IndexedVal, Ty}; use crate::ty::{Allocation, Binder, ExistentialTraitRef, IndexedVal, Ty};

View file

@ -1,6 +1,7 @@
// Based on //! Based on
// https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs //! <https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs>
// by matthieu-m //! by matthieu-m
use crate::alloc::{self, Layout, LayoutError}; use crate::alloc::{self, Layout, LayoutError};
use core::error::Error; use core::error::Error;
use core::fmt::{self, Debug, Display, Formatter}; use core::fmt::{self, Debug, Display, Formatter};

View file

@ -154,6 +154,7 @@
//! } //! }
//! vec.truncate(write_idx); //! vec.truncate(write_idx);
//! ``` //! ```
use crate::alloc::{handle_alloc_error, Global}; use crate::alloc::{handle_alloc_error, Global};
use core::alloc::Allocator; use core::alloc::Allocator;
use core::alloc::Layout; use core::alloc::Layout;

View file

@ -797,7 +797,8 @@ impl<T> Option<T> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "option_as_slice", since = "1.75.0")] #[stable(feature = "option_as_slice", since = "1.75.0")]
pub fn as_slice(&self) -> &[T] { #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
pub const fn as_slice(&self) -> &[T] {
// SAFETY: When the `Option` is `Some`, we're using the actual pointer // SAFETY: When the `Option` is `Some`, we're using the actual pointer
// to the payload, with a length of 1, so this is equivalent to // to the payload, with a length of 1, so this is equivalent to
// `slice::from_ref`, and thus is safe. // `slice::from_ref`, and thus is safe.
@ -811,7 +812,7 @@ impl<T> Option<T> {
unsafe { unsafe {
slice::from_raw_parts( slice::from_raw_parts(
(self as *const Self).byte_add(core::mem::offset_of!(Self, Some.0)).cast(), (self as *const Self).byte_add(core::mem::offset_of!(Self, Some.0)).cast(),
usize::from(self.is_some()), self.is_some() as usize,
) )
} }
} }
@ -851,7 +852,8 @@ impl<T> Option<T> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "option_as_slice", since = "1.75.0")] #[stable(feature = "option_as_slice", since = "1.75.0")]
pub fn as_mut_slice(&mut self) -> &mut [T] { #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
pub const fn as_mut_slice(&mut self) -> &mut [T] {
// SAFETY: When the `Option` is `Some`, we're using the actual pointer // SAFETY: When the `Option` is `Some`, we're using the actual pointer
// to the payload, with a length of 1, so this is equivalent to // to the payload, with a length of 1, so this is equivalent to
// `slice::from_mut`, and thus is safe. // `slice::from_mut`, and thus is safe.
@ -867,7 +869,7 @@ impl<T> Option<T> {
unsafe { unsafe {
slice::from_raw_parts_mut( slice::from_raw_parts_mut(
(self as *mut Self).byte_add(core::mem::offset_of!(Self, Some.0)).cast(), (self as *mut Self).byte_add(core::mem::offset_of!(Self, Some.0)).cast(),
usize::from(self.is_some()), self.is_some() as usize,
) )
} }
} }

View file

@ -17,6 +17,7 @@
//! Note: Because the term "leading byte" can sometimes be ambiguous (for //! Note: Because the term "leading byte" can sometimes be ambiguous (for
//! example, it could also refer to the first byte of a slice), we'll often use //! example, it could also refer to the first byte of a slice), we'll often use
//! the term "non-continuation byte" to refer to these bytes in the code. //! the term "non-continuation byte" to refer to these bytes in the code.
use core::intrinsics::unlikely; use core::intrinsics::unlikely;
const USIZE_SIZE: usize = core::mem::size_of::<usize>(); const USIZE_SIZE: usize = core::mem::size_of::<usize>();

View file

@ -3,6 +3,7 @@ use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
#[cfg(not(panic = "abort"))] #[cfg(not(panic = "abort"))]
mod drop_checks { mod drop_checks {
//! These tests mainly make sure the elements are correctly dropped. //! These tests mainly make sure the elements are correctly dropped.
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst};
#[derive(Debug)] #[derive(Debug)]

View file

@ -1,4 +1,5 @@
// FIXME: These tests are all excellent candidates for AFL fuzz testing // FIXME: These tests are all excellent candidates for AFL fuzz testing
use core::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; use core::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use core::str::FromStr; use core::str::FromStr;

View file

@ -27,6 +27,7 @@
//! standard. That is why they accept wildly diverse inputs or may seem to duplicate other tests. //! standard. That is why they accept wildly diverse inputs or may seem to duplicate other tests.
//! Please consider this carefully when adding, removing, or reorganizing these tests. They are //! Please consider this carefully when adding, removing, or reorganizing these tests. They are
//! here so that it is clear what tests are required by the standard and what can be changed. //! here so that it is clear what tests are required by the standard and what can be changed.
use ::core::str::FromStr; use ::core::str::FromStr;
// IEEE 754 for many tests is applied to specific bit patterns. // IEEE 754 for many tests is applied to specific bit patterns.

View file

@ -574,4 +574,13 @@ fn as_slice() {
assert_eq!(Some(43).as_mut_slice(), &[43]); assert_eq!(Some(43).as_mut_slice(), &[43]);
assert_eq!(None::<i32>.as_slice(), &[]); assert_eq!(None::<i32>.as_slice(), &[]);
assert_eq!(None::<i32>.as_mut_slice(), &[]); assert_eq!(None::<i32>.as_mut_slice(), &[]);
const A: &[u32] = Some(44).as_slice();
const B: &[u32] = None.as_slice();
const _: () = {
let [45] = Some(45).as_mut_slice() else { panic!() };
let []: &[u32] = None.as_mut_slice() else { panic!() };
};
assert_eq!(A, &[44]);
assert_eq!(B, &[]);
} }

View file

@ -1,4 +1,5 @@
// edition:2021 // edition:2021
use core::{ use core::{
marker::PhantomPinned, marker::PhantomPinned,
mem::{drop as stuff, transmute}, mem::{drop as stuff, transmute},

View file

@ -1,4 +1,5 @@
//! Unwinding panics for Miri. //! Unwinding panics for Miri.
use alloc::boxed::Box; use alloc::boxed::Box;
use core::any::Any; use core::any::Any;

View file

@ -1,6 +1,5 @@
// Code taken from the `packed_simd` crate //! Code taken from the `packed_simd` crate.
// Run this code with `cargo test --example dot_product` //! Run this code with `cargo test --example dot_product`.
//use std::iter::zip;
#![feature(array_chunks)] #![feature(array_chunks)]
#![feature(slice_as_chunks)] #![feature(slice_as_chunks)]

View file

@ -1,4 +1,5 @@
//! Assignment operators //! Assignment operators
use super::*; use super::*;
use core::ops::{AddAssign, MulAssign}; // commutative binary op-assignment use core::ops::{AddAssign, MulAssign}; // commutative binary op-assignment
use core::ops::{BitAndAssign, BitOrAssign, BitXorAssign}; // commutative bit binary op-assignment use core::ops::{BitAndAssign, BitOrAssign, BitXorAssign}; // commutative bit binary op-assignment

View file

@ -2,6 +2,7 @@
//! Ideally, Rust would take care of this itself, //! Ideally, Rust would take care of this itself,
//! and method calls usually handle the LHS implicitly. //! and method calls usually handle the LHS implicitly.
//! But this is not the case with arithmetic ops. //! But this is not the case with arithmetic ops.
use super::*; use super::*;
macro_rules! deref_lhs { macro_rules! deref_lhs {

View file

@ -6,6 +6,7 @@
//! outside this crate. //! outside this crate.
//! //!
//! [`collections`]: crate::collections //! [`collections`]: crate::collections
#[allow(deprecated)] #[allow(deprecated)]
use super::{BuildHasher, Hasher, SipHasher13}; use super::{BuildHasher, Hasher, SipHasher13};
use crate::cell::Cell; use crate::cell::Cell;

View file

@ -1,13 +1,14 @@
///! An encapsulation of `BufReader`'s buffer management logic. //! An encapsulation of `BufReader`'s buffer management logic.
/// //!
/// This module factors out the basic functionality of `BufReader` in order to protect two core //! This module factors out the basic functionality of `BufReader` in order to protect two core
/// invariants: //! invariants:
/// * `filled` bytes of `buf` are always initialized //! * `filled` bytes of `buf` are always initialized
/// * `pos` is always <= `filled` //! * `pos` is always <= `filled`
/// Since this module encapsulates the buffer management logic, we can ensure that the range //! Since this module encapsulates the buffer management logic, we can ensure that the range
/// `pos..filled` is always a valid index into the initialized region of the buffer. This means //! `pos..filled` is always a valid index into the initialized region of the buffer. This means
/// that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so //! that user code which wants to do reads from a `BufReader` via `buffer` + `consume` can do so
/// without encountering any runtime bounds checks. //! without encountering any runtime bounds checks.
use crate::cmp; use crate::cmp;
use crate::io::{self, BorrowedBuf, Read}; use crate::io::{self, BorrowedBuf, Read};
use crate::mem::MaybeUninit; use crate::mem::MaybeUninit;

View file

@ -1,5 +1,6 @@
/// The underlying OsString/OsStr implementation on Windows is a //! The underlying OsString/OsStr implementation on Windows is a
/// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. //! wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
use crate::borrow::Cow; use crate::borrow::Cow;
use crate::collections::TryReserveError; use crate::collections::TryReserveError;
use crate::fmt; use crate::fmt;

View file

@ -1,5 +1,6 @@
//! Thread implementation backed by μITRON tasks. Assumes `acre_tsk` and //! Thread implementation backed by μITRON tasks. Assumes `acre_tsk` and
//! `exd_tsk` are available. //! `exd_tsk` are available.
use super::{ use super::{
abi, abi,
error::{expect_success, expect_success_aborting, ItronError}, error::{expect_success, expect_success_aborting, ItronError},

View file

@ -1,4 +1,5 @@
//! `solid_fs.h` //! `solid_fs.h`
use crate::os::raw::{c_char, c_int, c_uchar}; use crate::os::raw::{c_char, c_int, c_uchar};
pub use libc::{ pub use libc::{
ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY,

View file

@ -1,6 +1,7 @@
//! Emulated wait status for non-Unix #[cfg(unix) platforms //! Emulated wait status for non-Unix #[cfg(unix) platforms
//! //!
//! Separate module to facilitate testing against a real Unix implementation. //! Separate module to facilitate testing against a real Unix implementation.
use crate::ffi::c_int; use crate::ffi::c_int;
use crate::fmt; use crate::fmt;
use crate::num::NonZero; use crate::num::NonZero;

View file

@ -475,6 +475,7 @@ mod cgroups {
//! * cgroup v2 in non-standard mountpoints //! * cgroup v2 in non-standard mountpoints
//! * paths containing control characters or spaces, since those would be escaped in procfs //! * paths containing control characters or spaces, since those would be escaped in procfs
//! output and we don't unescape //! output and we don't unescape
use crate::borrow::Cow; use crate::borrow::Cow;
use crate::ffi::OsString; use crate::ffi::OsString;
use crate::fs::{try_exists, File}; use crate::fs::{try_exists, File};

View file

@ -1,4 +1,5 @@
//! POSIX conditional variable implementation based on user-space wait queues. //! POSIX conditional variable implementation based on user-space wait queues.
use crate::sys::pal::itron::{ use crate::sys::pal::itron::{
abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong, abi, error::expect_success_aborting, spin::SpinMutex, task, time::with_tmos_strong,
}; };

View file

@ -1,5 +1,6 @@
//! Mutex implementation backed by μITRON mutexes. Assumes `acre_mtx` and //! Mutex implementation backed by μITRON mutexes. Assumes `acre_mtx` and
//! `TA_INHERIT` are available. //! `TA_INHERIT` are available.
use crate::sys::pal::itron::{ use crate::sys::pal::itron::{
abi, abi,
error::{expect_success, expect_success_aborting, fail, ItronError}, error::{expect_success, expect_success_aborting, fail, ItronError},

View file

@ -1,4 +1,5 @@
//! A readers-writer lock implementation backed by the SOLID kernel extension. //! A readers-writer lock implementation backed by the SOLID kernel extension.
use crate::sys::pal::{ use crate::sys::pal::{
abi, abi,
itron::{ itron::{

View file

@ -2,6 +2,7 @@
//! Note that this test changes the current directory so //! Note that this test changes the current directory so
//! should not be in the same process as other tests. //! should not be in the same process as other tests.
use std::env; use std::env;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};

View file

@ -1,4 +1,5 @@
//! Benchmarking module. //! Benchmarking module.
use super::{ use super::{
event::CompletedTest, event::CompletedTest,
options::BenchMode, options::BenchMode,

View file

@ -1,5 +1,6 @@
//! Helper module which helps to determine amount of threads to be used //! Helper module which helps to determine amount of threads to be used
//! during tests execution. //! during tests execution.
use std::{env, num::NonZero, thread}; use std::{env, num::NonZero, thread};
pub fn get_concurrency() -> usize { pub fn get_concurrency() -> usize {

View file

@ -1,4 +1,5 @@
//! Benchmark metrics. //! Benchmark metrics.
use std::collections::BTreeMap; use std::collections::BTreeMap;
#[derive(Clone, PartialEq, Debug, Copy)] #[derive(Clone, PartialEq, Debug, Copy)]

View file

@ -47,7 +47,7 @@
- [\*-linux-ohos](platform-support/openharmony.md) - [\*-linux-ohos](platform-support/openharmony.md)
- [\*-hurd-gnu](platform-support/hurd.md) - [\*-hurd-gnu](platform-support/hurd.md)
- [aarch64-unknown-teeos](platform-support/aarch64-unknown-teeos.md) - [aarch64-unknown-teeos](platform-support/aarch64-unknown-teeos.md)
- [\*-esp-espidf](platform-support/esp-idf.md) - [\*-espidf](platform-support/esp-idf.md)
- [\*-unknown-fuchsia](platform-support/fuchsia.md) - [\*-unknown-fuchsia](platform-support/fuchsia.md)
- [\*-kmc-solid_\*](platform-support/kmc-solid.md) - [\*-kmc-solid_\*](platform-support/kmc-solid.md)
- [csky-unknown-linux-gnuabiv2\*](platform-support/csky-unknown-linux-gnuabiv2.md) - [csky-unknown-linux-gnuabiv2\*](platform-support/csky-unknown-linux-gnuabiv2.md)
@ -81,6 +81,7 @@
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md) - [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
- [x86_64-unknown-linux-none.md](platform-support/x86_64-unknown-linux-none.md) - [x86_64-unknown-linux-none.md](platform-support/x86_64-unknown-linux-none.md)
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md) - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)
- [xtensa-\*-none-elf](platform-support/xtensa.md)
- [Targets](targets/index.md) - [Targets](targets/index.md)
- [Built-in Targets](targets/built-in.md) - [Built-in Targets](targets/built-in.md)
- [Custom Targets](targets/custom.md) - [Custom Targets](targets/custom.md)

View file

@ -384,8 +384,11 @@ target | std | host | notes
`x86_64-wrs-vxworks` | ? | | `x86_64-wrs-vxworks` | ? | |
[`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell) [`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell)
[`x86_64-unknown-linux-none`](platform-support/x86_64-unknown-linux-none.md) | * | | 64-bit Linux with no libc [`x86_64-unknown-linux-none`](platform-support/x86_64-unknown-linux-none.md) | * | | 64-bit Linux with no libc
`xtensa-esp32-none-elf` | | | Xtensa ESP32 [`xtensa-esp32-none-elf`](platform-support/xtensa.md) | * | | Xtensa ESP32
`xtensa-esp32s2-none-elf` | | | Xtensa ESP32-S2 [`xtensa-esp32-espidf`](platform-support/esp-idf.md) | ✓ | | Xtensa ESP32
`xtensa-esp32s3-none-elf` | | | Xtensa ESP32-S3 [`xtensa-esp32s2-none-elf`](platform-support/xtensa.md) | * | | Xtensa ESP32-S2
[`xtensa-esp32s2-espidf`](platform-support/esp-idf.md) | ✓ | | Xtensa ESP32-S2
[`xtensa-esp32s3-none-elf`](platform-support/xtensa.md) | * | | Xtensa ESP32-S3
[`xtensa-esp32s3-espidf`](platform-support/esp-idf.md) | ✓ | | Xtensa ESP32-S3
[runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets [runs on NVIDIA GPUs]: https://github.com/japaric-archived/nvptx#targets

View file

@ -1,4 +1,4 @@
# `*-esp-espidf` # `*-espidf`
**Tier: 3** **Tier: 3**
@ -8,18 +8,22 @@ Targets for the [ESP-IDF](https://github.com/espressif/esp-idf) development fram
- Ivan Markov [@ivmarkov](https://github.com/ivmarkov) - Ivan Markov [@ivmarkov](https://github.com/ivmarkov)
- Scott Mabin [@MabezDev](https://github.com/MabezDev) - Scott Mabin [@MabezDev](https://github.com/MabezDev)
- Sergio Gasquez [@SergioGasquez](https://github.com/SergioGasquez)
## Requirements ## Requirements
The target names follow this format: `$ARCH-esp-espidf`, where `$ARCH` specifies the target processor architecture. The following targets are currently defined: The target names follow this format: `$ARCH-esp-espidf`, where `$ARCH` specifies the target processor architecture. The following targets are currently defined:
| Target name | Target CPU(s) | Minimum ESP-IDF version | | Target name | Target CPU(s) | Minimum ESP-IDF version |
| ------------------------ | --------------------------------------------------------------- | ----------------------- | | ------------------------- | --------------------------------------------------------------- | ----------------------- |
| `riscv32imc-esp-espidf` | [ESP32-C2](https://www.espressif.com/en/products/socs/esp32-c2) | `v5.0` | | `riscv32imc-esp-espidf` | [ESP32-C2](https://www.espressif.com/en/products/socs/esp32-c2) | `v5.0` |
| `riscv32imc-esp-espidf` | [ESP32-C3](https://www.espressif.com/en/products/socs/esp32-c3) | `v4.3` | | `riscv32imc-esp-espidf` | [ESP32-C3](https://www.espressif.com/en/products/socs/esp32-c3) | `v4.4` |
| `riscv32imac-esp-espidf` | [ESP32-C6](https://www.espressif.com/en/products/socs/esp32-c6) | `v5.1` | | `riscv32imac-esp-espidf` | [ESP32-C6](https://www.espressif.com/en/products/socs/esp32-c6) | `v5.1` |
| `riscv32imac-esp-espidf` | [ESP32-H2](https://www.espressif.com/en/products/socs/esp32-h2) | `v5.1` | | `riscv32imac-esp-espidf` | [ESP32-H2](https://www.espressif.com/en/products/socs/esp32-h2) | `v5.1` |
| `riscv32imafc-esp-espidf` | [ESP32-P4](https://www.espressif.com/en/news/ESP32-P4) | `v5.2` | | `riscv32imafc-esp-espidf` | [ESP32-P4](https://www.espressif.com/en/news/ESP32-P4) | `v5.2` |
| `xtensa-esp32-espidf` | [ESP32](https://www.espressif.com/en/products/socs/esp32) | `v4.4` |
| `xtensa-esp32s2-espidf` | [ESP32-S2](https://www.espressif.com/en/products/socs/esp32-s2) | `v4.4` |
| `xtensa-esp32s3-espidf` | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) | `v4.4` |
It is recommended to use the latest ESP-IDF stable release if possible. It is recommended to use the latest ESP-IDF stable release if possible.

View file

@ -1,4 +1,4 @@
# `xtensa-*` # `xtensa-*-none-elf`
**Tier: 3** **Tier: 3**
@ -20,6 +20,8 @@ The target names follow this format: `xtensa-$CPU`, where `$CPU` specifies the t
| `xtensa-esp32s3-none-elf` | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) | | `xtensa-esp32s3-none-elf` | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) |
## Building the target Xtensa targets that support `std` are documented in the [ESP-IDF platform support document](esp-idf.md)
## Building the targets
The targets can be built by installing the [Xtensa enabled Rust channel](https://github.com/esp-rs/rust/). See instructions in the [RISC-V and Xtensa Targets section of the The Rust on ESP Book](https://docs.esp-rs.org/book/installation/riscv-and-xtensa.html). The targets can be built by installing the [Xtensa enabled Rust channel](https://github.com/esp-rs/rust/). See instructions in the [RISC-V and Xtensa Targets section of the The Rust on ESP Book](https://docs.esp-rs.org/book/installation/riscv-and-xtensa.html).

View file

@ -1,4 +1,5 @@
//! Calculates information used for the --show-coverage flag. //! Calculates information used for the --show-coverage flag.
use crate::clean; use crate::clean;
use crate::core::DocContext; use crate::core::DocContext;
use crate::html::markdown::{find_testable_code, ErrorCodes}; use crate::html::markdown::{find_testable_code, ErrorCodes};

View file

@ -1,6 +1,7 @@
//! Collects trait impls for each item in the crate. For example, if a crate //! Collects trait impls for each item in the crate. For example, if a crate
//! defines a struct that implements a trait, this pass will note that the //! defines a struct that implements a trait, this pass will note that the
//! struct implements that trait. //! struct implements that trait.
use super::Pass; use super::Pass;
use crate::clean::*; use crate::clean::*;
use crate::core::DocContext; use crate::core::DocContext;

View file

@ -1,4 +1,5 @@
//! Validates syntax inside Rust code blocks (\`\`\`rust). //! Validates syntax inside Rust code blocks (\`\`\`rust).
use rustc_data_structures::sync::{Lock, Lrc}; use rustc_data_structures::sync::{Lock, Lrc};
use rustc_errors::{ use rustc_errors::{
emitter::Emitter, emitter::Emitter,

View file

@ -1,4 +1,5 @@
//! Detects invalid HTML (like an unclosed `<span>`) in doc comments. //! Detects invalid HTML (like an unclosed `<span>`) in doc comments.
use crate::clean::*; use crate::clean::*;
use crate::core::DocContext; use crate::core::DocContext;
use crate::html::markdown::main_body_opts; use crate::html::markdown::main_body_opts;

View file

@ -1,4 +1,5 @@
//! Propagates [`#[doc(cfg(...))]`](https://github.com/rust-lang/rust/issues/43781) to child items. //! Propagates [`#[doc(cfg(...))]`](https://github.com/rust-lang/rust/issues/43781) to child items.
use std::sync::Arc; use std::sync::Arc;
use crate::clean::cfg::Cfg; use crate::clean::cfg::Cfg;

View file

@ -1,5 +1,6 @@
//! Strips all private import statements (use, extern crate) from a //! Strips all private import statements (use, extern crate) from a
//! crate. //! crate.
use crate::clean; use crate::clean;
use crate::core::DocContext; use crate::core::DocContext;
use crate::fold::DocFolder; use crate::fold::DocFolder;

View file

@ -1,5 +1,6 @@
//! Strip all private items from the output. Additionally implies strip_priv_imports. //! Strip all private items from the output. Additionally implies strip_priv_imports.
//! Basically, the goal is to remove items that are not relevant for public documentation. //! Basically, the goal is to remove items that are not relevant for public documentation.
use crate::clean::{self, ItemIdSet}; use crate::clean::{self, ItemIdSet};
use crate::core::DocContext; use crate::core::DocContext;
use crate::fold::DocFolder; use crate::fold::DocFolder;

View file

@ -1,4 +1,5 @@
//! A collection of utility functions for the `strip_*` passes. //! A collection of utility functions for the `strip_*` passes.
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_middle::ty::{TyCtxt, Visibility}; use rustc_middle::ty::{TyCtxt, Visibility};
use std::mem; use std::mem;

View file

@ -21,6 +21,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
fn is_known_nan(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { fn is_known_nan(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
match constant(cx, cx.typeck_results(), e) { match constant(cx, cx.typeck_results(), e) {
// FIXME(f16_f128): add these types when nan checks are available on all platforms
Some(Constant::F64(n)) => n.is_nan(), Some(Constant::F64(n)) => n.is_nan(),
Some(Constant::F32(n)) => n.is_nan(), Some(Constant::F32(n)) => n.is_nan(),
_ => false, _ => false,

View file

@ -141,18 +141,17 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
#[must_use] #[must_use]
fn max_digits(fty: FloatTy) -> u32 { fn max_digits(fty: FloatTy) -> u32 {
match fty { match fty {
// FIXME(f16_f128): replace the magic numbers once `{f16,f128}::DIGITS` are available FloatTy::F16 => f16::DIGITS,
FloatTy::F16 => 3,
FloatTy::F32 => f32::DIGITS, FloatTy::F32 => f32::DIGITS,
FloatTy::F64 => f64::DIGITS, FloatTy::F64 => f64::DIGITS,
FloatTy::F128 => 33, FloatTy::F128 => f128::DIGITS,
} }
} }
/// Counts the digits excluding leading zeros /// Counts the digits excluding leading zeros
#[must_use] #[must_use]
fn count_digits(s: &str) -> usize { fn count_digits(s: &str) -> usize {
// Note that s does not contain the f32/64 suffix, and underscores have been stripped // Note that s does not contain the `f{16,32,64,128}` suffix, and underscores have been stripped
s.chars() s.chars()
.filter(|c| *c != '-' && *c != '.') .filter(|c| *c != '-' && *c != '.')
.take_while(|c| *c != 'e' && *c != 'E') .take_while(|c| *c != 'e' && *c != 'E')

View file

@ -1,6 +1,8 @@
#![feature(array_windows)] #![feature(array_windows)]
#![feature(binary_heap_into_iter_sorted)] #![feature(binary_heap_into_iter_sorted)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(f128)]
#![feature(f16)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -156,6 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualFloatMethods {
fn is_infinity(constant: &Constant<'_>) -> bool { fn is_infinity(constant: &Constant<'_>) -> bool {
match constant { match constant {
// FIXME(f16_f128): add f16 and f128 when constants are available
Constant::F32(float) => *float == f32::INFINITY, Constant::F32(float) => *float == f32::INFINITY,
Constant::F64(float) => *float == f64::INFINITY, Constant::F64(float) => *float == f64::INFINITY,
_ => false, _ => false,
@ -164,6 +165,7 @@ fn is_infinity(constant: &Constant<'_>) -> bool {
fn is_neg_infinity(constant: &Constant<'_>) -> bool { fn is_neg_infinity(constant: &Constant<'_>) -> bool {
match constant { match constant {
// FIXME(f16_f128): add f16 and f128 when constants are available
Constant::F32(float) => *float == f32::NEG_INFINITY, Constant::F32(float) => *float == f32::NEG_INFINITY,
Constant::F64(float) => *float == f64::NEG_INFINITY, Constant::F64(float) => *float == f64::NEG_INFINITY,
_ => false, _ => false,

View file

@ -86,6 +86,7 @@ fn get_lint_and_message(is_local: bool, is_comparing_arrays: bool) -> (&'static
fn is_allowed(val: &Constant<'_>) -> bool { fn is_allowed(val: &Constant<'_>) -> bool {
match val { match val {
// FIXME(f16_f128): add when equality check is available on all platforms
&Constant::F32(f) => f == 0.0 || f.is_infinite(), &Constant::F32(f) => f == 0.0 || f.is_infinite(),
&Constant::F64(f) => f == 0.0 || f.is_infinite(), &Constant::F64(f) => f == 0.0 || f.is_infinite(),
Constant::Vec(vec) => vec.iter().all(|f| match f { Constant::Vec(vec) => vec.iter().all(|f| match f {

View file

@ -79,6 +79,7 @@ fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_>, expr: &Expr<'_>) ->
}, },
_ => {}, _ => {},
}, },
// FIXME(f16_f128): add when casting is available on all platforms
Some(Constant::F32(f)) => { Some(Constant::F32(f)) => {
return Some(floating_point_operand_info(&f)); return Some(floating_point_operand_info(&f));
}, },

View file

@ -38,6 +38,7 @@ impl<'tcx> LateLintPass<'tcx> for ZeroDiv {
// do something like 0.0/(2.0 - 2.0), but it would be nice to warn on that case too. // do something like 0.0/(2.0 - 2.0), but it would be nice to warn on that case too.
&& let Some(lhs_value) = constant_simple(cx, cx.typeck_results(), left) && let Some(lhs_value) = constant_simple(cx, cx.typeck_results(), left)
&& let Some(rhs_value) = constant_simple(cx, cx.typeck_results(), right) && let Some(rhs_value) = constant_simple(cx, cx.typeck_results(), right)
// FIXME(f16_f128): add these types when eq is available on all platforms
&& (Constant::F32(0.0) == lhs_value || Constant::F64(0.0) == lhs_value) && (Constant::F32(0.0) == lhs_value || Constant::F64(0.0) == lhs_value)
&& (Constant::F32(0.0) == rhs_value || Constant::F64(0.0) == rhs_value) && (Constant::F32(0.0) == rhs_value || Constant::F64(0.0) == rhs_value)
{ {

View file

@ -9,6 +9,8 @@ clippy_config = { path = "../clippy_config" }
arrayvec = { version = "0.7", default-features = false } arrayvec = { version = "0.7", default-features = false }
itertools = "0.12" itertools = "0.12"
rustc-semver = "1.1" rustc-semver = "1.1"
# FIXME(f16_f128): remove when no longer needed for parsing
rustc_apfloat = "0.2.0"
[features] [features]
deny-warnings = ["clippy_config/deny-warnings"] deny-warnings = ["clippy_config/deny-warnings"]

View file

@ -3,6 +3,8 @@
use crate::source::{get_source_text, walk_span_to_context}; use crate::source::{get_source_text, walk_span_to_context};
use crate::{clip, is_direct_expn_of, sext, unsext}; use crate::{clip, is_direct_expn_of, sext, unsext};
use rustc_apfloat::ieee::{Half, Quad};
use rustc_apfloat::Float;
use rustc_ast::ast::{self, LitFloatType, LitKind}; use rustc_ast::ast::{self, LitFloatType, LitKind};
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
@ -33,10 +35,14 @@ pub enum Constant<'tcx> {
Char(char), Char(char),
/// An integer's bit representation. /// An integer's bit representation.
Int(u128), Int(u128),
/// An `f16`.
F16(f16),
/// An `f32`. /// An `f32`.
F32(f32), F32(f32),
/// An `f64`. /// An `f64`.
F64(f64), F64(f64),
/// An `f128`.
F128(f128),
/// `true` or `false`. /// `true` or `false`.
Bool(bool), Bool(bool),
/// An array of constants. /// An array of constants.
@ -161,12 +167,19 @@ impl<'tcx> Hash for Constant<'tcx> {
Self::Int(i) => { Self::Int(i) => {
i.hash(state); i.hash(state);
}, },
Self::F16(f) => {
// FIXME(f16_f128): once conversions to/from `f128` are available on all platforms,
f.to_bits().hash(state);
},
Self::F32(f) => { Self::F32(f) => {
f64::from(f).to_bits().hash(state); f64::from(f).to_bits().hash(state);
}, },
Self::F64(f) => { Self::F64(f) => {
f.to_bits().hash(state); f.to_bits().hash(state);
}, },
Self::F128(f) => {
f.to_bits().hash(state);
},
Self::Bool(b) => { Self::Bool(b) => {
b.hash(state); b.hash(state);
}, },
@ -268,6 +281,16 @@ impl<'tcx> Constant<'tcx> {
} }
self self
} }
fn parse_f16(s: &str) -> Self {
let f: Half = s.parse().unwrap();
Self::F16(f16::from_bits(f.to_bits().try_into().unwrap()))
}
fn parse_f128(s: &str) -> Self {
let f: Quad = s.parse().unwrap();
Self::F128(f128::from_bits(f.to_bits()))
}
} }
/// Parses a `LitKind` to a `Constant`. /// Parses a `LitKind` to a `Constant`.
@ -279,16 +302,17 @@ pub fn lit_to_mir_constant<'tcx>(lit: &LitKind, ty: Option<Ty<'tcx>>) -> Constan
LitKind::Char(c) => Constant::Char(c), LitKind::Char(c) => Constant::Char(c),
LitKind::Int(n, _) => Constant::Int(n.get()), LitKind::Int(n, _) => Constant::Int(n.get()),
LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty { LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty {
ast::FloatTy::F16 => unimplemented!("f16_f128"), // FIXME(f16_f128): just use `parse()` directly when available for `f16`/`f128`
ast::FloatTy::F16 => Constant::parse_f16(is.as_str()),
ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()), ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()),
ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()), ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()),
ast::FloatTy::F128 => unimplemented!("f16_f128"), ast::FloatTy::F128 => Constant::parse_f128(is.as_str()),
}, },
LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() { LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() {
ty::Float(FloatTy::F16) => unimplemented!("f16_f128"), ty::Float(FloatTy::F16) => Constant::parse_f16(is.as_str()),
ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()), ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
ty::Float(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()), ty::Float(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()),
ty::Float(FloatTy::F128) => unimplemented!("f16_f128"), ty::Float(FloatTy::F128) => Constant::parse_f128(is.as_str()),
_ => bug!(), _ => bug!(),
}, },
LitKind::Bool(b) => Constant::Bool(b), LitKind::Bool(b) => Constant::Bool(b),
@ -625,15 +649,19 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
match (lhs, index) { match (lhs, index) {
(Some(Constant::Vec(vec)), Some(Constant::Int(index))) => match vec.get(index as usize) { (Some(Constant::Vec(vec)), Some(Constant::Int(index))) => match vec.get(index as usize) {
Some(Constant::F16(x)) => Some(Constant::F16(*x)),
Some(Constant::F32(x)) => Some(Constant::F32(*x)), Some(Constant::F32(x)) => Some(Constant::F32(*x)),
Some(Constant::F64(x)) => Some(Constant::F64(*x)), Some(Constant::F64(x)) => Some(Constant::F64(*x)),
Some(Constant::F128(x)) => Some(Constant::F128(*x)),
_ => None, _ => None,
}, },
(Some(Constant::Vec(vec)), _) => { (Some(Constant::Vec(vec)), _) => {
if !vec.is_empty() && vec.iter().all(|x| *x == vec[0]) { if !vec.is_empty() && vec.iter().all(|x| *x == vec[0]) {
match vec.first() { match vec.first() {
Some(Constant::F16(x)) => Some(Constant::F16(*x)),
Some(Constant::F32(x)) => Some(Constant::F32(*x)), Some(Constant::F32(x)) => Some(Constant::F32(*x)),
Some(Constant::F64(x)) => Some(Constant::F64(*x)), Some(Constant::F64(x)) => Some(Constant::F64(*x)),
Some(Constant::F128(x)) => Some(Constant::F128(*x)),
_ => None, _ => None,
} }
} else { } else {
@ -760,6 +788,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
}, },
_ => None, _ => None,
}, },
// FIXME(f16_f128): add these types when binary operations are available on all platforms
(Constant::F32(l), Some(Constant::F32(r))) => match op.node { (Constant::F32(l), Some(Constant::F32(r))) => match op.node {
BinOpKind::Add => Some(Constant::F32(l + r)), BinOpKind::Add => Some(Constant::F32(l + r)),
BinOpKind::Sub => Some(Constant::F32(l - r)), BinOpKind::Sub => Some(Constant::F32(l - r)),
@ -813,8 +842,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
ty::Adt(adt_def, _) if adt_def.is_struct() => Some(Constant::Adt(result)), ty::Adt(adt_def, _) if adt_def.is_struct() => Some(Constant::Adt(result)),
ty::Bool => Some(Constant::Bool(int == ScalarInt::TRUE)), ty::Bool => Some(Constant::Bool(int == ScalarInt::TRUE)),
ty::Uint(_) | ty::Int(_) => Some(Constant::Int(int.to_bits(int.size()))), ty::Uint(_) | ty::Int(_) => Some(Constant::Int(int.to_bits(int.size()))),
ty::Float(FloatTy::F16) => Some(Constant::F16(f16::from_bits(int.into()))),
ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(int.into()))), ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(int.into()))),
ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(int.into()))), ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(int.into()))),
ty::Float(FloatTy::F128) => Some(Constant::F128(f128::from_bits(int.into()))),
ty::RawPtr(_, _) => Some(Constant::RawPtr(int.to_bits(int.size()))), ty::RawPtr(_, _) => Some(Constant::RawPtr(int.to_bits(int.size()))),
_ => None, _ => None,
}, },
@ -835,10 +866,10 @@ pub fn mir_to_const<'tcx>(lcx: &LateContext<'tcx>, result: mir::Const<'tcx>) ->
let range = alloc_range(offset + size * idx, size); let range = alloc_range(offset + size * idx, size);
let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?; let val = alloc.read_scalar(&lcx.tcx, range, /* read_provenance */ false).ok()?;
res.push(match flt { res.push(match flt {
FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().ok()?)),
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)), FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)), FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
FloatTy::F128 => unimplemented!("f16_f128"), FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().ok()?)),
}); });
} }
Some(Constant::Vec(res)) Some(Constant::Vec(res))

View file

@ -1,6 +1,8 @@
#![feature(array_chunks)] #![feature(array_chunks)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(control_flow_enum)] #![feature(control_flow_enum)]
#![feature(f128)]
#![feature(f16)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(lint_reasons)] #![feature(lint_reasons)]

View file

@ -40,6 +40,7 @@ fn main() {
a.sort_unstable(); a.sort_unstable();
// FIXME(f16_f128): add a clamp test once the function is available
let _ = 2.0f32.clamp(3.0f32, 4.0f32); let _ = 2.0f32.clamp(3.0f32, 4.0f32);
let _ = 2.0f64.clamp(3.0f64, 4.0f64); let _ = 2.0f64.clamp(3.0f64, 4.0f64);

View file

@ -28,61 +28,61 @@ LL | a.sort_unstable();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: use of a disallowed method `f32::clamp` error: use of a disallowed method `f32::clamp`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:43:13 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:44:13
| |
LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32); LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of a disallowed method `regex::Regex::new` error: use of a disallowed method `regex::Regex::new`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:46:61 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:47:61
| |
LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new; LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
| ^^^^^^^^^^ | ^^^^^^^^^^
error: use of a disallowed method `f32::clamp` error: use of a disallowed method `f32::clamp`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:49:28 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:50:28
| |
LL | let in_call = Box::new(f32::clamp); LL | let in_call = Box::new(f32::clamp);
| ^^^^^^^^^^ | ^^^^^^^^^^
error: use of a disallowed method `regex::Regex::new` error: use of a disallowed method `regex::Regex::new`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:50:53 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:51:53
| |
LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new); LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
| ^^^^^^^^^^ | ^^^^^^^^^^
error: use of a disallowed method `futures::stream::select_all` error: use of a disallowed method `futures::stream::select_all`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:53:31 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:54:31
| |
LL | let same_name_as_module = select_all(vec![empty::<()>()]); LL | let same_name_as_module = select_all(vec![empty::<()>()]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of a disallowed method `conf_disallowed_methods::local_fn` error: use of a disallowed method `conf_disallowed_methods::local_fn`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:55:5 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:56:5
| |
LL | local_fn(); LL | local_fn();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: use of a disallowed method `conf_disallowed_methods::local_mod::f` error: use of a disallowed method `conf_disallowed_methods::local_mod::f`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:56:5 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:57:5
| |
LL | local_mod::f(); LL | local_mod::f();
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: use of a disallowed method `conf_disallowed_methods::Struct::method` error: use of a disallowed method `conf_disallowed_methods::Struct::method`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:58:5 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:59:5
| |
LL | s.method(); LL | s.method();
| ^^^^^^^^^^ | ^^^^^^^^^^
error: use of a disallowed method `conf_disallowed_methods::Trait::provided_method` error: use of a disallowed method `conf_disallowed_methods::Trait::provided_method`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:59:5 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:60:5
| |
LL | s.provided_method(); LL | s.provided_method();
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: use of a disallowed method `conf_disallowed_methods::Trait::implemented_method` error: use of a disallowed method `conf_disallowed_methods::Trait::implemented_method`
--> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:60:5 --> tests/ui-toml/toml_disallowed_methods/conf_disallowed_methods.rs:61:5
| |
LL | s.implemented_method(); LL | s.implemented_method();
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -11,6 +11,8 @@
unconditional_panic unconditional_panic
)] )]
#![feature(const_mut_refs)] #![feature(const_mut_refs)]
#![feature(f128)]
#![feature(f16)]
#![warn(clippy::arithmetic_side_effects)] #![warn(clippy::arithmetic_side_effects)]
extern crate proc_macro_derive; extern crate proc_macro_derive;
@ -162,8 +164,10 @@ pub fn association_with_structures_should_not_trigger_the_lint() {
} }
pub fn hard_coded_allowed() { pub fn hard_coded_allowed() {
let _ = 1f16 + 1f16;
let _ = 1f32 + 1f32; let _ = 1f32 + 1f32;
let _ = 1f64 + 1f64; let _ = 1f64 + 1f64;
let _ = 1f128 + 1f128;
let _ = Saturating(0u32) + Saturating(0u32); let _ = Saturating(0u32) + Saturating(0u32);
let _ = String::new() + ""; let _ = String::new() + "";

View file

@ -1,731 +1,743 @@
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:304:5 --> tests/ui/arithmetic_side_effects.rs:167:13
| |
LL | _n += 1; LL | let _ = 1f16 + 1f16;
| ^^^^^^^ | ^^^^^^^^^^^
| |
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings` = note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]` = help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:305:5 --> tests/ui/arithmetic_side_effects.rs:170:13
| |
LL | _n += &1; LL | let _ = 1f128 + 1f128;
| ^^^^^^^^ | ^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:306:5
|
LL | _n -= 1;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:307:5
|
LL | _n -= &1;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:308:5 --> tests/ui/arithmetic_side_effects.rs:308:5
| |
LL | _n /= 0; LL | _n += 1;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:309:5 --> tests/ui/arithmetic_side_effects.rs:309:5
| |
LL | _n /= &0; LL | _n += &1;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:310:5 --> tests/ui/arithmetic_side_effects.rs:310:5
| |
LL | _n %= 0; LL | _n -= 1;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:311:5 --> tests/ui/arithmetic_side_effects.rs:311:5
| |
LL | _n %= &0; LL | _n -= &1;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:312:5 --> tests/ui/arithmetic_side_effects.rs:312:5
| |
LL | _n *= 2; LL | _n /= 0;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:313:5 --> tests/ui/arithmetic_side_effects.rs:313:5
| |
LL | _n *= &2; LL | _n /= &0;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:314:5 --> tests/ui/arithmetic_side_effects.rs:314:5
| |
LL | _n += -1; LL | _n %= 0;
| ^^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:315:5 --> tests/ui/arithmetic_side_effects.rs:315:5
| |
LL | _n += &-1; LL | _n %= &0;
| ^^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:316:5 --> tests/ui/arithmetic_side_effects.rs:316:5
| |
LL | _n -= -1; LL | _n *= 2;
| ^^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:317:5 --> tests/ui/arithmetic_side_effects.rs:317:5
| |
LL | _n -= &-1; LL | _n *= &2;
| ^^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:318:5 --> tests/ui/arithmetic_side_effects.rs:318:5
| |
LL | _n /= -0; LL | _n += -1;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:319:5 --> tests/ui/arithmetic_side_effects.rs:319:5
| |
LL | _n /= &-0; LL | _n += &-1;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:320:5 --> tests/ui/arithmetic_side_effects.rs:320:5
| |
LL | _n %= -0; LL | _n -= -1;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:321:5 --> tests/ui/arithmetic_side_effects.rs:321:5
| |
LL | _n %= &-0; LL | _n -= &-1;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:322:5 --> tests/ui/arithmetic_side_effects.rs:322:5
| |
LL | _n *= -2; LL | _n /= -0;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:323:5 --> tests/ui/arithmetic_side_effects.rs:323:5
| |
LL | _n *= &-2; LL | _n /= &-0;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:324:5 --> tests/ui/arithmetic_side_effects.rs:324:5
| |
LL | _custom += Custom; LL | _n %= -0;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:325:5 --> tests/ui/arithmetic_side_effects.rs:325:5
| |
LL | _custom += &Custom; LL | _n %= &-0;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:326:5 --> tests/ui/arithmetic_side_effects.rs:326:5
| |
LL | _custom -= Custom; LL | _n *= -2;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:327:5 --> tests/ui/arithmetic_side_effects.rs:327:5
| |
LL | _custom -= &Custom; LL | _n *= &-2;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:328:5 --> tests/ui/arithmetic_side_effects.rs:328:5
| |
LL | _custom /= Custom; LL | _custom += Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:329:5 --> tests/ui/arithmetic_side_effects.rs:329:5
| |
LL | _custom /= &Custom; LL | _custom += &Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:330:5 --> tests/ui/arithmetic_side_effects.rs:330:5
| |
LL | _custom %= Custom; LL | _custom -= Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:331:5 --> tests/ui/arithmetic_side_effects.rs:331:5
| |
LL | _custom %= &Custom; LL | _custom -= &Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:332:5 --> tests/ui/arithmetic_side_effects.rs:332:5
| |
LL | _custom *= Custom; LL | _custom /= Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:333:5 --> tests/ui/arithmetic_side_effects.rs:333:5
| |
LL | _custom *= &Custom; LL | _custom /= &Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:334:5 --> tests/ui/arithmetic_side_effects.rs:334:5
| |
LL | _custom >>= Custom; LL | _custom %= Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:335:5 --> tests/ui/arithmetic_side_effects.rs:335:5
| |
LL | _custom >>= &Custom; LL | _custom %= &Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:336:5 --> tests/ui/arithmetic_side_effects.rs:336:5
| |
LL | _custom <<= Custom; LL | _custom *= Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:337:5 --> tests/ui/arithmetic_side_effects.rs:337:5
| |
LL | _custom <<= &Custom; LL | _custom *= &Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:338:5 --> tests/ui/arithmetic_side_effects.rs:338:5
| |
LL | _custom += -Custom; LL | _custom >>= Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:339:5 --> tests/ui/arithmetic_side_effects.rs:339:5
| |
LL | _custom += &-Custom; LL | _custom >>= &Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:340:5 --> tests/ui/arithmetic_side_effects.rs:340:5
| |
LL | _custom -= -Custom; LL | _custom <<= Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:341:5 --> tests/ui/arithmetic_side_effects.rs:341:5
| |
LL | _custom -= &-Custom; LL | _custom <<= &Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:342:5 --> tests/ui/arithmetic_side_effects.rs:342:5
| |
LL | _custom /= -Custom; LL | _custom += -Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:343:5 --> tests/ui/arithmetic_side_effects.rs:343:5
| |
LL | _custom /= &-Custom; LL | _custom += &-Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:344:5 --> tests/ui/arithmetic_side_effects.rs:344:5
| |
LL | _custom %= -Custom; LL | _custom -= -Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:345:5 --> tests/ui/arithmetic_side_effects.rs:345:5
| |
LL | _custom %= &-Custom; LL | _custom -= &-Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:346:5 --> tests/ui/arithmetic_side_effects.rs:346:5
| |
LL | _custom *= -Custom; LL | _custom /= -Custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:347:5 --> tests/ui/arithmetic_side_effects.rs:347:5
| |
LL | _custom *= &-Custom; LL | _custom /= &-Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:348:5 --> tests/ui/arithmetic_side_effects.rs:348:5
| |
LL | _custom %= -Custom;
| ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:349:5
|
LL | _custom %= &-Custom;
| ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:350:5
|
LL | _custom *= -Custom;
| ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:351:5
|
LL | _custom *= &-Custom;
| ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:352:5
|
LL | _custom >>= -Custom; LL | _custom >>= -Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:349:5 --> tests/ui/arithmetic_side_effects.rs:353:5
| |
LL | _custom >>= &-Custom; LL | _custom >>= &-Custom;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:350:5 --> tests/ui/arithmetic_side_effects.rs:354:5
| |
LL | _custom <<= -Custom; LL | _custom <<= -Custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:351:5 --> tests/ui/arithmetic_side_effects.rs:355:5
| |
LL | _custom <<= &-Custom; LL | _custom <<= &-Custom;
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:354:10 --> tests/ui/arithmetic_side_effects.rs:358:10
| |
LL | _n = _n + 1; LL | _n = _n + 1;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:355:10 --> tests/ui/arithmetic_side_effects.rs:359:10
| |
LL | _n = _n + &1; LL | _n = _n + &1;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:356:10 --> tests/ui/arithmetic_side_effects.rs:360:10
| |
LL | _n = 1 + _n; LL | _n = 1 + _n;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:357:10 --> tests/ui/arithmetic_side_effects.rs:361:10
| |
LL | _n = &1 + _n; LL | _n = &1 + _n;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:358:10 --> tests/ui/arithmetic_side_effects.rs:362:10
| |
LL | _n = _n - 1; LL | _n = _n - 1;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:359:10 --> tests/ui/arithmetic_side_effects.rs:363:10
| |
LL | _n = _n - &1; LL | _n = _n - &1;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:360:10 --> tests/ui/arithmetic_side_effects.rs:364:10
| |
LL | _n = 1 - _n; LL | _n = 1 - _n;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:361:10 --> tests/ui/arithmetic_side_effects.rs:365:10
| |
LL | _n = &1 - _n; LL | _n = &1 - _n;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:362:10 --> tests/ui/arithmetic_side_effects.rs:366:10
| |
LL | _n = _n / 0; LL | _n = _n / 0;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:363:10 --> tests/ui/arithmetic_side_effects.rs:367:10
| |
LL | _n = _n / &0; LL | _n = _n / &0;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:364:10 --> tests/ui/arithmetic_side_effects.rs:368:10
| |
LL | _n = _n % 0; LL | _n = _n % 0;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:365:10 --> tests/ui/arithmetic_side_effects.rs:369:10
| |
LL | _n = _n % &0; LL | _n = _n % &0;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:366:10 --> tests/ui/arithmetic_side_effects.rs:370:10
| |
LL | _n = _n * 2; LL | _n = _n * 2;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:367:10 --> tests/ui/arithmetic_side_effects.rs:371:10
| |
LL | _n = _n * &2; LL | _n = _n * &2;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:368:10 --> tests/ui/arithmetic_side_effects.rs:372:10
| |
LL | _n = 2 * _n; LL | _n = 2 * _n;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:369:10 --> tests/ui/arithmetic_side_effects.rs:373:10
| |
LL | _n = &2 * _n; LL | _n = &2 * _n;
| ^^^^^^^ | ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:370:10 --> tests/ui/arithmetic_side_effects.rs:374:10
| |
LL | _n = 23 + &85; LL | _n = 23 + &85;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:371:10 --> tests/ui/arithmetic_side_effects.rs:375:10
| |
LL | _n = &23 + 85; LL | _n = &23 + 85;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:372:10 --> tests/ui/arithmetic_side_effects.rs:376:10
| |
LL | _n = &23 + &85; LL | _n = &23 + &85;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:373:15 --> tests/ui/arithmetic_side_effects.rs:377:15
| |
LL | _custom = _custom + _custom; LL | _custom = _custom + _custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:374:15 --> tests/ui/arithmetic_side_effects.rs:378:15
| |
LL | _custom = _custom + &_custom; LL | _custom = _custom + &_custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:375:15 --> tests/ui/arithmetic_side_effects.rs:379:15
| |
LL | _custom = Custom + _custom; LL | _custom = Custom + _custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:376:15 --> tests/ui/arithmetic_side_effects.rs:380:15
| |
LL | _custom = &Custom + _custom; LL | _custom = &Custom + _custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:377:15 --> tests/ui/arithmetic_side_effects.rs:381:15
| |
LL | _custom = _custom - Custom; LL | _custom = _custom - Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:378:15 --> tests/ui/arithmetic_side_effects.rs:382:15
| |
LL | _custom = _custom - &Custom; LL | _custom = _custom - &Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:379:15 --> tests/ui/arithmetic_side_effects.rs:383:15
| |
LL | _custom = Custom - _custom; LL | _custom = Custom - _custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:380:15 --> tests/ui/arithmetic_side_effects.rs:384:15
| |
LL | _custom = &Custom - _custom; LL | _custom = &Custom - _custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:381:15 --> tests/ui/arithmetic_side_effects.rs:385:15
| |
LL | _custom = _custom / Custom; LL | _custom = _custom / Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:382:15 --> tests/ui/arithmetic_side_effects.rs:386:15
| |
LL | _custom = _custom / &Custom; LL | _custom = _custom / &Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:383:15 --> tests/ui/arithmetic_side_effects.rs:387:15
| |
LL | _custom = _custom % Custom; LL | _custom = _custom % Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:384:15 --> tests/ui/arithmetic_side_effects.rs:388:15
| |
LL | _custom = _custom % &Custom; LL | _custom = _custom % &Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:385:15 --> tests/ui/arithmetic_side_effects.rs:389:15
| |
LL | _custom = _custom * Custom; LL | _custom = _custom * Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:386:15 --> tests/ui/arithmetic_side_effects.rs:390:15
| |
LL | _custom = _custom * &Custom; LL | _custom = _custom * &Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:387:15 --> tests/ui/arithmetic_side_effects.rs:391:15
| |
LL | _custom = Custom * _custom; LL | _custom = Custom * _custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:388:15 --> tests/ui/arithmetic_side_effects.rs:392:15
| |
LL | _custom = &Custom * _custom; LL | _custom = &Custom * _custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:389:15 --> tests/ui/arithmetic_side_effects.rs:393:15
| |
LL | _custom = Custom + &Custom; LL | _custom = Custom + &Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:390:15 --> tests/ui/arithmetic_side_effects.rs:394:15
| |
LL | _custom = &Custom + Custom; LL | _custom = &Custom + Custom;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:391:15 --> tests/ui/arithmetic_side_effects.rs:395:15
| |
LL | _custom = &Custom + &Custom; LL | _custom = &Custom + &Custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:392:15 --> tests/ui/arithmetic_side_effects.rs:396:15
| |
LL | _custom = _custom >> _custom; LL | _custom = _custom >> _custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:393:15 --> tests/ui/arithmetic_side_effects.rs:397:15
| |
LL | _custom = _custom >> &_custom; LL | _custom = _custom >> &_custom;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:394:15 --> tests/ui/arithmetic_side_effects.rs:398:15
| |
LL | _custom = Custom << _custom; LL | _custom = Custom << _custom;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:395:15 --> tests/ui/arithmetic_side_effects.rs:399:15
| |
LL | _custom = &Custom << _custom; LL | _custom = &Custom << _custom;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:398:23 --> tests/ui/arithmetic_side_effects.rs:402:23
| |
LL | _n.saturating_div(0); LL | _n.saturating_div(0);
| ^ | ^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:399:21 --> tests/ui/arithmetic_side_effects.rs:403:21
| |
LL | _n.wrapping_div(0); LL | _n.wrapping_div(0);
| ^ | ^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:400:21 --> tests/ui/arithmetic_side_effects.rs:404:21
| |
LL | _n.wrapping_rem(0); LL | _n.wrapping_rem(0);
| ^ | ^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:401:28 --> tests/ui/arithmetic_side_effects.rs:405:28
| |
LL | _n.wrapping_rem_euclid(0); LL | _n.wrapping_rem_euclid(0);
| ^ | ^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:403:23 --> tests/ui/arithmetic_side_effects.rs:407:23
| |
LL | _n.saturating_div(_n); LL | _n.saturating_div(_n);
| ^^ | ^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:404:21 --> tests/ui/arithmetic_side_effects.rs:408:21
| |
LL | _n.wrapping_div(_n); LL | _n.wrapping_div(_n);
| ^^ | ^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:405:21 --> tests/ui/arithmetic_side_effects.rs:409:21
| |
LL | _n.wrapping_rem(_n); LL | _n.wrapping_rem(_n);
| ^^ | ^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:406:28 --> tests/ui/arithmetic_side_effects.rs:410:28
| |
LL | _n.wrapping_rem_euclid(_n); LL | _n.wrapping_rem_euclid(_n);
| ^^ | ^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:409:10 --> tests/ui/arithmetic_side_effects.rs:413:10
| |
LL | _n = -_n; LL | _n = -_n;
| ^^^ | ^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:410:10 --> tests/ui/arithmetic_side_effects.rs:414:10
| |
LL | _n = -&_n; LL | _n = -&_n;
| ^^^^ | ^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:411:15 --> tests/ui/arithmetic_side_effects.rs:415:15
| |
LL | _custom = -_custom; LL | _custom = -_custom;
| ^^^^^^^^ | ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:412:15 --> tests/ui/arithmetic_side_effects.rs:416:15
| |
LL | _custom = -&_custom; LL | _custom = -&_custom;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:421:5 --> tests/ui/arithmetic_side_effects.rs:425:5
| |
LL | 1 + i; LL | 1 + i;
| ^^^^^ | ^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:422:5 --> tests/ui/arithmetic_side_effects.rs:426:5
| |
LL | i * 2; LL | i * 2;
| ^^^^^ | ^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:423:5 --> tests/ui/arithmetic_side_effects.rs:427:5
| |
LL | 1 % i / 2; LL | 1 % i / 2;
| ^^^^^ | ^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:424:5 --> tests/ui/arithmetic_side_effects.rs:428:5
| |
LL | i - 2 + 2 - i; LL | i - 2 + 2 - i;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:425:5 --> tests/ui/arithmetic_side_effects.rs:429:5
| |
LL | -i; LL | -i;
| ^^ | ^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:436:5 --> tests/ui/arithmetic_side_effects.rs:440:5
| |
LL | i += 1; LL | i += 1;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:437:5 --> tests/ui/arithmetic_side_effects.rs:441:5
| |
LL | i -= 1; LL | i -= 1;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:438:5 --> tests/ui/arithmetic_side_effects.rs:442:5
| |
LL | i *= 2; LL | i *= 2;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:440:5 --> tests/ui/arithmetic_side_effects.rs:444:5
| |
LL | i /= 0; LL | i /= 0;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:442:5 --> tests/ui/arithmetic_side_effects.rs:446:5
| |
LL | i /= var1; LL | i /= var1;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:443:5 --> tests/ui/arithmetic_side_effects.rs:447:5
| |
LL | i /= var2; LL | i /= var2;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:445:5 --> tests/ui/arithmetic_side_effects.rs:449:5
| |
LL | i %= 0; LL | i %= 0;
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:447:5 --> tests/ui/arithmetic_side_effects.rs:451:5
| |
LL | i %= var1; LL | i %= var1;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:448:5 --> tests/ui/arithmetic_side_effects.rs:452:5
| |
LL | i %= var2; LL | i %= var2;
| ^^^^^^^^^ | ^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:458:5 --> tests/ui/arithmetic_side_effects.rs:462:5
| |
LL | 10 / a LL | 10 / a
| ^^^^^^ | ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:512:9 --> tests/ui/arithmetic_side_effects.rs:516:9
| |
LL | x / maybe_zero LL | x / maybe_zero
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:516:9 --> tests/ui/arithmetic_side_effects.rs:520:9
| |
LL | x % maybe_zero LL | x % maybe_zero
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:527:5 --> tests/ui/arithmetic_side_effects.rs:531:5
| |
LL | one.add_assign(1); LL | one.add_assign(1);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects error: arithmetic operation that can potentially result in unexpected side-effects
--> tests/ui/arithmetic_side_effects.rs:531:5 --> tests/ui/arithmetic_side_effects.rs:535:5
| |
LL | one.sub_assign(1); LL | one.sub_assign(1);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: aborting due to 121 previous errors error: aborting due to 123 previous errors

View file

@ -17,6 +17,8 @@
clippy::identity_op clippy::identity_op
)] )]
// FIXME(f16_f128): add tests once const casting is available for these types
fn main() { fn main() {
// Test clippy::cast_precision_loss // Test clippy::cast_precision_loss
let x0 = 1i32; let x0 = 1i32;

View file

@ -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:23: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:27: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:29: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:32: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:35: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:37: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:40: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:42: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:42: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:46: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:48: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:50: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:52: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:54: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:54: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:57: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:57: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:57: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:62: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:64: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:66: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:68: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:68: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:73: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:76: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:78: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:80: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:82: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:85: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:88: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:88: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:93: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:93: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:97: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:102: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:106: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:109: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:109: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:114: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:117: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:128: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:132: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:133: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:140: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:155: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:206: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:220: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:243: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:245: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:287: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:289: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:306: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:325: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:372: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:383: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:387: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:399: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:404: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:406: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:407: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:412: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:414: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:417: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:421: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:422: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:426: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:428: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:429: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:431: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:431: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:434: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:436: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:440: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:442: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:445: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:446: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:448: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:450: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:451: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:453: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:455: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:456: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:458: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:460: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:462: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:470: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:471: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:472: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:481: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:481: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:496: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:498:5 --> tests/ui/cast.rs:500:5
| |
LL | (255 % 999999u64) as u8; LL | (255 % 999999u64) as u8;
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^

Some files were not shown because too many files have changed in this diff Show more