Skip to content

Yet another bug with slice_patterns #26619

@leonardinius

Description

@leonardinius

I'm not particularly sure. It's either the bug with compiler failing to enforce lifetime rule or data corruption in Iterator flat_map filter_map (Updated).


I tried code found at https://github.com/leonardinius/git-wayback-machine.rs/tree/rust-bug:

Unfortunately I fail to reproduce the bug in different conditions and fail to create standalone code snippet to reproduce the bug.

How to repeat:

#shell
$ git clone https://github.com/leonardinius/git-wayback-machine.rs.git
$ cd git-wayback-machine.rs
$ git checkout rust-bug
$ cargo build
$ env RUST_LOG=debug  target/debug/git-wayback-machine 2>&1 | egrep "3 Page - Inspect 1-2|3 Page - Inspect 2-2"

I expected to see this happen:

Since they iterate the same vector data before and after flat_map (See history.rs#L62-L71) I expect the following lines to be as follows.

DEBUG:git_wayback_machine::history: 3 Page - Inspect 1-2: Entry: "9419034" "7 days ago" "Leonids Maslovs": "Personal e-mail?"                                                                     
DEBUG:git_wayback_machine::history: 3 Page - Inspect 2-2: Entry: "9419034" "7 days ago" "Leonids Maslovs": "Personal e-mail?"                                                                     

Instead, this happened: See lines below. Line 3 Page - Inspect 1-2: Entry: and 3 Page - Inspect 2-2: Entry: entries should read the same.

DEBUG:git_wayback_machine::history: 3 Page - Inspect 1-2: Entry: "368669f" "7 days ago" "Leonids Maslovs": "Try out execd command sample"                                                         
DEBUG:git_wayback_machine::history: 3 Page - Inspect 2-2: Entry: "3\u{2}\u{107}\u{7f}\u{0}" "\u{f}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{633}" "\u{7}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{233}\u{2
}\u{107}\u{7f}\u{0}": "\u{107}\u{7f}\u{0}\u{0}\n\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{f3}\u{2}\u{107}\u{7f}\u{0}\u{0}\u{10}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}"                                        

My assumptions / what went wrong:

  • ? Data corruption has happened at flat_map
  • ? Compiler didn't (but should) throw me away at history.rs#L62-L71 and history.rs#L73-L82, returning Option<Entry> without reference classifier

Meta

rustc --version --verbose:

rustc 1.3.0-nightly (912ab64a0 2015-06-25)                                                                                                                                                        
binary: rustc                                                                                                                                                                                     
commit-hash: 912ab64a0de2c121a1c9f10bb1dbe75983b78c73                                                                                                                                             
commit-date: 2015-06-25                                                                                                                                                                           
host: x86_64-unknown-linux-gnu                                                                                                                                                                    
release: 1.3.0-nightly

Backtrace:

No backtrace


Please do not hesitate to ask me for more information and standalone code snippets, however you might need to help me to create those ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-slice-patternsArea: Slice patterns, https://github.com/rust-lang/rust/issues/23121C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions