Skip to content

Extending ? macro repetition to Rust 2015 #56668

Closed
@Centril

Description

@Centril

We recently stabilized the ? macro repeater "operator" proposed by @mark-i-m for Rust 2018 and it will be in Rust 1.32.

The original rust-lang/rfcs#2298 did not say anything about using edition dependent behavior; this was instead decided upon with an FCP in #51934. This was done after a crater run in #49719 (comment) that was green and showed 0 regressions.

After accepting the edition dependent change, @petrochenkov noted in #51934 (comment) that:

As you can see in #51587 the edition-specific logic is much worse than previously implemented fallback.

However, in #53668, there was a similar situation of a syntactic change for non-soundness reasons that was theoretically breaking but in practice not. In that case, @rust-lang/lang decided to accept the change for Rust 2015 and 2018 in an effort to minimize technical debt.

In #53668 @petrochenkov noted that (#53668 (comment)):

Changes with negligible effects on contrived code are done very regularly, it's just nobody notices them.

In #53668 (comment), @nikomatsakis then expanded upon the practical way in which we interpret breaking changes.

If I recall correctly, in a language team meeting not too long ago, it was suggested that we might want to reverse our decision and extend ? as a macro repetition "operator" in Rust 2015 as well. I think personally that it would be advisable; in particular, if we do so, we can avoid the technical debt in the compiler, the debt in the spec, but first and foremost, we can avoid the distinction that users must learn. Ultimately I think this is of greater practical benefit than the theoretical breakage that it would be according to crater.

Therefore I'd like to use this issue to propose an extension of ? as a macro repetition "operator" to Rust 2015.

@mark-i-m noted that they would rather not have to change the implementation again so I will not ask them to; but I'm sure someone else might want to tackle it (e.g. @petrochenkov since they were one of the first proponents of keeping it in Rust 2015 or @alexreg since they concurred with @petrochenkov).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions