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

&static/str should be sendable #4448

Closed
bstrie opened this issue Jan 11, 2013 · 3 comments
Closed

&static/str should be sendable #4448

bstrie opened this issue Jan 11, 2013 · 3 comments
Labels
A-concurrency Area: Concurrency A-lifetimes Area: Lifetimes / regions
Milestone

Comments

@bstrie
Copy link
Contributor

bstrie commented Jan 11, 2013

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)
@bblum
Copy link
Contributor

bblum commented Feb 28, 2013

I think (assuming &static can never point to mutable things) that all &static pointers should be sendable.

@nikomatsakis
Copy link
Contributor

As of b171d0e, this program compiles:

fn foo<T: Owned>() {}
fn main() {
    foo::<&static/str>();
}

Therefore, closing the bug.

@bstrie
Copy link
Contributor Author

bstrie commented Feb 28, 2013

I'll make a test case for this.

bstrie added a commit to bstrie/rust that referenced this issue Mar 5, 2013
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
* Fixed Comment removed between type name and = issue

* Fixed where clause issue and pass the full span

* has_where condition inline

* Fixed indentation error on where clause

* Removed tmp file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

No branches or pull requests

3 participants