Skip to content

Fix mismatched_lifetime_syntaxes warning#656

Merged
sagudev merged 5 commits intoservo:mainfrom
jschwe:compiler_warnings
Mar 19, 2026
Merged

Fix mismatched_lifetime_syntaxes warning#656
sagudev merged 5 commits intoservo:mainfrom
jschwe:compiler_warnings

Conversation

@jschwe
Copy link
Member

@jschwe jschwe commented Nov 12, 2025

Fixes #652

Not sure if this fixes all instances, since there are still many bindgen related warnings polluting the output, where I can't seem to find the option that can silence them.

Copy link
Member

@sagudev sagudev left a comment

Choose a reason for hiding this comment

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

LGTM, although I prefer explicit lifetimes (even if '_). everywhere.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
@jschwe jschwe force-pushed the compiler_warnings branch 2 times, most recently from a7d6b39 to 5ed3daa Compare March 17, 2026 16:22
jschwe added 2 commits March 17, 2026 17:24
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
@jschwe jschwe force-pushed the compiler_warnings branch from 5ed3daa to 36003d1 Compare March 17, 2026 16:24
@jschwe jschwe added this pull request to the merge queue Mar 18, 2026
}

pub fn handle_mut(&mut self) -> MutableHandle<T>
pub fn handle_mut(&'a mut self) -> MutableHandle<'a, T>
Copy link
Member

Choose a reason for hiding this comment

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

I think this is wrong, we should use separate lifetime.

Copy link
Member Author

@jschwe jschwe Mar 18, 2026

Choose a reason for hiding this comment

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

hmm, I think you are right. Wouldn't that mean that the regular handle functions should also be '_ and not 'a?

Copy link
Member

Choose a reason for hiding this comment

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

yes

BTW in some cases we even do:

mozjs/mozjs/src/gc/root.rs

Lines 401 to 403 in b01d302

pub unsafe fn as_mut<'b>(&'b mut self) -> &'b mut T
where
'a: 'b,

Copy link
Member Author

Choose a reason for hiding this comment

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

Can I do this in a follow-up to keep this one scoped to pure warning-fixes?

Copy link
Member

Choose a reason for hiding this comment

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

I am not really 100% sure we need 'a: 'b part TBH. Its just something I want to bring attention to. This will need more investigation.

@sagudev sagudev removed this pull request from the merge queue due to a manual request Mar 18, 2026
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
@sagudev sagudev added this pull request to the merge queue Mar 19, 2026
Merged via the queue into servo:main with commit 29230db Mar 19, 2026
42 checks passed
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.

Fix mismatched_lifetime_syntaxes warning

2 participants