diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/source/cfg_if/detect/arch/x86.rs | 2 | ||||
| -rw-r--r-- | tests/source/let_else.rs | 3 | ||||
| -rw-r--r-- | tests/source/type.rs | 24 | ||||
| -rw-r--r-- | tests/target/cfg_if/detect/arch/x86.rs | 2 | ||||
| -rw-r--r-- | tests/target/let_else.rs | 3 | ||||
| -rw-r--r-- | tests/target/type.rs | 24 |
6 files changed, 25 insertions, 33 deletions
diff --git a/tests/source/cfg_if/detect/arch/x86.rs b/tests/source/cfg_if/detect/arch/x86.rs index 50d5cfa87c4..4c71a2c6ab9 100644 --- a/tests/source/cfg_if/detect/arch/x86.rs +++ b/tests/source/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/tests/source/let_else.rs b/tests/source/let_else.rs new file mode 100644 index 00000000000..a6e816fb524 --- /dev/null +++ b/tests/source/let_else.rs @@ -0,0 +1,3 @@ +fn main() { + let Some(1) = Some(1) else { return }; +} diff --git a/tests/source/type.rs b/tests/source/type.rs index 57f31dc901e..61ef73a3cab 100644 --- a/tests/source/type.rs +++ b/tests/source/type.rs @@ -140,29 +140,23 @@ fn foo(a: SomeLongComplexType, b: SomeOtherLongComplexType) -> Box<Future<Item = type MyFn = fn(a: SomeLongComplexType, b: SomeOtherLongComplexType,) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>; -// Const opt-out +// Const bound -trait T: ? const Super {} +trait T: ~ const Super {} -const fn maybe_const<S: ? const T>() -> i32 { <S as T>::CONST } +const fn not_quite_const<S: ~ const T>() -> i32 { <S as T>::CONST } -struct S<T:? const ? Sized>(std::marker::PhantomData<T>); +struct S<T:~ const ? Sized>(std::marker::PhantomData<T>); -impl ? const T {} +impl ~ const T {} -fn trait_object() -> &'static dyn ? const T { &S } +fn apit(_: impl ~ const T) {} -fn i(_: impl IntoIterator<Item = Box<dyn ? const T>>) {} - -fn apit(_: impl ?const T) {} - -fn rpit() -> impl ? const T { S } +fn rpit() -> impl ~ const T { S } pub struct Foo<T: Trait>(T); -impl<T: ? const Trait> Foo<T> { +impl<T: ~ const Trait> Foo<T> { fn new(t: T) -> Self { - // not calling methods on `t`, so we opt out of requiring - // `<T as Trait>` to have const methods via `?const` Self(t) } } @@ -171,4 +165,4 @@ impl<T: ? const Trait> Foo<T> { type T = typeof( 1); impl T for .. { -} \ No newline at end of file +} diff --git a/tests/target/cfg_if/detect/arch/x86.rs b/tests/target/cfg_if/detect/arch/x86.rs index 9219a4a577f..b985dd8caa1 100644 --- a/tests/target/cfg_if/detect/arch/x86.rs +++ b/tests/target/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/tests/target/let_else.rs b/tests/target/let_else.rs new file mode 100644 index 00000000000..a6e816fb524 --- /dev/null +++ b/tests/target/let_else.rs @@ -0,0 +1,3 @@ +fn main() { + let Some(1) = Some(1) else { return }; +} diff --git a/tests/target/type.rs b/tests/target/type.rs index e7761251688..38cf909c258 100644 --- a/tests/target/type.rs +++ b/tests/target/type.rs @@ -145,35 +145,27 @@ type MyFn = fn( b: SomeOtherLongComplexType, ) -> Box<Future<Item = AnotherLongType, Error = ALongErrorType>>; -// Const opt-out +// Const bound -trait T: ?const Super {} +trait T: ~const Super {} -const fn maybe_const<S: ?const T>() -> i32 { +const fn not_quite_const<S: ~const T>() -> i32 { <S as T>::CONST } -struct S<T: ?const ?Sized>(std::marker::PhantomData<T>); +struct S<T: ~const ?Sized>(std::marker::PhantomData<T>); -impl ?const T {} +impl ~const T {} -fn trait_object() -> &'static dyn ?const T { - &S -} - -fn i(_: impl IntoIterator<Item = Box<dyn ?const T>>) {} - -fn apit(_: impl ?const T) {} +fn apit(_: impl ~const T) {} -fn rpit() -> impl ?const T { +fn rpit() -> impl ~const T { S } pub struct Foo<T: Trait>(T); -impl<T: ?const Trait> Foo<T> { +impl<T: ~const Trait> Foo<T> { fn new(t: T) -> Self { - // not calling methods on `t`, so we opt out of requiring - // `<T as Trait>` to have const methods via `?const` Self(t) } } |
