Skip to content

Paren sugar #18622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Paren sugar #18622

wants to merge 2 commits into from

Conversation

nikomatsakis
Copy link
Contributor

Implement the Foo() paren sugar more uniformly as envisioned by the RFC.

r? @pcwalton

Fixes #17703 (among other things).

@@ -1838,6 +1838,14 @@ pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> t {

pub fn mk_tup(cx: &ctxt, ts: Vec<t>) -> t { mk_t(cx, ty_tup(ts)) }

pub fn mk_tup_or_nil(cx: &ctxt, ts: Vec<t>) -> t {
if ts.len() == 0 {
ty::mk_nil()
Copy link
Member

Choose a reason for hiding this comment

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

We ought to investigate the cost of interning ty_tup(Vec::new()).
Actually, one idea I had (interning everything referenced by Ty in the arena) would result in ty_tup(&'tcx [Ty<'tcx>]) which allows a statically declared ty_nil as ty_tup(&[]).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eddyb see also #18614

@nikomatsakis
Copy link
Contributor Author

Closing in favor of #18630, which includes these commits.

lnicola pushed a commit to lnicola/rust that referenced this pull request Dec 11, 2024
fix: Fix parsing of dyn T in generic arg on 2015 edition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unboxed closure sugar not working in trait objects
4 participants