Skip to content

Fix ICE in write_interface when the interface file can't be written#158843

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cezarbbb:fix-143981-sdylib-write-interface-panic
Jul 17, 2026
Merged

Fix ICE in write_interface when the interface file can't be written#158843
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cezarbbb:fix-143981-sdylib-write-interface-panic

Conversation

@cezarbbb

@cezarbbb cezarbbb commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #143981.

write_interface opened the sdylib interface file with fs::File::create_buffered(...).unwrap(), so any failure to create it (like -o into a non-existent or unwritable directory) will ICE instead of reporting a normal error. Emit FailedWritingFile instead, matching the rlink and dep-graph write paths.

Also drop a stray trailing " from the FailedWritingFile in diagnostic.rs and error.rs.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 6, 2026
@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 21 candidates

@cezarbbb

Copy link
Copy Markdown
Contributor Author

r? @bjorn3

@rustbot rustbot assigned bjorn3 and unassigned jackh726 Jul 15, 2026
Comment thread compiler/rustc_interface/src/passes.rs Outdated
@cezarbbb
cezarbbb force-pushed the fix-143981-sdylib-write-interface-panic branch from 8617caf to 297060e Compare July 16, 2026 01:04

@bjorn3 bjorn3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me with or without nit

View changes since this review

Comment thread compiler/rustc_interface/src/passes.rs Outdated
@cezarbbb
cezarbbb force-pushed the fix-143981-sdylib-write-interface-panic branch from 297060e to 07069b3 Compare July 17, 2026 01:26
@rust-bors

rust-bors Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@cezarbbb: 🔑 Insufficient privileges: not in review users

@bjorn3

bjorn3 commented Jul 17, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 07069b3 has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jul 17, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 17, 2026
…nterface-panic, r=bjorn3

Fix ICE in `write_interface` when the interface file can't be written

Fixes rust-lang#143981.

`write_interface` opened the `sdylib` interface file with `fs::File::create_buffered(...).unwrap()`, so any failure to create it (like `-o` into a non-existent or unwritable directory) will ICE instead of reporting a normal error. Emit `FailedWritingFile` instead, matching the rlink and dep-graph write paths.

Also drop a stray trailing `"` from the `FailedWritingFile` in `diagnostic.rs` and `error.rs`.
rust-bors Bot pushed a commit that referenced this pull request Jul 17, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #150732 (Convert `-Ctarget-cpu` into a target-modifier for AVR, AMDGCN and NVPTX )
 - #159301 (Update Enzyme to handle LLVM23)
 - #159365 (fix: point at method call chain when a return-position `impl Trait` assoc type diverges)
 - #159402 (Clarify safety requirements for SIMD shl/shr and masked load/store)
 - #159410 (rustdoc: remove old `--emit` types)
 - #158398 (Comment about empty run_passes, fixup of #158040)
 - #158843 (Fix ICE in `write_interface` when the interface file can't be written)
 - #159302 (Implement `Debug` helpers via `Cell`)
 - #159332 (Honor field-level lint attributes in non_snake_case)
 - #159386 (add a fallback for `fmuladdf*`)
 - #159391 (Update tests for LLVM 23)
 - #159400 (Update books)
 - #159401 (Gate `tests/debuginfo/function-call.rs` on min GDB 15.1)
 - #159404 ([aarch64][win] Pass oversized c-variadic args indirectly on Arm64EC)
 - #159405 (Manually implement Clone for GrowableBitSet)
 - #159415 (rustdoc: rename the doc parts metadata params)
rust-bors Bot pushed a commit that referenced this pull request Jul 17, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #159301 (Update Enzyme to handle LLVM23)
 - #159365 (fix: point at method call chain when a return-position `impl Trait` assoc type diverges)
 - #159402 (Clarify safety requirements for SIMD shl/shr and masked load/store)
 - #159408 (rustc_data_structures: Expand documentation for rustc jobserver APIs)
 - #159410 (rustdoc: remove old `--emit` types)
 - #158398 (Comment about empty run_passes, fixup of #158040)
 - #158843 (Fix ICE in `write_interface` when the interface file can't be written)
 - #159302 (Implement `Debug` helpers via `Cell`)
 - #159332 (Honor field-level lint attributes in non_snake_case)
 - #159340 (Rename `errors.rs` file to `diagnostics.rs` (14/N))
 - #159386 (add a fallback for `fmuladdf*`)
 - #159391 (Update tests for LLVM 23)
 - #159400 (Update books)
 - #159401 (Gate `tests/debuginfo/function-call.rs` on min GDB 15.1)
 - #159404 ([aarch64][win] Pass oversized c-variadic args indirectly on Arm64EC)
 - #159405 (Manually implement Clone for GrowableBitSet)
 - #159415 (rustdoc: rename the doc parts metadata params)
@rust-bors
rust-bors Bot merged commit 151c662 into rust-lang:main Jul 17, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 17, 2026
rust-timer added a commit that referenced this pull request Jul 17, 2026
Rollup merge of #158843 - cezarbbb:fix-143981-sdylib-write-interface-panic, r=bjorn3

Fix ICE in `write_interface` when the interface file can't be written

Fixes #143981.

`write_interface` opened the `sdylib` interface file with `fs::File::create_buffered(...).unwrap()`, so any failure to create it (like `-o` into a non-existent or unwritable directory) will ICE instead of reporting a normal error. Emit `FailedWritingFile` instead, matching the rlink and dep-graph write paths.

Also drop a stray trailing `"` from the `FailedWritingFile` in `diagnostic.rs` and `error.rs`.
@cezarbbb
cezarbbb deleted the fix-143981-sdylib-write-interface-panic branch July 20, 2026 01:11
Kobzol pushed a commit to Kobzol/rustc_codegen_cranelift that referenced this pull request Jul 23, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#159301 (Update Enzyme to handle LLVM23)
 - rust-lang/rust#159365 (fix: point at method call chain when a return-position `impl Trait` assoc type diverges)
 - rust-lang/rust#159402 (Clarify safety requirements for SIMD shl/shr and masked load/store)
 - rust-lang/rust#159408 (rustc_data_structures: Expand documentation for rustc jobserver APIs)
 - rust-lang/rust#159410 (rustdoc: remove old `--emit` types)
 - rust-lang/rust#158398 (Comment about empty run_passes, fixup of rust-lang/rust#158040)
 - rust-lang/rust#158843 (Fix ICE in `write_interface` when the interface file can't be written)
 - rust-lang/rust#159302 (Implement `Debug` helpers via `Cell`)
 - rust-lang/rust#159332 (Honor field-level lint attributes in non_snake_case)
 - rust-lang/rust#159340 (Rename `errors.rs` file to `diagnostics.rs` (14/N))
 - rust-lang/rust#159386 (add a fallback for `fmuladdf*`)
 - rust-lang/rust#159391 (Update tests for LLVM 23)
 - rust-lang/rust#159400 (Update books)
 - rust-lang/rust#159401 (Gate `tests/debuginfo/function-call.rs` on min GDB 15.1)
 - rust-lang/rust#159404 ([aarch64][win] Pass oversized c-variadic args indirectly on Arm64EC)
 - rust-lang/rust#159405 (Manually implement Clone for GrowableBitSet)
 - rust-lang/rust#159415 (rustdoc: rename the doc parts metadata params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PermissionDenied panic when writing sdylib into nonexisting directory

4 participants