[COMMITTED 79/83] gccrs: Change alloc crate test edition to 2018

arthur.cohen@opensrcsec.com arthur.cohen@opensrcsec.com
Wed Sep 16 12:30:38 GMT 2026


From: Owen Avery <powerboat9.gamer@gmail.com>

The alloc crate should be tested with edition 2018, not 2015. However,
the included mock core crate did not support edition 2018.

gcc/testsuite/ChangeLog:

	* rust/alloc/alloc.exp: Test with edition 2018.
	* rust/alloc/core.rs: Fix some use declaration paths and use raw
	identifiers for "try".

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
 gcc/testsuite/rust/alloc/alloc.exp |  2 +-
 gcc/testsuite/rust/alloc/core.rs   | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/testsuite/rust/alloc/alloc.exp b/gcc/testsuite/rust/alloc/alloc.exp
index d412b50cf22..7e6331cab90 100644
--- a/gcc/testsuite/rust/alloc/alloc.exp
+++ b/gcc/testsuite/rust/alloc/alloc.exp
@@ -37,7 +37,7 @@ if { [check_effective_target_lp64] } {
 		$srcdir/$subdir/alloc/* \
 	]]
 
-	dg-runtest $srcdir/$subdir/alloc/src/lib.rs "-frust-edition=2015 -frust-crate=alloc -frust-compile-until=nameresolution -frust-cfg=target_has_atomic=\"ptr\" -w" ""
+	dg-runtest $srcdir/$subdir/alloc/src/lib.rs "-frust-edition=2018 -frust-crate=alloc -frust-compile-until=nameresolution -frust-cfg=target_has_atomic=\"ptr\" -w" ""
 	set dg-do-what-default ${saved-dg-do-what-default}
 } else {
 	unsupported "alloc crate tests require a 64-bit target "
diff --git a/gcc/testsuite/rust/alloc/core.rs b/gcc/testsuite/rust/alloc/core.rs
index 8362e3473fc..e74ed9e4db8 100644
--- a/gcc/testsuite/rust/alloc/core.rs
+++ b/gcc/testsuite/rust/alloc/core.rs
@@ -106,14 +106,14 @@ pub mod ops {
 
     pub use self::arith::{Add, AddAssign, Sub};
     pub use self::deref::{Deref, DerefMut, Receiver};
-    pub use bit::{BitAnd, BitOr, BitXor};
-    pub use drop::Drop;
-    pub use function::{Fn, FnMut, FnOnce};
-    pub use generator::{Generator, GeneratorState};
-    pub use index::{Index, IndexMut};
-    pub use range::{Bound, Range, RangeBounds};
-    pub use try::Try;
-    pub use unsize::{CoerceUnsized, DispatchFromDyn};
+    pub use self::bit::{BitAnd, BitOr, BitXor};
+    pub use self::drop::Drop;
+    pub use self::function::{Fn, FnMut, FnOnce};
+    pub use self::generator::{Generator, GeneratorState};
+    pub use self::index::{Index, IndexMut};
+    pub use self::range::{Bound, Range, RangeBounds};
+    pub use self::r#try::Try;
+    pub use self::unsize::{CoerceUnsized, DispatchFromDyn};
 
     use super::marker::Sized;
 
@@ -222,7 +222,7 @@ pub mod ops {
             fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
         }
     }
-    pub mod try {
+    pub mod r#try {
         use crate::core::result::Result;
 
         #[lang = "try"]
@@ -855,7 +855,7 @@ pub mod iter {
         use super::Result;
         use super::Sized;
         use crate::core::ops::function::FnMut;
-        use crate::core::ops::try::Try;
+        use crate::core::ops::r#try::Try;
         pub trait IntoIterator {
             type Item;
             type IntoIter: Iterator<Item = Self::Item>;
-- 
2.50.1



More information about the Gcc-rust mailing list