-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Decide on keyword order for impl, mut restrictions #155222
Copy link
Copy link
Open
Labels
F-impl_restriction`#![feature(impl_restriction)]``#![feature(impl_restriction)]`F-mut_restriction`#![feature(mut_restriction)]``#![feature(mut_restriction)]`F-unsafe_fields`#![feature(unsafe_fields)]``#![feature(unsafe_fields)]`I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
F-impl_restriction`#![feature(impl_restriction)]``#![feature(impl_restriction)]`F-mut_restriction`#![feature(mut_restriction)]``#![feature(mut_restriction)]`F-unsafe_fields`#![feature(unsafe_fields)]``#![feature(unsafe_fields)]`I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Both
implandmutrestrictions were approved in RFC 3323.For
mutrestrictions, the syntax was specified asNeither the restrictions RFC nor
unsafefields RFC specify the relative order of the newly-introduced keywords (both appearing between visibility and the identifier/type).Similarly, the restrictions RFC specifies
Trait : unsafe? + ImplRestriction? trait IDENTIFIER GenericParams? ( : TypeParamBounds? )? WhereClause? { InnerAttribute* AssociatedItem* }as the syntax for
implrestrictions.In my PRs parsing
implrestrictions, I put the restriction before unsafety, so as to group it with visibility. This was contrary to what was specified in the RFC and was noticed during review.Given that I personally authored the restrictions RFC,the initial version of the
unsafefields RFC, and the initial (though ultimately closed) implementation for the restrictions, the fact that I did not know the ordering is concerning. Now thatimplrestrictions are available on nightly andmutrestrictions will be shortly, this is something that should be decided sooner rather than later.cc tracking issue for restrictions (#105077), unsafe fields (#132922), r-a request for supporting restrictions (rust-lang/rust-analyzer#22021)
Nominating for the lang team to discuss and hopefully decide. I will note that this presumes that the keywords as originally proposed is the desired syntax, which is explicitly an unresolved question from the RFC.