Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

thaliaarchi
Copy link
Contributor

@thaliaarchi thaliaarchi commented Apr 22, 2025

The extension is validated in PathBuf::set_extension, but not add_extension. Fix that. Check for both / and \ path separators on Windows, even when the path is verbatim, since this is logically like PathBuf::push which normalizes separators (i.e., keeping the current behavior).

PathBuf::add_extension is tracked in #127292.

r? @ChrisDenton

The extension is validated in `PathBuf::set_extension`, but not
`add_extension`. Fix that. Check for both / and \ path separators on
Windows, even when the path is verbatim, since this is logically like
`PathBuf::push` which normalizes separators (i.e., keeping the current
behavior).
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 22, 2025
@ChrisDenton
Copy link
Member

It definitely makes sense for the unstable add_extension to be consistent with the stable set_extension. Thanks!

@ChrisDenton
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 22, 2025

📌 Commit 006b7e3 has been approved by ChrisDenton

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
…enton

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140142 (Some more graphviz tweaks)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - rust-lang#140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - rust-lang#140163 (Validate extension in `PathBuf::add_extension`)
 - rust-lang#140173 (Ping Mara when touching format_args!() internals.)
 - rust-lang#140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
…enton

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140142 (Some more graphviz tweaks)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - rust-lang#140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - rust-lang#140163 (Validate extension in `PathBuf::add_extension`)
 - rust-lang#140173 (Ping Mara when touching format_args!() internals.)
 - rust-lang#140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
…enton

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140142 (Some more graphviz tweaks)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - rust-lang#140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - rust-lang#140163 (Validate extension in `PathBuf::add_extension`)
 - rust-lang#140173 (Ping Mara when touching format_args!() internals.)
 - rust-lang#140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
…enton

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140142 (Some more graphviz tweaks)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - rust-lang#140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - rust-lang#140163 (Validate extension in `PathBuf::add_extension`)
 - rust-lang#140173 (Ping Mara when touching format_args!() internals.)
 - rust-lang#140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ed4e167 into rust-lang:master Apr 23, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 23, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
Rollup merge of rust-lang#140163 - thaliaarchi:pathbuf-validate-extension, r=ChrisDenton

Validate extension in `PathBuf::add_extension`

The extension is validated in `PathBuf::set_extension`, but not `add_extension`. Fix that. Check for both `/` and `\` path separators on Windows, even when the path is verbatim, since this is logically like `PathBuf::push` which normalizes separators (i.e., keeping the current behavior).

`PathBuf::add_extension` is tracked in rust-lang#127292.

r? `@ChrisDenton`
@thaliaarchi thaliaarchi deleted the pathbuf-validate-extension branch April 23, 2025 18:48
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 24, 2025
…sion, r=ChrisDenton

Validate extension in `PathBuf::add_extension`

The extension is validated in `PathBuf::set_extension`, but not `add_extension`. Fix that. Check for both `/` and `\` path separators on Windows, even when the path is verbatim, since this is logically like `PathBuf::push` which normalizes separators (i.e., keeping the current behavior).

`PathBuf::add_extension` is tracked in rust-lang#127292.

r? `@ChrisDenton`
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 24, 2025
…enton

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140142 (Some more graphviz tweaks)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.)
 - rust-lang#140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic)
 - rust-lang#140163 (Validate extension in `PathBuf::add_extension`)
 - rust-lang#140173 (Ping Mara when touching format_args!() internals.)
 - rust-lang#140175 (`rc""` more clear error message)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Sep 3, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 3, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 3, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 4, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 4, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
rust-timer added a commit that referenced this pull request Sep 4, 2025
Rollup merge of #145209 - hanna-kruppe:path_add_extension, r=tgross35

Stabilize `path_add_extension`

FCP in tracking issue #127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in #140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes #127292

[0]: #127292 (comment)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 5, 2025
Stabilize `path_add_extension`

FCP in tracking issue rust-lang/rust#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang/rust#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang/rust#127292

[0]: rust-lang/rust#127292 (comment)
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 8, 2025
Stabilize `path_add_extension`

FCP in tracking issue rust-lang/rust#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang/rust#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang/rust#127292

[0]: rust-lang/rust#127292 (comment)
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Sep 9, 2025
…=tgross35

Stabilize `path_add_extension`

FCP in tracking issue rust-lang#127292 finished in January. There was more discussion since then, but [libs-api decided to match `set_extension`][0] by keeping the return type as-is and adding a panic for invalid extensions. The latter was implemented in rust-lang#140163, so this feature should be ready for stabilization. But if anyone's unsure, another FCP could be done to confirm.

Closes rust-lang#127292

[0]: rust-lang#127292 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants