Skip to content

Add test for #5239 - #8800

Closed
fhahn wants to merge 1 commit into
rust-lang:masterfrom
fhahn:ticket_5239
Closed

Add test for #5239#8800
fhahn wants to merge 1 commit into
rust-lang:masterfrom
fhahn:ticket_5239

Conversation

@fhahn

@fhahn fhahn commented Aug 27, 2013

Copy link
Copy Markdown
Contributor

I've added a test for the second example mentioned in #5239. The first example does not compile with a reasonable error message. Should I add a compile-fail test for that example as well?

/rust/src/test/run-pass/issue-5239.rs:15:45: 15:51 error: binary operation + cannot be applied to type `&int`
rust/src/test/run-pass/issue-5239.rs:15     let _f = |ref x: int| { x += 1};
                                                                                     ^~~~~~

error: aborting due to previous error

@alexcrichton

Copy link
Copy Markdown
Member

Could you add Closes #5239 into the commit message? That way it'll be conveniently closed when the commit is merged into master.

Also, I think you can remove the comment about it being a "bogus ref" because it's a legitimate way to write a pattern binding.

I think that it'd also be a good idea to add a test for the original code as well as compile-fail, thanks!

@fhahn

fhahn commented Aug 28, 2013

Copy link
Copy Markdown
Contributor Author

I've added a compile-fail test and updated the commit message.

@catamorphism

Copy link
Copy Markdown
Contributor

Looks like the same problem as #8458

bors added a commit that referenced this pull request Aug 29, 2013
I've added a test for the second example mentioned in #5239. The first example does not compile with a reasonable error message. Should I add a compile-fail test for that example as well?

    /rust/src/test/run-pass/issue-5239.rs:15:45: 15:51 error: binary operation + cannot be applied to type `&int`
    rust/src/test/run-pass/issue-5239.rs:15     let _f = |ref x: int| { x += 1};
                                                                                         ^~~~~~

    error: aborting due to previous error
@bors bors closed this Aug 29, 2013
@fhahn
fhahn deleted the ticket_5239 branch January 7, 2014 17:35
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2022
…, r=Manishearth

add vec.capacity() to [`slow_vec_initialization`] detection

fix rust-lang#8800

for example
```rust
let mut vec1 = Vec::with_capacity(len);
vec1.resize(vec1.capacity(), 0);

let mut vec2 = Vec::with_capacity(len);
vec2.extend(repeat(0).take(vec2.capacity()));
```
will trigger the lint

---

changelog: add `vec.capacity()` to [`slow_vec_initialization`] detection
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
8800: feat: Make "pull assignments up" assist work in more cases r=Jesse-Bakker a=Jesse-Bakker

Fixes rust-lang#8771

Co-authored-by: Jesse Bakker <github@jessebakker.com>
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.

4 participants