Skip to content

Comments

Remove unnecessary KJ_LIFETIMEBOUND on getRelative() in url.h#6159

Merged
jasnell merged 1 commit intomainfrom
jasnell/remove-errant-lifetimebound-on-url
Feb 24, 2026
Merged

Remove unnecessary KJ_LIFETIMEBOUND on getRelative() in url.h#6159
jasnell merged 1 commit intomainfrom
jasnell/remove-errant-lifetimebound-on-url

Conversation

@jasnell
Copy link
Collaborator

@jasnell jasnell commented Feb 24, 2026

No description provided.

@jasnell jasnell requested review from danlapid and fhanau February 24, 2026 20:21
@jasnell jasnell requested review from a team as code owners February 24, 2026 20:21
@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 24, 2026

The analysis is clear. The Url::Relative struct (lines 144-147 of url.h) contains:

  • Url base — an owned Url value
  • kj::String name — an owned string

The getRelative() implementation (lines 366-371) constructs a new Relative with a freshly resolved base URL and a freshly allocated kj::str(...) for name. The returned Relative struct is fully independent of the Url object it was called on — it owns all its data. KJ_LIFETIMEBOUND is incorrect here because it would warn callers that the returned value's lifetime is bound to the Url, when in fact it's not.

LGTM

github run

@jasnell jasnell enabled auto-merge February 24, 2026 20:23
@jasnell jasnell merged commit 312f004 into main Feb 24, 2026
29 checks passed
@jasnell jasnell deleted the jasnell/remove-errant-lifetimebound-on-url branch February 24, 2026 21:15
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.

4 participants