Skip to content

Tracking Issue for De-RFC 3307: Remove type ascription #101728

@Manishearth

Description

@Manishearth
Member

This supersedes #23416

This is a tracking issue for the RFC "3307" (rust-lang/rfcs#3307).

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

  • Implement the RFC:
    • Remove type ascription from the parser and diagnostics
    • @rust-lang/compiler: Do y'all have a preference as to how far the removal should go? Unparseable AST nodes could be left in the code, for example (perhaps only instantiable by internal macro)
  • Adjust documentation: Remove it from the unstable book
    (No stabilization PR necessary)
    Remove the feature gate.

Unresolved Questions

    • Should this be completely removed by the compiler, or left behind in a way that cannot be directly accessed through Rust syntax (or requires using a wrapper macro)?
    • [ ]

Implementation history

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Sep 12, 2022
added
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
T-langRelevant to the language team
on Sep 12, 2022
SoniEx2

SoniEx2 commented on Sep 12, 2022

@SoniEx2
added a commit that references this issue on Sep 29, 2022
Noratrieb

Noratrieb commented on Nov 16, 2022

@Noratrieb
Member

@rustbot claim

I'll remove all the parsing and diagnostic logic/hacks but leave the AST nodes and everything after it behind for now.

added a commit that references this issue on Dec 2, 2022
4fdc3eb
added a commit that references this issue on Dec 12, 2022
c8b07c0
RalfJung

RalfJung commented on Jan 10, 2023

@RalfJung
Member

Would it make sense to possibly replace type ascription by an unstable macro in the standard library?

macro_rules! type_ascribe {
    ($e:expr, $t:ty) => {{
        let val: $t = $e;
        val
    }};
}

I noticed #104614 added a magic macro that preserves the old semantics, but maybe we can implement this entirely in userland?

bjorn3

bjorn3 commented on Jan 10, 2023

@bjorn3
Member

That macro shortens the lifetime of temporaries created in the expression.

2 remaining items

Noratrieb

Noratrieb commented on Feb 13, 2023

@Noratrieb
Member

This has taken a lot more time than I thought since lots of diagnostics were relying on it in subtle ways and require restructuring. I don't have enough time to work on this and also the other things I'm working on so I'm dropping my assignment here, feel free to take it. There's a WIP PR #106826 which may or may not be useful.
@estebank maybe you're interested in working on it, given all the pains you've had with type ascription :D
@rustbot release-assignment

self-assigned this
on Mar 8, 2023
added a commit that references this issue on May 2, 2023
added a commit that references this issue on May 5, 2023
added a commit that references this issue on Jun 20, 2023
added
S-tracking-remove-implementationStatus: The feature needs to be removed from the Rust toolchain before this issue can be closed
on Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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-type_ascription`#![feature(type_ascription)]`S-tracking-remove-implementationStatus: The feature needs to be removed from the Rust toolchain before this issue can be closedT-langRelevant to the language team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @chenyukang@RalfJung@Manishearth@SoniEx2@Skgland

      Issue actions

        Tracking Issue for De-RFC 3307: Remove type ascription · Issue #101728 · rust-lang/rust