diff options
Diffstat (limited to 'gcc/testsuite/rust/compile')
124 files changed, 1507 insertions, 268 deletions
diff --git a/gcc/testsuite/rust/compile/additional-trait-bounds2nr2.rs b/gcc/testsuite/rust/compile/additional-trait-bounds2nr2.rs index 6764f6e..1c49b75 100644 --- a/gcc/testsuite/rust/compile/additional-trait-bounds2nr2.rs +++ b/gcc/testsuite/rust/compile/additional-trait-bounds2nr2.rs @@ -1,5 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } - #![feature(optin_builtin_traits)] pub unsafe auto trait Send {} diff --git a/gcc/testsuite/rust/compile/all-cast.rs b/gcc/testsuite/rust/compile/all-cast.rs index fa24373..6d8576c 100644 --- a/gcc/testsuite/rust/compile/all-cast.rs +++ b/gcc/testsuite/rust/compile/all-cast.rs @@ -4,7 +4,7 @@ fn main() { 0u32 as char; // { dg-error "cannot cast .u32. as .char., only .u8. can be cast as .char." } - let x = &[1_usize, 2] as [usize]; // { dg-error "cast to unsized type: .& .usize:CAPACITY.. as ..usize.." } + let x = &[1_usize, 2] as [usize]; // { dg-error "cast to unsized type: .& .usize; 2.. as ..usize.." } let a = &0u8; // Here, `x` is a `&u8`. let y: u32 = a as u32; // { dg-error "casting .& u8. as .u32. is invalid" } diff --git a/gcc/testsuite/rust/compile/arrays2.rs b/gcc/testsuite/rust/compile/arrays2.rs index 668bcf0..1090059 100644 --- a/gcc/testsuite/rust/compile/arrays2.rs +++ b/gcc/testsuite/rust/compile/arrays2.rs @@ -1,5 +1,4 @@ -// { dg-additional-options "-w" } fn main() { let array: [i32; 5] = [1, 2, 3]; - // { dg-error "mismatched types, expected an array with a fixed size of 5 elements, found one with 3 elements" "" { target *-*-* } .-1 } + // { dg-error "mismatched types, expected ..i32; 5.. but got ...integer.; 3.. .E0308." "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/rust/compile/auto_traits2.rs b/gcc/testsuite/rust/compile/auto_traits2.rs index 382d446..7004761 100644 --- a/gcc/testsuite/rust/compile/auto_traits2.rs +++ b/gcc/testsuite/rust/compile/auto_traits2.rs @@ -15,7 +15,7 @@ fn foo(a: &(dyn A + Send + Sync)) { struct S; impl A for S { - fn a_method(&self) {} // { dg-warning "unused name" } + fn a_method(&self) {} } fn main() { diff --git a/gcc/testsuite/rust/compile/bad-rpit1.rs b/gcc/testsuite/rust/compile/bad-rpit1.rs new file mode 100644 index 0000000..d8c21b1 --- /dev/null +++ b/gcc/testsuite/rust/compile/bad-rpit1.rs @@ -0,0 +1,26 @@ +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn id(&self) -> i32; +} + +struct A; +struct B; + +impl Foo for A { + fn id(&self) -> i32 { + 1 + } +} + +impl Foo for B { + fn id(&self) -> i32 { + 2 + } +} + +fn make_foo(cond: bool) -> impl Foo { + if cond { A } else { B } + // { dg-error "mismatched types, expected .A. but got .B. .E0308." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/bug-with-default-generic.rs b/gcc/testsuite/rust/compile/bug-with-default-generic.rs new file mode 100644 index 0000000..25f46a0 --- /dev/null +++ b/gcc/testsuite/rust/compile/bug-with-default-generic.rs @@ -0,0 +1,15 @@ +#[lang = "sized"] +pub trait Sized {} + +pub trait MyBinaryTrait<Rhs = Self> { + fn do_something(&self, rhs: &Rhs); +} + +struct Foo<T> { + // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } + value: T, +} + +impl<T> MyBinaryTrait for Foo<T> { + fn do_something(&self, _rhs: &Self) {} +} diff --git a/gcc/testsuite/rust/compile/const3.rs b/gcc/testsuite/rust/compile/const3.rs index 22dc3d3..c1d0f29 100644 --- a/gcc/testsuite/rust/compile/const3.rs +++ b/gcc/testsuite/rust/compile/const3.rs @@ -3,5 +3,5 @@ fn size() -> usize { } fn main() { - let a = [15; size()]; // { dg-error "only functions marked as .const. are allowed to be called from constant contexts" } + let a = [15; size()]; // { dg-error "calls in constants are limited to constant functions, tuple structs and tuple variants" } } diff --git a/gcc/testsuite/rust/compile/const_generics_10.rs b/gcc/testsuite/rust/compile/const_generics_10.rs new file mode 100644 index 0000000..7e3bc86 --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_10.rs @@ -0,0 +1,32 @@ +#[lang = "sized"] +trait Sized {} + +const M: usize = 4; + +struct Foo<T, const N: usize = 1> { + value: [T; N], +} + +fn main() { + let foo = Foo::<i32> { value: [15] }; + let foo = Foo::<i32, 2> { value: [15, 13] }; + let foo: Foo<i32, 2> = Foo { value: [15, 13] }; + let foo: Foo<i32, 2> = Foo::<i32, 2> { value: [15, 13] }; + let foo: Foo<i32, { 1 + 1 }> = Foo { value: [15, 13] }; + let foo = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; + let foo: Foo<i32, { 1 + 1 }> = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; + let foo: Foo<i32, M> = Foo::<i32, 4> { + value: [15, 13, 11, 9], + }; + + let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, 3> { value: [15, 13] }; + // { dg-error {mismatched types, expected ..T=i32; 3.. but got ...integer.; 2.. .E0308.} "" { target *-*-* } .-1 } + // { dg-error {mismatched types, expected ..T=i32; 2.. but got ..T=i32; 3.. .E0308.} "" { target *-*-* } .-2 } + + let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, M> { value: [15, 13] }; + // { dg-error {mismatched types, expected ..T=i32; 4.. but got ...integer.; 2.. .E0308.} "" { target *-*-* } .-1 } + // { dg-error {mismatched types, expected ..T=i32; 2.. but got ..T=i32; 4.. .E0308.} "" { target *-*-* } .-2 } + + let invalid_foo: Foo<i32> = Foo::<i32, 2> { value: [15, 13] }; + // { dg-error {mismatched types, expected ..T=i32; 1.. but got ..T=i32; 2.. .E0308.} "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/const_generics_11.rs b/gcc/testsuite/rust/compile/const_generics_11.rs new file mode 100644 index 0000000..de902ee --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_11.rs @@ -0,0 +1,14 @@ +// { dg-options "-w" } + +#[lang = "sized"] +trait Sized {} + +struct Matrix<T, const ROWS: usize, const COLS: usize> { + data: [[T; COLS]; ROWS], +} + +fn main() { + let _: Matrix<u8, 2, 3> = Matrix { + data: [[1, 2, 3], [4, 5, 6]], + }; +} diff --git a/gcc/testsuite/rust/compile/const_generics_12.rs b/gcc/testsuite/rust/compile/const_generics_12.rs new file mode 100644 index 0000000..a17c525 --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_12.rs @@ -0,0 +1,14 @@ +// { dg-options "-w" } + +#[lang = "sized"] +trait Sized {} + +const BASE: usize = 2; + +struct Foo<T, const N: usize> { + data: [T; N], +} + +fn main() { + let _ = Foo::<u8, { BASE + 1 * 2 }> { data: [0; 4] }; +} diff --git a/gcc/testsuite/rust/compile/const_generics_13.rs b/gcc/testsuite/rust/compile/const_generics_13.rs new file mode 100644 index 0000000..20dd0b90 --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_13.rs @@ -0,0 +1,11 @@ +#[lang = "sized"] +trait Sized {} + +struct Foo<T, const N: usize> { + value: [T; N], +} + +fn main() { + let foo: Foo<_, _>; + // { dg-error {type provided when a constant was expected .E0747.} "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/const_generics_14.rs b/gcc/testsuite/rust/compile/const_generics_14.rs new file mode 100644 index 0000000..4d52efb --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_14.rs @@ -0,0 +1,13 @@ +#[lang = "sized"] +trait Sized {} + +type MyLen = usize; +struct Foo<T, const N: usize> { + data: [T; N], +} + +fn main() { + let _ = Foo::<u8, MyLen> { data: [1, 2, 3] }; + // { dg-error {type provided when a constant was expected .E0747.} "" { target *-*-* } .-1 } + // { dg-error {expected an ADT type for constructor} "" { target *-*-* } .-2 } +} diff --git a/gcc/testsuite/rust/compile/const_generics_15.rs b/gcc/testsuite/rust/compile/const_generics_15.rs new file mode 100644 index 0000000..a160abf --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_15.rs @@ -0,0 +1,16 @@ +#[lang = "sized"] +trait Sized {} + +enum Foo<const N: usize> { + A([u8; N]), +} + +union Bar<const N: usize> { + a: [i32; N], + b: [u8; N], +} + +fn main() { + let _ = Foo::<4>::A([1, 2, 3, 4]); + let _ = Bar::<4> { a: [0; 4] }; +} diff --git a/gcc/testsuite/rust/compile/const_generics_16.rs b/gcc/testsuite/rust/compile/const_generics_16.rs new file mode 100644 index 0000000..060dbda --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_16.rs @@ -0,0 +1,10 @@ +#[lang = "sized"] +trait Sized {} + +struct Foo<T = u8, const N: usize = 4> { + data: [T; N], // { dg-warning "field is never read: .data." } +} + +fn main() { + let _x = Foo { data: [1, 2, 3, 4] }; +} diff --git a/gcc/testsuite/rust/compile/const_generics_3.rs b/gcc/testsuite/rust/compile/const_generics_3.rs index 524d48d..3415f17 100644 --- a/gcc/testsuite/rust/compile/const_generics_3.rs +++ b/gcc/testsuite/rust/compile/const_generics_3.rs @@ -1,28 +1,21 @@ -// { dg-additional-options "-w -frust-name-resolution-2.0" } - #[lang = "sized"] trait Sized {} const M: usize = 4; struct Foo<T, const N: usize = 1> { - value: [T; N], + value: [T; N], // { dg-warning "field is never read: .value." } } fn main() { - let foo = Foo::<i32> { value: [15] }; - let foo = Foo::<i32, 2> { value: [15, 13] }; - let foo: Foo<i32, 2> = Foo { value: [15, 13] }; - let foo: Foo<i32, 2> = Foo::<i32, 2> { value: [15, 13] }; - let foo: Foo<i32, { 1 + 1 }> = Foo { value: [15, 13] }; - let foo = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; - let foo: Foo<i32, { 1 + 1 }> = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; - let foo: Foo<i32, M> = Foo::<i32, 4> { + let _foo = Foo::<i32> { value: [15] }; + let _foo = Foo::<i32, 2> { value: [15, 13] }; + let _foo: Foo<i32, 2> = Foo { value: [15, 13] }; + let _foo: Foo<i32, 2> = Foo::<i32, 2> { value: [15, 13] }; + let _foo: Foo<i32, { 1 + 1 }> = Foo { value: [15, 13] }; + let _foo = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; + let _foo: Foo<i32, { 1 + 1 }> = Foo::<i32, { 1 + 1 }> { value: [15, 13] }; + let _foo: Foo<i32, M> = Foo::<i32, 4> { value: [15, 13, 11, 9], }; - - // FIXME: Add proper const typecheck errors here - let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, 3> { value: [15, 13] }; - let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, M> { value: [15, 13] }; - let invalid_foo: Foo<i32> = Foo::<i32, 2> { value: [15, 13] }; } diff --git a/gcc/testsuite/rust/compile/const_generics_5.rs b/gcc/testsuite/rust/compile/const_generics_5.rs index 685229e..4d05569 100644 --- a/gcc/testsuite/rust/compile/const_generics_5.rs +++ b/gcc/testsuite/rust/compile/const_generics_5.rs @@ -1,4 +1,3 @@ -// { dg-options "-w" } struct Foo<const N: usize = { 14 }>; const M: usize = 15; @@ -8,5 +7,6 @@ fn main() { let _: Foo<15> = Foo; let _: Foo<{ M }> = Foo; let _: Foo<M> = Foo; - // let _: Foo<N> = Foo; this causes an ICE we need to do const generics + let _: Foo<N> = Foo; + // { dg-error {type provided when a constant was expected .E0747.} "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/rust/compile/const_generics_8.rs b/gcc/testsuite/rust/compile/const_generics_8.rs index bb34652..ce5e1b5 100644 --- a/gcc/testsuite/rust/compile/const_generics_8.rs +++ b/gcc/testsuite/rust/compile/const_generics_8.rs @@ -9,12 +9,13 @@ type Bipboupe<const N: i32 = 15> = Bidule; trait Fooable<const N: i32 = 15> {} union Bidoulepe<const N: i32 = 15> { - // { dg-error "default values for const generic parameters are not allowed in .union. items" "" {target *-*-* } .-1 } int: i32, float: f32, } -fn const_default<const N: i32 = 15>() {} // { dg-error "default values for const generic parameters are not allowed in .function. items" } +fn const_default<const N: i32 = 15>() {} // { dg-error "default values for const generic parameters are not allowed here" } // Note - missing generic parameter - needs name resolution on const generics -impl<const N: i32 = 15> Bidule {} // { dg-error "default values for const generic parameters are not allowed in .impl. items" } +impl<const N: i32 = 15> Bidule {} +// { dg-error "default values for const generic parameters are not allowed here" "" {target *-*-* } .-1 } +// { dg-error "unconstrained type parameter" "" {target *-*-* } .-2 } diff --git a/gcc/testsuite/rust/compile/const_generics_9.rs b/gcc/testsuite/rust/compile/const_generics_9.rs new file mode 100644 index 0000000..98e2d3f --- /dev/null +++ b/gcc/testsuite/rust/compile/const_generics_9.rs @@ -0,0 +1,13 @@ +// { dg-options "-w" } + +#[lang = "sized"] +trait Sized {} + +struct ArrayWrapper<T, const N: usize> { + data: [T; N], +} + +pub fn test() -> [u8; 4] { + let a = ArrayWrapper { data: [1u8; 4] }; + a.data +} diff --git a/gcc/testsuite/rust/compile/deferred_const_inference.rs b/gcc/testsuite/rust/compile/deferred_const_inference.rs new file mode 100644 index 0000000..25a3b17 --- /dev/null +++ b/gcc/testsuite/rust/compile/deferred_const_inference.rs @@ -0,0 +1,7 @@ +// { dg-additional-options "-frust-compile-until=typecheck" } + +// #![feature(generic_arg_infer)] + +fn main() { + let a: [u32; _] = [15u32]; +} diff --git a/gcc/testsuite/rust/compile/derive-debug1.rs b/gcc/testsuite/rust/compile/derive-debug1.rs index cf2187d..5927374 100644 --- a/gcc/testsuite/rust/compile/derive-debug1.rs +++ b/gcc/testsuite/rust/compile/derive-debug1.rs @@ -23,15 +23,15 @@ mod core { } } -#[derive(Debug)] // { dg-warning "unused name" } +#[derive(Debug)] // { dg-warning "stub implementation" "" { target *-*-* } .-1 } struct Foo { a: i32, b: i64 } // { dg-warning "is never constructed" } -#[derive(Debug)] // { dg-warning "unused name" } +#[derive(Debug)] // { dg-warning "stub implementation" "" { target *-*-* } .-1 } struct Bar(i32, i32); // { dg-warning "is never constructed" } -#[derive(Debug)] // { dg-warning "unused name" } +#[derive(Debug)] // { dg-warning "stub implementation" "" { target *-*-* } .-1 } enum Baz { A, diff --git a/gcc/testsuite/rust/compile/derive_macro1.rs b/gcc/testsuite/rust/compile/derive_macro1.rs index bc10d60..8c42aba 100644 --- a/gcc/testsuite/rust/compile/derive_macro1.rs +++ b/gcc/testsuite/rust/compile/derive_macro1.rs @@ -7,7 +7,7 @@ pub trait Clone { } // This warning can be removed once we properly handle implems with #[automatically_derived] -#[derive(Clone)] // { dg-warning "unused name .self." } +#[derive(Clone)] pub struct S; fn main() { diff --git a/gcc/testsuite/rust/compile/derive_partial_ord1.rs b/gcc/testsuite/rust/compile/derive_partial_ord1.rs new file mode 100644 index 0000000..eeca62d --- /dev/null +++ b/gcc/testsuite/rust/compile/derive_partial_ord1.rs @@ -0,0 +1,464 @@ +// { dg-additional-options "-w" } + +#![feature(intrinsics)] + +mod core { + mod option { + // #[rustc_diagnostic_item = "option_type"] + #[stable(feature = "rust1", since = "1.0.0")] + pub enum Option<T> { + /// No value + #[lang = "None"] + #[stable(feature = "rust1", since = "1.0.0")] + None, + /// Some value `T` + #[lang = "Some"] + #[stable(feature = "rust1", since = "1.0.0")] + Some(#[stable(feature = "rust1", since = "1.0.0")] T), + } + } + + mod marker { + #[lang = "phantom_data"] + #[stable(feature = "rust1", since = "1.0.0")] + pub struct PhantomData<T: ?Sized>; + + #[unstable(feature = "structural_match", issue = "31434")] + // #[rustc_on_unimplemented(message = "the type `{Self}` does not `#[derive(PartialEq)]`")] + #[lang = "structural_peq"] + pub trait StructuralPartialEq { + // Empty. + } + + #[unstable(feature = "structural_match", issue = "31434")] + // #[rustc_on_unimplemented(message = "the type `{Self}` does not `#[derive(Eq)]`")] + #[lang = "structural_teq"] + pub trait StructuralEq { + // Empty. + } + + #[stable(feature = "rust1", since = "1.0.0")] + #[lang = "sized"] + // #[rustc_on_unimplemented( + // message = "the size for values of type `{Self}` cannot be known at compilation time", + // label = "doesn't have a size known at compile-time" + // )] + // #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable + // #[rustc_specialization_trait] + pub trait Sized { + // Empty. + } + } + + mod cmp { + use super::marker::Sized; + use super::option::Option; + + // #[derive(Clone, Copy, PartialEq, Debug, Hash)] + #[stable(feature = "rust1", since = "1.0.0")] + pub enum Ordering { + /// An ordering where a compared value is less than another. + #[stable(feature = "rust1", since = "1.0.0")] + Less = -1, + /// An ordering where a compared value is equal to another. + #[stable(feature = "rust1", since = "1.0.0")] + Equal = 0, + /// An ordering where a compared value is greater than another. + #[stable(feature = "rust1", since = "1.0.0")] + Greater = 1, + } + + #[lang = "eq"] + #[stable(feature = "rust1", since = "1.0.0")] + #[doc(alias = "==")] + #[doc(alias = "!=")] + // #[rustc_on_unimplemented( + // message = "can't compare `{Self}` with `{Rhs}`", + // label = "no implementation for `{Self} == {Rhs}`" + // )] + pub trait PartialEq<Rhs: ?Sized = Self> { + /// This method tests for `self` and `other` values to be equal, and is used + /// by `==`. + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn eq(&self, other: &Rhs) -> bool; + + fn ne(&self, other: &Rhs) -> bool { + !self.eq(other) + } + } + + #[doc(alias = "==")] + #[doc(alias = "!=")] + #[stable(feature = "rust1", since = "1.0.0")] + pub trait Eq: PartialEq<Self> { + // this method is used solely by #[deriving] to assert + // that every component of a type implements #[deriving] + // itself, the current deriving infrastructure means doing this + // assertion without using a method on this trait is nearly + // impossible. + // + // This should never be implemented by hand. + #[doc(hidden)] + #[stable(feature = "rust1", since = "1.0.0")] + fn assert_receiver_is_total_eq(&self) {} + } + + #[lang = "partial_ord"] + #[stable(feature = "rust1", since = "1.0.0")] + #[doc(alias = ">")] + #[doc(alias = "<")] + #[doc(alias = "<=")] + #[doc(alias = ">=")] + // #[rustc_on_unimplemented( + // message = "can't compare `{Self}` with `{Rhs}`", + // label = "no implementation for `{Self} < {Rhs}` and `{Self} > {Rhs}`" + // )] + pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { + /// This method returns an ordering between `self` and `other` values if one exists. + /// + /// # Examples + /// + /// ``` + /// use std::cmp::Ordering; + /// + /// let result = 1.0.partial_cmp(&2.0); + /// assert_eq!(result, Some(Ordering::Less)); + /// + /// let result = 1.0.partial_cmp(&1.0); + /// assert_eq!(result, Some(Ordering::Equal)); + /// + /// let result = 2.0.partial_cmp(&1.0); + /// assert_eq!(result, Some(Ordering::Greater)); + /// ``` + /// + /// When comparison is impossible: + /// + /// ``` + /// let result = f64::NAN.partial_cmp(&1.0); + /// assert_eq!(result, None); + /// ``` + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; + + /// This method tests less than (for `self` and `other`) and is used by the `<` operator. + /// + /// # Examples + /// + /// ``` + /// let result = 1.0 < 2.0; + /// assert_eq!(result, true); + /// + /// let result = 2.0 < 1.0; + /// assert_eq!(result, false); + /// ``` + #[inline] + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn lt(&self, other: &Rhs) -> bool { + match self.partial_cmp(other) { + Option::Some(Ordering::Less) => true, + _ => false, + } + } + + /// This method tests less than or equal to (for `self` and `other`) and is used by the `<=` + /// operator. + /// + /// # Examples + /// + /// ``` + /// let result = 1.0 <= 2.0; + /// assert_eq!(result, true); + /// + /// let result = 2.0 <= 2.0; + /// assert_eq!(result, true); + /// ``` + #[inline] + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn le(&self, other: &Rhs) -> bool { + match self.partial_cmp(other) { + Option::Some(Ordering::Less | Ordering::Equal) => true, + _ => false, + } + } + + /// This method tests greater than (for `self` and `other`) and is used by the `>` operator. + /// + /// # Examples + /// + /// ``` + /// let result = 1.0 > 2.0; + /// assert_eq!(result, false); + /// + /// let result = 2.0 > 2.0; + /// assert_eq!(result, false); + /// ``` + #[inline] + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn gt(&self, other: &Rhs) -> bool { + match self.partial_cmp(other) { + Option::Some(Ordering::Greater) => true, + _ => false, + } + } + + /// This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` + /// operator. + /// + /// # Examples + /// + /// ``` + /// let result = 2.0 >= 1.0; + /// assert_eq!(result, true); + /// + /// let result = 2.0 >= 2.0; + /// assert_eq!(result, true); + /// ``` + #[inline] + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn ge(&self, other: &Rhs) -> bool { + match self.partial_cmp(other) { + Option::Some(Ordering::Greater | Ordering::Equal) => true, + _ => false, + } + } + } + + #[doc(alias = "<")] + #[doc(alias = ">")] + #[doc(alias = "<=")] + #[doc(alias = ">=")] + #[stable(feature = "rust1", since = "1.0.0")] + pub trait Ord: Eq + PartialOrd<Self> { + /// This method returns an [`Ordering`] between `self` and `other`. + /// + /// By convention, `self.cmp(&other)` returns the ordering matching the expression + /// `self <operator> other` if true. + /// + /// # Examples + /// + /// ``` + /// use std::cmp::Ordering; + /// + /// assert_eq!(5.cmp(&10), Ordering::Less); + /// assert_eq!(10.cmp(&5), Ordering::Greater); + /// assert_eq!(5.cmp(&5), Ordering::Equal); + /// ``` + #[must_use] + #[stable(feature = "rust1", since = "1.0.0")] + fn cmp(&self, other: &Self) -> Ordering; + + /// Compares and returns the maximum of two values. + /// + /// Returns the second argument if the comparison determines them to be equal. + /// + /// # Examples + /// + /// ``` + /// assert_eq!(2, 1.max(2)); + /// assert_eq!(2, 2.max(2)); + /// ``` + #[stable(feature = "ord_max_min", since = "1.21.0")] + #[must_use] + fn max(self, other: Self) -> Self + where + Self: Sized, + { + self + } + + /// Compares and returns the minimum of two values. + /// + /// Returns the first argument if the comparison determines them to be equal. + /// + /// # Examples + /// + /// ``` + /// assert_eq!(1, 1.min(2)); + /// assert_eq!(2, 2.min(2)); + /// ``` + #[stable(feature = "ord_max_min", since = "1.21.0")] + #[must_use] + fn min(self, other: Self) -> Self + where + Self: Sized, + { + self + } + + /// Restrict a value to a certain interval. + /// + /// Returns `max` if `self` is greater than `max`, and `min` if `self` is + /// less than `min`. Otherwise this returns `self`. + /// + /// # Panics + /// + /// Panics if `min > max`. + /// + /// # Examples + /// + /// ``` + /// #![feature(clamp)] + /// + /// assert!((-3).clamp(-2, 1) == -2); + /// assert!(0.clamp(-2, 1) == 0); + /// assert!(2.clamp(-2, 1) == 1); + /// ``` + #[must_use] + #[unstable(feature = "clamp", issue = "44095")] + fn clamp(self, min: Self, max: Self) -> Self + where + Self: Sized, + { + if self < min { + min + } else if self > max { + max + } else { + self + } + } + } + } + + pub mod intrinsics { + #[lang = "discriminant_kind"] + pub trait DiscriminantKind { + #[lang = "discriminant_type"] + type Discriminant; + } + + extern "rust-intrinsic" { + pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant; + } + } +} + +use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; +use core::marker::Sized; +use core::option::Option; + +// for comparing discriminant_value +impl PartialEq for isize { + fn eq(&self, other: &Self) -> bool { + *self == *other + } +} + +// for comparing discriminant_value +impl PartialOrd for isize { + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + if *self > *other { + Option::Some(Ordering::Greater) + } else if *self < *other { + Option::Some(Ordering::Less) + } else { + Option::Some(Ordering::Equal) + } + } + + fn lt(&self, other: &Self) -> bool { + *self < *other + } + fn le(&self, other: &Self) -> bool { + *self <= *other + } + fn ge(&self, other: &Self) -> bool { + *self >= *other + } + fn gt(&self, other: &Self) -> bool { + *self > *other + } +} + +impl PartialEq for i32 { + fn eq(&self, other: &Self) -> bool { + *self == *other + } +} + +impl PartialOrd for i32 { + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + if *self > *other { + Option::Some(Ordering::Greater) + } else if *self < *other { + Option::Some(Ordering::Less) + } else { + Option::Some(Ordering::Equal) + } + } + + fn lt(&self, other: &Self) -> bool { + *self < *other + } + fn le(&self, other: &Self) -> bool { + *self <= *other + } + fn ge(&self, other: &Self) -> bool { + *self >= *other + } + fn gt(&self, other: &Self) -> bool { + *self > *other + } +} + +impl Ord for i32 { + fn cmp(&self, other: &Self) -> Ordering { + if *self > *other { + Ordering::Greater + } else if *self < *other { + Ordering::Less + } else { + Ordering::Equal + } + } +} + +impl Eq for i32 {} + +#[derive(PartialEq, PartialOrd)] +enum Foo { + A, + B(i32, i32, i32), + C { inner: i32, outer: i32 }, +} + +#[derive(Ord, PartialOrd, PartialEq, Eq)] +struct Bar { + a: i32, +} + +#[derive(Ord, PartialOrd, PartialEq, Eq)] +struct BarFull { + a: i32, + b: i32, + c: i32, + d: i32, +} + +extern "C" { + fn puts(s: *const i8); +} + +fn print(s: &str) { + unsafe { + puts(s as *const str as *const i8); + } +} + +fn main() { + let a = Foo::A; + let b = Foo::B(15, 14, 13); + + match a.partial_cmp(&b) { + Option::Some(Ordering::Less) => print("less"), + Option::Some(Ordering::Greater) => print("greater"), + Option::Some(Ordering::Equal) => print("equal"), + _ => print("uuuuh woops lol"), + } +} diff --git a/gcc/testsuite/rust/compile/enum_variant_name.rs b/gcc/testsuite/rust/compile/enum_variant_name.rs index 671fced..965acd1 100644 --- a/gcc/testsuite/rust/compile/enum_variant_name.rs +++ b/gcc/testsuite/rust/compile/enum_variant_name.rs @@ -1,4 +1,4 @@ -// { dg-additional-options "-w -frust-name-resolution-2.0" } +// { dg-additional-options "-w" } struct E1; enum Test { diff --git a/gcc/testsuite/rust/compile/format_args_basic_expansion.rs b/gcc/testsuite/rust/compile/format_args_basic_expansion.rs index 40bcd3c..cedb62c 100644 --- a/gcc/testsuite/rust/compile/format_args_basic_expansion.rs +++ b/gcc/testsuite/rust/compile/format_args_basic_expansion.rs @@ -35,7 +35,6 @@ pub mod core { impl Display for i32 { fn fmt(&self, _: &mut Formatter) -> Result { - // { dg-warning "unused name .self." "" { target *-*-* } .-1 } Result } } diff --git a/gcc/testsuite/rust/compile/format_args_extra_comma.rs b/gcc/testsuite/rust/compile/format_args_extra_comma.rs index fcc435c..dc48a3a 100644 --- a/gcc/testsuite/rust/compile/format_args_extra_comma.rs +++ b/gcc/testsuite/rust/compile/format_args_extra_comma.rs @@ -35,7 +35,6 @@ pub mod core { impl Display for i32 { fn fmt(&self, _: &mut Formatter) -> Result { - // { dg-warning "unused name .self." "" { target *-*-* } .-1 } Result } } diff --git a/gcc/testsuite/rust/compile/generics8.rs b/gcc/testsuite/rust/compile/generics8.rs index 88c4bac..2d30a9e 100644 --- a/gcc/testsuite/rust/compile/generics8.rs +++ b/gcc/testsuite/rust/compile/generics8.rs @@ -4,7 +4,7 @@ pub trait Sized {} struct Foo<A, B>(A, B); impl<T> Foo<i32, T> { - fn test(a: T) -> T { + fn test(a: T) -> T { // { dg-error "duplicate definitions with name .test." } a } } diff --git a/gcc/testsuite/rust/compile/generics9.rs b/gcc/testsuite/rust/compile/generics9.rs index 56c6198..949fbb1 100644 --- a/gcc/testsuite/rust/compile/generics9.rs +++ b/gcc/testsuite/rust/compile/generics9.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } struct Foo<A, B = (A, B)>(A, B); // { dg-error "type parameters with a default cannot use forward declared identifiers" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/glob_import_enum.rs b/gcc/testsuite/rust/compile/glob_import_enum.rs new file mode 100644 index 0000000..032a1db --- /dev/null +++ b/gcc/testsuite/rust/compile/glob_import_enum.rs @@ -0,0 +1,16 @@ +use self::Ordering::*; +use Ordering::*; + +enum Ordering { + A, + B, +} + +fn foo(_: Ordering) {} + +fn main() { + let a = A; + + foo(a); + foo(B); +} diff --git a/gcc/testsuite/rust/compile/impl_trait_diag.rs b/gcc/testsuite/rust/compile/impl_trait_diag.rs new file mode 100644 index 0000000..54a0cd2 --- /dev/null +++ b/gcc/testsuite/rust/compile/impl_trait_diag.rs @@ -0,0 +1,17 @@ +#[lang = "sized"] +pub trait Sized {} + +trait Foo { + fn method(&self); +} + +struct Bar; +impl Foo for Bar {} + +fn main() { + let x: impl Foo = Bar; // { dg-error ".impl Trait. not allowed outside of function and inherent method return types .E0562." } + + struct Wrapper { + field: impl Foo, // { dg-error ".impl Trait. not allowed outside of function and inherent method return types .E0562." } + } +} diff --git a/gcc/testsuite/rust/compile/impl_trait_generic_arg.rs b/gcc/testsuite/rust/compile/impl_trait_generic_arg.rs new file mode 100644 index 0000000..ecdb088 --- /dev/null +++ b/gcc/testsuite/rust/compile/impl_trait_generic_arg.rs @@ -0,0 +1,24 @@ +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn id(&self) -> u8; +} + +struct Bar; + +impl Foo for Bar { + fn id(&self) -> u8 { + 1 + } +} + +fn takes(val: impl Foo) -> u8 { + val.id() +} + +fn main() { + let b = Bar; + let x = takes::<Bar>(b); + // { dg-error "cannot provide explicit generic arguments when .impl Trait. is used in argument position .E0632." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/invalid_label_name.rs b/gcc/testsuite/rust/compile/invalid_label_name.rs index 66e40a6..d1c5a33 100644 --- a/gcc/testsuite/rust/compile/invalid_label_name.rs +++ b/gcc/testsuite/rust/compile/invalid_label_name.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } pub fn function() { 'continue: loop { // { dg-error "invalid label name .'continue." "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-1048.rs b/gcc/testsuite/rust/compile/issue-1048.rs new file mode 100644 index 0000000..8d4053a --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1048.rs @@ -0,0 +1,8 @@ +macro_rules! maybe_return { ($e:expr) => ($e); } + +fn frob(x: i32) -> i32{ + maybe_return! {x} + // { dg-error "mismatched types. expected .... but got .i32. .E0308." "" { target *-*-* } .-1 } + // should return -1 + -1 +} diff --git a/gcc/testsuite/rust/compile/issue-1485.rs b/gcc/testsuite/rust/compile/issue-1485.rs new file mode 100644 index 0000000..a0cd5a0 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1485.rs @@ -0,0 +1,16 @@ +#[lang = "sized"] +pub trait Sized {} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +struct BinOpInvalid { + lhs: i32, + rhs: i32, + f: impl FnOnce(i32) -> i32, // { dg-error ".impl Trait. not allowed outside of function and inherent method return types .E0562." } +} diff --git a/gcc/testsuite/rust/compile/issue-1487.rs b/gcc/testsuite/rust/compile/issue-1487.rs new file mode 100644 index 0000000..4a4d759 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1487.rs @@ -0,0 +1,15 @@ +// { dg-options "-w" } +#[lang = "sized"] +trait Sized {} + +trait Printable { + fn print(&self); +} + +struct Foo; + +impl Printable for Foo { + fn print(&self) {} +} + +fn take_printable(_: impl Printable) {} diff --git a/gcc/testsuite/rust/compile/issue-2015.rs b/gcc/testsuite/rust/compile/issue-2015.rs index 7789ecd..7e03651 100644 --- a/gcc/testsuite/rust/compile/issue-2015.rs +++ b/gcc/testsuite/rust/compile/issue-2015.rs @@ -1,4 +1,5 @@ -// { dg-additional-options "-frust-compile-until=lowering" } +#[lang = "sized"] +trait Sized {} macro_rules! impl_foo { () => { impl Foo } diff --git a/gcc/testsuite/rust/compile/issue-2043.rs b/gcc/testsuite/rust/compile/issue-2043.rs index efa1ded..92532b7 100644 --- a/gcc/testsuite/rust/compile/issue-2043.rs +++ b/gcc/testsuite/rust/compile/issue-2043.rs @@ -6,7 +6,6 @@ struct Foo<'a> { impl<'a> Foo<'a> { fn bar(self: &mut Foo<'a>) {} // { dg-warning "associated function is never used: .bar." "" { target *-*-* } .-1 } - // { dg-warning "unused name .self." "" { target *-*-* } .-2 } } fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-2166.rs b/gcc/testsuite/rust/compile/issue-2166.rs index 318f0a6..142ed17 100644 --- a/gcc/testsuite/rust/compile/issue-2166.rs +++ b/gcc/testsuite/rust/compile/issue-2166.rs @@ -11,7 +11,6 @@ impl Add for u32 { type Output = u32; fn add(self) -> u32 { - // { dg-warning "unused name" "" { target *-*-* } .-1 } 0 } } @@ -20,7 +19,6 @@ impl<'a> Add for &'a u32 { type Output = u32; fn add(self) -> <u32 as Add>::Output { - // { dg-warning "unused name" "" { target *-*-* } .-1 } 0 } } diff --git a/gcc/testsuite/rust/compile/issue-2238.rs b/gcc/testsuite/rust/compile/issue-2238.rs index 38871b3..6a43a13 100644 --- a/gcc/testsuite/rust/compile/issue-2238.rs +++ b/gcc/testsuite/rust/compile/issue-2238.rs @@ -10,7 +10,6 @@ fn main() { impl Bar for Foo { fn foo(&self) {} - // { dg-warning "unused name" "" { target *-*-* } .-1 } } let s = Foo; diff --git a/gcc/testsuite/rust/compile/issue-2680.rs b/gcc/testsuite/rust/compile/issue-2680.rs new file mode 100644 index 0000000..d5ae2ff44 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-2680.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-fdump-tree-gimple" } +pub fn test_cast() { + let i = 1; + // { dg-final { scan-tree-dump-times {const i32 i;} 1 gimple } } + let _j = i as i64; +} diff --git a/gcc/testsuite/rust/compile/issue-2907.rs b/gcc/testsuite/rust/compile/issue-2907.rs index 1af843f..fdf1953 100644 --- a/gcc/testsuite/rust/compile/issue-2907.rs +++ b/gcc/testsuite/rust/compile/issue-2907.rs @@ -15,7 +15,6 @@ impl<B: Bar> Foo for B { type Ty = u32; fn foo(self) -> Self::Ty { - // { dg-warning "unused name" "" { target *-*-* } .-1 } 14 } } diff --git a/gcc/testsuite/rust/compile/issue-3144.rs b/gcc/testsuite/rust/compile/issue-3144.rs new file mode 100644 index 0000000..4e61078 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3144.rs @@ -0,0 +1,29 @@ +#[lang = "sized"] +pub trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[lang = "clone"] +pub trait Clone { + fn clone(&self) -> Self; +} + +impl Clone for i32 { + fn clone(&self) -> i32 { + *self + } +} + +struct S {} + +#[derive(Clone, Copy)] +// { dg-error {bounds not satisfied for S .Clone. is not satisfied .E0277.} "" { target *-*-* } .-1 } +struct S2 { + a: i32, + s: S, +} + +fn main() -> i32 { + 0 +} diff --git a/gcc/testsuite/rust/compile/issue-3304.rs b/gcc/testsuite/rust/compile/issue-3304.rs index 6ab614f..cc376fa 100644 --- a/gcc/testsuite/rust/compile/issue-3304.rs +++ b/gcc/testsuite/rust/compile/issue-3304.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } #[lang = "sized"] trait Sized {} diff --git a/gcc/testsuite/rust/compile/issue-3454.rs b/gcc/testsuite/rust/compile/issue-3454.rs new file mode 100644 index 0000000..2a3c0c7 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3454.rs @@ -0,0 +1,20 @@ +#[lang = "sized"] +pub trait Sized {} + +macro_rules! impl_foo { + () => { impl Foo } +} + +pub trait Foo {} + +pub trait Bar { + type Baz; +} + +pub fn foo(_value: impl Bar<Baz = impl_foo!()>) -> i32 { + 15 +} + +pub fn bar(_value: impl Bar<Baz = impl Foo>) -> i32 { + 16 +} diff --git a/gcc/testsuite/rust/compile/issue-3524.rs b/gcc/testsuite/rust/compile/issue-3524.rs new file mode 100644 index 0000000..62c8c35 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3524.rs @@ -0,0 +1,9 @@ +struct A {} +// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } + +impl A { + fn main() {} + // { dg-warning "associated function is never used: .main." "" { target *-*-* } .-1 } +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3525.rs b/gcc/testsuite/rust/compile/issue-3525.rs new file mode 100644 index 0000000..84a7ebe --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3525.rs @@ -0,0 +1,6 @@ +// { dg-options "-w" } + +struct Foo(usize); + +const B: usize = A.0; +const A: Foo = Foo(123); diff --git a/gcc/testsuite/rust/compile/issue-3546.rs b/gcc/testsuite/rust/compile/issue-3546.rs new file mode 100644 index 0000000..d4ec0bb --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3546.rs @@ -0,0 +1,16 @@ +const L: usize = 3; + +fn main() { + let p = Printer {}; + p.print(); +} + +trait Print<const N: usize> { + fn print(&self) -> usize { + 3 + } +} + +struct Printer {} +impl Print<L> for Printer {} +// { dg-error "generic item takes at most 1 type arguments but 1 were supplied" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-3551.rs b/gcc/testsuite/rust/compile/issue-3551.rs new file mode 100644 index 0000000..6d6a812 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3551.rs @@ -0,0 +1,15 @@ +#[lang = "sized"] +pub trait Sized {} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +struct Bug { + a: [(); (|| 0)()], + // { dg-error "calls in constants are limited to constant functions, tuple structs and tuple variants" "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3599.rs b/gcc/testsuite/rust/compile/issue-3599.rs new file mode 100644 index 0000000..1d29fac --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3599.rs @@ -0,0 +1,8 @@ +#[lang = "sized"] +trait Sized {} + +trait Bar {} + +struct S; // { dg-warning "struct is never constructed" } + +pub fn test(foo: impl Bar) {} diff --git a/gcc/testsuite/rust/compile/issue-3618.rs b/gcc/testsuite/rust/compile/issue-3618.rs new file mode 100644 index 0000000..3bf2c7e --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3618.rs @@ -0,0 +1,2 @@ +static _X : () + = loop{}; // { dg-error "'loop' is not allowed in const context" } diff --git a/gcc/testsuite/rust/compile/issue-3642.rs b/gcc/testsuite/rust/compile/issue-3642.rs new file mode 100644 index 0000000..6d9decc --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3642.rs @@ -0,0 +1,9 @@ +#[lang = "sized"] +trait Sized {} + +pub trait T<X> { + const D: i32 = { + // { dg-error "mismatched types, expected .i32. but got .()." "" { target *-*-* } .-1 } + const C: X; + }; +} diff --git a/gcc/testsuite/rust/compile/issue-3660.rs b/gcc/testsuite/rust/compile/issue-3660.rs new file mode 100644 index 0000000..1f1c583 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3660.rs @@ -0,0 +1,3 @@ +pub static A: [u32; 2] = [1, 2]; + +pub static B: [u8; 2] = [3, 4]; diff --git a/gcc/testsuite/rust/compile/issue-3661.rs b/gcc/testsuite/rust/compile/issue-3661.rs new file mode 100644 index 0000000..8d03c36 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3661.rs @@ -0,0 +1,10 @@ +pub macro m($inner_str:expr) { + #[m = $inner_str] + // { dg-error "macro not found" "" { target *-*-* } .-1 } + + struct S; +} + +fn main() { + m!(stringify!(foo)); +} diff --git a/gcc/testsuite/rust/compile/issue-3671.rs b/gcc/testsuite/rust/compile/issue-3671.rs index e800d53..8015653 100644 --- a/gcc/testsuite/rust/compile/issue-3671.rs +++ b/gcc/testsuite/rust/compile/issue-3671.rs @@ -1,2 +1,2 @@ -impl Self<0> {} +impl Foo<0> {} // { dg-error "could not resolve type path" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-3836.rs b/gcc/testsuite/rust/compile/issue-3836.rs new file mode 100644 index 0000000..a228795 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3836.rs @@ -0,0 +1,67 @@ +// { dg-options "-w" } +mod core { + mod option { + pub enum Option<T> { + #[lang = "None"] + None, + #[lang = "Some"] + Some(T), + } + } + + mod marker { + #[lang = "sized"] + pub trait Sized {} + } + + mod cmp { + use super::marker::Sized; + use super::option::Option; + + pub enum Ordering { + Less = -1, + Equal = 0, + Greater = 1, + } + + #[lang = "eq"] + pub trait PartialEq<Rhs: ?Sized = Self> { + fn eq(&self, other: &Rhs) -> bool; + + fn ne(&self, other: &Rhs) -> bool { + !self.eq(other) + } + } + + #[lang = "partial_ord"] + pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { + fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; + } + } +} + +use core::cmp::{Ordering, PartialEq, PartialOrd}; +use core::marker::Sized; +use core::option::Option; + +impl PartialEq for i32 { + fn eq(&self, other: &Self) -> bool { + false + } +} + +impl PartialOrd for i32 { + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + Option::Some(Ordering::Equal) + } +} + +struct Foo { + a: i32, +} + +impl PartialEq for Foo { + fn eq(&self, other: &'_ Self) -> bool { + ::core::cmp::PartialEq::eq(&self.a, &other.a) + } +} diff --git a/gcc/testsuite/rust/compile/issue-3874.rs b/gcc/testsuite/rust/compile/issue-3874.rs new file mode 100644 index 0000000..ebce4b6 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3874.rs @@ -0,0 +1,4 @@ +fn wow(){ + &#[serde] + // { dg-error "found unexpected token .#. in null denotation" "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3876.rs b/gcc/testsuite/rust/compile/issue-3876.rs new file mode 100644 index 0000000..17b1590 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3876.rs @@ -0,0 +1,8 @@ +enum test { + A(i32), +} + +fn fun(x: i32) { + test::A { x } + // { dg-error "unknown field" "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3885.rs b/gcc/testsuite/rust/compile/issue-3885.rs new file mode 100644 index 0000000..050a59c --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3885.rs @@ -0,0 +1,7 @@ +pub fn test() { + let _u: [_; _] = [15u32]; + let _v: [u8; _] = [1, 2, 3]; + let _w: [_; 2] = [1.0, 2.0]; + let _x = [42; 5]; + let _y: [_; _] = _x; +} diff --git a/gcc/testsuite/rust/compile/issue-3915.rs b/gcc/testsuite/rust/compile/issue-3915.rs new file mode 100644 index 0000000..7132036 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3915.rs @@ -0,0 +1,28 @@ +// { dg-options "-w" } +#[lang = "sized"] +trait Sized {} + +trait Trait { + fn do_thing(); +} + +struct MyType; + +impl Trait for MyType { + fn do_thing() {} +} + +struct Wrapper<T: Trait> { + value: T, +} + +impl<T: Trait> Wrapper<T> { + fn call_it() { + T::do_thing(); + } +} + +fn main() { + let _ = Wrapper::<MyType> { value: MyType }; + Wrapper::<MyType>::call_it(); +} diff --git a/gcc/testsuite/rust/compile/issue-3916.rs b/gcc/testsuite/rust/compile/issue-3916.rs new file mode 100644 index 0000000..59b522b --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3916.rs @@ -0,0 +1,36 @@ +#![feature(rustc_attrs)] + +#[lang = "sized"] +trait Sized {} + +#[lang = "add"] +trait Add<Rhs = Self> { + type Output; + + fn add(self, rhs: Rhs) -> Self::Output; +} + +macro_rules! add_impl { + ($($t:ty)*) => ($( + impl Add for $t { + type Output = $t; + + #[inline] + #[rustc_inherit_overflow_checks] + fn add(self, other: $t) -> $t { self + other } + } + )*) +} + +add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } + +pub fn test(len: usize) -> u64 { + let mut i = 0; + let mut out = 0; + if i + 3 < len { + out = 123; + } else { + out = 456; + } + out +} diff --git a/gcc/testsuite/rust/compile/issue-3960.rs b/gcc/testsuite/rust/compile/issue-3960.rs new file mode 100644 index 0000000..57329f0 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3960.rs @@ -0,0 +1,7 @@ +fn main() { + struct G { + g: (), + } + let g = [0; G { g: () }]; + // { dg-error "mismatched types, expected .usize. but got .G. .E0308." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3978.rs b/gcc/testsuite/rust/compile/issue-3978.rs new file mode 100644 index 0000000..4f17d3d --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3978.rs @@ -0,0 +1,8 @@ +type Dimension = usize; + +pub fn main() {} + +mod m2 { + fn main() {} + // { dg-warning "function is never used" "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-4006.rs b/gcc/testsuite/rust/compile/issue-4006.rs new file mode 100644 index 0000000..328c7b6 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-4006.rs @@ -0,0 +1,13 @@ +#![feature(rustc_attrs)] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +pub fn main() { + asm!( + "xor eax, eax" + "xor eax, eax"); + // { dg-error "expected token .;." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/loop_constant_context.rs b/gcc/testsuite/rust/compile/loop_constant_context.rs new file mode 100644 index 0000000..ed0782b --- /dev/null +++ b/gcc/testsuite/rust/compile/loop_constant_context.rs @@ -0,0 +1,5 @@ +// { dg-error "'loop' is not allowed in const context" "" { target *-*-* } .+1 } +const CONST_LOOP : () = loop{}; + +// { dg-error "'loop' is not allowed in const context" "" { target *-*-* } .+1 } +static STATIC_LOOP : () = loop{};
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/macros/builtin/recurse2.rs b/gcc/testsuite/rust/compile/macros/builtin/recurse2.rs index 73e6ab4..fbb4b10 100644 --- a/gcc/testsuite/rust/compile/macros/builtin/recurse2.rs +++ b/gcc/testsuite/rust/compile/macros/builtin/recurse2.rs @@ -34,7 +34,7 @@ fn print_str(s: &str) { } } -// { dg-final { scan-assembler {"abheyho"} } } +// { dg-final { scan-assembler {"abheyho(\\0)?"} } } static S: &str = concat!("a", 'b', a!(), a!(b c d e f a!()), '\0'); fn main() { diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs index e5b38bb..bcbc8dd 100644 --- a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs @@ -1,4 +1,4 @@ -// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-additional-options "-frust-compile-until=lowering" } macro_rules! impl_fn_for_zst { ($( diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs index cfc8ab4..47514f1 100644 --- a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs @@ -1,4 +1,4 @@ -// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-additional-options "-frust-compile-until=lowering" } macro_rules! impl_fn_for_zst { ($( diff --git a/gcc/testsuite/rust/compile/macros/mbe/meta-param.rs b/gcc/testsuite/rust/compile/macros/mbe/meta-param.rs new file mode 100644 index 0000000..ed6e100 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/meta-param.rs @@ -0,0 +1,7 @@ +macro_rules! foo { + ($x:meta) => {0} +} + +pub fn main() -> i32 { + foo!(Clone) +} diff --git a/gcc/testsuite/rust/compile/match-identifierpattern-enum.rs b/gcc/testsuite/rust/compile/match-identifierpattern-enum.rs new file mode 100644 index 0000000..c712667 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-identifierpattern-enum.rs @@ -0,0 +1,12 @@ +enum Foo { + I(i32), +} + +fn main() { + let x = Foo::I(1); + + match x { + a @ Foo::I(b) => {}, + _ => {}, + }; +} diff --git a/gcc/testsuite/rust/compile/match-identifierpattern.rs b/gcc/testsuite/rust/compile/match-identifierpattern.rs new file mode 100644 index 0000000..6c558ac --- /dev/null +++ b/gcc/testsuite/rust/compile/match-identifierpattern.rs @@ -0,0 +1,9 @@ +fn main() { + let x = 1; + + match x { + 2 => {}, + a @ 3 => {}, + _ => {}, + } +} diff --git a/gcc/testsuite/rust/compile/match-restpattern-tuple-1.rs b/gcc/testsuite/rust/compile/match-restpattern-tuple-1.rs new file mode 100644 index 0000000..5cce3c4 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-restpattern-tuple-1.rs @@ -0,0 +1,8 @@ +fn main() { + let x = (1, 2, 3, 4); + + match x { + (1, .., 4) => {}, + _ => {} + } +}
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/match-restpattern-tuple-2.rs b/gcc/testsuite/rust/compile/match-restpattern-tuple-2.rs new file mode 100644 index 0000000..40900a3 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-restpattern-tuple-2.rs @@ -0,0 +1,8 @@ +fn main() { + let x = (1, 2, 3, 4); + + match x { + (1, .., 2, 3, 4, 5) => {}, // { dg-error "expected a tuple with 4 elements, found one with 5 elements" } + _ => {} + } +}
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/match-slicepattern-array.rs b/gcc/testsuite/rust/compile/match-slicepattern-array.rs new file mode 100644 index 0000000..e48ca75 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-slicepattern-array.rs @@ -0,0 +1,8 @@ +fn main() { + let a = [0, 1]; + + match a { + [0, 1] => {}, + _ => {} + } +} diff --git a/gcc/testsuite/rust/compile/match-slicepattern-slice.rs b/gcc/testsuite/rust/compile/match-slicepattern-slice.rs new file mode 100644 index 0000000..cc33d93 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-slicepattern-slice.rs @@ -0,0 +1,10 @@ +fn main() { + let arr = [1, 2]; + let slice: &[i32] = &arr; + + match slice { + [1] => {}, + [_, 2] => {}, + _ => {} + } +}
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/match-tuplestructpattern.rs b/gcc/testsuite/rust/compile/match-tuplestructpattern.rs new file mode 100644 index 0000000..0dae71e --- /dev/null +++ b/gcc/testsuite/rust/compile/match-tuplestructpattern.rs @@ -0,0 +1,9 @@ +fn main() { + struct A (i32, i32); + let a = A (0, 1); + + match a { + A (0, 1) => {}, + _ => {} + } +} diff --git a/gcc/testsuite/rust/compile/min_specialization1.rs b/gcc/testsuite/rust/compile/min_specialization1.rs index d38167e..ba97f87 100644 --- a/gcc/testsuite/rust/compile/min_specialization1.rs +++ b/gcc/testsuite/rust/compile/min_specialization1.rs @@ -9,7 +9,7 @@ pub trait Foo { pub struct Bar; impl Foo for Bar { - default fn foo(&self) -> bool { // { dg-warning "unused" } + default fn foo(&self) -> bool { true } } diff --git a/gcc/testsuite/rust/compile/name_resolution10.rs b/gcc/testsuite/rust/compile/name_resolution10.rs index 33643bd..f156f98 100644 --- a/gcc/testsuite/rust/compile/name_resolution10.rs +++ b/gcc/testsuite/rust/compile/name_resolution10.rs @@ -1,4 +1,4 @@ -// { dg-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-options "-frust-compile-until=lowering" } #![feature(decl_macro)] diff --git a/gcc/testsuite/rust/compile/name_resolution11.rs b/gcc/testsuite/rust/compile/name_resolution11.rs index a464d2a..329567a 100644 --- a/gcc/testsuite/rust/compile/name_resolution11.rs +++ b/gcc/testsuite/rust/compile/name_resolution11.rs @@ -1,4 +1,4 @@ -// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-additional-options "-frust-compile-until=lowering" } fn foo() { let b = 10; fn bar() { diff --git a/gcc/testsuite/rust/compile/name_resolution12.rs b/gcc/testsuite/rust/compile/name_resolution12.rs index 9cce31c..0f217aa 100644 --- a/gcc/testsuite/rust/compile/name_resolution12.rs +++ b/gcc/testsuite/rust/compile/name_resolution12.rs @@ -1,4 +1,4 @@ -// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-additional-options "-frust-compile-until=lowering" } const TOTO: i32 = 10; diff --git a/gcc/testsuite/rust/compile/name_resolution13.rs b/gcc/testsuite/rust/compile/name_resolution13.rs index 33edbf9..8356cf6 100644 --- a/gcc/testsuite/rust/compile/name_resolution13.rs +++ b/gcc/testsuite/rust/compile/name_resolution13.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - pub mod foo { pub macro bar() {} } diff --git a/gcc/testsuite/rust/compile/name_resolution14.rs b/gcc/testsuite/rust/compile/name_resolution14.rs index eaef6a5..44c43aa 100644 --- a/gcc/testsuite/rust/compile/name_resolution14.rs +++ b/gcc/testsuite/rust/compile/name_resolution14.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - pub mod foo { pub macro bar() {} } diff --git a/gcc/testsuite/rust/compile/name_resolution15.rs b/gcc/testsuite/rust/compile/name_resolution15.rs index 45f38da..e82c90e 100644 --- a/gcc/testsuite/rust/compile/name_resolution15.rs +++ b/gcc/testsuite/rust/compile/name_resolution15.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } #![feature(decl_macro)] pub mod foo { diff --git a/gcc/testsuite/rust/compile/name_resolution16.rs b/gcc/testsuite/rust/compile/name_resolution16.rs index 230722e..4db7b2e 100644 --- a/gcc/testsuite/rust/compile/name_resolution16.rs +++ b/gcc/testsuite/rust/compile/name_resolution16.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } #![feature(decl_macro)] pub mod foo { diff --git a/gcc/testsuite/rust/compile/name_resolution17.rs b/gcc/testsuite/rust/compile/name_resolution17.rs index 4859476..84ad380 100644 --- a/gcc/testsuite/rust/compile/name_resolution17.rs +++ b/gcc/testsuite/rust/compile/name_resolution17.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - struct Foo; fn Foo() {} // { dg-error ".Foo. defined multiple times" } diff --git a/gcc/testsuite/rust/compile/name_resolution18.rs b/gcc/testsuite/rust/compile/name_resolution18.rs index 5940149..17a3352 100644 --- a/gcc/testsuite/rust/compile/name_resolution18.rs +++ b/gcc/testsuite/rust/compile/name_resolution18.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - struct Marker; struct Foo { diff --git a/gcc/testsuite/rust/compile/name_resolution2.rs b/gcc/testsuite/rust/compile/name_resolution2.rs index 7e4f5a1..564c5d2 100644 --- a/gcc/testsuite/rust/compile/name_resolution2.rs +++ b/gcc/testsuite/rust/compile/name_resolution2.rs @@ -4,7 +4,7 @@ pub trait Sized {} struct Bar; trait Foo { - fn bar(&self) {} // { dg-warning "unused name" } + fn bar(&self) {} } pub fn outer() { diff --git a/gcc/testsuite/rust/compile/name_resolution20.rs b/gcc/testsuite/rust/compile/name_resolution20.rs index e6c2dd5..f131bb4 100644 --- a/gcc/testsuite/rust/compile/name_resolution20.rs +++ b/gcc/testsuite/rust/compile/name_resolution20.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - pub mod foo { pub macro bar() {} } diff --git a/gcc/testsuite/rust/compile/name_resolution22.rs b/gcc/testsuite/rust/compile/name_resolution22.rs index c49331e..bb5edda 100644 --- a/gcc/testsuite/rust/compile/name_resolution22.rs +++ b/gcc/testsuite/rust/compile/name_resolution22.rs @@ -1,4 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } struct Marker; struct Foo(Marker); diff --git a/gcc/testsuite/rust/compile/name_resolution23.rs b/gcc/testsuite/rust/compile/name_resolution23.rs index 50b8e81..843be2a 100644 --- a/gcc/testsuite/rust/compile/name_resolution23.rs +++ b/gcc/testsuite/rust/compile/name_resolution23.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - mod a { pub mod b { pub fn foo() {} diff --git a/gcc/testsuite/rust/compile/name_resolution24.rs b/gcc/testsuite/rust/compile/name_resolution24.rs index f4eb7b2..4350cd8 100644 --- a/gcc/testsuite/rust/compile/name_resolution24.rs +++ b/gcc/testsuite/rust/compile/name_resolution24.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - mod a { pub mod b { pub fn baz() {} diff --git a/gcc/testsuite/rust/compile/name_resolution25.rs b/gcc/testsuite/rust/compile/name_resolution25.rs index 3cacac7..0cadd9e 100644 --- a/gcc/testsuite/rust/compile/name_resolution25.rs +++ b/gcc/testsuite/rust/compile/name_resolution25.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - struct Test; // { dg-warning "struct is never constructed: .Test." } impl Test {} diff --git a/gcc/testsuite/rust/compile/name_resolution4.rs b/gcc/testsuite/rust/compile/name_resolution4.rs index b2eadbe..0fc72f6 100644 --- a/gcc/testsuite/rust/compile/name_resolution4.rs +++ b/gcc/testsuite/rust/compile/name_resolution4.rs @@ -2,7 +2,7 @@ pub trait Sized {} trait Foo { - fn foo(&self) {} // { dg-warning "unused name" } + fn foo(&self) {} } struct Bar; diff --git a/gcc/testsuite/rust/compile/name_resolution6.rs b/gcc/testsuite/rust/compile/name_resolution6.rs index e4087e6..b2b5f6b 100644 --- a/gcc/testsuite/rust/compile/name_resolution6.rs +++ b/gcc/testsuite/rust/compile/name_resolution6.rs @@ -1,4 +1,4 @@ -// { dg-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } +// { dg-options "-frust-compile-until=lowering" } pub mod foo { pub mod bar { diff --git a/gcc/testsuite/rust/compile/name_resolution7.rs b/gcc/testsuite/rust/compile/name_resolution7.rs index fa84e2f..78cb0b2 100644 --- a/gcc/testsuite/rust/compile/name_resolution7.rs +++ b/gcc/testsuite/rust/compile/name_resolution7.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - // check that macros by example do not get inserted in ribs like regular items pub mod foo { pub mod bar { diff --git a/gcc/testsuite/rust/compile/name_resolution8.rs b/gcc/testsuite/rust/compile/name_resolution8.rs index 6fb5170..aca1945 100644 --- a/gcc/testsuite/rust/compile/name_resolution8.rs +++ b/gcc/testsuite/rust/compile/name_resolution8.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - // check that macros by example get exported to the crate's root with #[macro_export] pub mod foo { pub mod bar { diff --git a/gcc/testsuite/rust/compile/name_resolution9.rs b/gcc/testsuite/rust/compile/name_resolution9.rs index 792b3bd..84ba3c5 100644 --- a/gcc/testsuite/rust/compile/name_resolution9.rs +++ b/gcc/testsuite/rust/compile/name_resolution9.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - pub mod foo { pub mod bar { fn f() { diff --git a/gcc/testsuite/rust/compile/nested_macro_definition.rs b/gcc/testsuite/rust/compile/nested_macro_definition.rs index c0b7250..b71afbd 100644 --- a/gcc/testsuite/rust/compile/nested_macro_definition.rs +++ b/gcc/testsuite/rust/compile/nested_macro_definition.rs @@ -1,5 +1,3 @@ -// { dg-options "-frust-name-resolution-2.0" } - macro_rules! toto { () => { macro_rules! tata { diff --git a/gcc/testsuite/rust/compile/nr2/compile.exp b/gcc/testsuite/rust/compile/nr2/compile.exp deleted file mode 100644 index 9e15cdd..0000000 --- a/gcc/testsuite/rust/compile/nr2/compile.exp +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2021-2024 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Run compile tests with name resolution 2.0 enabled - -# Load support procs. -load_lib rust-dg.exp - -# These tests don't run runtest_file_p consistently if it -# doesn't return the same values, so disable parallelization -# of this *.exp file. The first parallel runtest to reach -# this will run all the tests serially. -if ![gcc_parallel_test_run_p compile] { - return -} -gcc_parallel_test_enable 0 - -# Initialize `dg'. -dg-init - -namespace eval rust-nr2-ns { - # Exclude tests which aren't passing yet - # These should be removed from the exclude file over time - - set exclude_fh [open $srcdir/$subdir/exclude r] - set exclude_raw [lsort [split [read $exclude_fh] "\n"]] - close $exclude_fh - unset exclude_fh - - set exclude "" - foreach ent $exclude_raw { - if [regexp {^[^#].*} $ent] { - lappend exclude $ent - } - } - unset exclude_raw - - # Run tests in directories - # Manually specifying these, in case some other test file - # does something weird - set test_dirs {{} {macros builtin} {macros mbe} {macros proc} {torture}} - - set tests_expect_ok "" - set tests_expect_err "" - - set compile_dir [list {*}[file split $srcdir] {*}[file split $subdir]] - set compile_dir [lreplace $compile_dir end end] - - foreach test_dir $test_dirs { - foreach test [lsort [glob -nocomplain -tails -directory [file join {*}$compile_dir {*}$test_dir] *.rs]] { - # use '/' as the path seperator for entries in the exclude file - set test_lbl [join [list {*}$test_dir $test] "/"] - set idx [lsearch -exact -sorted $exclude $test_lbl] - if {$idx == -1} { - if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} { - lappend tests_expect_ok [list {*}$test_dir $test] - } - } else { - if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} { - lappend tests_expect_err [list {*}$test_dir $test] - } - set exclude [lreplace $exclude $idx $idx] - } - } - } - - # Generate failures for unmatched tests in the exclude list - foreach ent $exclude { - fail "$ent: could not exclude test" - } - unset exclude - - # run a test while catching record_test calls - set record_test_out "" - proc try_test { test } { - variable record_test_out - rename ::record_test record_test_old - - proc ::record_test { type msg args } { - namespace eval ::rust-nr2-ns { - set type [uplevel 1 {set type}] - set msg [uplevel 1 {set msg}] - variable record_test_out - switch $type { - FAIL { - lappend record_test_out [list $type $msg] - } - XPASS { - lappend record_test_out [list $type $msg] - } - } - } - } - - namespace eval :: { - set saved-dg-do-what-default ${dg-do-what-default} - set dg-do-what-default "compile" - dg-runtest [list [uplevel 1 {set test}]] "-frust-name-resolution-2.0" "" - set dg-do-what-default ${saved-dg-do-what-default} - } - - rename ::record_test "" - rename record_test_old ::record_test - - set record_test_cache $record_test_out - set record_test_out "" - return $record_test_cache - } - - # check for unexpected failures - foreach test $tests_expect_ok { - set fails [try_test [file join {*}$compile_dir {*}$test]] - if {[llength $fails] != 0} { - foreach ent $fails { - record_test [lindex $ent 0] "on nr2: [lindex $ent 1]" - } - } else { - record_test PASS "[file join {*}$test] on nr2" - } - } - - #check for unexpected successes - foreach test $tests_expect_err { - set fails [try_test [file join {*}$compile_dir {*}$test]] - if {[llength $fails] == 0} { - record_test XPASS "[file join {*}$test] on nr2" - } else { - record_test XFAIL "[file join {*}$test] on nr2 was rightfully excluded" - } - } -} - -# All done. -dg-finish - -gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude deleted file mode 100644 index c020e36..0000000 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ /dev/null @@ -1,17 +0,0 @@ -canonical_paths1.rs -issue-3315-2.rs -privacy5.rs -privacy8.rs -pub_restricted_1.rs -pub_restricted_2.rs -pub_restricted_3.rs -issue-2905-2.rs -derive-default1.rs -derive-eq-invalid.rs -torture/alt_patterns1.rs -torture/name_resolve1.rs -issue-3663.rs -issue-3671.rs -issue-3652.rs -issue-3649.rs -# please don't delete the trailing newline diff --git a/gcc/testsuite/rust/compile/offset_of1.rs b/gcc/testsuite/rust/compile/offset_of1.rs new file mode 100644 index 0000000..5b79699 --- /dev/null +++ b/gcc/testsuite/rust/compile/offset_of1.rs @@ -0,0 +1,11 @@ +// { dg-additional-options "-frust-compile-until=lowering -frust-assume-builtin-offset-of" } + +pub struct Foo { + a: i32, +} + +fn main() { + let _ = offset_of!(Foo, a); // valid + let _ = offset_of!("bloop", a); // { dg-error "could not parse type" } + let _ = offset_of!(Foo, 15); // { dg-error "could not parse field" } +} diff --git a/gcc/testsuite/rust/compile/offset_of2.rs b/gcc/testsuite/rust/compile/offset_of2.rs new file mode 100644 index 0000000..d4ad9c2 --- /dev/null +++ b/gcc/testsuite/rust/compile/offset_of2.rs @@ -0,0 +1,9 @@ +// { dg-additional-options "-frust-compile-until=compilation -frust-assume-builtin-offset-of" } + +pub struct Foo { + a: i32, +} + +fn main() { + let _ = offset_of!(Foo, a); // valid +} diff --git a/gcc/testsuite/rust/compile/parse_simple_path_fail_1.rs b/gcc/testsuite/rust/compile/parse_simple_path_fail_1.rs new file mode 100644 index 0000000..c112e40 --- /dev/null +++ b/gcc/testsuite/rust/compile/parse_simple_path_fail_1.rs @@ -0,0 +1,3 @@ +pub(in crate::) struct S; +// { dg-error "expecting ... but .::. found" "" { target *-*-* } .-1 } +// { dg-error "failed to parse item in crate" "" { target *-*-* } .-2 } diff --git a/gcc/testsuite/rust/compile/parse_simple_path_fail_2.rs b/gcc/testsuite/rust/compile/parse_simple_path_fail_2.rs new file mode 100644 index 0000000..94c49c3 --- /dev/null +++ b/gcc/testsuite/rust/compile/parse_simple_path_fail_2.rs @@ -0,0 +1,9 @@ +mod A { + struct B; +} + +use A{B}; +// { dg-error "unexpected token" "" { target *-*-* } .-1 } +// { dg-error "could not parse use tree" "" { target *-*-* } .-2 } +// { dg-error "failed to parse item in crate" "" { target *-*-* } 10 } +// ^^^ TODO: should the above error happen at line 10? diff --git a/gcc/testsuite/rust/compile/pub_restricted_1.rs b/gcc/testsuite/rust/compile/pub_restricted_1.rs index 9bda968..2afbeb4 100644 --- a/gcc/testsuite/rust/compile/pub_restricted_1.rs +++ b/gcc/testsuite/rust/compile/pub_restricted_1.rs @@ -6,8 +6,8 @@ pub mod foo { } } -pub(in foo::fah::baz) struct A1; // { dg-error "cannot find simple path segment .fah." } -pub(in fro::bulator::saindoux) struct A2; // { dg-error "cannot find simple path segment .fro." } -pub(in foo::bar::saindoux) struct A3; // { dg-error "cannot find simple path segment .saindoux." } +pub(in foo::fah::baz) struct A1; // { dg-error "could not resolve path .foo::fah::baz." } +pub(in fro::bulator::saindoux) struct A2; // { dg-error "could not resolve path .fro::bulator::saindoux." } +pub(in foo::bar::saindoux) struct A3; // { dg-error "could not resolve path .foo::bar::saindoux." } fn main() {} diff --git a/gcc/testsuite/rust/compile/pub_restricted_2.rs b/gcc/testsuite/rust/compile/pub_restricted_2.rs index 8588f27..fea9379 100644 --- a/gcc/testsuite/rust/compile/pub_restricted_2.rs +++ b/gcc/testsuite/rust/compile/pub_restricted_2.rs @@ -3,16 +3,16 @@ mod foo { mod bar { mod baz { - pub(in baz) struct A0; - pub(in bar::baz) struct A1; + pub(in super::baz) struct A0; + pub(in super::super::bar::baz) struct A1; pub(in foo::bar::baz) struct A2; mod sain { mod doux {} } - pub(in sain) struct A3; // { dg-error "restricted path is not an ancestor of the current module" } - pub(in sain::doux) struct A4; // { dg-error "restricted path is not an ancestor of the current module" } + pub(in self::sain) struct A3; // { dg-error "restricted path is not an ancestor of the current module" } + pub(in self::sain::doux) struct A4; // { dg-error "restricted path is not an ancestor of the current module" } } } } diff --git a/gcc/testsuite/rust/compile/same_field_name.rs b/gcc/testsuite/rust/compile/same_field_name.rs new file mode 100644 index 0000000..8e5b78c --- /dev/null +++ b/gcc/testsuite/rust/compile/same_field_name.rs @@ -0,0 +1,8 @@ +// https://doc.rust-lang.org/error_codes/E0124.html +fn main() { + struct Foo { + field1: i32, + field1: i32, // { dg-error "field .field1. is already declared" } + field1: i32, // { dg-error "field .field1. is already declared" } + } +} diff --git a/gcc/testsuite/rust/compile/self-in-impl.rs b/gcc/testsuite/rust/compile/self-in-impl.rs new file mode 100644 index 0000000..a567897 --- /dev/null +++ b/gcc/testsuite/rust/compile/self-in-impl.rs @@ -0,0 +1,15 @@ +// the error message here is what rustc >=1.66 emits +// rustc <1.66 emits a "cycle detected" error when +// trying to calculate the impl type +// +// since we aren't trying to match error messages too closely +// and the >=1.66 error message is nicer +// we may as well mimic that + +impl ((Self, i32)) {} +// { dg-error ".Self. is not valid in the self" "" { target *-*-* } .-1 } + +trait Foo {} + +impl Foo for ((Self, i32)) {} +// { dg-error ".Self. is not valid in the self" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/self_import_namespace.rs b/gcc/testsuite/rust/compile/self_import_namespace.rs index 2d9b2ed..a63c1d7 100644 --- a/gcc/testsuite/rust/compile/self_import_namespace.rs +++ b/gcc/testsuite/rust/compile/self_import_namespace.rs @@ -1,5 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } - mod bar { pub mod foo {} pub fn foo() {} diff --git a/gcc/testsuite/rust/compile/silly-order-bug.rs b/gcc/testsuite/rust/compile/silly-order-bug.rs new file mode 100644 index 0000000..0d9cf1d --- /dev/null +++ b/gcc/testsuite/rust/compile/silly-order-bug.rs @@ -0,0 +1,8 @@ +#[lang = "sized"] +trait Sized {} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; + type Output; +} diff --git a/gcc/testsuite/rust/compile/slicepattern-size-mismatch.rs b/gcc/testsuite/rust/compile/slicepattern-size-mismatch.rs new file mode 100644 index 0000000..b54b532 --- /dev/null +++ b/gcc/testsuite/rust/compile/slicepattern-size-mismatch.rs @@ -0,0 +1,8 @@ +fn main() { + let arr = [0, 1]; + + match arr { + [0, 1, 2] => {} // { dg-error "pattern requires 3 elements but array has 2 .E0527." } + _ => {} + } +}
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/torture/extern_mod2.rs b/gcc/testsuite/rust/compile/torture/extern_mod2.rs index 4984d5d..f3a4f79 100644 --- a/gcc/testsuite/rust/compile/torture/extern_mod2.rs +++ b/gcc/testsuite/rust/compile/torture/extern_mod2.rs @@ -12,6 +12,12 @@ mod no_leading_equal; #[path = "modules/valid_path.rs"] mod extra_spaces; +#[path = ""] // { dg-error "path attributes must contain a filename" } +mod empty_path; // { dg-error "no candidate found" } + +#[path = " "] // { dg-error "path attributes must contain a filename" } +mod path_with_spaces; // { dg-error "no candidate found" } + #[path] // { dg-error "path attributes must contain a filename" } mod error; // { dg-error "no candidate found" } diff --git a/gcc/testsuite/rust/compile/torture/generics29.rs b/gcc/testsuite/rust/compile/torture/generics29.rs index e9c693e..baf53e4 100644 --- a/gcc/testsuite/rust/compile/torture/generics29.rs +++ b/gcc/testsuite/rust/compile/torture/generics29.rs @@ -5,7 +5,6 @@ struct Foo<A, B>(A, B); impl Foo<i32, f32> { fn test<X>(self, a: X) -> X { - // { dg-warning "unused name" "" { target *-*-* } .-1 } a } } diff --git a/gcc/testsuite/rust/compile/torture/generics30.rs b/gcc/testsuite/rust/compile/torture/generics30.rs index 24ae58f..a84f140 100644 --- a/gcc/testsuite/rust/compile/torture/generics30.rs +++ b/gcc/testsuite/rust/compile/torture/generics30.rs @@ -5,7 +5,6 @@ struct Foo<A, B>(A, B); impl<T> Foo<T, f32> { fn test<X>(self, a: X) -> X { - // { dg-warning "unused name" "" { target *-*-* } .-1 } a } } diff --git a/gcc/testsuite/rust/compile/torture/traits3.rs b/gcc/testsuite/rust/compile/torture/traits3.rs index d805da5..dad6dda 100644 --- a/gcc/testsuite/rust/compile/torture/traits3.rs +++ b/gcc/testsuite/rust/compile/torture/traits3.rs @@ -10,7 +10,6 @@ struct Baz; impl Foo for Baz { fn Bar(self) -> i32 { - // { dg-warning "unused name .self." "" { target *-*-* } .-1 } 123 } } diff --git a/gcc/testsuite/rust/compile/torture/traits7.rs b/gcc/testsuite/rust/compile/torture/traits7.rs index 8e4472d..545fd39 100644 --- a/gcc/testsuite/rust/compile/torture/traits7.rs +++ b/gcc/testsuite/rust/compile/torture/traits7.rs @@ -13,7 +13,6 @@ impl Foo for Bar { // { dg-warning "unused name" "" { target *-*-* } .-1 } fn test(self) {} - // { dg-warning "unused name" "" { target *-*-* } .-1 } } fn main() { diff --git a/gcc/testsuite/rust/compile/torture/unended-raw-byte-string.rs b/gcc/testsuite/rust/compile/torture/unended-raw-byte-string.rs new file mode 100644 index 0000000..91a3c9a --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/unended-raw-byte-string.rs @@ -0,0 +1,6 @@ +// { dg-excess-errors "...." } +fn main() { + // { dg-error "unended raw byte string literal" "" { target *-*-* } .+1 } + let s = br##"123"# +} + diff --git a/gcc/testsuite/rust/compile/traits9.rs b/gcc/testsuite/rust/compile/traits9.rs index bb3034d..f4308e8 100644 --- a/gcc/testsuite/rust/compile/traits9.rs +++ b/gcc/testsuite/rust/compile/traits9.rs @@ -11,6 +11,5 @@ fn main() { a = Foo(123); let b: &dyn Bar = &a; - // { dg-error "bounds not satisfied for Foo .Bar. is not satisfied" "" { target *-*-* } .-1 } - // { dg-error "expected" "" { target *-*-* } .-2 } + // { dg-error "bounds not satisfied for Foo .Bar. is not satisfied .E0277." "" { target *-*-* } .-1 } } diff --git a/gcc/testsuite/rust/compile/try_block1.rs b/gcc/testsuite/rust/compile/try_block1.rs new file mode 100644 index 0000000..7ae0536 --- /dev/null +++ b/gcc/testsuite/rust/compile/try_block1.rs @@ -0,0 +1,89 @@ +// { dg-additional-options "-frust-edition=2018" } + +#[lang = "sized"] +trait Sized {} + +enum Result<T, E> { + Ok(T), + Err(E) +} + +pub trait Try { + /// The type of this value when viewed as successful. + #[unstable(feature = "try_trait", issue = "42327")] + type Ok; + /// The type of this value when viewed as failed. + #[unstable(feature = "try_trait", issue = "42327")] + type Error; + + /// Applies the "?" operator. A return of `Ok(t)` means that the + /// execution should continue normally, and the result of `?` is the + /// value `t`. A return of `Err(e)` means that execution should branch + /// to the innermost enclosing `catch`, or return from the function. + /// + /// If an `Err(e)` result is returned, the value `e` will be "wrapped" + /// in the return type of the enclosing scope (which must itself implement + /// `Try`). Specifically, the value `X::from_error(From::from(e))` + /// is returned, where `X` is the return type of the enclosing function. + #[lang = "into_result"] + #[unstable(feature = "try_trait", issue = "42327")] + fn into_result(self) -> Result<Self::Ok, Self::Error>; + + /// Wrap an error value to construct the composite result. For example, + /// `Result::Err(x)` and `Result::from_error(x)` are equivalent. + #[lang = "from_error"] + #[unstable(feature = "try_trait", issue = "42327")] + fn from_error(v: Self::Error) -> Self; + + /// Wrap an OK value to construct the composite result. For example, + /// `Result::Ok(x)` and `Result::from_ok(x)` are equivalent. + #[lang = "from_ok"] + #[unstable(feature = "try_trait", issue = "42327")] + fn from_ok(v: Self::Ok) -> Self; +} + +pub struct NoneError; + + +pub enum Option<T> { + /// No value + None, + /// Some value `T` + Some(T), +} + +impl<T> Option<T> { + pub fn ok_or<E>(self, err: E) -> Result<T, E> { + match self { + Some(ok) => Result::Ok(ok), + None => Result::Err(err) + } + } +} + +use Option::*; + +#[unstable(feature = "try_trait", issue = "42327")] +impl<T> Try for Option<T> { + type Ok = T; + type Error = NoneError; + + #[inline] + fn into_result(self) -> Result<T, NoneError> { + self.ok_or(NoneError) + } + + #[inline] + fn from_ok(v: T) -> Self { + Some(v) + } + + #[inline] + fn from_error(_: NoneError) -> Self { + None + } +} + +fn main() { + let _: Option<i32> = try { 15i32 }; +} diff --git a/gcc/testsuite/rust/compile/tuple_mismatch.rs b/gcc/testsuite/rust/compile/tuple_mismatch.rs index 828586b..1ff358b 100644 --- a/gcc/testsuite/rust/compile/tuple_mismatch.rs +++ b/gcc/testsuite/rust/compile/tuple_mismatch.rs @@ -3,6 +3,7 @@ fn main() { let (_,) = (1, 2); // { dg-error "expected a tuple with 2 elements, found one with 1 element" } let (_, _) = (1, 2, 3); // { dg-error "expected a tuple with 3 elements, found one with 2 elements" } let (_, _) = (1,); // { dg-error "expected a tuple with 1 element, found one with 2 elements" } + let (_, .., _) = (1,); // { dg-error "expected a tuple with 1 element, found one with 2 elements" } } // The lhs and rhs sizes don't match, but we still resolve 'a' to be bool, we don't diff --git a/gcc/testsuite/rust/compile/unify-errors1.rs b/gcc/testsuite/rust/compile/unify-errors1.rs new file mode 100644 index 0000000..0fe95ef --- /dev/null +++ b/gcc/testsuite/rust/compile/unify-errors1.rs @@ -0,0 +1,49 @@ +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +trait MyTrait {} + +struct Wrapper<T: MyTrait> { + value: T, +} + +struct NotImpl; + +trait A {} +trait B {} + +struct Wrapper2<T: A + B> { + value: T, +} + +struct NotImpl2; + +impl A for NotImpl2 {} + +fn takes_tuple(x: (i32, bool)) {} + +fn requires_copy<T: Copy>(value: T) {} + +pub fn test() { + takes_tuple((1, 2)); + // { dg-error "mismatched types, expected .bool. but got .<integer>. .E0308." "" { target *-*-* } .-1 } + + takes_tuple((1, 2, 3)); + // { dg-error "mismatched types, expected ..i32, bool.. but got ..<integer>, <integer>, <integer>.. .E0308." "" { target *-*-* } .-1 } + + takes_tuple("hello"); + // { dg-error "mismatched types, expected ..i32, bool.. but got .& str. .E0308." "" { target *-*-* } .-1 } + + let x = &mut 5; + requires_copy(x); + // { dg-error "bounds not satisfied for &mut <integer> .Copy. is not satisfied .E0277." "" { target *-*-* } .-1 } + + let _x = Wrapper { value: NotImpl }; + // { dg-error "bounds not satisfied for NotImpl .MyTrait. is not satisfied .E0277." "" { target *-*-* } .-1 } + + let _x = Wrapper2 { value: NotImpl2 }; + // { dg-error "bounds not satisfied for NotImpl2 .B. is not satisfied .E0277." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/use_1.rs b/gcc/testsuite/rust/compile/use_1.rs index e8e2037..21ee3e1 100644 --- a/gcc/testsuite/rust/compile/use_1.rs +++ b/gcc/testsuite/rust/compile/use_1.rs @@ -1,4 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } mod frob {} use foo::bar::baz; // { dg-error "unresolved import .foo::bar::baz." } diff --git a/gcc/testsuite/rust/compile/usize1.rs b/gcc/testsuite/rust/compile/usize1.rs index 36cb99b..08f6c9c 100644 --- a/gcc/testsuite/rust/compile/usize1.rs +++ b/gcc/testsuite/rust/compile/usize1.rs @@ -1,5 +1,5 @@ fn main() { let a = [1, 2, 3]; let b: u32 = 1; - let c = a[b]; // { dg-error "the type ...integer..CAPACITY.. cannot be indexed by .u32." } + let c = a[b]; // { dg-error "the type ...integer.; 3.. cannot be indexed by .u32." } } diff --git a/gcc/testsuite/rust/compile/while_let1.rs b/gcc/testsuite/rust/compile/while_let1.rs new file mode 100644 index 0000000..a3fa305 --- /dev/null +++ b/gcc/testsuite/rust/compile/while_let1.rs @@ -0,0 +1,109 @@ +// use self::Ordering::*; +// use Ordering::*; + +// enum Ordering { +// A, +// B, +// } + +// fn foo(_: Ordering) {} + +// fn main() { +// let a = A; + +// foo(a); +// foo(B); +// } + +#[lang = "sized"] +trait Sized {} + +enum Result<T, E> { + Ok(T), + Err(E), +} + +pub trait Try { + /// The type of this value when viewed as successful. + #[unstable(feature = "try_trait", issue = "42327")] + type Ok; + /// The type of this value when viewed as failed. + #[unstable(feature = "try_trait", issue = "42327")] + type Error; + + /// Applies the "?" operator. A return of `Ok(t)` means that the + /// execution should continue normally, and the result of `?` is the + /// value `t`. A return of `Err(e)` means that execution should branch + /// to the innermost enclosing `catch`, or return from the function. + /// + /// If an `Err(e)` result is returned, the value `e` will be "wrapped" + /// in the return type of the enclosing scope (which must itself implement + /// `Try`). Specifically, the value `X::from_error(From::from(e))` + /// is returned, where `X` is the return type of the enclosing function. + #[lang = "into_result"] + #[unstable(feature = "try_trait", issue = "42327")] + fn into_result(self) -> Result<Self::Ok, Self::Error>; + + /// Wrap an error value to construct the composite result. For example, + /// `Result::Err(x)` and `Result::from_error(x)` are equivalent. + #[lang = "from_error"] + #[unstable(feature = "try_trait", issue = "42327")] + fn from_error(v: Self::Error) -> Self; + + /// Wrap an OK value to construct the composite result. For example, + /// `Result::Ok(x)` and `Result::from_ok(x)` are equivalent. + #[lang = "from_ok"] + #[unstable(feature = "try_trait", issue = "42327")] + fn from_ok(v: Self::Ok) -> Self; +} + +pub struct NoneError; + +pub enum Option<T> { + /// No value + None, + /// Some value `T` + Some(T), +} + +impl<T> Option<T> { + pub fn ok_or<E>(self, err: E) -> Result<T, E> { + match self { + Some(ok) => Result::Ok(ok), + None => Result::Err(err), + } + } +} + +use Option::*; + +#[unstable(feature = "try_trait", issue = "42327")] +impl<T> Try for Option<T> { + type Ok = T; + type Error = NoneError; + + #[inline] + fn into_result(self) -> Result<T, NoneError> { + self.ok_or(NoneError) + } + + #[inline] + fn from_ok(v: T) -> Self { + Some(v) + } + + #[inline] + fn from_error(_: NoneError) -> Self { + None + } +} + +fn foo() -> Option<i32> { + Option::Some(15) +} + +fn main() { + // let _: Option<i32> = try { 15i32 }; + + while let Option::Some(15) = foo() {} +} diff --git a/gcc/testsuite/rust/compile/while_let_without_label.rs b/gcc/testsuite/rust/compile/while_let_without_label.rs new file mode 100644 index 0000000..e04e4b5 --- /dev/null +++ b/gcc/testsuite/rust/compile/while_let_without_label.rs @@ -0,0 +1,11 @@ +// { dg-additional-options "-frust-compile-until=lowering" } + +enum Foo { + A(i32), +} + +fn main() { + let b = Foo::A(15); + + while let Foo::A(x) = b {} +} diff --git a/gcc/testsuite/rust/compile/xfail/name_resolution21.rs b/gcc/testsuite/rust/compile/xfail/name_resolution21.rs index df48d00..fc8e94b 100644 --- a/gcc/testsuite/rust/compile/xfail/name_resolution21.rs +++ b/gcc/testsuite/rust/compile/xfail/name_resolution21.rs @@ -1,5 +1,3 @@ -// { dg-additional-options "-frust-name-resolution-2.0" } - pub mod foo { pub macro bar() {} } |