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

Remove cross-borrowing entirely #15349

Closed
pcwalton opened this issue Jul 2, 2014 · 5 comments · Fixed by #16917
Closed

Remove cross-borrowing entirely #15349

pcwalton opened this issue Jul 2, 2014 · 5 comments · Fixed by #16917
Labels
A-typesystem Area: The type system
Milestone

Comments

@pcwalton
Copy link
Contributor

pcwalton commented Jul 2, 2014

Tracking bug for RFC PR rust-lang/rfcs#139.

Nominating for 1.0, P-backcompat-lang.

@lilyball
Copy link
Contributor

lilyball commented Jul 2, 2014

This needs to be blocked on DST. @wycats pointed out in IRC that this breaks the ability to coerce Box<Trait> to &Trait. The expected solution is to use &*x, but that's not legal until DST lands.

@lilyball
Copy link
Contributor

lilyball commented Jul 2, 2014

Summary of IRC discussion:

@pcwalton feels that transmute() is an acceptable solution. Others disagree. @nick29581 says that the part of DST that allows this is estimated to land in ~2 weeks. @pcwalton has agreed that ~2 weeks is an acceptable amount of time to delay this.

@pcwalton
Copy link
Contributor Author

pcwalton commented Jul 2, 2014

Note that, per later discussion, this doesn't have to block cross-borrowing entirely, just cross-borrowing for traits.

@pnkfelix
Copy link
Member

pnkfelix commented Jul 3, 2014

Assigning P-backcompat-lang, 1.0 milestone.

@pnkfelix pnkfelix added this to the 1.0 milestone Jul 3, 2014
pcwalton added a commit to pcwalton/rust that referenced this issue Jul 17, 2014
except where trait objects are involved.

Part of issue rust-lang#15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]
bors added a commit that referenced this issue Jul 17, 2014
except where trait objects are involved.

Part of issue #15349, though I'm leaving it open for trait objects.
Cross borrowing for trait objects remains because it is needed until we
have DST.

This will break code like:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(a);

Change this code to:

    fn foo(x: &int) { ... }

    let a = box 3i;
    foo(&*a);

[breaking-change]

r? @alexcrichton
@chris-morgan
Copy link
Member

I’ve just discovered that [T, ..N] coerces to &mut [T] silently. Not sure if there’s any way to do this explicitly at present, though. Still, it should be dismantled.

nrc added a commit to nrc/rust that referenced this issue Sep 2, 2014
Closes rust-lang#15349

[breaking-change]

Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
bors added a commit that referenced this issue Sep 3, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 7, 2023
…r=lnicola

Show anonymous fn def type as a fn pointer in source code

Fixes rust-lang#15346

The second commit is an unrelated change. I can remove it if not desired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants