diff options
author | Aleksey Kladov <[email protected]> | 2021-06-17 18:49:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-17 18:49:49 +0100 |
commit | 08c220ab2c4651f38d3029898706f2a996bf2c6b (patch) | |
tree | e65e8eeb44c21a0f1e378c0c32a565c3c09375bc /crates | |
parent | ce926aebc4461e38535047958c0b6f72b7a0c0ea (diff) |
internal: add default to minicore
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/hover.rs | 4 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs | 41 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/generate_default_from_new.rs | 83 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/record.rs | 28 | ||||
-rw-r--r-- | crates/ide_db/src/helpers/famous_defs_fixture.rs | 6 | ||||
-rw-r--r-- | crates/test_utils/src/minicore.rs | 10 |
6 files changed, 94 insertions, 78 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 529cf5f33..592610eab 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -3016,8 +3016,8 @@ fn foo() { | |||
3016 | file_id: FileId( | 3016 | file_id: FileId( |
3017 | 1, | 3017 | 1, |
3018 | ), | 3018 | ), |
3019 | full_range: 245..427, | 3019 | full_range: 246..428, |
3020 | focus_range: 284..290, | 3020 | focus_range: 285..291, |
3021 | name: "Future", | 3021 | name: "Future", |
3022 | kind: Trait, | 3022 | kind: Trait, |
3023 | description: "pub trait Future", | 3023 | description: "pub trait Future", |
diff --git a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs index 588ee1350..e55c38502 100644 --- a/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs +++ b/crates/ide_assists/src/handlers/generate_default_from_enum_variant.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use ide_db::helpers::FamousDefs; | 1 | use ide_db::{helpers::FamousDefs, RootDatabase}; |
2 | use ide_db::RootDatabase; | ||
3 | use syntax::ast::{self, AstNode, NameOwner}; | 2 | use syntax::ast::{self, AstNode, NameOwner}; |
4 | 3 | ||
5 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 4 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
@@ -92,23 +91,20 @@ mod tests { | |||
92 | 91 | ||
93 | use super::*; | 92 | use super::*; |
94 | 93 | ||
95 | fn check_not_applicable(ra_fixture: &str) { | ||
96 | let fixture = | ||
97 | format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE); | ||
98 | check_assist_not_applicable(generate_default_from_enum_variant, &fixture) | ||
99 | } | ||
100 | |||
101 | #[test] | 94 | #[test] |
102 | fn test_generate_default_from_variant() { | 95 | fn test_generate_default_from_variant() { |
103 | check_assist( | 96 | check_assist( |
104 | generate_default_from_enum_variant, | 97 | generate_default_from_enum_variant, |
105 | r#" | 98 | r#" |
99 | //- minicore: default | ||
106 | enum Variant { | 100 | enum Variant { |
107 | Undefined, | 101 | Undefined, |
108 | Minor$0, | 102 | Minor$0, |
109 | Major, | 103 | Major, |
110 | }"#, | 104 | } |
111 | r#"enum Variant { | 105 | "#, |
106 | r#" | ||
107 | enum Variant { | ||
112 | Undefined, | 108 | Undefined, |
113 | Minor, | 109 | Minor, |
114 | Major, | 110 | Major, |
@@ -118,15 +114,18 @@ impl Default for Variant { | |||
118 | fn default() -> Self { | 114 | fn default() -> Self { |
119 | Self::Minor | 115 | Self::Minor |
120 | } | 116 | } |
121 | }"#, | 117 | } |
118 | "#, | ||
122 | ); | 119 | ); |
123 | } | 120 | } |
124 | 121 | ||
125 | #[test] | 122 | #[test] |
126 | fn test_generate_default_already_implemented() { | 123 | fn test_generate_default_already_implemented() { |
127 | cov_mark::check!(test_gen_default_impl_already_exists); | 124 | cov_mark::check!(test_gen_default_impl_already_exists); |
128 | check_not_applicable( | 125 | check_assist_not_applicable( |
126 | generate_default_from_enum_variant, | ||
129 | r#" | 127 | r#" |
128 | //- minicore: default | ||
130 | enum Variant { | 129 | enum Variant { |
131 | Undefined, | 130 | Undefined, |
132 | Minor$0, | 131 | Minor$0, |
@@ -137,20 +136,24 @@ impl Default for Variant { | |||
137 | fn default() -> Self { | 136 | fn default() -> Self { |
138 | Self::Minor | 137 | Self::Minor |
139 | } | 138 | } |
140 | }"#, | 139 | } |
140 | "#, | ||
141 | ); | 141 | ); |
142 | } | 142 | } |
143 | 143 | ||
144 | #[test] | 144 | #[test] |
145 | fn test_add_from_impl_no_element() { | 145 | fn test_add_from_impl_no_element() { |
146 | cov_mark::check!(test_gen_default_on_non_unit_variant_not_implemented); | 146 | cov_mark::check!(test_gen_default_on_non_unit_variant_not_implemented); |
147 | check_not_applicable( | 147 | check_assist_not_applicable( |
148 | generate_default_from_enum_variant, | ||
148 | r#" | 149 | r#" |
150 | //- minicore: default | ||
149 | enum Variant { | 151 | enum Variant { |
150 | Undefined, | 152 | Undefined, |
151 | Minor(u32)$0, | 153 | Minor(u32)$0, |
152 | Major, | 154 | Major, |
153 | }"#, | 155 | } |
156 | "#, | ||
154 | ); | 157 | ); |
155 | } | 158 | } |
156 | 159 | ||
@@ -158,7 +161,10 @@ enum Variant { | |||
158 | fn test_generate_default_from_variant_with_one_variant() { | 161 | fn test_generate_default_from_variant_with_one_variant() { |
159 | check_assist( | 162 | check_assist( |
160 | generate_default_from_enum_variant, | 163 | generate_default_from_enum_variant, |
161 | r#"enum Variant { Undefi$0ned }"#, | 164 | r#" |
165 | //- minicore: default | ||
166 | enum Variant { Undefi$0ned } | ||
167 | "#, | ||
162 | r#" | 168 | r#" |
163 | enum Variant { Undefined } | 169 | enum Variant { Undefined } |
164 | 170 | ||
@@ -166,7 +172,8 @@ impl Default for Variant { | |||
166 | fn default() -> Self { | 172 | fn default() -> Self { |
167 | Self::Undefined | 173 | Self::Undefined |
168 | } | 174 | } |
169 | }"#, | 175 | } |
176 | "#, | ||
170 | ); | 177 | ); |
171 | } | 178 | } |
172 | } | 179 | } |
diff --git a/crates/ide_assists/src/handlers/generate_default_from_new.rs b/crates/ide_assists/src/handlers/generate_default_from_new.rs index bad826366..b54ec59da 100644 --- a/crates/ide_assists/src/handlers/generate_default_from_new.rs +++ b/crates/ide_assists/src/handlers/generate_default_from_new.rs | |||
@@ -1,7 +1,3 @@ | |||
1 | use crate::{ | ||
2 | assist_context::{AssistContext, Assists}, | ||
3 | AssistId, | ||
4 | }; | ||
5 | use ide_db::helpers::FamousDefs; | 1 | use ide_db::helpers::FamousDefs; |
6 | use itertools::Itertools; | 2 | use itertools::Itertools; |
7 | use stdx::format_to; | 3 | use stdx::format_to; |
@@ -10,6 +6,11 @@ use syntax::{ | |||
10 | AstNode, | 6 | AstNode, |
11 | }; | 7 | }; |
12 | 8 | ||
9 | use crate::{ | ||
10 | assist_context::{AssistContext, Assists}, | ||
11 | AssistId, | ||
12 | }; | ||
13 | |||
13 | // Assist: generate_default_from_new | 14 | // Assist: generate_default_from_new |
14 | // | 15 | // |
15 | // Generates default implementation from new method. | 16 | // Generates default implementation from new method. |
@@ -140,16 +141,16 @@ fn is_default_implemented(ctx: &AssistContext, impl_: &Impl) -> bool { | |||
140 | 141 | ||
141 | #[cfg(test)] | 142 | #[cfg(test)] |
142 | mod tests { | 143 | mod tests { |
143 | use ide_db::helpers::FamousDefs; | ||
144 | |||
145 | use crate::tests::{check_assist, check_assist_not_applicable}; | 144 | use crate::tests::{check_assist, check_assist_not_applicable}; |
146 | 145 | ||
147 | use super::*; | 146 | use super::*; |
148 | 147 | ||
149 | #[test] | 148 | #[test] |
150 | fn generate_default() { | 149 | fn generate_default() { |
151 | check_pass( | 150 | check_assist( |
151 | generate_default_from_new, | ||
152 | r#" | 152 | r#" |
153 | //- minicore: default | ||
153 | struct Example { _inner: () } | 154 | struct Example { _inner: () } |
154 | 155 | ||
155 | impl Example { | 156 | impl Example { |
@@ -182,8 +183,10 @@ fn main() {} | |||
182 | 183 | ||
183 | #[test] | 184 | #[test] |
184 | fn generate_default2() { | 185 | fn generate_default2() { |
185 | check_pass( | 186 | check_assist( |
187 | generate_default_from_new, | ||
186 | r#" | 188 | r#" |
189 | //- minicore: default | ||
187 | struct Test { value: u32 } | 190 | struct Test { value: u32 } |
188 | 191 | ||
189 | impl Test { | 192 | impl Test { |
@@ -212,8 +215,10 @@ impl Default for Test { | |||
212 | 215 | ||
213 | #[test] | 216 | #[test] |
214 | fn new_function_with_generic() { | 217 | fn new_function_with_generic() { |
215 | check_pass( | 218 | check_assist( |
219 | generate_default_from_new, | ||
216 | r#" | 220 | r#" |
221 | //- minicore: default | ||
217 | pub struct Foo<T> { | 222 | pub struct Foo<T> { |
218 | _bar: *mut T, | 223 | _bar: *mut T, |
219 | } | 224 | } |
@@ -246,8 +251,10 @@ impl<T> Default for Foo<T> { | |||
246 | 251 | ||
247 | #[test] | 252 | #[test] |
248 | fn new_function_with_generics() { | 253 | fn new_function_with_generics() { |
249 | check_pass( | 254 | check_assist( |
255 | generate_default_from_new, | ||
250 | r#" | 256 | r#" |
257 | //- minicore: default | ||
251 | pub struct Foo<T, B> { | 258 | pub struct Foo<T, B> { |
252 | _tars: *mut T, | 259 | _tars: *mut T, |
253 | _bar: *mut B, | 260 | _bar: *mut B, |
@@ -282,8 +289,10 @@ impl<T, B> Default for Foo<T, B> { | |||
282 | 289 | ||
283 | #[test] | 290 | #[test] |
284 | fn new_function_with_generic_and_bound() { | 291 | fn new_function_with_generic_and_bound() { |
285 | check_pass( | 292 | check_assist( |
293 | generate_default_from_new, | ||
286 | r#" | 294 | r#" |
295 | //- minicore: default | ||
287 | pub struct Foo<T> { | 296 | pub struct Foo<T> { |
288 | t: T, | 297 | t: T, |
289 | } | 298 | } |
@@ -316,8 +325,10 @@ impl<T: From<i32>> Default for Foo<T> { | |||
316 | 325 | ||
317 | #[test] | 326 | #[test] |
318 | fn new_function_with_generics_and_bounds() { | 327 | fn new_function_with_generics_and_bounds() { |
319 | check_pass( | 328 | check_assist( |
329 | generate_default_from_new, | ||
320 | r#" | 330 | r#" |
331 | //- minicore: default | ||
321 | pub struct Foo<T, B> { | 332 | pub struct Foo<T, B> { |
322 | _tars: T, | 333 | _tars: T, |
323 | _bar: B, | 334 | _bar: B, |
@@ -352,8 +363,10 @@ impl<T: From<i32>, B: From<i64>> Default for Foo<T, B> { | |||
352 | 363 | ||
353 | #[test] | 364 | #[test] |
354 | fn new_function_with_generic_and_where() { | 365 | fn new_function_with_generic_and_where() { |
355 | check_pass( | 366 | check_assist( |
367 | generate_default_from_new, | ||
356 | r#" | 368 | r#" |
369 | //- minicore: default | ||
357 | pub struct Foo<T> { | 370 | pub struct Foo<T> { |
358 | t: T, | 371 | t: T, |
359 | } | 372 | } |
@@ -395,8 +408,10 @@ where | |||
395 | 408 | ||
396 | #[test] | 409 | #[test] |
397 | fn new_function_with_generics_and_wheres() { | 410 | fn new_function_with_generics_and_wheres() { |
398 | check_pass( | 411 | check_assist( |
412 | generate_default_from_new, | ||
399 | r#" | 413 | r#" |
414 | //- minicore: default | ||
400 | pub struct Foo<T, B> { | 415 | pub struct Foo<T, B> { |
401 | _tars: T, | 416 | _tars: T, |
402 | _bar: B, | 417 | _bar: B, |
@@ -441,8 +456,10 @@ where | |||
441 | #[test] | 456 | #[test] |
442 | fn new_function_with_parameters() { | 457 | fn new_function_with_parameters() { |
443 | cov_mark::check!(new_function_with_parameters); | 458 | cov_mark::check!(new_function_with_parameters); |
444 | check_not_applicable( | 459 | check_assist_not_applicable( |
460 | generate_default_from_new, | ||
445 | r#" | 461 | r#" |
462 | //- minicore: default | ||
446 | struct Example { _inner: () } | 463 | struct Example { _inner: () } |
447 | 464 | ||
448 | impl Example { | 465 | impl Example { |
@@ -457,7 +474,8 @@ impl Example { | |||
457 | #[test] | 474 | #[test] |
458 | fn other_function_than_new() { | 475 | fn other_function_than_new() { |
459 | cov_mark::check!(other_function_than_new); | 476 | cov_mark::check!(other_function_than_new); |
460 | check_not_applicable( | 477 | check_assist_not_applicable( |
478 | generate_default_from_new, | ||
461 | r#" | 479 | r#" |
462 | struct Example { _inner: () } | 480 | struct Example { _inner: () } |
463 | 481 | ||
@@ -474,8 +492,10 @@ impl Example { | |||
474 | #[test] | 492 | #[test] |
475 | fn default_block_is_already_present() { | 493 | fn default_block_is_already_present() { |
476 | cov_mark::check!(default_block_is_already_present); | 494 | cov_mark::check!(default_block_is_already_present); |
477 | check_not_applicable( | 495 | check_assist_not_applicable( |
496 | generate_default_from_new, | ||
478 | r#" | 497 | r#" |
498 | //- minicore: default | ||
479 | struct Example { _inner: () } | 499 | struct Example { _inner: () } |
480 | 500 | ||
481 | impl Example { | 501 | impl Example { |
@@ -495,7 +515,8 @@ impl Default for Example { | |||
495 | 515 | ||
496 | #[test] | 516 | #[test] |
497 | fn standalone_new_function() { | 517 | fn standalone_new_function() { |
498 | check_not_applicable( | 518 | check_assist_not_applicable( |
519 | generate_default_from_new, | ||
499 | r#" | 520 | r#" |
500 | fn n$0ew() -> u32 { | 521 | fn n$0ew() -> u32 { |
501 | 0 | 522 | 0 |
@@ -506,8 +527,10 @@ fn n$0ew() -> u32 { | |||
506 | 527 | ||
507 | #[test] | 528 | #[test] |
508 | fn multiple_struct_blocks() { | 529 | fn multiple_struct_blocks() { |
509 | check_pass( | 530 | check_assist( |
531 | generate_default_from_new, | ||
510 | r#" | 532 | r#" |
533 | //- minicore: default | ||
511 | struct Example { _inner: () } | 534 | struct Example { _inner: () } |
512 | struct Test { value: u32 } | 535 | struct Test { value: u32 } |
513 | 536 | ||
@@ -538,8 +561,10 @@ impl Default for Example { | |||
538 | 561 | ||
539 | #[test] | 562 | #[test] |
540 | fn when_struct_is_after_impl() { | 563 | fn when_struct_is_after_impl() { |
541 | check_pass( | 564 | check_assist( |
565 | generate_default_from_new, | ||
542 | r#" | 566 | r#" |
567 | //- minicore: default | ||
543 | impl Example { | 568 | impl Example { |
544 | pub fn $0new() -> Self { | 569 | pub fn $0new() -> Self { |
545 | Self { _inner: () } | 570 | Self { _inner: () } |
@@ -568,8 +593,10 @@ struct Example { _inner: () } | |||
568 | 593 | ||
569 | #[test] | 594 | #[test] |
570 | fn struct_in_module() { | 595 | fn struct_in_module() { |
571 | check_pass( | 596 | check_assist( |
597 | generate_default_from_new, | ||
572 | r#" | 598 | r#" |
599 | //- minicore: default | ||
573 | mod test { | 600 | mod test { |
574 | struct Example { _inner: () } | 601 | struct Example { _inner: () } |
575 | 602 | ||
@@ -603,8 +630,10 @@ impl Default for Example { | |||
603 | #[test] | 630 | #[test] |
604 | fn struct_in_module_with_default() { | 631 | fn struct_in_module_with_default() { |
605 | cov_mark::check!(struct_in_module_with_default); | 632 | cov_mark::check!(struct_in_module_with_default); |
606 | check_not_applicable( | 633 | check_assist_not_applicable( |
634 | generate_default_from_new, | ||
607 | r#" | 635 | r#" |
636 | //- minicore: default | ||
608 | mod test { | 637 | mod test { |
609 | struct Example { _inner: () } | 638 | struct Example { _inner: () } |
610 | 639 | ||
@@ -623,14 +652,4 @@ mod test { | |||
623 | "#, | 652 | "#, |
624 | ); | 653 | ); |
625 | } | 654 | } |
626 | |||
627 | fn check_pass(before: &str, after: &str) { | ||
628 | let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE); | ||
629 | check_assist(generate_default_from_new, before, after); | ||
630 | } | ||
631 | |||
632 | fn check_not_applicable(before: &str) { | ||
633 | let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE); | ||
634 | check_assist_not_applicable(generate_default_from_new, before); | ||
635 | } | ||
636 | } | 655 | } |
diff --git a/crates/ide_completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs index 47523f72f..e876337f1 100644 --- a/crates/ide_completion/src/completions/record.rs +++ b/crates/ide_completion/src/completions/record.rs | |||
@@ -48,10 +48,9 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> | |||
48 | #[cfg(test)] | 48 | #[cfg(test)] |
49 | mod tests { | 49 | mod tests { |
50 | use expect_test::{expect, Expect}; | 50 | use expect_test::{expect, Expect}; |
51 | use ide_db::helpers::FamousDefs; | ||
52 | 51 | ||
53 | use crate::{ | 52 | use crate::{ |
54 | tests::{self, filtered_completion_list}, | 53 | tests::{check_edit, filtered_completion_list}, |
55 | CompletionKind, | 54 | CompletionKind, |
56 | }; | 55 | }; |
57 | 56 | ||
@@ -61,31 +60,17 @@ mod tests { | |||
61 | } | 60 | } |
62 | 61 | ||
63 | fn check_snippet(ra_fixture: &str, expect: Expect) { | 62 | fn check_snippet(ra_fixture: &str, expect: Expect) { |
64 | let actual = filtered_completion_list( | 63 | let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet); |
65 | &format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE), | ||
66 | CompletionKind::Snippet, | ||
67 | ); | ||
68 | expect.assert_eq(&actual); | 64 | expect.assert_eq(&actual); |
69 | } | 65 | } |
70 | 66 | ||
71 | fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | ||
72 | tests::check_edit( | ||
73 | what, | ||
74 | &format!( | ||
75 | "//- /main.rs crate:main deps:core{}\n{}", | ||
76 | ra_fixture_before, | ||
77 | FamousDefs::FIXTURE, | ||
78 | ), | ||
79 | &(ra_fixture_after.to_owned() + "\n"), | ||
80 | ); | ||
81 | } | ||
82 | |||
83 | #[test] | 67 | #[test] |
84 | fn test_record_literal_field_default() { | 68 | fn test_record_literal_field_default() { |
85 | let test_code = r#" | 69 | let test_code = r#" |
70 | //- minicore: default | ||
86 | struct S { foo: u32, bar: usize } | 71 | struct S { foo: u32, bar: usize } |
87 | 72 | ||
88 | impl core::default::Default for S { | 73 | impl Default for S { |
89 | fn default() -> Self { | 74 | fn default() -> Self { |
90 | S { | 75 | S { |
91 | foo: 0, | 76 | foo: 0, |
@@ -121,9 +106,10 @@ fn process(f: S) { | |||
121 | check_edit( | 106 | check_edit( |
122 | "..Default::default()", | 107 | "..Default::default()", |
123 | r#" | 108 | r#" |
109 | //- minicore: default | ||
124 | struct S { foo: u32, bar: usize } | 110 | struct S { foo: u32, bar: usize } |
125 | 111 | ||
126 | impl core::default::Default for S { | 112 | impl Default for S { |
127 | fn default() -> Self { | 113 | fn default() -> Self { |
128 | S { | 114 | S { |
129 | foo: 0, | 115 | foo: 0, |
@@ -142,7 +128,7 @@ fn process(f: S) { | |||
142 | r#" | 128 | r#" |
143 | struct S { foo: u32, bar: usize } | 129 | struct S { foo: u32, bar: usize } |
144 | 130 | ||
145 | impl core::default::Default for S { | 131 | impl Default for S { |
146 | fn default() -> Self { | 132 | fn default() -> Self { |
147 | S { | 133 | S { |
148 | foo: 0, | 134 | foo: 0, |
diff --git a/crates/ide_db/src/helpers/famous_defs_fixture.rs b/crates/ide_db/src/helpers/famous_defs_fixture.rs index 551203936..5e0d514cf 100644 --- a/crates/ide_db/src/helpers/famous_defs_fixture.rs +++ b/crates/ide_db/src/helpers/famous_defs_fixture.rs | |||
@@ -20,12 +20,6 @@ pub mod convert { | |||
20 | } | 20 | } |
21 | } | 21 | } |
22 | 22 | ||
23 | pub mod default { | ||
24 | pub trait Default { | ||
25 | fn default() -> Self; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | pub mod option { | 23 | pub mod option { |
30 | pub enum Option<T> { | 24 | pub enum Option<T> { |
31 | None, | 25 | None, |
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index e6d2301c7..4093a04bc 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -22,6 +22,7 @@ | |||
22 | //! result: | 22 | //! result: |
23 | //! iterator: option | 23 | //! iterator: option |
24 | //! iterators: iterator | 24 | //! iterators: iterator |
25 | //! default: sized | ||
25 | 26 | ||
26 | pub mod marker { | 27 | pub mod marker { |
27 | // region:sized | 28 | // region:sized |
@@ -37,6 +38,14 @@ pub mod marker { | |||
37 | // endregion:unsize | 38 | // endregion:unsize |
38 | } | 39 | } |
39 | 40 | ||
41 | // region:default | ||
42 | pub mod default { | ||
43 | pub trait Default: Sized { | ||
44 | fn default() -> Self; | ||
45 | } | ||
46 | } | ||
47 | // endregion:default | ||
48 | |||
40 | pub mod ops { | 49 | pub mod ops { |
41 | // region:coerce_unsized | 50 | // region:coerce_unsized |
42 | mod unsize { | 51 | mod unsize { |
@@ -309,6 +318,7 @@ pub mod iter { | |||
309 | pub mod prelude { | 318 | pub mod prelude { |
310 | pub mod v1 { | 319 | pub mod v1 { |
311 | pub use crate::{ | 320 | pub use crate::{ |
321 | default::Default, // :default | ||
312 | iter::{IntoIterator, Iterator}, // :iterator | 322 | iter::{IntoIterator, Iterator}, // :iterator |
313 | marker::Sized, // :sized | 323 | marker::Sized, // :sized |
314 | ops::{Fn, FnMut, FnOnce}, // :fn | 324 | ops::{Fn, FnMut, FnOnce}, // :fn |