Skip to content

Typo in container guide: "As long an iterator" => "As long as an iterator" #11451

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

Merged
merged 1 commit into from
Jan 10, 2014
Merged

Typo in container guide: "As long an iterator" => "As long as an iterator" #11451

merged 1 commit into from
Jan 10, 2014

Conversation

kud1ing
Copy link

@kud1ing kud1ing commented Jan 10, 2014

No description provided.

bors added a commit that referenced this pull request Jan 10, 2014
@bors bors closed this Jan 10, 2014
@bors bors merged commit aca705c into rust-lang:master Jan 10, 2014
@kud1ing kud1ing deleted the patch-1 branch January 10, 2014 21:10
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 7, 2023
[`slow_vector_initialization`]: use the source span of vec![] macro and fix another FP

Fixes rust-lang#11408

<details>
<summary>Also fixes a FP when the vec initializer comes from a macro other than `vec![]`</summary>

```rs
macro_rules! x {
  () => { vec![] }
}
fn f() {
  let mut v = x!();
  v.resize(10, 0);
}
```
This shouldn't warn. The `x!` macro might be doing other things, so just replacing `x!()` with `vec![0; 10]` is not always an option.
</details>

I added some test cases for macro expansions, however I don't think there's a way to write a test for that specific warning that appeared in the linked issue. As far as I understand, that happens when the rust-src rustup component isn't installed (so the stdlib source is unavailable) and the span points to the `vec![]` *expansion*, instead of the `vec![]` that the user wrote.

changelog: [`slow_vector_initialization`]: use the source span of `vec![]` macro
changelog: [`slow_vector_initialization`]: only warn on `vec![]` expansions and allow other macros
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.

2 participants