Skip to content

Tracking issue for RFC 2582, &raw [mut | const] $place (raw_ref_op) #64490

Closed
rust-lang/reference
#1567
@Centril

Description

@Centril
Contributor

This is a tracking issue for the RFC "an operator to take a raw reference" (rust-lang/rfcs#2582), feature(raw_ref_op).

Steps:

Unresolved questions:

(None left here, since the lint was moved to #127724)

Implementation history:

Activity

added
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
T-langRelevant to the language team
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
requires-nightlyThis issue requires a nightly compiler in some way.
F-raw_ref_op`#![feature(raw_ref_op)]`
on Sep 15, 2019
matthewjasper

matthewjasper commented on Sep 15, 2019

@matthewjasper
Contributor

I'll try to get a PR open for this soon.

Centril

Centril commented on Sep 15, 2019

@Centril
ContributorAuthor

I would suggest splitting the implementation work up into phases to make each part thoroughly reviewed and tested. However, think of this list as a bunch of tasks that need to be done at some point.

    1. Implement &raw [mut | const] $expr in the parser and AST.
      1. Ensure the unused_parens lint works alright.
      2. Handle interactions in librustc_resolve.
    2. Push things down from AST => HIR
      1. Handle lowering
      2. Handle type checking
    3. Push things down from HIR => HAIR
      Push things down from HAIR => MIR -- here, the actual MIR operation is introduced.
      Introduce lints for statically detectable UB as per the RFC.
      Make safe_packed_borrows a hard error when the feature gate is active, and make this the case as well for unsafe equivalents.

...but it seems @matthewjasper already has a PR heh.

Aaron1011

Aaron1011 commented on Sep 15, 2019

@Aaron1011
Member

Make safe_packed_borrows a hard error when the feature gate is active, and make this the case as well for unsafe equivalents.

I'm not sure that this is a good idea. This would make it impossible to gradually migrate a codebase over to using raw references - once the feature gate is enabled, all references to packed structs must be fixed at once in order to get the crate building again.

moshg

moshg commented on Sep 15, 2019

@moshg

I wonder why not &raw $expr but &raw const $expr. Is there a discussion about this?

mjbshaw

mjbshaw commented on Sep 15, 2019

@mjbshaw
Contributor

@moshg Yes, this was discussed. See here (and the following comments) for an initial discussion. And here (and the following comments) for a signoff from grammar-wg. And here for an example that &raw (expr) can be ambiguous.

I think it might be worth amending the RFC to state why &raw const $expr was chosen over &raw $expr.

Ixrec

Ixrec commented on Sep 15, 2019

@Ixrec
Contributor

The RFC thread noted a couple times (including in the FCP comment) that &raw expr without the const conflicts with existing syntax and would break real code. rust-lang/rfcs#2582 (comment) goes into some detail. My understanding is that it is still possible to migrate to &raw expr with breaking changes in an edition, and I didn't see much explicit discussion of that, but I think everyone agrees that there's enough urgency here that we definitely prefer making &raw const expr a thing over blocking any solution on waiting for another edition.

moshg

moshg commented on Sep 16, 2019

@moshg

@mjbshaw @lxrec
Thank you for your explanations! I've understood why &raw $expr is breaking change.

RalfJung

RalfJung commented on Sep 16, 2019

@RalfJung
Member

I think it might be worth amending the RFC to state why &raw const $expr was chosen over &raw $expr.

rust-lang/rfcs#2764

131 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-raw_ref_op`#![feature(raw_ref_op)]`S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @eddyb@nikomatsakis@joshtriplett@SimonSapin@RalfJung

      Issue actions

        Tracking issue for RFC 2582, `&raw [mut | const] $place` (raw_ref_op) · Issue #64490 · rust-lang/rust