aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/StringBufferInputStream.java
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2025-05-19 18:02:13 +0100
committerPhilip Herron <philip.herron@embecosm.com>2025-05-26 19:18:47 +0000
commita497ed083516891db184e4e87a4b954dbd23ef06 (patch)
tree9cd4d8789feb9ee75eb30eaef4dd9061e9248c60 /libjava/java/io/StringBufferInputStream.java
parentb401e72ba547d2fa595e13f119e3e5e337afc0d9 (diff)
downloadgcc-a497ed083516891db184e4e87a4b954dbd23ef06.zip
gcc-a497ed083516891db184e4e87a4b954dbd23ef06.tar.gz
gcc-a497ed083516891db184e4e87a4b954dbd23ef06.tar.bz2
gccrs: Initial support for Return Position Impl Trait
This is the initial patch for RPIT, we can build on this to handle the more complex cases but there are enough distinct changes going on here that it should just get merged now. RPIT is really a sneaky generic so for example: fn foo() -> impl Bar { Baz } This is represented as: fn () -> OpaqueType Bar. But when we handle the coercion site for Baz on impl Bar when we type resolve the function we know that the underlying type is Baz. Note this function is _not_ generic so its using this special OpaqueType and keeping track of the underlying type in its ty_ref reference hir-id which will resolve to Baz. This also means if we have a case where maybe this was in an if statement: fn foo(a: i32) -> impl Bar { if a > 10 { Baz } else { Qux } } The rules of impl Bar is that Baz is handled but Baz and Qux are different underlying types so this is not allowed. The reason is impl traits are not generic and although from a programmer perspective the callers dont know what the underlying type is, the compiler _knows_ what it is. So really when you call a function and get its return position impl trait the compiler knows what to do and does all whats nessecary to handle calling functions using that type etc. gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): we need to resolve the underlying type * typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): just clone * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): ensure we monomphize to get the underlying * typecheck/rust-tyty.cc (BaseType::destructure): handle opaque types (OpaqueType::resolve): this is much simpler now (OpaqueType::handle_substitions): no longer needed * typecheck/rust-tyty.h: update header * typecheck/rust-unify.cc (UnifyRules::expect_opaque): unify rules for opaque gcc/testsuite/ChangeLog: * rust/compile/bad-rpit1.rs: New test. * rust/execute/torture/impl_rpit1.rs: New test. * rust/execute/torture/impl_rpit2.rs: New test. * rust/execute/torture/impl_rpit3.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'libjava/java/io/StringBufferInputStream.java')
0 files changed, 0 insertions, 0 deletions