mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Auto merge of #121569 - matthiaskrgr:rollup-awglrax, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #121343 (Add examples for some methods on slices) - #121374 (match lowering: Split off `test_candidates` into several functions and improve comments) - #121474 (Ignore compiletest test directive migration commits) - #121515 (promotion: don't promote int::MIN / -1) - #121530 (Fix incorrect doc of ScopedJoinHandle::is_finished) - #121551 (Forbid use of `extern "C-unwind"` inside standard library) - #121556 (Use `addr_of!`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
2ae1bb6711
@ -20,3 +20,6 @@ f97fddab91fbf290ea5b691fe355d6f915220b6e
|
||||
cc907f80b95c6ec530c5ee1b05b044a468f07eca
|
||||
# format let-chains
|
||||
b2d2184edea578109a48ec3d8decbee5948e8f35
|
||||
# test directives migration
|
||||
6e48b96692d63a79a14563f27fe5185f122434f8
|
||||
ec2cc761bc7067712ecc7734502f703fe3b024c8
|
||||
|
@ -313,7 +313,7 @@ fn get_llvm_object_symbols(
|
||||
llvm::LLVMRustGetSymbols(
|
||||
buf.as_ptr(),
|
||||
buf.len(),
|
||||
&mut *state as *mut &mut _ as *mut c_void,
|
||||
std::ptr::addr_of_mut!(*state) as *mut c_void,
|
||||
callback,
|
||||
error_callback,
|
||||
)
|
||||
|
@ -169,7 +169,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
|
||||
fn print_pass_timings(&self) {
|
||||
unsafe {
|
||||
let mut size = 0;
|
||||
let cstr = llvm::LLVMRustPrintPassTimings(&mut size as *mut usize);
|
||||
let cstr = llvm::LLVMRustPrintPassTimings(std::ptr::addr_of_mut!(size));
|
||||
if cstr.is_null() {
|
||||
println!("failed to get pass timings");
|
||||
} else {
|
||||
@ -182,7 +182,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
|
||||
fn print_statistics(&self) {
|
||||
unsafe {
|
||||
let mut size = 0;
|
||||
let cstr = llvm::LLVMRustPrintStatistics(&mut size as *mut usize);
|
||||
let cstr = llvm::LLVMRustPrintStatistics(std::ptr::addr_of_mut!(size));
|
||||
if cstr.is_null() {
|
||||
println!("failed to get pass stats");
|
||||
} else {
|
||||
|
@ -435,7 +435,7 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut dyn PrintBackendInfo, sess
|
||||
&tm,
|
||||
cpu_cstring.as_ptr(),
|
||||
callback,
|
||||
&mut out as *mut &mut dyn PrintBackendInfo as *mut c_void,
|
||||
std::ptr::addr_of_mut!(out) as *mut c_void,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ impl<T> RwLock<T> {
|
||||
#[inline(always)]
|
||||
pub fn leak(&self) -> &T {
|
||||
let guard = self.read();
|
||||
let ret = unsafe { &*(&*guard as *const T) };
|
||||
let ret = unsafe { &*std::ptr::addr_of!(*guard) };
|
||||
std::mem::forget(guard);
|
||||
ret
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ impl<'sess> OnDiskCache<'sess> {
|
||||
|
||||
for (index, file) in files.iter().enumerate() {
|
||||
let index = SourceFileIndex(index as u32);
|
||||
let file_ptr: *const SourceFile = &**file as *const _;
|
||||
let file_ptr: *const SourceFile = std::ptr::addr_of!(**file);
|
||||
file_to_file_index.insert(file_ptr, index);
|
||||
let source_file_id = EncodedSourceFileId::new(tcx, file);
|
||||
file_index_to_stable_id.insert(index, source_file_id);
|
||||
@ -835,7 +835,7 @@ pub struct CacheEncoder<'a, 'tcx> {
|
||||
impl<'a, 'tcx> CacheEncoder<'a, 'tcx> {
|
||||
#[inline]
|
||||
fn source_file_index(&mut self, source_file: Lrc<SourceFile>) -> SourceFileIndex {
|
||||
self.file_to_file_index[&(&*source_file as *const SourceFile)]
|
||||
self.file_to_file_index[&std::ptr::addr_of!(*source_file)]
|
||||
}
|
||||
|
||||
/// Encode something with additional information that allows to do some
|
||||
|
@ -61,7 +61,7 @@ impl<T> List<T> {
|
||||
// length) that is 64-byte aligned, thus featuring the necessary
|
||||
// trailing padding for elements with up to 64-byte alignment.
|
||||
static EMPTY_SLICE: InOrder<usize, MaxAlign> = InOrder(0, MaxAlign);
|
||||
unsafe { &*(&EMPTY_SLICE as *const _ as *const List<T>) }
|
||||
unsafe { &*(std::ptr::addr_of!(EMPTY_SLICE) as *const List<T>) }
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
|
@ -1150,39 +1150,61 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// the value, we will set and generate a branch to the appropriate
|
||||
/// pre-binding block.
|
||||
///
|
||||
/// If we find that *NONE* of the candidates apply, we branch to the
|
||||
/// `otherwise_block`, setting it to `Some` if required. In principle, this
|
||||
/// means that the input list was not exhaustive, though at present we
|
||||
/// sometimes are not smart enough to recognize all exhaustive inputs.
|
||||
/// If we find that *NONE* of the candidates apply, we branch to `otherwise_block`.
|
||||
///
|
||||
/// It might be surprising that the input can be non-exhaustive.
|
||||
/// Indeed, initially, it is not, because all matches are
|
||||
/// exhaustive in Rust. But during processing we sometimes divide
|
||||
/// up the list of candidates and recurse with a non-exhaustive
|
||||
/// list. This is important to keep the size of the generated code
|
||||
/// under control. See [`Builder::test_candidates`] for more details.
|
||||
/// list. This is how our lowering approach (called "backtracking
|
||||
/// automaton" in the literature) works.
|
||||
/// See [`Builder::test_candidates`] for more details.
|
||||
///
|
||||
/// If `fake_borrows` is `Some`, then places which need fake borrows
|
||||
/// will be added to it.
|
||||
///
|
||||
/// For an example of a case where we set `otherwise_block`, even for an
|
||||
/// exhaustive match, consider:
|
||||
///
|
||||
/// For an example of how we use `otherwise_block`, consider:
|
||||
/// ```
|
||||
/// # fn foo(x: (bool, bool)) {
|
||||
/// match x {
|
||||
/// (true, true) => (),
|
||||
/// (_, false) => (),
|
||||
/// (false, true) => (),
|
||||
/// # fn foo((x, y): (bool, bool)) -> u32 {
|
||||
/// match (x, y) {
|
||||
/// (true, true) => 1,
|
||||
/// (_, false) => 2,
|
||||
/// (false, true) => 3,
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
/// For this match, we generate something like:
|
||||
/// ```
|
||||
/// # fn foo((x, y): (bool, bool)) -> u32 {
|
||||
/// if x {
|
||||
/// if y {
|
||||
/// return 1
|
||||
/// } else {
|
||||
/// // continue
|
||||
/// }
|
||||
/// } else {
|
||||
/// // continue
|
||||
/// }
|
||||
/// if y {
|
||||
/// if x {
|
||||
/// // This is actually unreachable because the `(true, true)` case was handled above.
|
||||
/// // continue
|
||||
/// } else {
|
||||
/// return 3
|
||||
/// }
|
||||
/// } else {
|
||||
/// return 2
|
||||
/// }
|
||||
/// // this is the final `otherwise_block`, which is unreachable because the match was exhaustive.
|
||||
/// unreachable!()
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// For this match, we check if `x.0` matches `true` (for the first
|
||||
/// arm). If it doesn't match, we check `x.1`. If `x.1` is `true` we check
|
||||
/// if `x.0` matches `false` (for the third arm). In the (impossible at
|
||||
/// runtime) case when `x.0` is now `true`, we branch to
|
||||
/// `otherwise_block`.
|
||||
/// Every `continue` is an instance of branching to some `otherwise_block` somewhere deep within
|
||||
/// the algorithm. For more details on why we lower like this, see [`Builder::test_candidates`].
|
||||
///
|
||||
/// Note how we test `x` twice. This is the tradeoff of backtracking automata: we prefer smaller
|
||||
/// code size at the expense of non-optimal code paths.
|
||||
#[instrument(skip(self, fake_borrows), level = "debug")]
|
||||
fn match_candidates<'pat>(
|
||||
&mut self,
|
||||
@ -1557,18 +1579,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the most subtle part of the matching algorithm. At
|
||||
/// this point, the input candidates have been fully simplified,
|
||||
/// and so we know that all remaining match-pairs require some
|
||||
/// sort of test. To decide what test to perform, we take the highest
|
||||
/// priority candidate (the first one in the list, as of January 2021)
|
||||
/// and extract the first match-pair from the list. From this we decide
|
||||
/// what kind of test is needed using [`Builder::test`], defined in the
|
||||
/// [`test` module](mod@test).
|
||||
/// Pick a test to run. Which test doesn't matter as long as it is guaranteed to fully match at
|
||||
/// least one match pair. We currently simply pick the test corresponding to the first match
|
||||
/// pair of the first candidate in the list.
|
||||
///
|
||||
/// *Note:* taking the first match pair is somewhat arbitrary, and
|
||||
/// we might do better here by choosing more carefully what to
|
||||
/// test.
|
||||
/// *Note:* taking the first match pair is somewhat arbitrary, and we might do better here by
|
||||
/// choosing more carefully what to test.
|
||||
///
|
||||
/// For example, consider the following possible match-pairs:
|
||||
///
|
||||
@ -1580,121 +1596,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// [`Switch`]: TestKind::Switch
|
||||
/// [`SwitchInt`]: TestKind::SwitchInt
|
||||
/// [`Range`]: TestKind::Range
|
||||
///
|
||||
/// Once we know what sort of test we are going to perform, this
|
||||
/// test may also help us winnow down our candidates. So we walk over
|
||||
/// the candidates (from high to low priority) and check. This
|
||||
/// gives us, for each outcome of the test, a transformed list of
|
||||
/// candidates. For example, if we are testing `x.0`'s variant,
|
||||
/// and we have a candidate `(x.0 @ Some(v), x.1 @ 22)`,
|
||||
/// then we would have a resulting candidate of `((x.0 as Some).0 @ v, x.1 @ 22)`.
|
||||
/// Note that the first match-pair is now simpler (and, in fact, irrefutable).
|
||||
///
|
||||
/// But there may also be candidates that the test just doesn't
|
||||
/// apply to. The classical example involves wildcards:
|
||||
///
|
||||
/// ```
|
||||
/// # let (x, y, z) = (true, true, true);
|
||||
/// match (x, y, z) {
|
||||
/// (true , _ , true ) => true, // (0)
|
||||
/// (_ , true , _ ) => true, // (1)
|
||||
/// (false, false, _ ) => false, // (2)
|
||||
/// (true , _ , false) => false, // (3)
|
||||
/// }
|
||||
/// # ;
|
||||
/// ```
|
||||
///
|
||||
/// In that case, after we test on `x`, there are 2 overlapping candidate
|
||||
/// sets:
|
||||
///
|
||||
/// - If the outcome is that `x` is true, candidates 0, 1, and 3
|
||||
/// - If the outcome is that `x` is false, candidates 1 and 2
|
||||
///
|
||||
/// Here, the traditional "decision tree" method would generate 2
|
||||
/// separate code-paths for the 2 separate cases.
|
||||
///
|
||||
/// In some cases, this duplication can create an exponential amount of
|
||||
/// code. This is most easily seen by noticing that this method terminates
|
||||
/// with precisely the reachable arms being reachable - but that problem
|
||||
/// is trivially NP-complete:
|
||||
///
|
||||
/// ```ignore (illustrative)
|
||||
/// match (var0, var1, var2, var3, ...) {
|
||||
/// (true , _ , _ , false, true, ...) => false,
|
||||
/// (_ , true, true , false, _ , ...) => false,
|
||||
/// (false, _ , false, false, _ , ...) => false,
|
||||
/// ...
|
||||
/// _ => true
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Here the last arm is reachable only if there is an assignment to
|
||||
/// the variables that does not match any of the literals. Therefore,
|
||||
/// compilation would take an exponential amount of time in some cases.
|
||||
///
|
||||
/// That kind of exponential worst-case might not occur in practice, but
|
||||
/// our simplistic treatment of constants and guards would make it occur
|
||||
/// in very common situations - for example [#29740]:
|
||||
///
|
||||
/// ```ignore (illustrative)
|
||||
/// match x {
|
||||
/// "foo" if foo_guard => ...,
|
||||
/// "bar" if bar_guard => ...,
|
||||
/// "baz" if baz_guard => ...,
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// [#29740]: https://github.com/rust-lang/rust/issues/29740
|
||||
///
|
||||
/// Here we first test the match-pair `x @ "foo"`, which is an [`Eq` test].
|
||||
///
|
||||
/// [`Eq` test]: TestKind::Eq
|
||||
///
|
||||
/// It might seem that we would end up with 2 disjoint candidate
|
||||
/// sets, consisting of the first candidate or the other two, but our
|
||||
/// algorithm doesn't reason about `"foo"` being distinct from the other
|
||||
/// constants; it considers the latter arms to potentially match after
|
||||
/// both outcomes, which obviously leads to an exponential number
|
||||
/// of tests.
|
||||
///
|
||||
/// To avoid these kinds of problems, our algorithm tries to ensure
|
||||
/// the amount of generated tests is linear. When we do a k-way test,
|
||||
/// we return an additional "unmatched" set alongside the obvious `k`
|
||||
/// sets. When we encounter a candidate that would be present in more
|
||||
/// than one of the sets, we put it and all candidates below it into the
|
||||
/// "unmatched" set. This ensures these `k+1` sets are disjoint.
|
||||
///
|
||||
/// After we perform our test, we branch into the appropriate candidate
|
||||
/// set and recurse with `match_candidates`. These sub-matches are
|
||||
/// obviously non-exhaustive - as we discarded our otherwise set - so
|
||||
/// we set their continuation to do `match_candidates` on the
|
||||
/// "unmatched" set (which is again non-exhaustive).
|
||||
///
|
||||
/// If you apply this to the above test, you basically wind up
|
||||
/// with an if-else-if chain, testing each candidate in turn,
|
||||
/// which is precisely what we want.
|
||||
///
|
||||
/// In addition to avoiding exponential-time blowups, this algorithm
|
||||
/// also has the nice property that each guard and arm is only generated
|
||||
/// once.
|
||||
fn test_candidates<'pat, 'b, 'c>(
|
||||
fn pick_test(
|
||||
&mut self,
|
||||
span: Span,
|
||||
scrutinee_span: Span,
|
||||
mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>],
|
||||
start_block: BasicBlock,
|
||||
otherwise_block: BasicBlock,
|
||||
candidates: &mut [&mut Candidate<'_, 'tcx>],
|
||||
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
|
||||
) {
|
||||
// extract the match-pair from the highest priority candidate
|
||||
) -> (PlaceBuilder<'tcx>, Test<'tcx>) {
|
||||
// Extract the match-pair from the highest priority candidate
|
||||
let match_pair = &candidates.first().unwrap().match_pairs[0];
|
||||
let mut test = self.test(match_pair);
|
||||
let match_place = match_pair.place.clone();
|
||||
|
||||
// most of the time, the test to perform is simply a function
|
||||
// of the main candidate; but for a test like SwitchInt, we
|
||||
// may want to add cases based on the candidates that are
|
||||
debug!(?test, ?match_pair);
|
||||
// Most of the time, the test to perform is simply a function of the main candidate; but for
|
||||
// a test like SwitchInt, we may want to add cases based on the candidates that are
|
||||
// available
|
||||
match test.kind {
|
||||
TestKind::SwitchInt { switch_ty: _, ref mut options } => {
|
||||
@ -1721,20 +1635,58 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
fb.insert(resolved_place);
|
||||
}
|
||||
|
||||
// perform the test, branching to one of N blocks. For each of
|
||||
// those N possible outcomes, create a (initially empty)
|
||||
// vector of candidates. Those are the candidates that still
|
||||
// apply if the test has that particular outcome.
|
||||
debug!("test_candidates: test={:?} match_pair={:?}", test, match_pair);
|
||||
(match_place, test)
|
||||
}
|
||||
|
||||
/// Given a test, we sort the input candidates into several buckets. If a candidate only matches
|
||||
/// in one of the branches of `test`, we move it there. If it could match in more than one of
|
||||
/// the branches of `test`, we stop sorting candidates.
|
||||
///
|
||||
/// This returns a pair of
|
||||
/// - the candidates that weren't sorted;
|
||||
/// - for each possible outcome of the test, the candidates that match in that outcome.
|
||||
///
|
||||
/// Moreover, we transform the branched candidates to reflect the fact that we know which
|
||||
/// outcome of `test` occurred.
|
||||
///
|
||||
/// For example:
|
||||
/// ```
|
||||
/// # let (x, y, z) = (true, true, true);
|
||||
/// match (x, y, z) {
|
||||
/// (true , _ , true ) => true, // (0)
|
||||
/// (false, false, _ ) => false, // (1)
|
||||
/// (_ , true , _ ) => true, // (2)
|
||||
/// (true , _ , false) => false, // (3)
|
||||
/// }
|
||||
/// # ;
|
||||
/// ```
|
||||
///
|
||||
/// Assume we are testing on `x`. There are 2 overlapping candidate sets:
|
||||
/// - If the outcome is that `x` is true, candidates 0, 2, and 3
|
||||
/// - If the outcome is that `x` is false, candidates 1 and 2
|
||||
///
|
||||
/// Following our algorithm, candidate 0 is sorted into outcome `x == true`, candidate 1 goes
|
||||
/// into outcome `x == false`, and candidate 2 and 3 remain unsorted.
|
||||
///
|
||||
/// The sorted candidates are transformed:
|
||||
/// - candidate 0 becomes `[z @ true]` since we know that `x` was `true`;
|
||||
/// - candidate 1 becomes `[y @ false]` since we know that `x` was `false`.
|
||||
fn sort_candidates<'b, 'c, 'pat>(
|
||||
&mut self,
|
||||
match_place: &PlaceBuilder<'tcx>,
|
||||
test: &Test<'tcx>,
|
||||
mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>],
|
||||
) -> (&'b mut [&'c mut Candidate<'pat, 'tcx>], Vec<Vec<&'b mut Candidate<'pat, 'tcx>>>) {
|
||||
// For each of the N possible outcomes, create a (initially empty) vector of candidates.
|
||||
// Those are the candidates that apply if the test has that particular outcome.
|
||||
let mut target_candidates: Vec<Vec<&mut Candidate<'pat, 'tcx>>> = vec![];
|
||||
target_candidates.resize_with(test.targets(), Default::default);
|
||||
|
||||
let total_candidate_count = candidates.len();
|
||||
|
||||
// Sort the candidates into the appropriate vector in
|
||||
// `target_candidates`. Note that at some point we may
|
||||
// encounter a candidate where the test is not relevant; at
|
||||
// that point, we stop sorting.
|
||||
// Sort the candidates into the appropriate vector in `target_candidates`. Note that at some
|
||||
// point we may encounter a candidate where the test is not relevant; at that point, we stop
|
||||
// sorting.
|
||||
while let Some(candidate) = candidates.first_mut() {
|
||||
let Some(idx) = self.sort_candidate(&match_place, &test, candidate) else {
|
||||
break;
|
||||
@ -1743,7 +1695,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
target_candidates[idx].push(candidate);
|
||||
candidates = rest;
|
||||
}
|
||||
// at least the first candidate ought to be tested
|
||||
|
||||
// At least the first candidate ought to be tested
|
||||
assert!(
|
||||
total_candidate_count > candidates.len(),
|
||||
"{total_candidate_count}, {candidates:#?}"
|
||||
@ -1751,16 +1704,130 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
debug!("tested_candidates: {}", total_candidate_count - candidates.len());
|
||||
debug!("untested_candidates: {}", candidates.len());
|
||||
|
||||
(candidates, target_candidates)
|
||||
}
|
||||
|
||||
/// This is the most subtle part of the match lowering algorithm. At this point, the input
|
||||
/// candidates have been fully simplified, so all remaining match-pairs require some sort of
|
||||
/// test.
|
||||
///
|
||||
/// Once we pick what sort of test we are going to perform, this test will help us winnow down
|
||||
/// our candidates. So we walk over the candidates (from high to low priority) and check. We
|
||||
/// compute, for each outcome of the test, a transformed list of candidates. If a candidate
|
||||
/// matches in a single branch of our test, we add it to the corresponding outcome. We also
|
||||
/// transform it to record the fact that we know which outcome occurred.
|
||||
///
|
||||
/// For example, if we are testing `x.0`'s variant, and we have a candidate `(x.0 @ Some(v), x.1
|
||||
/// @ 22)`, then we would have a resulting candidate of `((x.0 as Some).0 @ v, x.1 @ 22)` in the
|
||||
/// branch corresponding to `Some`. To ensure we make progress, we always pick a test that
|
||||
/// results in simplifying the first candidate.
|
||||
///
|
||||
/// But there may also be candidates that the test doesn't
|
||||
/// apply to. The classical example is wildcards:
|
||||
///
|
||||
/// ```
|
||||
/// # let (x, y, z) = (true, true, true);
|
||||
/// match (x, y, z) {
|
||||
/// (true , _ , true ) => true, // (0)
|
||||
/// (false, false, _ ) => false, // (1)
|
||||
/// (_ , true , _ ) => true, // (2)
|
||||
/// (true , _ , false) => false, // (3)
|
||||
/// }
|
||||
/// # ;
|
||||
/// ```
|
||||
///
|
||||
/// Here, the traditional "decision tree" method would generate 2 separate code-paths for the 2
|
||||
/// possible values of `x`. This would however duplicate some candidates, which would need to be
|
||||
/// lowered several times.
|
||||
///
|
||||
/// In some cases, this duplication can create an exponential amount of
|
||||
/// code. This is most easily seen by noticing that this method terminates
|
||||
/// with precisely the reachable arms being reachable - but that problem
|
||||
/// is trivially NP-complete:
|
||||
///
|
||||
/// ```ignore (illustrative)
|
||||
/// match (var0, var1, var2, var3, ...) {
|
||||
/// (true , _ , _ , false, true, ...) => false,
|
||||
/// (_ , true, true , false, _ , ...) => false,
|
||||
/// (false, _ , false, false, _ , ...) => false,
|
||||
/// ...
|
||||
/// _ => true
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Here the last arm is reachable only if there is an assignment to
|
||||
/// the variables that does not match any of the literals. Therefore,
|
||||
/// compilation would take an exponential amount of time in some cases.
|
||||
///
|
||||
/// In rustc, we opt instead for the "backtracking automaton" approach. This guarantees we never
|
||||
/// duplicate a candidate (except in the presence of or-patterns). In fact this guarantee is
|
||||
/// ensured by the fact that we carry around `&mut Candidate`s which can't be duplicated.
|
||||
///
|
||||
/// To make this work, whenever we decide to perform a test, if we encounter a candidate that
|
||||
/// could match in more than one branch of the test, we stop. We generate code for the test and
|
||||
/// for the candidates in its branches; the remaining candidates will be tested if the
|
||||
/// candidates in the branches fail to match.
|
||||
///
|
||||
/// For example, if we test on `x` in the following:
|
||||
/// ```
|
||||
/// # fn foo((x, y, z): (bool, bool, bool)) -> u32 {
|
||||
/// match (x, y, z) {
|
||||
/// (true , _ , true ) => 0,
|
||||
/// (false, false, _ ) => 1,
|
||||
/// (_ , true , _ ) => 2,
|
||||
/// (true , _ , false) => 3,
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
/// this function generates code that looks more of less like:
|
||||
/// ```
|
||||
/// # fn foo((x, y, z): (bool, bool, bool)) -> u32 {
|
||||
/// if x {
|
||||
/// match (y, z) {
|
||||
/// (_, true) => return 0,
|
||||
/// _ => {} // continue matching
|
||||
/// }
|
||||
/// } else {
|
||||
/// match (y, z) {
|
||||
/// (false, _) => return 1,
|
||||
/// _ => {} // continue matching
|
||||
/// }
|
||||
/// }
|
||||
/// // the block here is `remainder_start`
|
||||
/// match (x, y, z) {
|
||||
/// (_ , true , _ ) => 2,
|
||||
/// (true , _ , false) => 3,
|
||||
/// _ => unreachable!(),
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
fn test_candidates<'pat, 'b, 'c>(
|
||||
&mut self,
|
||||
span: Span,
|
||||
scrutinee_span: Span,
|
||||
candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>],
|
||||
start_block: BasicBlock,
|
||||
otherwise_block: BasicBlock,
|
||||
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
|
||||
) {
|
||||
// Extract the match-pair from the highest priority candidate and build a test from it.
|
||||
let (match_place, test) = self.pick_test(candidates, fake_borrows);
|
||||
|
||||
// For each of the N possible test outcomes, build the vector of candidates that applies if
|
||||
// the test has that particular outcome.
|
||||
let (remaining_candidates, target_candidates) =
|
||||
self.sort_candidates(&match_place, &test, candidates);
|
||||
|
||||
// The block that we should branch to if none of the
|
||||
// `target_candidates` match.
|
||||
let remainder_start = if !candidates.is_empty() {
|
||||
let remainder_start = if !remaining_candidates.is_empty() {
|
||||
let remainder_start = self.cfg.start_new_block();
|
||||
self.match_candidates(
|
||||
span,
|
||||
scrutinee_span,
|
||||
remainder_start,
|
||||
otherwise_block,
|
||||
candidates,
|
||||
remaining_candidates,
|
||||
fake_borrows,
|
||||
);
|
||||
remainder_start
|
||||
|
@ -482,17 +482,40 @@ impl<'tcx> Validator<'_, 'tcx> {
|
||||
match op {
|
||||
BinOp::Div | BinOp::Rem => {
|
||||
if lhs_ty.is_integral() {
|
||||
let sz = lhs_ty.primitive_size(self.tcx);
|
||||
// Integer division: the RHS must be a non-zero const.
|
||||
let const_val = match rhs {
|
||||
let rhs_val = match rhs {
|
||||
Operand::Constant(c) => {
|
||||
c.const_.try_eval_bits(self.tcx, self.param_env)
|
||||
c.const_.try_eval_scalar_int(self.tcx, self.param_env)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
match const_val {
|
||||
match rhs_val.map(|x| x.try_to_uint(sz).unwrap()) {
|
||||
// for the zero test, int vs uint does not matter
|
||||
Some(x) if x != 0 => {} // okay
|
||||
_ => return Err(Unpromotable), // value not known or 0 -- not okay
|
||||
}
|
||||
// Furthermore, for signed divison, we also have to exclude `int::MIN / -1`.
|
||||
if lhs_ty.is_signed() {
|
||||
match rhs_val.map(|x| x.try_to_int(sz).unwrap()) {
|
||||
Some(-1) | None => {
|
||||
// The RHS is -1 or unknown, so we have to be careful.
|
||||
// But is the LHS int::MIN?
|
||||
let lhs_val = match lhs {
|
||||
Operand::Constant(c) => c
|
||||
.const_
|
||||
.try_eval_scalar_int(self.tcx, self.param_env),
|
||||
_ => None,
|
||||
};
|
||||
let lhs_min = sz.signed_int_min();
|
||||
match lhs_val.map(|x| x.try_to_int(sz).unwrap()) {
|
||||
Some(x) if x != lhs_min => {} // okay
|
||||
_ => return Err(Unpromotable), // value not known or int::MIN -- not okay
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// The remaining operations can never fail.
|
||||
|
@ -208,7 +208,7 @@ where
|
||||
if TLV.is_set() {
|
||||
Err(Error::from("StableMIR already running"))
|
||||
} else {
|
||||
let ptr: *const () = &context as *const &_ as _;
|
||||
let ptr: *const () = std::ptr::addr_of!(context) as _;
|
||||
TLV.set(&Cell::new(ptr), || Ok(f()))
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ impl<T: ?Sized> ThinBox<T> {
|
||||
|
||||
fn with_header(&self) -> &WithHeader<<T as Pointee>::Metadata> {
|
||||
// SAFETY: both types are transparent to `NonNull<u8>`
|
||||
unsafe { &*((&self.ptr) as *const WithOpaqueHeader as *const WithHeader<_>) }
|
||||
unsafe { &*(core::ptr::addr_of!(self.ptr) as *const WithHeader<_>) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@
|
||||
#![warn(multiple_supertrait_upcastable)]
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustdoc::redundant_explicit_links)]
|
||||
#![deny(ffi_unwind_calls)]
|
||||
//
|
||||
// Library features:
|
||||
// tidy-alphabetical-start
|
||||
|
@ -1969,7 +1969,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
|
||||
|
||||
// Copy value as bytes
|
||||
ptr::copy_nonoverlapping(
|
||||
&*src as *const T as *const u8,
|
||||
core::ptr::addr_of!(*src) as *const u8,
|
||||
ptr::addr_of_mut!((*ptr).value) as *mut u8,
|
||||
value_size,
|
||||
);
|
||||
@ -2440,7 +2440,7 @@ impl<T: ?Sized + fmt::Debug, A: Allocator> fmt::Debug for Rc<T, A> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized, A: Allocator> fmt::Pointer for Rc<T, A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Pointer::fmt(&(&**self as *const T), f)
|
||||
fmt::Pointer::fmt(&core::ptr::addr_of!(**self), f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1914,7 +1914,7 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
|
||||
|
||||
// Copy value as bytes
|
||||
ptr::copy_nonoverlapping(
|
||||
&*src as *const T as *const u8,
|
||||
core::ptr::addr_of!(*src) as *const u8,
|
||||
ptr::addr_of_mut!((*ptr).data) as *mut u8,
|
||||
value_size,
|
||||
);
|
||||
@ -3265,7 +3265,7 @@ impl<T: ?Sized + fmt::Debug, A: Allocator> fmt::Debug for Arc<T, A> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: ?Sized, A: Allocator> fmt::Pointer for Arc<T, A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Pointer::fmt(&(&**self as *const T), f)
|
||||
fmt::Pointer::fmt(&core::ptr::addr_of!(**self), f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ use crate::ffi::c_char;
|
||||
use crate::fmt;
|
||||
use crate::intrinsics;
|
||||
use crate::ops;
|
||||
use crate::ptr::addr_of;
|
||||
use crate::slice;
|
||||
use crate::slice::memchr;
|
||||
use crate::str;
|
||||
@ -603,7 +604,7 @@ impl CStr {
|
||||
pub const fn to_bytes_with_nul(&self) -> &[u8] {
|
||||
// SAFETY: Transmuting a slice of `c_char`s to a slice of `u8`s
|
||||
// is safe on all supported targets.
|
||||
unsafe { &*(&self.inner as *const [c_char] as *const [u8]) }
|
||||
unsafe { &*(addr_of!(self.inner) as *const [u8]) }
|
||||
}
|
||||
|
||||
/// Yields a <code>&[str]</code> slice if the `CStr` contains valid UTF-8.
|
||||
|
@ -2,6 +2,7 @@ use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable, TrustedF
|
||||
use crate::mem::{ManuallyDrop, MaybeUninit};
|
||||
use crate::num::NonZero;
|
||||
use crate::ops::{ControlFlow, Try};
|
||||
use crate::ptr::addr_of;
|
||||
use crate::{array, fmt};
|
||||
|
||||
/// An iterator that uses `f` to both filter and map elements from `iter`.
|
||||
@ -98,9 +99,8 @@ where
|
||||
// SAFETY: Loop conditions ensure the index is in bounds.
|
||||
|
||||
unsafe {
|
||||
let opt_payload_at: *const MaybeUninit<B> = (&val as *const Option<B>)
|
||||
.byte_add(core::mem::offset_of!(Option<B>, Some.0))
|
||||
.cast();
|
||||
let opt_payload_at: *const MaybeUninit<B> =
|
||||
addr_of!(val).byte_add(core::mem::offset_of!(Option<B>, Some.0)).cast();
|
||||
let dst = guard.array.as_mut_ptr().add(idx);
|
||||
crate::ptr::copy_nonoverlapping(opt_payload_at, dst, 1);
|
||||
crate::mem::forget(val);
|
||||
|
@ -106,6 +106,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![warn(multiple_supertrait_upcastable)]
|
||||
#![allow(internal_features)]
|
||||
#![deny(ffi_unwind_calls)]
|
||||
// Do not check link redundancy on bootstraping phase
|
||||
#![allow(rustdoc::redundant_explicit_links)]
|
||||
//
|
||||
|
@ -1553,7 +1553,7 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
|
||||
// `dst` cannot overlap `src` because the caller has mutable access
|
||||
// to `dst` while `src` is owned by this function.
|
||||
unsafe {
|
||||
copy_nonoverlapping(&src as *const T as *const u8, dst as *mut u8, mem::size_of::<T>());
|
||||
copy_nonoverlapping(addr_of!(src) as *const u8, dst as *mut u8, mem::size_of::<T>());
|
||||
// We are calling the intrinsic directly to avoid function calls in the generated code.
|
||||
intrinsics::forget(src);
|
||||
}
|
||||
|
@ -146,6 +146,9 @@ impl<T> [T] {
|
||||
/// ```
|
||||
/// let a = [1, 2, 3];
|
||||
/// assert!(!a.is_empty());
|
||||
///
|
||||
/// let b: &[i32] = &[];
|
||||
/// assert!(b.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")]
|
||||
@ -185,6 +188,9 @@ impl<T> [T] {
|
||||
/// *first = 5;
|
||||
/// }
|
||||
/// assert_eq!(x, &[5, 1, 2]);
|
||||
///
|
||||
/// let y: &mut [i32] = &mut [];
|
||||
/// assert_eq!(None, y.first_mut());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
|
||||
@ -297,7 +303,7 @@ impl<T> [T] {
|
||||
if let [.., last] = self { Some(last) } else { None }
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the last item in the slice.
|
||||
/// Returns a mutable reference to the last item in the slice, or `None` if it is empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -308,6 +314,9 @@ impl<T> [T] {
|
||||
/// *last = 10;
|
||||
/// }
|
||||
/// assert_eq!(x, &[0, 1, 10]);
|
||||
///
|
||||
/// let y: &mut [i32] = &mut [];
|
||||
/// assert_eq!(None, y.last_mut());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")]
|
||||
|
@ -36,6 +36,7 @@
|
||||
#![feature(strict_provenance)]
|
||||
#![recursion_limit = "256"]
|
||||
#![allow(internal_features)]
|
||||
#![deny(ffi_unwind_calls)]
|
||||
|
||||
#[unstable(feature = "proc_macro_internals", issue = "27812")]
|
||||
#[doc(hidden)]
|
||||
|
@ -21,7 +21,7 @@ mod libc {
|
||||
fn sun_path_offset(addr: &libc::sockaddr_un) -> usize {
|
||||
// Work with an actual instance of the type since using a null pointer is UB
|
||||
let base = (addr as *const libc::sockaddr_un).addr();
|
||||
let path = (&addr.sun_path as *const libc::c_char).addr();
|
||||
let path = core::ptr::addr_of!(addr.sun_path).addr();
|
||||
path - base
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ impl SocketAddr {
|
||||
unsafe {
|
||||
let mut addr: libc::sockaddr_un = mem::zeroed();
|
||||
let mut len = mem::size_of::<libc::sockaddr_un>() as libc::socklen_t;
|
||||
cvt(f(&mut addr as *mut _ as *mut _, &mut len))?;
|
||||
cvt(f(core::ptr::addr_of_mut!(addr) as *mut _, &mut len))?;
|
||||
SocketAddr::from_parts(addr, len)
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ pub(super) fn recv_vectored_with_ancillary_from(
|
||||
unsafe {
|
||||
let mut msg_name: libc::sockaddr_un = zeroed();
|
||||
let mut msg: libc::msghdr = zeroed();
|
||||
msg.msg_name = &mut msg_name as *mut _ as *mut _;
|
||||
msg.msg_name = core::ptr::addr_of_mut!(msg_name) as *mut _;
|
||||
msg.msg_namelen = size_of::<libc::sockaddr_un>() as libc::socklen_t;
|
||||
msg.msg_iov = bufs.as_mut_ptr().cast();
|
||||
msg.msg_iovlen = bufs.len() as _;
|
||||
@ -70,7 +70,7 @@ pub(super) fn send_vectored_with_ancillary_to(
|
||||
if let Some(path) = path { sockaddr_un(path)? } else { (zeroed(), 0) };
|
||||
|
||||
let mut msg: libc::msghdr = zeroed();
|
||||
msg.msg_name = &mut msg_name as *mut _ as *mut _;
|
||||
msg.msg_name = core::ptr::addr_of_mut!(msg_name) as *mut _;
|
||||
msg.msg_namelen = msg_namelen;
|
||||
msg.msg_iov = bufs.as_ptr() as *mut _;
|
||||
msg.msg_iovlen = bufs.len() as _;
|
||||
|
@ -91,7 +91,7 @@ impl UnixDatagram {
|
||||
let socket = UnixDatagram::unbound()?;
|
||||
let (addr, len) = sockaddr_un(path.as_ref())?;
|
||||
|
||||
cvt(libc::bind(socket.as_raw_fd(), &addr as *const _ as *const _, len as _))?;
|
||||
cvt(libc::bind(socket.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len as _))?;
|
||||
|
||||
Ok(socket)
|
||||
}
|
||||
@ -124,7 +124,7 @@ impl UnixDatagram {
|
||||
let socket = UnixDatagram::unbound()?;
|
||||
cvt(libc::bind(
|
||||
socket.as_raw_fd(),
|
||||
&socket_addr.addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(socket_addr.addr) as *const _,
|
||||
socket_addr.len as _,
|
||||
))?;
|
||||
Ok(socket)
|
||||
@ -206,7 +206,7 @@ impl UnixDatagram {
|
||||
unsafe {
|
||||
let (addr, len) = sockaddr_un(path.as_ref())?;
|
||||
|
||||
cvt(libc::connect(self.as_raw_fd(), &addr as *const _ as *const _, len))?;
|
||||
cvt(libc::connect(self.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -238,7 +238,7 @@ impl UnixDatagram {
|
||||
unsafe {
|
||||
cvt(libc::connect(
|
||||
self.as_raw_fd(),
|
||||
&socket_addr.addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(socket_addr.addr) as *const _,
|
||||
socket_addr.len,
|
||||
))?;
|
||||
}
|
||||
@ -505,7 +505,7 @@ impl UnixDatagram {
|
||||
buf.as_ptr() as *const _,
|
||||
buf.len(),
|
||||
MSG_NOSIGNAL,
|
||||
&addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(addr) as *const _,
|
||||
len,
|
||||
))?;
|
||||
Ok(count as usize)
|
||||
@ -540,7 +540,7 @@ impl UnixDatagram {
|
||||
buf.as_ptr() as *const _,
|
||||
buf.len(),
|
||||
MSG_NOSIGNAL,
|
||||
&socket_addr.addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(socket_addr.addr) as *const _,
|
||||
socket_addr.len,
|
||||
))?;
|
||||
Ok(count as usize)
|
||||
|
@ -99,7 +99,11 @@ impl UnixListener {
|
||||
)))]
|
||||
const backlog: libc::c_int = libc::SOMAXCONN;
|
||||
|
||||
cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?;
|
||||
cvt(libc::bind(
|
||||
inner.as_inner().as_raw_fd(),
|
||||
core::ptr::addr_of!(addr) as *const _,
|
||||
len as _,
|
||||
))?;
|
||||
cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?;
|
||||
|
||||
Ok(UnixListener(inner))
|
||||
@ -139,7 +143,7 @@ impl UnixListener {
|
||||
const backlog: libc::c_int = 128;
|
||||
cvt(libc::bind(
|
||||
inner.as_raw_fd(),
|
||||
&socket_addr.addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(socket_addr.addr) as *const _,
|
||||
socket_addr.len as _,
|
||||
))?;
|
||||
cvt(libc::listen(inner.as_raw_fd(), backlog))?;
|
||||
@ -174,7 +178,7 @@ impl UnixListener {
|
||||
pub fn accept(&self) -> io::Result<(UnixStream, SocketAddr)> {
|
||||
let mut storage: libc::sockaddr_un = unsafe { mem::zeroed() };
|
||||
let mut len = mem::size_of_val(&storage) as libc::socklen_t;
|
||||
let sock = self.0.accept(&mut storage as *mut _ as *mut _, &mut len)?;
|
||||
let sock = self.0.accept(core::ptr::addr_of_mut!(storage) as *mut _, &mut len)?;
|
||||
let addr = SocketAddr::from_parts(storage, len)?;
|
||||
Ok((UnixStream(sock), addr))
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ impl UnixStream {
|
||||
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
|
||||
let (addr, len) = sockaddr_un(path.as_ref())?;
|
||||
|
||||
cvt(libc::connect(inner.as_raw_fd(), &addr as *const _ as *const _, len))?;
|
||||
cvt(libc::connect(inner.as_raw_fd(), core::ptr::addr_of!(addr) as *const _, len))?;
|
||||
Ok(UnixStream(inner))
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ impl UnixStream {
|
||||
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
|
||||
cvt(libc::connect(
|
||||
inner.as_raw_fd(),
|
||||
&socket_addr.addr as *const _ as *const _,
|
||||
core::ptr::addr_of!(socket_addr.addr) as *const _,
|
||||
socket_addr.len,
|
||||
))?;
|
||||
Ok(UnixStream(inner))
|
||||
|
@ -62,7 +62,7 @@ pub mod impl_linux {
|
||||
socket.as_raw_fd(),
|
||||
SOL_SOCKET,
|
||||
SO_PEERCRED,
|
||||
&mut ucred as *mut ucred as *mut c_void,
|
||||
core::ptr::addr_of_mut!(ucred) as *mut c_void,
|
||||
&mut ucred_size,
|
||||
);
|
||||
|
||||
@ -122,7 +122,7 @@ pub mod impl_mac {
|
||||
socket.as_raw_fd(),
|
||||
SOL_LOCAL,
|
||||
LOCAL_PEERPID,
|
||||
&mut pid as *mut pid_t as *mut c_void,
|
||||
core::ptr::addr_of_mut!(pid) as *mut c_void,
|
||||
&mut pid_size,
|
||||
);
|
||||
|
||||
|
@ -502,7 +502,7 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
// method of calling a catch panic whilst juggling ownership.
|
||||
let mut data = Data { f: ManuallyDrop::new(f) };
|
||||
|
||||
let data_ptr = &mut data as *mut _ as *mut u8;
|
||||
let data_ptr = core::ptr::addr_of_mut!(data) as *mut u8;
|
||||
// SAFETY:
|
||||
//
|
||||
// Access to the union's fields: this is `std` and we know that the `r#try`
|
||||
|
@ -182,7 +182,11 @@ impl<T> Channel<T> {
|
||||
// Prepare for blocking until a receiver wakes us up.
|
||||
let oper = Operation::hook(token);
|
||||
let mut packet = Packet::<T>::message_on_stack(msg);
|
||||
inner.senders.register_with_packet(oper, &mut packet as *mut Packet<T> as *mut (), cx);
|
||||
inner.senders.register_with_packet(
|
||||
oper,
|
||||
core::ptr::addr_of_mut!(packet) as *mut (),
|
||||
cx,
|
||||
);
|
||||
inner.receivers.notify();
|
||||
drop(inner);
|
||||
|
||||
@ -251,7 +255,7 @@ impl<T> Channel<T> {
|
||||
let mut packet = Packet::<T>::empty_on_stack();
|
||||
inner.receivers.register_with_packet(
|
||||
oper,
|
||||
&mut packet as *mut Packet<T> as *mut (),
|
||||
core::ptr::addr_of_mut!(packet) as *mut (),
|
||||
cx,
|
||||
);
|
||||
inner.senders.notify();
|
||||
|
@ -207,7 +207,7 @@ impl Socket {
|
||||
buf.as_mut_ptr(),
|
||||
buf.len(),
|
||||
flags,
|
||||
&mut storage as *mut _ as *mut _,
|
||||
core::ptr::addr_of_mut!(storage) as *mut _,
|
||||
&mut addrlen,
|
||||
)
|
||||
})?;
|
||||
@ -323,7 +323,7 @@ impl Socket {
|
||||
netc::ioctl(
|
||||
self.as_raw_fd(),
|
||||
netc::FIONBIO,
|
||||
&mut nonblocking as *mut _ as *mut core::ffi::c_void,
|
||||
core::ptr::addr_of_mut!(nonblocking) as *mut core::ffi::c_void,
|
||||
)
|
||||
})
|
||||
.map(drop)
|
||||
|
@ -100,7 +100,7 @@ pub struct Instant(Timespec);
|
||||
impl Instant {
|
||||
pub fn now() -> Instant {
|
||||
let mut time: Timespec = Timespec::zero();
|
||||
let _ = unsafe { abi::clock_gettime(CLOCK_MONOTONIC, &mut time.t as *mut timespec) };
|
||||
let _ = unsafe { abi::clock_gettime(CLOCK_MONOTONIC, core::ptr::addr_of_mut!(time.t)) };
|
||||
|
||||
Instant(time)
|
||||
}
|
||||
@ -197,7 +197,7 @@ pub const UNIX_EPOCH: SystemTime = SystemTime(Timespec::zero());
|
||||
impl SystemTime {
|
||||
pub fn now() -> SystemTime {
|
||||
let mut time: Timespec = Timespec::zero();
|
||||
let _ = unsafe { abi::clock_gettime(CLOCK_REALTIME, &mut time.t as *mut timespec) };
|
||||
let _ = unsafe { abi::clock_gettime(CLOCK_REALTIME, core::ptr::addr_of_mut!(time.t)) };
|
||||
|
||||
SystemTime(time)
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl Tls {
|
||||
#[allow(unused)]
|
||||
pub unsafe fn activate_persistent(self: Box<Self>) {
|
||||
// FIXME: Needs safety information. See entry.S for `set_tls_ptr` definition.
|
||||
unsafe { set_tls_ptr((&*self) as *const Tls as _) };
|
||||
unsafe { set_tls_ptr(core::ptr::addr_of!(*self) as _) };
|
||||
mem::forget(self);
|
||||
}
|
||||
|
||||
|
@ -1344,7 +1344,7 @@ impl File {
|
||||
}
|
||||
cvt(unsafe { libc::fsetattrlist(
|
||||
self.as_raw_fd(),
|
||||
(&attrlist as *const libc::attrlist).cast::<libc::c_void>().cast_mut(),
|
||||
core::ptr::addr_of!(attrlist).cast::<libc::c_void>().cast_mut(),
|
||||
buf.as_ptr().cast::<libc::c_void>().cast_mut(),
|
||||
num_times * mem::size_of::<libc::timespec>(),
|
||||
0
|
||||
@ -1744,7 +1744,7 @@ fn open_from(from: &Path) -> io::Result<(crate::fs::File, crate::fs::Metadata)>
|
||||
#[cfg(target_os = "espidf")]
|
||||
fn open_to_and_set_permissions(
|
||||
to: &Path,
|
||||
reader_metadata: crate::fs::Metadata,
|
||||
_reader_metadata: crate::fs::Metadata,
|
||||
) -> io::Result<(crate::fs::File, crate::fs::Metadata)> {
|
||||
use crate::fs::OpenOptions;
|
||||
let writer = OpenOptions::new().open(to)?;
|
||||
@ -1918,7 +1918,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||
copyfile_state_get(
|
||||
state.0,
|
||||
COPYFILE_STATE_COPIED,
|
||||
&mut bytes_copied as *mut libc::off_t as *mut libc::c_void,
|
||||
core::ptr::addr_of_mut!(bytes_copied) as *mut libc::c_void,
|
||||
)
|
||||
})?;
|
||||
Ok(bytes_copied as u64)
|
||||
|
@ -38,7 +38,7 @@ pub mod thread_parking;
|
||||
pub mod time;
|
||||
|
||||
#[cfg(target_os = "espidf")]
|
||||
pub fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {}
|
||||
pub fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
|
||||
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
// SAFETY: must be called only once during runtime initialization.
|
||||
|
@ -316,7 +316,7 @@ impl Socket {
|
||||
buf.as_mut_ptr() as *mut c_void,
|
||||
buf.len(),
|
||||
flags,
|
||||
&mut storage as *mut _ as *mut _,
|
||||
core::ptr::addr_of_mut!(storage) as *mut _,
|
||||
&mut addrlen,
|
||||
)
|
||||
})?;
|
||||
|
@ -182,7 +182,7 @@ impl Process {
|
||||
zx_cvt(zx_object_get_info(
|
||||
self.handle.raw(),
|
||||
ZX_INFO_PROCESS,
|
||||
&mut proc_info as *mut _ as *mut libc::c_void,
|
||||
core::ptr::addr_of_mut!(proc_info) as *mut libc::c_void,
|
||||
mem::size_of::<zx_info_process_t>(),
|
||||
&mut actual,
|
||||
&mut avail,
|
||||
@ -219,7 +219,7 @@ impl Process {
|
||||
zx_cvt(zx_object_get_info(
|
||||
self.handle.raw(),
|
||||
ZX_INFO_PROCESS,
|
||||
&mut proc_info as *mut _ as *mut libc::c_void,
|
||||
core::ptr::addr_of_mut!(proc_info) as *mut libc::c_void,
|
||||
mem::size_of::<zx_info_process_t>(),
|
||||
&mut actual,
|
||||
&mut avail,
|
||||
|
@ -694,15 +694,15 @@ impl Command {
|
||||
let mut iov = [IoSlice::new(b"")];
|
||||
let mut msg: libc::msghdr = mem::zeroed();
|
||||
|
||||
msg.msg_iov = &mut iov as *mut _ as *mut _;
|
||||
msg.msg_iov = core::ptr::addr_of_mut!(iov) as *mut _;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
// only attach cmsg if we successfully acquired the pidfd
|
||||
if pidfd >= 0 {
|
||||
msg.msg_controllen = mem::size_of_val(&cmsg.buf) as _;
|
||||
msg.msg_control = &mut cmsg.buf as *mut _ as *mut _;
|
||||
msg.msg_control = core::ptr::addr_of_mut!(cmsg.buf) as *mut _;
|
||||
|
||||
let hdr = CMSG_FIRSTHDR(&mut msg as *mut _ as *mut _);
|
||||
let hdr = CMSG_FIRSTHDR(core::ptr::addr_of_mut!(msg) as *mut _);
|
||||
(*hdr).cmsg_level = SOL_SOCKET;
|
||||
(*hdr).cmsg_type = SCM_RIGHTS;
|
||||
(*hdr).cmsg_len = CMSG_LEN(SCM_MSG_LEN as _) as _;
|
||||
@ -744,17 +744,17 @@ impl Command {
|
||||
|
||||
let mut msg: libc::msghdr = mem::zeroed();
|
||||
|
||||
msg.msg_iov = &mut iov as *mut _ as *mut _;
|
||||
msg.msg_iov = core::ptr::addr_of_mut!(iov) as *mut _;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_controllen = mem::size_of::<Cmsg>() as _;
|
||||
msg.msg_control = &mut cmsg as *mut _ as *mut _;
|
||||
msg.msg_control = core::ptr::addr_of_mut!(cmsg) as *mut _;
|
||||
|
||||
match cvt_r(|| libc::recvmsg(sock.as_raw(), &mut msg, libc::MSG_CMSG_CLOEXEC)) {
|
||||
Err(_) => return -1,
|
||||
Ok(_) => {}
|
||||
}
|
||||
|
||||
let hdr = CMSG_FIRSTHDR(&mut msg as *mut _ as *mut _);
|
||||
let hdr = CMSG_FIRSTHDR(core::ptr::addr_of_mut!(msg) as *mut _);
|
||||
if hdr.is_null()
|
||||
|| (*hdr).cmsg_level != SOL_SOCKET
|
||||
|| (*hdr).cmsg_type != SCM_RIGHTS
|
||||
|
@ -239,7 +239,7 @@ impl Thread {
|
||||
tv_nsec: nsecs,
|
||||
};
|
||||
secs -= ts.tv_sec as u64;
|
||||
let ts_ptr = &mut ts as *mut _;
|
||||
let ts_ptr = core::ptr::addr_of_mut!(ts);
|
||||
if libc::nanosleep(ts_ptr, ts_ptr) == -1 {
|
||||
assert_eq!(os::errno(), libc::EINTR);
|
||||
secs += ts.tv_sec as u64;
|
||||
@ -418,8 +418,8 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
|
||||
libc::sysctl(
|
||||
mib.as_mut_ptr(),
|
||||
2,
|
||||
&mut cpus as *mut _ as *mut _,
|
||||
&mut cpus_size as *mut _ as *mut _,
|
||||
core::ptr::addr_of_mut!(cpus) as *mut _,
|
||||
core::ptr::addr_of_mut!(cpus_size) as *mut _,
|
||||
ptr::null_mut(),
|
||||
0,
|
||||
)
|
||||
@ -864,7 +864,7 @@ pub mod guard {
|
||||
.unwrap();
|
||||
match sysctlbyname.get() {
|
||||
Some(fcn) => {
|
||||
if fcn(oid.as_ptr(), &mut guard as *mut _ as *mut _, &mut size as *mut _ as *mut _, crate::ptr::null_mut(), 0) == 0 {
|
||||
if fcn(oid.as_ptr(), core::ptr::addr_of_mut!(guard) as *mut _, core::ptr::addr_of_mut!(size) as *mut _, crate::ptr::null_mut(), 0) == 0 {
|
||||
return guard;
|
||||
}
|
||||
return 1;
|
||||
|
@ -58,7 +58,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
||||
unsafe extern "C" fn(*mut libc::c_void),
|
||||
>(dtor),
|
||||
t.cast(),
|
||||
&__dso_handle as *const _ as *mut _,
|
||||
core::ptr::addr_of!(__dso_handle) as *mut _,
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
@ -166,7 +166,7 @@ pub fn abort_internal() -> ! {
|
||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
let mut ret = (0u64, 0u64);
|
||||
unsafe {
|
||||
let base = &mut ret as *mut (u64, u64) as *mut u8;
|
||||
let base = core::ptr::addr_of_mut!(ret) as *mut u8;
|
||||
let len = mem::size_of_val(&ret);
|
||||
wasi::random_get(base, len).expect("random_get failure");
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ impl File {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileBasicInfo,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
core::ptr::addr_of_mut!(info) as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
let mut attr = FileAttr {
|
||||
@ -422,7 +422,7 @@ impl File {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileStandardInfo,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
core::ptr::addr_of_mut!(info) as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
attr.file_size = info.AllocationSize as u64;
|
||||
@ -638,7 +638,7 @@ impl File {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileBasicInfo,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
core::ptr::addr_of_mut!(info) as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
Ok(info)
|
||||
@ -1438,7 +1438,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||
pfrom.as_ptr(),
|
||||
pto.as_ptr(),
|
||||
Some(callback),
|
||||
&mut size as *mut _ as *mut _,
|
||||
core::ptr::addr_of_mut!(size) as *mut _,
|
||||
ptr::null_mut(),
|
||||
0,
|
||||
)
|
||||
|
@ -122,7 +122,7 @@ unsafe fn msys_tty_on(handle: c::HANDLE) -> bool {
|
||||
let res = c::GetFileInformationByHandleEx(
|
||||
handle,
|
||||
c::FileNameInfo,
|
||||
&mut name_info as *mut _ as *mut c_void,
|
||||
core::ptr::addr_of_mut!(name_info) as *mut c_void,
|
||||
size_of::<FILE_NAME_INFO>() as u32,
|
||||
);
|
||||
if res == 0 {
|
||||
|
@ -310,7 +310,7 @@ impl Socket {
|
||||
buf.as_mut_ptr() as *mut _,
|
||||
length,
|
||||
flags,
|
||||
&mut storage as *mut _ as *mut _,
|
||||
core::ptr::addr_of_mut!(storage) as *mut _,
|
||||
&mut addrlen,
|
||||
)
|
||||
};
|
||||
|
@ -375,7 +375,7 @@ impl AnonPipe {
|
||||
let mut overlapped: c::OVERLAPPED = crate::mem::zeroed();
|
||||
// `hEvent` is unused by `ReadFileEx` and `WriteFileEx`.
|
||||
// Therefore the documentation suggests using it to smuggle a pointer to the callback.
|
||||
overlapped.hEvent = &mut async_result as *mut _ as *mut _;
|
||||
overlapped.hEvent = core::ptr::addr_of_mut!(async_result) as *mut _;
|
||||
|
||||
// Asynchronous read of the pipe.
|
||||
// If successful, `callback` will be called once it completes.
|
||||
|
@ -350,10 +350,10 @@ impl Command {
|
||||
StartupInfo: si,
|
||||
lpAttributeList: proc_thread_attribute_list.0.as_mut_ptr() as _,
|
||||
};
|
||||
si_ptr = &mut si_ex as *mut _ as _;
|
||||
si_ptr = core::ptr::addr_of_mut!(si_ex) as _;
|
||||
} else {
|
||||
si.cb = mem::size_of::<c::STARTUPINFOW>() as c::DWORD;
|
||||
si_ptr = &mut si as *mut _ as _;
|
||||
si_ptr = core::ptr::addr_of_mut!(si) as _;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
@ -935,7 +935,7 @@ fn make_proc_thread_attribute_list(
|
||||
// It's theoretically possible for the attribute count to exceed a u32 value.
|
||||
// Therefore, we ensure that we don't add more attributes than the buffer was initialized for.
|
||||
for (&attribute, value) in attributes.iter().take(attribute_count as usize) {
|
||||
let value_ptr = &*value.data as *const (dyn Send + Sync) as _;
|
||||
let value_ptr = core::ptr::addr_of!(*value.data) as _;
|
||||
cvt(unsafe {
|
||||
c::UpdateProcThreadAttribute(
|
||||
proc_thread_attribute_list.0.as_mut_ptr() as _,
|
||||
|
@ -7,7 +7,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
let ret = unsafe {
|
||||
c::BCryptGenRandom(
|
||||
ptr::null_mut(),
|
||||
&mut v as *mut _ as *mut u8,
|
||||
core::ptr::addr_of_mut!(v) as *mut u8,
|
||||
mem::size_of_val(&v) as c::ULONG,
|
||||
c::BCRYPT_USE_SYSTEM_PREFERRED_RNG,
|
||||
)
|
||||
@ -28,7 +28,7 @@ fn fallback_rng() -> (u64, u64) {
|
||||
|
||||
let mut v = (0, 0);
|
||||
let ret = unsafe {
|
||||
c::RtlGenRandom(&mut v as *mut _ as *mut c_void, mem::size_of_val(&v) as c::ULONG)
|
||||
c::RtlGenRandom(core::ptr::addr_of_mut!(v) as *mut c_void, mem::size_of_val(&v) as c::ULONG)
|
||||
};
|
||||
|
||||
if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) }
|
||||
|
@ -215,7 +215,7 @@ impl Parker {
|
||||
}
|
||||
|
||||
fn ptr(&self) -> c::LPVOID {
|
||||
&self.state as *const _ as c::LPVOID
|
||||
core::ptr::addr_of!(self.state) as c::LPVOID
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ pub fn setsockopt<T>(
|
||||
sock.as_raw(),
|
||||
level,
|
||||
option_name,
|
||||
&option_value as *const T as *const _,
|
||||
core::ptr::addr_of!(option_value) as *const _,
|
||||
mem::size_of::<T>() as c::socklen_t,
|
||||
))?;
|
||||
Ok(())
|
||||
@ -85,7 +85,7 @@ pub fn getsockopt<T: Copy>(sock: &Socket, level: c_int, option_name: c_int) -> i
|
||||
sock.as_raw(),
|
||||
level,
|
||||
option_name,
|
||||
&mut option_value as *mut T as *mut _,
|
||||
core::ptr::addr_of_mut!(option_value) as *mut _,
|
||||
&mut option_len,
|
||||
))?;
|
||||
Ok(option_value)
|
||||
@ -99,7 +99,7 @@ where
|
||||
unsafe {
|
||||
let mut storage: c::sockaddr_storage = mem::zeroed();
|
||||
let mut len = mem::size_of_val(&storage) as c::socklen_t;
|
||||
cvt(f(&mut storage as *mut _ as *mut _, &mut len))?;
|
||||
cvt(f(core::ptr::addr_of_mut!(storage) as *mut _, &mut len))?;
|
||||
sockaddr_to_addr(&storage, len as usize)
|
||||
}
|
||||
}
|
||||
@ -444,7 +444,7 @@ impl TcpListener {
|
||||
pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
|
||||
let mut storage: c::sockaddr_storage = unsafe { mem::zeroed() };
|
||||
let mut len = mem::size_of_val(&storage) as c::socklen_t;
|
||||
let sock = self.inner.accept(&mut storage as *mut _ as *mut _, &mut len)?;
|
||||
let sock = self.inner.accept(core::ptr::addr_of_mut!(storage) as *mut _, &mut len)?;
|
||||
let addr = sockaddr_to_addr(&storage, len as usize)?;
|
||||
Ok((TcpStream { inner: sock }, addr))
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ fn wait(state_and_queue: &AtomicPtr<Masked>, mut current_state: *mut Masked) {
|
||||
signaled: AtomicBool::new(false),
|
||||
next: current_state.with_addr(current_state.addr() & !STATE_MASK) as *const Waiter,
|
||||
};
|
||||
let me = &node as *const Waiter as *const Masked as *mut Masked;
|
||||
let me = core::ptr::addr_of!(node) as *const Masked as *mut Masked;
|
||||
|
||||
// Try to slide in the node at the head of the linked list, making sure
|
||||
// that another thread didn't just replace the head of the linked list.
|
||||
|
@ -311,7 +311,7 @@ impl<'scope, T> ScopedJoinHandle<'scope, T> {
|
||||
/// Checks if the associated thread has finished running its main function.
|
||||
///
|
||||
/// `is_finished` supports implementing a non-blocking join operation, by checking
|
||||
/// `is_finished`, and calling `join` if it returns `false`. This function does not block. To
|
||||
/// `is_finished`, and calling `join` if it returns `true`. This function does not block. To
|
||||
/// block while waiting on the thread to finish, use [`join`][Self::join].
|
||||
///
|
||||
/// This might return `true` for a brief moment after the thread's main
|
||||
|
@ -219,14 +219,14 @@ if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", targe
|
||||
pub unsafe fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word {
|
||||
let mut val: _Unwind_Word = core::ptr::null();
|
||||
_Unwind_VRS_Get(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
|
||||
&mut val as *mut _ as *mut c_void);
|
||||
core::ptr::addr_of_mut!(val) as *mut c_void);
|
||||
val
|
||||
}
|
||||
|
||||
pub unsafe fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word) {
|
||||
let mut value = value;
|
||||
_Unwind_VRS_Set(ctx, _UVRSC_CORE, reg_index as _Unwind_Word, _UVRSD_UINT32,
|
||||
&mut value as *mut _ as *mut c_void);
|
||||
core::ptr::addr_of_mut!(value) as *mut c_void);
|
||||
}
|
||||
|
||||
pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context)
|
||||
|
@ -49,6 +49,10 @@ fn main() {
|
||||
// No promotion of fallible operations.
|
||||
let _val: &'static _ = &(1/0); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(1/(1-1)); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &((1+1)/(1-1)); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(i32::MIN/-1); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(i32::MIN/(0-1)); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(-128i8/-1); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(1%0); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &(1%(1-1)); //~ ERROR temporary value dropped while borrowed
|
||||
let _val: &'static _ = &([1,2,3][4]+1); //~ ERROR temporary value dropped while borrowed
|
||||
|
@ -105,6 +105,50 @@ LL | }
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:52:29
|
||||
|
|
||||
LL | let _val: &'static _ = &((1+1)/(1-1));
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:53:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(i32::MIN/-1);
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:54:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(i32::MIN/(0-1));
|
||||
| ---------- ^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:55:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(-128i8/-1);
|
||||
| ---------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:56:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1%0);
|
||||
| ---------- ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
@ -114,7 +158,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:53:29
|
||||
--> $DIR/promote-not.rs:57:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1%(1-1));
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -125,7 +169,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:54:29
|
||||
--> $DIR/promote-not.rs:58:29
|
||||
|
|
||||
LL | let _val: &'static _ = &([1,2,3][4]+1);
|
||||
| ---------- ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -136,7 +180,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:57:29
|
||||
--> $DIR/promote-not.rs:61:29
|
||||
|
|
||||
LL | let _val: &'static _ = &TEST_DROP;
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -147,7 +191,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:59:29
|
||||
--> $DIR/promote-not.rs:63:29
|
||||
|
|
||||
LL | let _val: &'static _ = &&TEST_DROP;
|
||||
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -158,7 +202,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:59:30
|
||||
--> $DIR/promote-not.rs:63:30
|
||||
|
|
||||
LL | let _val: &'static _ = &&TEST_DROP;
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -169,7 +213,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:62:29
|
||||
--> $DIR/promote-not.rs:66:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(&TEST_DROP,);
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -180,7 +224,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:62:31
|
||||
--> $DIR/promote-not.rs:66:31
|
||||
|
|
||||
LL | let _val: &'static _ = &(&TEST_DROP,);
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -191,7 +235,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:65:29
|
||||
--> $DIR/promote-not.rs:69:29
|
||||
|
|
||||
LL | let _val: &'static _ = &[&TEST_DROP; 1];
|
||||
| ---------- ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
@ -202,7 +246,7 @@ LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:65:31
|
||||
--> $DIR/promote-not.rs:69:31
|
||||
|
|
||||
LL | let _val: &'static _ = &[&TEST_DROP; 1];
|
||||
| ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
@ -210,6 +254,6 @@ LL | let _val: &'static _ = &[&TEST_DROP; 1];
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
error: aborting due to 24 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
||||
|
@ -28,8 +28,11 @@ fn main() {
|
||||
// make sure that this does not cause trouble despite overflowing
|
||||
assert_static(&(0-1));
|
||||
|
||||
// div-by-non-0 is okay
|
||||
// div-by-non-0 (and also not MIN/-1) is okay
|
||||
assert_static(&(1/1));
|
||||
assert_static(&(0/1));
|
||||
assert_static(&(1/-1));
|
||||
assert_static(&(i32::MIN/1));
|
||||
assert_static(&(1%1));
|
||||
|
||||
// in-bounds array access is okay
|
||||
|
@ -876,498 +876,353 @@ error: this operation will panic at runtime
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:251:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:251:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:254:14
|
||||
--> $DIR/lint-overflowing-ops.rs:253:14
|
||||
|
|
||||
LL | let _n = 1i16 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:255:15
|
||||
--> $DIR/lint-overflowing-ops.rs:254:15
|
||||
|
|
||||
LL | let _n = &(1i16 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:256:14
|
||||
--> $DIR/lint-overflowing-ops.rs:255:14
|
||||
|
|
||||
LL | let _n = i16::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
--> $DIR/lint-overflowing-ops.rs:256:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:257:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
--> $DIR/lint-overflowing-ops.rs:258:14
|
||||
|
|
||||
LL | let _n = 1i32 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
--> $DIR/lint-overflowing-ops.rs:259:15
|
||||
|
|
||||
LL | let _n = &(1i32 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:262:14
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
|
|
||||
LL | let _n = i32::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:266:14
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = 1i64 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:267:15
|
||||
--> $DIR/lint-overflowing-ops.rs:264:15
|
||||
|
|
||||
LL | let _n = &(1i64 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
--> $DIR/lint-overflowing-ops.rs:265:14
|
||||
|
|
||||
LL | let _n = i64::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
--> $DIR/lint-overflowing-ops.rs:266:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:269:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:272:14
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
|
|
||||
LL | let _n = 1i128 / 0;
|
||||
| ^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:273:15
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(1i128 / 0);
|
||||
| ^^^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:274:14
|
||||
--> $DIR/lint-overflowing-ops.rs:270:14
|
||||
|
|
||||
LL | let _n = i128::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
--> $DIR/lint-overflowing-ops.rs:271:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:278:14
|
||||
--> $DIR/lint-overflowing-ops.rs:273:14
|
||||
|
|
||||
LL | let _n = 1isize / 0;
|
||||
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:279:15
|
||||
--> $DIR/lint-overflowing-ops.rs:274:15
|
||||
|
|
||||
LL | let _n = &(1isize / 0);
|
||||
| ^^^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = isize::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
--> $DIR/lint-overflowing-ops.rs:276:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:281:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
|
|
||||
LL | let _n = 1u8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(1u8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
--> $DIR/lint-overflowing-ops.rs:283:14
|
||||
|
|
||||
LL | let _n = 1u16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
--> $DIR/lint-overflowing-ops.rs:284:15
|
||||
|
|
||||
LL | let _n = &(1u16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
|
|
||||
LL | let _n = 1u32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
|
|
||||
LL | let _n = &(1u32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
|
|
||||
LL | let _n = 1u64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
|
|
||||
LL | let _n = &(1u64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
|
|
||||
LL | let _n = 1u128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
|
|
||||
LL | let _n = &(1u128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:301:14
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
|
|
||||
LL | let _n = 1usize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:302:15
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
|
|
||||
LL | let _n = &(1usize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:304:14
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
|
|
||||
LL | let _n = 1i8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:305:15
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
|
|
||||
LL | let _n = &(1i8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:306:14
|
||||
--> $DIR/lint-overflowing-ops.rs:300:14
|
||||
|
|
||||
LL | let _n = i8::MIN % -1;
|
||||
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
--> $DIR/lint-overflowing-ops.rs:301:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:307:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
--> $DIR/lint-overflowing-ops.rs:303:14
|
||||
|
|
||||
LL | let _n = 1i16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
--> $DIR/lint-overflowing-ops.rs:304:15
|
||||
|
|
||||
LL | let _n = &(1i16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:312:14
|
||||
--> $DIR/lint-overflowing-ops.rs:305:14
|
||||
|
|
||||
LL | let _n = i16::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
--> $DIR/lint-overflowing-ops.rs:306:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:316:14
|
||||
--> $DIR/lint-overflowing-ops.rs:308:14
|
||||
|
|
||||
LL | let _n = 1i32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:317:15
|
||||
--> $DIR/lint-overflowing-ops.rs:309:15
|
||||
|
|
||||
LL | let _n = &(1i32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
|
|
||||
LL | let _n = i32::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:319:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:322:14
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = 1i64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:323:15
|
||||
--> $DIR/lint-overflowing-ops.rs:314:15
|
||||
|
|
||||
LL | let _n = &(1i64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:324:14
|
||||
--> $DIR/lint-overflowing-ops.rs:315:14
|
||||
|
|
||||
LL | let _n = i64::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
--> $DIR/lint-overflowing-ops.rs:316:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:328:14
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
|
|
||||
LL | let _n = 1i128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:329:15
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(1i128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:330:14
|
||||
--> $DIR/lint-overflowing-ops.rs:320:14
|
||||
|
|
||||
LL | let _n = i128::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
--> $DIR/lint-overflowing-ops.rs:321:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:331:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:334:14
|
||||
--> $DIR/lint-overflowing-ops.rs:323:14
|
||||
|
|
||||
LL | let _n = 1isize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:335:15
|
||||
--> $DIR/lint-overflowing-ops.rs:324:15
|
||||
|
|
||||
LL | let _n = &(1isize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:336:14
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = isize::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
--> $DIR/lint-overflowing-ops.rs:326:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:337:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:341:14
|
||||
--> $DIR/lint-overflowing-ops.rs:329:14
|
||||
|
|
||||
LL | let _n = [1, 2, 3][4];
|
||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:342:15
|
||||
--> $DIR/lint-overflowing-ops.rs:330:15
|
||||
|
|
||||
LL | let _n = &([1, 2, 3][4]);
|
||||
| ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: aborting due to 215 previous errors
|
||||
error: aborting due to 203 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -876,594 +876,353 @@ error: this operation will panic at runtime
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:251:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:251:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:251:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:254:14
|
||||
--> $DIR/lint-overflowing-ops.rs:253:14
|
||||
|
|
||||
LL | let _n = 1i16 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:255:15
|
||||
--> $DIR/lint-overflowing-ops.rs:254:15
|
||||
|
|
||||
LL | let _n = &(1i16 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:256:14
|
||||
--> $DIR/lint-overflowing-ops.rs:255:14
|
||||
|
|
||||
LL | let _n = i16::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
--> $DIR/lint-overflowing-ops.rs:256:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:257:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:257:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
--> $DIR/lint-overflowing-ops.rs:258:14
|
||||
|
|
||||
LL | let _n = 1i32 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
--> $DIR/lint-overflowing-ops.rs:259:15
|
||||
|
|
||||
LL | let _n = &(1i32 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:262:14
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
|
|
||||
LL | let _n = i32::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:266:14
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = 1i64 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:267:15
|
||||
--> $DIR/lint-overflowing-ops.rs:264:15
|
||||
|
|
||||
LL | let _n = &(1i64 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
--> $DIR/lint-overflowing-ops.rs:265:14
|
||||
|
|
||||
LL | let _n = i64::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
--> $DIR/lint-overflowing-ops.rs:266:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:269:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:269:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:272:14
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
|
|
||||
LL | let _n = 1i128 / 0;
|
||||
| ^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:273:15
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(1i128 / 0);
|
||||
| ^^^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:274:14
|
||||
--> $DIR/lint-overflowing-ops.rs:270:14
|
||||
|
|
||||
LL | let _n = i128::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
--> $DIR/lint-overflowing-ops.rs:271:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:278:14
|
||||
--> $DIR/lint-overflowing-ops.rs:273:14
|
||||
|
|
||||
LL | let _n = 1isize / 0;
|
||||
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:279:15
|
||||
--> $DIR/lint-overflowing-ops.rs:274:15
|
||||
|
|
||||
LL | let _n = &(1isize / 0);
|
||||
| ^^^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = isize::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
--> $DIR/lint-overflowing-ops.rs:276:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:281:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:281:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
|
|
||||
LL | let _n = 1u8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(1u8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
--> $DIR/lint-overflowing-ops.rs:283:14
|
||||
|
|
||||
LL | let _n = 1u16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
--> $DIR/lint-overflowing-ops.rs:284:15
|
||||
|
|
||||
LL | let _n = &(1u16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
|
|
||||
LL | let _n = 1u32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
|
|
||||
LL | let _n = &(1u32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
|
|
||||
LL | let _n = 1u64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
|
|
||||
LL | let _n = &(1u64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
|
|
||||
LL | let _n = 1u128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
|
|
||||
LL | let _n = &(1u128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:301:14
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
|
|
||||
LL | let _n = 1usize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:302:15
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
|
|
||||
LL | let _n = &(1usize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:304:14
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
|
|
||||
LL | let _n = 1i8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:305:15
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
|
|
||||
LL | let _n = &(1i8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:306:14
|
||||
--> $DIR/lint-overflowing-ops.rs:300:14
|
||||
|
|
||||
LL | let _n = i8::MIN % -1;
|
||||
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
--> $DIR/lint-overflowing-ops.rs:301:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:307:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:307:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
--> $DIR/lint-overflowing-ops.rs:303:14
|
||||
|
|
||||
LL | let _n = 1i16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
--> $DIR/lint-overflowing-ops.rs:304:15
|
||||
|
|
||||
LL | let _n = &(1i16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:312:14
|
||||
--> $DIR/lint-overflowing-ops.rs:305:14
|
||||
|
|
||||
LL | let _n = i16::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
--> $DIR/lint-overflowing-ops.rs:306:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:316:14
|
||||
--> $DIR/lint-overflowing-ops.rs:308:14
|
||||
|
|
||||
LL | let _n = 1i32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:317:15
|
||||
--> $DIR/lint-overflowing-ops.rs:309:15
|
||||
|
|
||||
LL | let _n = &(1i32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
|
|
||||
LL | let _n = i32::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:319:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:319:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:322:14
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = 1i64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:323:15
|
||||
--> $DIR/lint-overflowing-ops.rs:314:15
|
||||
|
|
||||
LL | let _n = &(1i64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:324:14
|
||||
--> $DIR/lint-overflowing-ops.rs:315:14
|
||||
|
|
||||
LL | let _n = i64::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
--> $DIR/lint-overflowing-ops.rs:316:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:328:14
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
|
|
||||
LL | let _n = 1i128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:329:15
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(1i128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:330:14
|
||||
--> $DIR/lint-overflowing-ops.rs:320:14
|
||||
|
|
||||
LL | let _n = i128::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
--> $DIR/lint-overflowing-ops.rs:321:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:331:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:331:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:334:14
|
||||
--> $DIR/lint-overflowing-ops.rs:323:14
|
||||
|
|
||||
LL | let _n = 1isize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:335:15
|
||||
--> $DIR/lint-overflowing-ops.rs:324:15
|
||||
|
|
||||
LL | let _n = &(1isize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:336:14
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = isize::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
--> $DIR/lint-overflowing-ops.rs:326:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:337:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:337:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:341:14
|
||||
--> $DIR/lint-overflowing-ops.rs:329:14
|
||||
|
|
||||
LL | let _n = [1, 2, 3][4];
|
||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:342:15
|
||||
--> $DIR/lint-overflowing-ops.rs:330:15
|
||||
|
|
||||
LL | let _n = &([1, 2, 3][4]);
|
||||
| ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: aborting due to 215 previous errors
|
||||
error: aborting due to 203 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -876,498 +876,353 @@ error: this operation will panic at runtime
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:251:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:251:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:254:14
|
||||
--> $DIR/lint-overflowing-ops.rs:253:14
|
||||
|
|
||||
LL | let _n = 1i16 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:255:15
|
||||
--> $DIR/lint-overflowing-ops.rs:254:15
|
||||
|
|
||||
LL | let _n = &(1i16 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i16` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:256:14
|
||||
--> $DIR/lint-overflowing-ops.rs:255:14
|
||||
|
|
||||
LL | let _n = i16::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
--> $DIR/lint-overflowing-ops.rs:256:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:257:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:257:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
--> $DIR/lint-overflowing-ops.rs:258:14
|
||||
|
|
||||
LL | let _n = 1i32 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
--> $DIR/lint-overflowing-ops.rs:259:15
|
||||
|
|
||||
LL | let _n = &(1i32 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:262:14
|
||||
--> $DIR/lint-overflowing-ops.rs:260:14
|
||||
|
|
||||
LL | let _n = i32::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
--> $DIR/lint-overflowing-ops.rs:261:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:263:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:266:14
|
||||
--> $DIR/lint-overflowing-ops.rs:263:14
|
||||
|
|
||||
LL | let _n = 1i64 / 0;
|
||||
| ^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:267:15
|
||||
--> $DIR/lint-overflowing-ops.rs:264:15
|
||||
|
|
||||
LL | let _n = &(1i64 / 0);
|
||||
| ^^^^^^^^^^ attempt to divide `1_i64` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
--> $DIR/lint-overflowing-ops.rs:265:14
|
||||
|
|
||||
LL | let _n = i64::MIN / -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
--> $DIR/lint-overflowing-ops.rs:266:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:269:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:272:14
|
||||
--> $DIR/lint-overflowing-ops.rs:268:14
|
||||
|
|
||||
LL | let _n = 1i128 / 0;
|
||||
| ^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:273:15
|
||||
--> $DIR/lint-overflowing-ops.rs:269:15
|
||||
|
|
||||
LL | let _n = &(1i128 / 0);
|
||||
| ^^^^^^^^^^^ attempt to divide `1_i128` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:274:14
|
||||
--> $DIR/lint-overflowing-ops.rs:270:14
|
||||
|
|
||||
LL | let _n = i128::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
--> $DIR/lint-overflowing-ops.rs:271:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:275:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:278:14
|
||||
--> $DIR/lint-overflowing-ops.rs:273:14
|
||||
|
|
||||
LL | let _n = 1isize / 0;
|
||||
| ^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:279:15
|
||||
--> $DIR/lint-overflowing-ops.rs:274:15
|
||||
|
|
||||
LL | let _n = &(1isize / 0);
|
||||
| ^^^^^^^^^^^^ attempt to divide `1_isize` by zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
--> $DIR/lint-overflowing-ops.rs:275:14
|
||||
|
|
||||
LL | let _n = isize::MIN / -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
--> $DIR/lint-overflowing-ops.rs:276:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:281:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN / -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
--> $DIR/lint-overflowing-ops.rs:280:14
|
||||
|
|
||||
LL | let _n = 1u8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
--> $DIR/lint-overflowing-ops.rs:281:15
|
||||
|
|
||||
LL | let _n = &(1u8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
--> $DIR/lint-overflowing-ops.rs:283:14
|
||||
|
|
||||
LL | let _n = 1u16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
--> $DIR/lint-overflowing-ops.rs:284:15
|
||||
|
|
||||
LL | let _n = &(1u16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
--> $DIR/lint-overflowing-ops.rs:286:14
|
||||
|
|
||||
LL | let _n = 1u32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
--> $DIR/lint-overflowing-ops.rs:287:15
|
||||
|
|
||||
LL | let _n = &(1u32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
--> $DIR/lint-overflowing-ops.rs:289:14
|
||||
|
|
||||
LL | let _n = 1u64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
--> $DIR/lint-overflowing-ops.rs:290:15
|
||||
|
|
||||
LL | let _n = &(1u64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
--> $DIR/lint-overflowing-ops.rs:292:14
|
||||
|
|
||||
LL | let _n = 1u128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
--> $DIR/lint-overflowing-ops.rs:293:15
|
||||
|
|
||||
LL | let _n = &(1u128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:301:14
|
||||
--> $DIR/lint-overflowing-ops.rs:295:14
|
||||
|
|
||||
LL | let _n = 1usize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:302:15
|
||||
--> $DIR/lint-overflowing-ops.rs:296:15
|
||||
|
|
||||
LL | let _n = &(1usize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:304:14
|
||||
--> $DIR/lint-overflowing-ops.rs:298:14
|
||||
|
|
||||
LL | let _n = 1i8 % 0;
|
||||
| ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:305:15
|
||||
--> $DIR/lint-overflowing-ops.rs:299:15
|
||||
|
|
||||
LL | let _n = &(1i8 % 0);
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:306:14
|
||||
--> $DIR/lint-overflowing-ops.rs:300:14
|
||||
|
|
||||
LL | let _n = i8::MIN % -1;
|
||||
| ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
--> $DIR/lint-overflowing-ops.rs:301:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:307:15
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:307:14
|
||||
|
|
||||
LL | let _n = &(i8::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
--> $DIR/lint-overflowing-ops.rs:303:14
|
||||
|
|
||||
LL | let _n = 1i16 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
--> $DIR/lint-overflowing-ops.rs:304:15
|
||||
|
|
||||
LL | let _n = &(1i16 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:312:14
|
||||
--> $DIR/lint-overflowing-ops.rs:305:14
|
||||
|
|
||||
LL | let _n = i16::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
--> $DIR/lint-overflowing-ops.rs:306:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:313:15
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = &(i16::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:316:14
|
||||
--> $DIR/lint-overflowing-ops.rs:308:14
|
||||
|
|
||||
LL | let _n = 1i32 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:317:15
|
||||
--> $DIR/lint-overflowing-ops.rs:309:15
|
||||
|
|
||||
LL | let _n = &(1i32 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
--> $DIR/lint-overflowing-ops.rs:310:14
|
||||
|
|
||||
LL | let _n = i32::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
--> $DIR/lint-overflowing-ops.rs:311:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:319:14
|
||||
|
|
||||
LL | let _n = &(i32::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:322:14
|
||||
--> $DIR/lint-overflowing-ops.rs:313:14
|
||||
|
|
||||
LL | let _n = 1i64 % 0;
|
||||
| ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:323:15
|
||||
--> $DIR/lint-overflowing-ops.rs:314:15
|
||||
|
|
||||
LL | let _n = &(1i64 % 0);
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:324:14
|
||||
--> $DIR/lint-overflowing-ops.rs:315:14
|
||||
|
|
||||
LL | let _n = i64::MIN % -1;
|
||||
| ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
--> $DIR/lint-overflowing-ops.rs:316:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:325:15
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = &(i64::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:328:14
|
||||
--> $DIR/lint-overflowing-ops.rs:318:14
|
||||
|
|
||||
LL | let _n = 1i128 % 0;
|
||||
| ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:329:15
|
||||
--> $DIR/lint-overflowing-ops.rs:319:15
|
||||
|
|
||||
LL | let _n = &(1i128 % 0);
|
||||
| ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:330:14
|
||||
--> $DIR/lint-overflowing-ops.rs:320:14
|
||||
|
|
||||
LL | let _n = i128::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
--> $DIR/lint-overflowing-ops.rs:321:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:331:15
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:331:14
|
||||
|
|
||||
LL | let _n = &(i128::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:334:14
|
||||
--> $DIR/lint-overflowing-ops.rs:323:14
|
||||
|
|
||||
LL | let _n = 1isize % 0;
|
||||
| ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:335:15
|
||||
--> $DIR/lint-overflowing-ops.rs:324:15
|
||||
|
|
||||
LL | let _n = &(1isize % 0);
|
||||
| ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:336:14
|
||||
--> $DIR/lint-overflowing-ops.rs:325:14
|
||||
|
|
||||
LL | let _n = isize::MIN % -1;
|
||||
| ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
--> $DIR/lint-overflowing-ops.rs:326:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/lint-overflowing-ops.rs:337:15
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
|
||||
|
||||
note: erroneous constant encountered
|
||||
--> $DIR/lint-overflowing-ops.rs:337:14
|
||||
|
|
||||
LL | let _n = &(isize::MIN % -1);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:341:14
|
||||
--> $DIR/lint-overflowing-ops.rs:329:14
|
||||
|
|
||||
LL | let _n = [1, 2, 3][4];
|
||||
| ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: this operation will panic at runtime
|
||||
--> $DIR/lint-overflowing-ops.rs:342:15
|
||||
--> $DIR/lint-overflowing-ops.rs:330:15
|
||||
|
|
||||
LL | let _n = &([1, 2, 3][4]);
|
||||
| ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4
|
||||
|
||||
error: aborting due to 215 previous errors
|
||||
error: aborting due to 203 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -249,37 +249,31 @@ fn main() {
|
||||
let _n = &(1i8 / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i8::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i8::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i16 / 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i16 / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i16::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i16::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i32 / 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i32 / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i32::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i32::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i64 / 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i64 / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i64::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i64::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i128 / 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i128 / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i128::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i128::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1isize / 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1isize / 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = isize::MIN / -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(isize::MIN / -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
|
||||
// Modulus
|
||||
@ -305,37 +299,31 @@ fn main() {
|
||||
let _n = &(1i8 % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i8::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i8::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i16 % 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i16 % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i16::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i16::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i32 % 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i32 % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i32::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i32::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i64 % 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i64 % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i64::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i64::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1i128 % 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1i128 % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = i128::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(i128::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
let _n = 1isize % 0; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(1isize % 0); //~ ERROR: this operation will panic at runtime
|
||||
let _n = isize::MIN % -1; //~ ERROR: this operation will panic at runtime
|
||||
let _n = &(isize::MIN % -1); //~ ERROR: this operation will panic at runtime
|
||||
//~^ERROR: evaluation of constant value failed
|
||||
|
||||
// Out of bounds access
|
||||
let _n = [1, 2, 3][4]; //~ ERROR: this operation will panic at runtime
|
||||
|
Loading…
Reference in New Issue
Block a user