This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 5 files changed +78
-0
lines changed
5 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ rustc --edition 2018 -C incremental=foo --crate-type lib - << 'EOF '
4
+ #![feature(const_generics, const_evaluatable_checked)]
5
+ #![allow(incomplete_features)]
6
+ use core::{convert::TryFrom, num::NonZeroUsize};
7
+
8
+ struct A<const N: NonZeroUsize>([u8; N.get()]) where [u8; N.get()]: Sized;
9
+
10
+ impl<'a, const N: NonZeroUsize> TryFrom<&'a [u8]> for A<N> where [u8; N.get()]: Sized {
11
+ type Error = ();
12
+ fn try_from(slice: &'a [u8]) -> Result<A<N>, ()> {
13
+ let _x = <&[u8; N.get()] as TryFrom<&[u8]>>::try_from(slice);
14
+ unimplemented!();
15
+ }
16
+ }
17
+ EOF
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+ #![ feature( const_evaluatable_checked) ]
3
+
4
+ pub struct Foobar < T , const N : usize > {
5
+ t : T ,
6
+ }
7
+
8
+ pub trait Footrait {
9
+ const N : usize ;
10
+ }
11
+
12
+ impl < T > Footrait for T {
13
+ const N : usize = 0 ;
14
+ }
15
+
16
+ pub fn new_foo < T > ( t : T ) -> Foobar < T , { <T as Footrait >:: N } >
17
+ where
18
+ T : Footrait ,
19
+ {
20
+ Foobar { t }
21
+ }
22
+
23
+ fn main ( ) {
24
+ let foo = new_foo ( 0 ) ;
25
+ }
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ let inner;
3
+ let outer = || {
4
+ inner = || { } ;
5
+ inner ( ) ;
6
+ } ;
7
+ outer ( ) ;
8
+ }
Original file line number Diff line number Diff line change
1
+ fn map < T > ( _: fn ( ) -> Option < & ' static T > ) -> Option < T > {
2
+ None
3
+ }
4
+
5
+ fn value ( ) -> Option < & ' static _ > {
6
+ Option :: < & ' static u8 > :: None
7
+ }
8
+
9
+ const _: Option < _ > = {
10
+ let _: Option < _ > = map ( value) ;
11
+ } ;
Original file line number Diff line number Diff line change
1
+ #![ crate_type = "lib" ]
2
+ #![ feature( decl_macro) ]
3
+
4
+ pub mod module {
5
+ mod private {
6
+ __helper__ ! { [ $] recurse }
7
+
8
+ macro __helper__ ( [ $dol: tt] $exported_name: ident) {
9
+ macro_rules! $exported_name { ( ) => ( ) }
10
+ pub ( crate ) use $exported_name;
11
+ }
12
+ // pub(crate) use recurse;
13
+ }
14
+ pub ( super ) use private:: recurse;
15
+ }
16
+
17
+ module:: recurse!( ) ;
You can’t perform that action at this time.
0 commit comments