Skip to content
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

enable elision in where-clauses on functions #45667

Closed
nikomatsakis opened this issue Oct 31, 2017 · 6 comments
Closed

enable elision in where-clauses on functions #45667

nikomatsakis opened this issue Oct 31, 2017 · 6 comments
Labels
A-rust-2018-preview Area: The 2018 edition preview C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804

Comments

@nikomatsakis
Copy link
Contributor

The following test case does not presently work, but ought to:

trait Trait<'a> { }

// Supporting `'_` here is #15872:
impl<T> Trait<'_> for T { }

// Supporting `'_` here is this issue:
fn foo<T>(t: T)
where T: Trait<'_>
{ 
}

fn main() { 
  foo(22);
}

This is, I believe, blocked on #15872, because the same work that enables '_ to expand to an early-bound region in that work ought to make supporting '_ in functions fairly straightforward.

@nikomatsakis nikomatsakis added E-needs-mentor T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 31, 2017
@XAMPPRocky XAMPPRocky added the C-bug Category: This is a bug. label Feb 12, 2018
@aturon aturon added the A-rust-2018-preview Area: The 2018 edition preview label Jul 24, 2018
@aturon aturon added this to the Rust 2018 Release Candidate milestone Jul 24, 2018
@aturon aturon removed this from the Rust 2018 RC milestone Sep 5, 2018
@nikomatsakis
Copy link
Contributor Author

Actually, I thought we maybe didn't want to permit '_ in this position, since we had not yet decided on what it means -- e.g., does it mean "some fresh lifetime name" or does it mean for<'a> T: Trait<'a>?

@nikomatsakis
Copy link
Contributor Author

It turns out we accidentally started accepting '_ in some of these positions; this was discovered in #54902

@nikomatsakis
Copy link
Contributor Author

It will become a hard-error again

@jackh726 jackh726 added WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 and removed WG-compiler-middle labels Jan 29, 2022
@jackh726
Copy link
Member

Retagging as wg-traits; supporting elision feels trait-y to me

@jackh726
Copy link
Member

Visiting for types triage. This feels a bit dated to us. If this is something that is desired in the future, this should probably go throug an RFC.

@nikomatsakis
Copy link
Contributor Author

A few thoughts here:

I think we need to draft up a coherent RFC about what '_ means in all the places. I am of the opinion that it should mean "add a region to the innermost potential binder spot", which in this case would mean where T: Trait<'_> would mean where T: for<'a> Trait<'a>. I also think impl Foo should follow the same rules, so that T: Trait<'_, impl Debug> would be short for T: for<'a, T: Debug> Trait<'a, T>. But the topic is complex and hence the need for a lang team initiative to pursue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust-2018-preview Area: The 2018 edition preview C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

No branches or pull requests

4 participants