File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -132,18 +132,18 @@ fn test_discriminant_send_sync() {
132132
133133#[ test]
134134fn test_const_forget ( ) {
135- const fn test_const_forget < T > ( x : T ) {
136- forget ( x) ;
137- }
135+ const _: ( ) = forget ( 0i32 ) ;
136+ const _: ( ) = forget ( Vec :: < Vec < Box < i32 > > > :: new ( ) ) ;
138137
139138 // Writing this function signature without const-forget
140139 // triggers compiler errors:
141140 // 1) That we use a non-const fn inside a const fn
142141 // 2) without the forget, it complains about the destructor of Box
143- const fn const_forget_box < T > ( mut x : Box < T > ) {
142+ const fn const_forget_box < T > ( x : Box < T > ) {
144143 forget ( x) ;
145144 }
146145
147- const _: ( ) = test_const_forget ( 0i32 ) ;
148- const _: ( ) = test_const_forget ( Vec :: < Vec < Box < i32 > > > :: new ( ) ) ;
146+ // Call the forget_box at runtime,
147+ // as we can't const-construct a box yet.
148+ const_forget_box ( Box :: new ( 0i32 ) ) ;
149149}
You can’t perform that action at this time.
0 commit comments