diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-12-25 17:55:09 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-21 12:55:44 +0100 |
commit | cd8547f85e53b42eff5a7c7572b466c023c75daf (patch) | |
tree | c6b8d50192318dca24f4574f0505e461389258fd /gcc/testsuite/rust/compile | |
parent | c8721ccdeb45396c5acf53da058a0fe1e3d03590 (diff) | |
download | gcc-cd8547f85e53b42eff5a7c7572b466c023c75daf.zip gcc-cd8547f85e53b42eff5a7c7572b466c023c75daf.tar.gz gcc-cd8547f85e53b42eff5a7c7572b466c023c75daf.tar.bz2 |
gccrs: lower: Correctly lower parenthesized types
This is useful for handling multiple trait bounds, and required for better handling of auto traits.
gcc/rust/ChangeLog:
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Add implementation for
ParenthesizedType.
* hir/rust-ast-lower-type.h: Declare that new visitor.
gcc/testsuite/ChangeLog:
* rust/compile/auto_traits1.rs: New test.
Diffstat (limited to 'gcc/testsuite/rust/compile')
-rw-r--r-- | gcc/testsuite/rust/compile/auto_traits1.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/auto_traits1.rs b/gcc/testsuite/rust/compile/auto_traits1.rs new file mode 100644 index 0000000..192052d --- /dev/null +++ b/gcc/testsuite/rust/compile/auto_traits1.rs @@ -0,0 +1,27 @@ +// { dg-additional-options "-frust-compile-until=typecheck" } + +#![feature(optin_builtin_traits)] + +pub unsafe auto trait Send {} +#[lang = "sync"] +pub unsafe auto trait Sync {} + +trait A { + fn a_method(&self) {} +} + +fn foo(a: &(dyn A + Send + Sync)) { + a.a_method(); +} + +struct S; + +impl A for S { + fn a_method(&self) {} +} + +fn main() { + let s = S; + + foo(&s); +} |