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

Allow generics over &'static &'static T and &'static T #730

Closed
mdinger opened this issue Jan 24, 2015 · 3 comments
Closed

Allow generics over &'static &'static T and &'static T #730

mdinger opened this issue Jan 24, 2015 · 3 comments
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@mdinger
Copy link
Contributor

mdinger commented Jan 24, 2015

Rust can generalize over most types but it can't seem to over these because the reference/lifetimes they contain apparently.

  • PERLD has type &'static &'static [(char, char)]
  • PERLW has type &'static [(char, char)]
// I'd like to write like below or something similar which could handle both cases.
// I'm using `*` like globs but I don't really know what the syntax should be...
fn works<'a>(t: &'a* [(char, char)]) {}
@bluss
Copy link
Member

bluss commented Jan 24, 2015

Can you use a trait implemented for each of the two types?

@mdinger
Copy link
Contributor Author

mdinger commented Jan 24, 2015

Yes that works but it would still be nice if the &'static &'static could be handled somehow generically. The types are inherently similar.

The syntax I used would also restrict all lifetimes to being the same. I don't know how you could syntactically handle varying lifetimes...

@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

I believe this should be possible with #2532 and #1210 (RemoveRef as described in the RFC) so I am closing this.

@Centril Centril closed this as completed Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants