Skip to content

CheckoutBuilder: bind baseline{,_index}#1284

Open
jonathantanmy2 wants to merge 1 commit into
rust-lang:mainfrom
jonathantanmy2:bindbaseline
Open

CheckoutBuilder: bind baseline{,_index}#1284
jonathantanmy2 wants to merge 1 commit into
rust-lang:mainfrom
jonathantanmy2:bindbaseline

Conversation

@jonathantanmy2

Copy link
Copy Markdown

Add support for the baseline and baseline_index fields in CheckoutBuilder (to struct git_checkout_options).

Regarding lifetime of arguments passed to CheckoutBuilder, unlike the other fields in which owned versions are created upon function invocation, CheckoutBuilder only takes references to the input tree (baseline()) and index (baseline_index()) respectively. The Rust borrow checker enforces that the references live at least as long as CheckoutBuilder does.

Regarding safety of conversion of these new fields from CheckoutBuilder to struct git_checkout_options (in configure()), it is as unsafe as it currently is: the resulting struct git_checkout_options is valid as long as the source CheckoutBuilder lives.

Add support for the `baseline` and `baseline_index` fields in
CheckoutBuilder (to `struct git_checkout_options`).

Regarding lifetime of arguments passed to CheckoutBuilder, unlike
the other fields in which owned versions are created upon function
invocation, CheckoutBuilder only takes references to the input tree
(`baseline()`) and index (`baseline_index()`) respectively. The Rust
borrow checker enforces that the references live at least as long as
CheckoutBuilder does.

Regarding safety of conversion of these new fields from CheckoutBuilder
to `struct git_checkout_options` (in `configure()`), it is as unsafe as
it currently is: the resulting `struct git_checkout_options` is valid as
long as the source CheckoutBuilder lives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Waiting on review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants