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

LinearMap.len is wrong #4277

Closed
jesse99 opened this issue Dec 24, 2012 · 4 comments
Closed

LinearMap.len is wrong #4277

jesse99 opened this issue Dec 24, 2012 · 4 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@jesse99
Copy link
Contributor

jesse99 commented Dec 24, 2012

This does not return the number of entries in the map. I'm guessing that it instead returns capacity.

@ttaubert
Copy link
Contributor

Looking at the code, it should return the number of entries contained in the map. It definitely doesn't return the capacity but maybe does something wrong while tracking the entry count.

@jesse99
Copy link
Contributor Author

jesse99 commented Dec 30, 2012

Looked at the code myself. Wasn't clear at first what's going on, but after looking at it more closely expand seems wrong: each time through it's going to increment size by the old capacity.

@ttaubert
Copy link
Contributor

Yeah, you're right. This needs to reset self.size to zero before copying the old entries to their new buckets.

@brson
Copy link
Contributor

brson commented Jan 1, 2013

Fixed.

@brson brson closed this as completed Jan 1, 2013
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
…mparison, r=flip1995

Add lint for float in array comparison

Fixes rust-lang#4277
changelog:
- Added new handler for expression of index kind (e.g. `arr[i]`). It returns a constant when both array and index are constant, or when the array is constant and all values are equal.
- Trigger float_cmp and float_cmp_const lint when comparing arrays. Allow for comparison when one of the arrays contains only zeros or infinities.
- Added appropriate tests for such cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants