contracts: fix lowering final declaration without trailing semicolon
Lowering for contract delcarations introduced in rust-lang/rust#144444 incorrectly handled the final declaration statement when it didn't end in a semicolon. This change fixes the issue.
See the included regression test for the minimal reproducible example.
Contracts tracking issue: https://github.com/rust-lang/rust/issues/128044
r? @jieyouxu
rustbot has assigned @jieyouxu. 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
:warning: Warning :warning:
- There are issue links (such as
#123) in the commit messages of the following commits. Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.- 5d50b5430835d76e59f610d694a96c7bbb83722a
The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6590 files
tidy check
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
tidy [style (tests)]: /checkout/tests/ui/contracts/requires-block-stmt.rs:10: line longer than 100 chars
tidy [style (tests)]: FAIL
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.3)
linting python files
---
info: ES-Check: there were no ES version matching errors! 🎉
typechecking javascript files
tidy: The following check failed: style (tests)
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1314:29
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:52
local time: Sat Dec 6 19:27:41 UTC 2025
network time: Sat, 06 Dec 2025 19:27:41 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
@rustbot author
Reminder, once the PR becomes ready for a review, use @rustbot ready.
@rustbot ready
@bors r+ rollup
:pushpin: Commit d54fee82f43587656cfaea63ddba6fbd05005b83 has been approved by jieyouxu
It is now in the queue for this repository.