Skip to content

Compiler Warnings 2018-07-30 #2982

Closed
Closed
@ghost

Description

When building Clippy the compiler now emits the warnings below:

warning[E0502]: cannot borrow `reg.sess.target` as immutable because it is also borrowed as mutable
   --> clippy_lints/src/lib.rs:371:13
    |
369 |       reg.register_late_lint_pass(box trivially_copy_pass_by_ref::TriviallyCopyPassByRef::new(
    |       ---
    |       |
    |  _____mutable borrow occurs here
    | |
370 | |             conf.trivial_copy_size_limit,
371 | |             &reg.sess.target,
    | |             ^^^^^^^^^^^^^^^^ immutable borrow occurs here
372 | |     ));
    | |______- borrow later used here
    |
    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.

warning: variable does not need to be mutable
   --> clippy_lints/src/consts.rs:244:21
    |
244 |                 let mut value = !value;
    |                     ----^^^^^
    |                     |
    |                     help: remove this `mut`
    |
    = note: #[warn(unused_mut)] on by default

warning[E0502]: cannot borrow `self.cx.tcx` as immutable because it is also borrowed as mutable
   --> clippy_lints/src/utils/hir_utils.rs:518:33
    |
518 |                 self.hash_expr(&self.cx.tcx.hir.body(l_id.body).value);
    |                 ----------------^^^^^^^^^^^---------------------------
    |                 |               |
    |                 |               immutable borrow occurs here
    |                 mutable borrow occurs here
    |                 borrow later used here
    |
    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.

warning[E0502]: cannot borrow `self.cx.tcx` as immutable because it is also borrowed as mutable
   --> clippy_lints/src/utils/hir_utils.rs:451:33
    |
451 |                 self.hash_expr(&self.cx.tcx.hir.body(eid).value);
    |                 ----------------^^^^^^^^^^^---------------------
    |                 |               |
    |                 |               immutable borrow occurs here
    |                 mutable borrow occurs here
    |                 borrow later used here
    |
    = warning: This error has been downgraded to a warning for backwards compatibility with previous releases.
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.

I've already got a fix for the unused_mut error.
Is this a compiler issue or are these warnings genuine? Shouldn't the borrow on the argument end before the method is called?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions