Repository navigation
Conversation
philberty
requested changes
Nov 26, 2026
philberty
left a comment
Member
There was a problem hiding this comment.
minor nit to move that into the rust-compile-base.cc
| // rustc reports a local in an array length as E0435 | ||
| // shortcut: only a bare path is checked, `n + 1` gets the plain message | ||
| static void | ||
| report_non_const_length (Context *ctx, HIR::Expr &length) |
Member
There was a problem hiding this comment.
feels like this should be moved into the rust-compile-base.cc
Contributor
Author
There was a problem hiding this comment.
moved it into HIRCompileBase 👍
A local in an array length printed a broken '%T' error, now it's E0435 like rustc. Fixes Rust-GCC#5092 Assisted-by: Claude Opus (Anthropic) gcc/rust/ChangeLog: * backend/rust-compile-base.h (HIRCompileBase::report_non_const_length): New function. * backend/rust-compile-base.cc (HIRCompileBase::report_non_const_length): Likewise. * backend/rust-compile-expr.cc (CompileExpr::array_copied_expr): Use it. gcc/testsuite/ChangeLog: * rust/compile/issues/issue-5092.rs: New test. Signed-off-by: Utkarsh Bahuguna <utkarshbahuguna10@gmail.com>
u7k4rs6
force-pushed
the
fix-5092-array-len-local
branch
from
November 26, 2026 11:13
1116c21 to
bf38a4b
Compare
This branch has not been deployed
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.
a local in an array length printed
non const capacity domain '%T'. now it's E0435 like rustc, anything else non-constant gets a plain message.Fixes #5092