]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Generate error for const trait functions
authorNobel Singh <nobel2073@gmail.com>
Tue, 5 Dec 2023 12:27:29 +0000 (18:12 +0545)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:49 +0000 (12:36 +0100)
commitf48f9a9ac6f20ffe2775437e3b21ed0208a9cee2
tree8304a044d4e1f519beec5371df1335805ffe65c9
parenta7991de39ff3ef42cd48bb460a02134af73d7b9d
gccrs: Generate error for const trait functions

Fixes issue #2040

Add check to assure that a function cant be declared const inside trait impl
blocks.

gcc/rust/ChangeLog:

* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
check for const funtion.

gcc/testsuite/ChangeLog:

* rust/compile/issue-2040.rs: New test.

Signed-off-by: Nobel Singh <nobel2073@gmail.com>
gcc/rust/checks/errors/rust-ast-validation.cc
gcc/testsuite/rust/compile/issue-2040.rs [new file with mode: 0644]