]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: const generics: Forbid default values in Functions, Traits and Impls
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 12 Sep 2022 14:26:46 +0000 (16:26 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 31 Jan 2023 13:16:51 +0000 (14:16 +0100)
commitff9d7741d4b9d5255bc809a7505225216ecc7b86
tree717d70350195e764ebd3a6e64b1937253f3a083e
parent288b6298a6ae9356122362cd604e3582d8decd26
gccrs: const generics: Forbid default values in Functions, Traits and Impls

gcc/rust/ChangeLog:

* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Allow
getting an error string from a specific constant context.
(ConstChecker::ctx_allows_default): New function, check if a context
allows default values for Const generics.
(ConstChecker::visit): Call into `ctx_allows_default`.
* checks/errors/rust-const-checker.h: Declare `ctx_allows_default`.

gcc/testsuite/ChangeLog:

* rust/compile/const_generics_8.rs: New test.
gcc/rust/checks/errors/rust-const-checker.cc
gcc/rust/checks/errors/rust-const-checker.h
gcc/testsuite/rust/compile/const_generics_8.rs [new file with mode: 0644]