lint: Fix ICE on error_mark_node in unused variable linter#4438
Open
Pasta-coder wants to merge 1 commit intoRust-GCC:masterfrom
Open
lint: Fix ICE on error_mark_node in unused variable linter#4438Pasta-coder wants to merge 1 commit intoRust-GCC:masterfrom
Pasta-coder wants to merge 1 commit intoRust-GCC:masterfrom
Conversation
When encountering experimental or unsupported features like const generics, the compiler can insert an `error_mark_node` into the declaration lists. The unused variable linter was attempting to assert the `TREE_CODE` of these nodes, resulting in an Internal Compiler Error (ICE). This patch adds an early return for `error_mark_node` in `check_decl` to prevent the ICE and allow the compiler to exit gracefully, correctly emitting the standard compilation errors instead. Fixes Rust-GCC#3910 gcc/rust/ChangeLog: * checks/lints/rust-lint-unused-var.cc (check_decl): Return early if the tree is an error_mark_node. gcc/testsuite/ChangeLog: * rust/compile/issue-3910.rs: New test. Signed-off-by: jayant chauhan <0001jayant@gmail.com>
powerboat9
reviewed
Feb 14, 2026
Member
|
actually this is hiding a code gen bug it shouldnt merge this unless we understand why an error mark node has crept into the IR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3910