Skip to content
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

Missing unnecessary unsafe block warning #45107

Closed
bluss opened this issue Oct 8, 2017 · 2 comments
Closed

Missing unnecessary unsafe block warning #45107

bluss opened this issue Oct 8, 2017 · 2 comments
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Oct 8, 2017

The following code uses a redundant unsafe block inside a closure.

This is a warning on stable but there is no warning on nightly.

To reproduce (playground):

fn main() {
    let mut v = Vec::<i32>::with_capacity(24);
    
    unsafe {
        let f = |v: &mut Vec<_>| {
            unsafe {
                v.set_len(24);
            }
        };
        
        v.set_len(0);
        f(&mut v);
    }
}

Probably due to #44700, cc @arielb1

@bluss bluss added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. labels Oct 8, 2017
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Oct 19, 2017
@arielb1 arielb1 self-assigned this Nov 2, 2017
@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 16, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 16, 2017

Fixed in #45785.

@arielb1 arielb1 closed this as completed Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants