- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regions
Description
Here is some playpen code: http://is.gd/0HoeAB
Within it, there is the following routine:
        fn map_inner<'a, X:'a, Y:'a>(
            f: |&X| -> Y,
            n: NodeRef<'a, X>,
            nodes: &'a TypedArena<Node<Y>>) -> NodeRef<'a, Y> {
            match n {
                None => None,
                Some(ref n) => {
                    let y = f(&n.data);
                    Some(nodes.alloc(Node {
                                        data: y,
                                        next: map_inner(f, n.next, nodes)
                                    }))
                }
            }
        }The signature above has a bug; it omitted a lifetime on the type of nodes.
The current lifetime suggestion that rustc produces does not include that though.
The current lifetime suggestion says:
note: consider using an explicit lifetime parameter as shown: fn map_inner<'a, X: 'a,
             Y: 'a>(f: |&X| -> Y, n: NodeRef<'a, X>,
                    nodes: &'a TypedArena<Node<Y>>) -> NodeRef<'a, Y>
when I think it should be:
note: consider using an explicit lifetime parameter as shown: fn map_inner<'a, X: 'a,
             Y: 'a>(f: |&X| -> Y, n: NodeRef<'a, X>,
                    nodes: &'a TypedArena<Node<'a, Y>>) -> NodeRef<'a, Y>
(Note the additional 'ain the type ofnodes`.)
At least, after adding that, the playpen code gets further along in compilation.
(Sorry for not reducing the test case further. Hopefully I will get the chance to do so in the near future.)
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regions