Skip to content

Implement a explicit_generic_args_with_impl_trait feature gate - #86176

Merged
bors merged 1 commit into
rust-lang:masterfrom
nbdd0121:explicit-generic-args
Aug 2, 2021
Merged

Implement a explicit_generic_args_with_impl_trait feature gate#86176
bors merged 1 commit into
rust-lang:masterfrom
nbdd0121:explicit-generic-args

Conversation

@nbdd0121

Copy link
Copy Markdown
Member

Implements #83701

When this gate is enabled, explicit generic arguments can be specified even if impl Trait is used in argument position. Generic arguments can only be specified for explicit generic parameters but not for the synthetic type parameters from impl Trait

So code like this will be accepted:

#![feature(explicit_generic_args_with_impl_trait)]fnfoo<T: ?Sized>(_f:implAsRef<T>){}fnmain(){foo::<str>("".to_string());}

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @steveklabnik

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 9, 2021
@rust-log-analyzer

This comment has been minimized.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from 0d25b89 to d03079cCompareJune 9, 2021 21:37
@rust-log-analyzer

This comment has been minimized.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from d03079c to 52a8798CompareJune 9, 2021 22:47
@bors

bors commented Jun 10, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #80080) made this pull request unmergeable. Please resolve the merge conflicts.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from 52a8798 to 43a3064CompareJune 10, 2021 23:39
@rust-log-analyzer

This comment has been minimized.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from 43a3064 to ebefa0cCompareJune 10, 2021 23:52
@crlf0710crlf0710 added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. T-lang Relevant to the language team T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 26, 2021
@crlf0710

Copy link
Copy Markdown
Member

r? @matthewjasper

@JohnCSimonJohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 12, 2021
@bors

bors commented Jul 27, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #83484) made this pull request unmergeable. Please resolve the merge conflicts.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch 2 times, most recently from 15a1422 to 35b80d9CompareJuly 28, 2021 01:07
@bors

bors commented Jul 28, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #86735) made this pull request unmergeable. Please resolve the merge conflicts.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from 35b80d9 to ffb2892CompareJuly 28, 2021 20:19
@JohnTitor

Copy link
Copy Markdown
Member

r? @bjorn3 as per GitHub suggestions

@bjorn3

Copy link
Copy Markdown
Member

I have no experience with the typechecker, maybe

r? @lcnr

(another github suggestion)

@rust-highfiverust-highfive assigned lcnr and unassigned bjorn3Jul 28, 2021
@jackh726

Copy link
Copy Markdown
Member

I will take this review if @lcnr can't.

That being said, I think it's prudent to get a sign off from the lang team here. I imagine this probably falls under the "make more reversible decisions" part of the initiative process. So probably just need someone to give the okay. So cc @rust-lang/lang

@joshtriplett

Copy link
Copy Markdown
Member

I agree---since this is nightly-only, I think it's fine to go ahead with it.

I'll nominate this for consideration at a future meeting, but in the interim, go ahead.

@bors

bors commented Jul 30, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #87237) made this pull request unmergeable. Please resolve the merge conflicts.

@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from ffb2892 to 5527810CompareJuly 31, 2021 19:37

@jackh726jackh726 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple nits, but r=me for this after those are addressed.

#83701 needs modified to "become" a tracking issue before/when this lands (or a new issue could be opened)

Comment threadcompiler/rustc_feature/src/active.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can just co-opt that issue to be a tracking issue, yeah.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like a small comment here just explaining what we're doing.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment threadsrc/test/ui/impl-trait/explicit-generic-args-for-impl.rs Outdated
Comment threadsrc/test/ui/impl-trait/explicit-generic-args-for-impl.stderr Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...in fact, I imagine the longer for that part of the diagnostic will probably co-opt some of this logic

@jackh726

Copy link
Copy Markdown
Member

r? @jackh726

@rust-highfiverust-highfive assigned jackh726 and unassigned lcnrAug 2, 2021
@jackh726jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 2, 2021
When this gate is enabled, explicit generic arguments can be specified even
if `impl Trait` is used in argument position. Generic arguments can only be
specified for explicit generic parameters but not for the synthetic type
parameters from `impl Trait`
@nbdd0121
nbdd0121force-pushed the explicit-generic-args branch from 5527810 to 9b90e7eCompareAugust 2, 2021 03:17
@jackh726

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Aug 2, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 9b90e7e has been approved by jackh726

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 2, 2021
@camsteffencamsteffen mentioned this pull request Aug 2, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2021
Rollup of 6 pull requests
Successful merges:
- rust-lang#86176 (Implement a `explicit_generic_args_with_impl_trait` feature gate)
- rust-lang#87654 (Add documentation for the order of Option and Result)
- rust-lang#87659 (Fix invalid suggestions for non-ASCII characters in byte constants)
- rust-lang#87673 (Tweak opaque type mismatch error)
- rust-lang#87687 (Inline some macros)
- rust-lang#87690 (Add missing "allocated object" doc link to `<*mut T>::add`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 14f3418 into rust-lang:masterAug 2, 2021
@rustbotrustbot added this to the 1.56.0 milestone Aug 2, 2021
@nbdd0121
nbdd0121 deleted the explicit-generic-args branch August 2, 2021 22:14
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 26, 2022
…ackh726
Provide extra note if synthetic type args are specified
Implement the unresolved question in rust-lang#83701 as suggested in rust-lang#86176 (comment).
r? `@jackh726`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 26, 2022
…ackh726
Provide extra note if synthetic type args are specified
Implement the unresolved question in rust-lang#83701 as suggested in rust-lang#86176 (comment).
r? ``@jackh726``
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 11, 2022
…1,nagisa
Stabilize explicit_generic_args_with_impl_trait
This is a stabilisation PR for `explicit_generic_args_with_impl_trait`.
* [tracking issue](rust-lang#83701)
- [Stabilisation report](rust-lang#83701 (comment))
- [FCP entered](rust-lang#83701 (comment))
* [implementation PR](rust-lang#86176)
* [Reference PR](rust-lang/reference#1212)
* There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

14 participants

@nbdd0121@rust-highfive@rust-log-analyzer@bors@crlf0710@JohnTitor@bjorn3@jackh726@joshtriplett@steveklabnik@JohnCSimon@matthewjasper@lcnr@rustbot