Skip to content

Fix borrow warning for reg.sess.target #2986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

aaudiber
Copy link
Contributor

@aaudiber aaudiber commented Aug 1, 2018

Addresses this issue seen from building clippy:

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.

@@ -58,9 +57,9 @@ pub struct TriviallyCopyPassByRef {
}

impl TriviallyCopyPassByRef {
pub fn new(limit: Option<u64>, target: &SessionConfig) -> Self {
pub fn new(limit: Option<u64>, usize_ty : UintTy) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no space before colon

@flip1995
Copy link
Member

flip1995 commented Aug 1, 2018

Already fixed in #2983. Thanks for the contribution nonetheless!

@flip1995 flip1995 closed this Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants