You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation Fault while iterating over a vector of "~[~T as Trait]" #5666
A-codegenArea: Code generationA-trait-systemArea: Trait systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
Tested in rust 0.6 on Arch (Linux - 3.8.4, x86_64)
Modified testcase exhibits similar behavior on Mac OS X 10.7
I can call #bark() on any index of the vector and it does not seg-fault.
When using the #each() iterator however, only the first element is printed, the next access results in a segmentation fault.
I've been able to reproduce this on two separate systems, one running rust 0.6 (6dd20c8) on a fairly vanilla Linux kernel, the other running (release-0.5) on Mac OS X.
I've written a small test-case that exhibits this behavior on my systems.
Note
Please let me know if I can gather any additional information that might aid in resolving this issue.
I've been fiddling around with this example some more, here's what I've dug up.
If I instead store the vector as ~[@T as @Trait], the code works as expected.
Printing [~T as ~Trait].len() on a vector of n where n is greater than 1 yields n +1, as opposed to the actual length.
Printing the length on a vector [@T as @Trait] or [&T as &Trait] yields the actual length.
Attempting to access an out of bounds index still panics as expected; so I believe the segmentation fault is a combination of using the iterator and the storage of [~Trait]
A-codegenArea: Code generationA-trait-systemArea: Trait systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
Activity
drbawb commentedon Apr 2, 2013
I've been fiddling around with this example some more, here's what I've dug up.
If I instead store the vector as
~[@T as @Trait], the code works as expected.Printing
[~T as ~Trait].len()on a vector ofnwherenis greater than 1 yieldsn +1, as opposed to the actual length.Printing the length on a vector
[@T as @Trait]or[&T as &Trait]yields the actual length.Attempting to access an out of bounds index still panics as expected; so I believe the segmentation fault is a combination of using the iterator and the storage of
[~Trait]catamorphism commentedon May 24, 2013
Reproduced with 64963d6. Nominating for milestone 5, production-ready
emberian commentedon Jul 16, 2013
Cannot reproduce with:
Probably fixed by @luqmana's
~Traitfixes.emberian commentedon Jul 16, 2013
(Removing nomination)
Auto merge of rust-lang#5666 - flip1995:rollup-yjyvvbg, r=flip1995
Merge rust-lang#7667
Merge pull request rust-lang#5666 from WhySoBad/socket-option-hop-limit
Merge pull request rust-lang#5666 from WhySoBad/socket-option-hop-limit