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

Incorrect 'cannot bind by-move with sub-bindings` error #3761

Closed
brson opened this issue Oct 14, 2012 · 4 comments
Closed

Incorrect 'cannot bind by-move with sub-bindings` error #3761

brson opened this issue Oct 14, 2012 · 4 comments
Labels
A-lifetimes Area: Lifetimes / regions

Comments

@brson
Copy link
Contributor

brson commented Oct 14, 2012

                while self.from_content.peek() {                                                                   
                    match self.from_content.recv() {                                                               
                        move msg @ BuildMsg(*) => {                                                                
                            last_build_msg = Some(move msg);                                                       
                        }                                                                                          
                        move msg => {                                                                              
                            enqueue_last_build_msg();                                                              
                            // Other messages need responses                                                       
                            request_queue_chan.send(msg);                                                          
                        }                                                                                          
                    }                                                                                              
                } 
/home/brian/dev/servo/src/servo/layout/layout_task.rs:241:24: 241:49 error: cannot bind by-move with sub-bindings
/home/brian/dev/servo/src/servo/layout/layout_task.rs:241                         move msg @ BuildMsg(*) => {
                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~

There aren't any sub-bindings there.

@pcwalton
Copy link
Contributor

Still a problem, but I don't think this is a backwards compatibility issue.

@pcwalton
Copy link
Contributor

Minimal test case:

struct Foo(~str);

fn main() {
    match Foo(~"hi") {
        msg @ Foo(_) => {}
    }
}

@pnkfelix
Copy link
Member

accepted for feature complete milestone

@huonw
Copy link
Member

huonw commented Aug 14, 2013

Triage visit; will be fixed when #8508 lands.

huonw added a commit to huonw/rust that referenced this issue Aug 14, 2013
…indings.

A pattern like `foo @ Foo(Bar(*), _)` should be legal, even if `foo` moves,
since the subpatterns are purely structural.

Fixes rust-lang#3761.
@huonw huonw closed this as completed in 58021be Aug 15, 2013
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
RalfJung pushed a commit to RalfJung/rust that referenced this issue Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants