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

Either forbid or support implied bounds from type definitions #438

Closed
Manishearth opened this issue Feb 29, 2024 · 2 comments
Closed

Either forbid or support implied bounds from type definitions #438

Manishearth opened this issue Feb 29, 2024 · 2 comments

Comments

@Manishearth
Copy link
Contributor

Manishearth commented Feb 29, 2024

struct Foo<'a, 'b: 'a>(&'a u8, &'b u8);


fn foo<'a, 'b>(x: Foo<'a, 'b>, a: &'a u8, b: &'b u8) -> &'a u8 { b }

This compiles, since foo has an implicit 'b: 'a bound inherited from the struct. We should ideally just forbid this.

If we do so, a lot of the cases where borrowing code needs to do "all longer lifetimes" can be cleaned up as well.

@Manishearth
Copy link
Contributor Author

Honestly, I think the best route might be to fully expand lifetimes during lowering.

I've already got the validity check in #437

Manishearth added a commit to Manishearth/diplomat that referenced this issue Feb 29, 2024
@Manishearth
Copy link
Contributor Author

Fixed by 7687c0f

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

No branches or pull requests

1 participant