diff options
| author | Philip Herron <herron.philip@googlemail.com> | 2025-11-09 20:28:50 +0000 |
|---|---|---|
| committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-11-17 15:58:19 +0100 |
| commit | 792ce42cd3d44cc854c4fd389698abca35a1a039 (patch) | |
| tree | 39792a8b6426f2a6cfbf0d98034a1da509a2a57f /libjava/classpath/java/io/FileNotFoundException.java | |
| parent | db64745c39cd533a10391aa6fa49487d18730b4a (diff) | |
gccrs: Support generic constant impl items
Impl items can have constants defined which could in turn be generic this was
not supported by gccrs and missed. So for example:
impl<T> Foo<T> {
const MAGIC: usize = mem::size_of::<T>();
}
This is a normal type parameter but in order to setup the generics we need to
create a synthetic TyTy::FnType so we can bind the parent's impl generics to
the type system and it just works like any other generic item at that point.
Then for example we have:
impl<const N: usize> Foo<N> {
const VALUE: usize = N;
}
Again we consistently bind the this const generic parameter the same way so
the lazy evaluation of the generic can take place.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): support the synthetic function consts
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve): likewise
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): create the synth
* typecheck/rust-tyty.h: new flag for synthetic constant
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-5.rs: New test.
* rust/execute/torture/const-generics-6.rs: New test.
* rust/execute/torture/const-generics-7.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'libjava/classpath/java/io/FileNotFoundException.java')
0 files changed, 0 insertions, 0 deletions
