Skip to content

&static/str should be sendable #4448

Closed
Closed
@bstrie

Description

@bstrie
fn main() {
    let (port, chan) = pipes::stream::<&static/str>();  // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)

    do task::spawn {
        io::println(port.recv());  // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)
    }

    chan.send("hello, world");  // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)
}
<@nmatsakis> bstrie: oh, hmm, interesting.  I thought that'd work.
<@nmatsakis> bstrie: well, it's like "sending" an int
<@nmatsakis> that is to say, you copy the pointer...
<@nmatsakis> for values that don't need to be freed, you should be able
             to send them freely
<@nmatsakis> I think at some point that did work, must have changed.
<@nmatsakis> (let me be more specific: immutable values that do not need
             to be freed)
<@nmatsakis> (but, at least currently, we shouldn't have any &static data
             is not immutable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions