@@ -16,8 +16,14 @@ macro_rules! set {
16
16
}
17
17
18
18
macro_rules! declare_features {
19
+ ( __status_to_bool active) => {
20
+ false
21
+ } ;
22
+ ( __status_to_bool incomplete) => {
23
+ true
24
+ } ;
19
25
( $(
20
- $( #[ doc = $doc: tt] ) * ( active , $feature: ident, $ver: expr, $issue: expr, $edition: expr) ,
26
+ $( #[ doc = $doc: tt] ) * ( $status : ident , $feature: ident, $ver: expr, $issue: expr, $edition: expr) ,
21
27
) +) => {
22
28
/// Represents active features that are currently being implemented or
23
29
/// currently being considered for addition/removal.
@@ -67,6 +73,18 @@ macro_rules! declare_features {
67
73
pub fn unordered_const_ty_params( & self ) -> bool {
68
74
self . const_generics || self . const_generics_defaults
69
75
}
76
+
77
+ /// Some features are known to be incomplete and using them is likely to have
78
+ /// unanticipated results, such as compiler crashes. We warn the user about these
79
+ /// to alert them.
80
+ pub fn incomplete( & self , feature: Symbol ) -> bool {
81
+ match feature {
82
+ $(
83
+ sym:: $feature => declare_features!( __status_to_bool $status) ,
84
+ ) *
85
+ _ => false ,
86
+ }
87
+ }
70
88
}
71
89
} ;
72
90
}
@@ -305,7 +323,7 @@ declare_features! (
305
323
( active, cfg_target_thread_local, "1.7.0" , Some ( 29594 ) , None ) ,
306
324
307
325
/// Allows specialization of implementations (RFC 1210).
308
- ( active , specialization, "1.7.0" , Some ( 31844 ) , None ) ,
326
+ ( incomplete , specialization, "1.7.0" , Some ( 31844 ) , None ) ,
309
327
310
328
/// A minimal, sound subset of specialization intended to be used by the
311
329
/// standard library until the soundness issues with specialization
@@ -342,7 +360,7 @@ declare_features! (
342
360
( active, abi_ptx, "1.15.0" , Some ( 38788 ) , None ) ,
343
361
344
362
/// Allows the `#[repr(i128)]` attribute for enums.
345
- ( active , repr128, "1.16.0" , Some ( 56071 ) , None ) ,
363
+ ( incomplete , repr128, "1.16.0" , Some ( 56071 ) , None ) ,
346
364
347
365
/// Allows `#[link(kind="static-nobundle"...)]`.
348
366
( active, static_nobundle, "1.16.0" , Some ( 37403 ) , None ) ,
@@ -384,7 +402,7 @@ declare_features! (
384
402
( active, in_band_lifetimes, "1.23.0" , Some ( 44524 ) , None ) ,
385
403
386
404
/// Allows associated types to be generic, e.g., `type Foo<T>;` (RFC 1598).
387
- ( active , generic_associated_types, "1.23.0" , Some ( 44265 ) , None ) ,
405
+ ( incomplete , generic_associated_types, "1.23.0" , Some ( 44265 ) , None ) ,
388
406
389
407
/// Allows defining `trait X = A + B;` alias items.
390
408
( active, trait_alias, "1.24.0" , Some ( 41517 ) , None ) ,
@@ -429,7 +447,7 @@ declare_features! (
429
447
( active, proc_macro_hygiene, "1.30.0" , Some ( 54727 ) , None ) ,
430
448
431
449
/// Allows unsized rvalues at arguments and parameters.
432
- ( active , unsized_locals, "1.30.0" , Some ( 48055 ) , None ) ,
450
+ ( incomplete , unsized_locals, "1.30.0" , Some ( 48055 ) , None ) ,
433
451
434
452
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.
435
453
( active, custom_test_frameworks, "1.30.0" , Some ( 50297 ) , None ) ,
@@ -438,7 +456,7 @@ declare_features! (
438
456
( active, custom_inner_attributes, "1.30.0" , Some ( 54726 ) , None ) ,
439
457
440
458
/// Allows `impl Trait` in bindings (`let`, `const`, `static`).
441
- ( active , impl_trait_in_bindings, "1.30.0" , Some ( 63065 ) , None ) ,
459
+ ( incomplete , impl_trait_in_bindings, "1.30.0" , Some ( 63065 ) , None ) ,
442
460
443
461
/// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
444
462
( active, lint_reasons, "1.31.0" , Some ( 54503 ) , None ) ,
@@ -450,7 +468,7 @@ declare_features! (
450
468
( active, ffi_returns_twice, "1.34.0" , Some ( 58314 ) , None ) ,
451
469
452
470
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
453
- ( active , const_generics, "1.34.0" , Some ( 44580 ) , None ) ,
471
+ ( incomplete , const_generics, "1.34.0" , Some ( 44580 ) , None ) ,
454
472
455
473
/// Allows using `#[optimize(X)]`.
456
474
( active, optimize_attribute, "1.34.0" , Some ( 54882 ) , None ) ,
@@ -462,7 +480,7 @@ declare_features! (
462
480
( active, associated_type_bounds, "1.34.0" , Some ( 52662 ) , None ) ,
463
481
464
482
/// Allows `if/while p && let q = r && ...` chains.
465
- ( active , let_chains, "1.37.0" , Some ( 53667 ) , None ) ,
483
+ ( incomplete , let_chains, "1.37.0" , Some ( 53667 ) , None ) ,
466
484
467
485
/// Allows #[repr(transparent)] on unions (RFC 2645).
468
486
( active, transparent_unions, "1.37.0" , Some ( 60405 ) , None ) ,
@@ -474,13 +492,13 @@ declare_features! (
474
492
( active, async_closure, "1.37.0" , Some ( 62290 ) , None ) ,
475
493
476
494
/// Allows `impl Trait` to be used inside type aliases (RFC 2515).
477
- ( active , type_alias_impl_trait, "1.38.0" , Some ( 63063 ) , None ) ,
495
+ ( incomplete , type_alias_impl_trait, "1.38.0" , Some ( 63063 ) , None ) ,
478
496
479
497
/// Allows the definition of `const extern fn` and `const unsafe extern fn`.
480
498
( active, const_extern_fn, "1.40.0" , Some ( 64926 ) , None ) ,
481
499
482
500
/// Allows the use of raw-dylibs (RFC 2627).
483
- ( active , raw_dylib, "1.40.0" , Some ( 58713 ) , None ) ,
501
+ ( incomplete , raw_dylib, "1.40.0" , Some ( 58713 ) , None ) ,
484
502
485
503
/// Allows making `dyn Trait` well-formed even if `Trait` is not object safe.
486
504
/// In that case, `dyn Trait: Trait` does not hold. Moreover, coercions and
@@ -516,10 +534,10 @@ declare_features! (
516
534
( active, bindings_after_at, "1.41.0" , Some ( 65490 ) , None ) ,
517
535
518
536
/// Allows `impl const Trait for T` syntax.
519
- ( active , const_trait_impl, "1.42.0" , Some ( 67792 ) , None ) ,
537
+ ( incomplete , const_trait_impl, "1.42.0" , Some ( 67792 ) , None ) ,
520
538
521
539
/// Allows `T: ?const Trait` syntax in bounds.
522
- ( active , const_trait_bound_opt_out, "1.42.0" , Some ( 67794 ) , None ) ,
540
+ ( incomplete , const_trait_bound_opt_out, "1.42.0" , Some ( 67794 ) , None ) ,
523
541
524
542
/// Allows the use of `no_sanitize` attribute.
525
543
( active, no_sanitize, "1.42.0" , Some ( 39699 ) , None ) ,
@@ -552,16 +570,16 @@ declare_features! (
552
570
( active, format_args_capture, "1.46.0" , Some ( 67984 ) , None ) ,
553
571
554
572
/// Lazily evaluate constants. This allows constants to depend on type parameters.
555
- ( active , lazy_normalization_consts, "1.46.0" , Some ( 72219 ) , None ) ,
573
+ ( incomplete , lazy_normalization_consts, "1.46.0" , Some ( 72219 ) , None ) ,
556
574
557
575
/// Allows calling `transmute` in const fn
558
576
( active, const_fn_transmute, "1.46.0" , Some ( 53605 ) , None ) ,
559
577
560
578
/// Allows `if let` guard in match arms.
561
- ( active , if_let_guard, "1.47.0" , Some ( 51114 ) , None ) ,
579
+ ( incomplete , if_let_guard, "1.47.0" , Some ( 51114 ) , None ) ,
562
580
563
581
/// Allows non-trivial generic constants which have to be manually propagated upwards.
564
- ( active , const_evaluatable_checked, "1.48.0" , Some ( 76560 ) , None ) ,
582
+ ( incomplete , const_evaluatable_checked, "1.48.0" , Some ( 76560 ) , None ) ,
565
583
566
584
/// Allows basic arithmetic on floating point types in a `const fn`.
567
585
( active, const_fn_floating_point_arithmetic, "1.48.0" , Some ( 57241 ) , None ) ,
@@ -582,7 +600,7 @@ declare_features! (
582
600
( active, isa_attribute, "1.48.0" , Some ( 74727 ) , None ) ,
583
601
584
602
/// Allow anonymous constants from an inline `const` block
585
- ( active , inline_const, "1.49.0" , Some ( 76001 ) , None ) ,
603
+ ( incomplete , inline_const, "1.49.0" , Some ( 76001 ) , None ) ,
586
604
587
605
/// Allows unsized fn parameters.
588
606
( active, unsized_fn_params, "1.49.0" , Some ( 48055 ) , None ) ,
@@ -594,7 +612,7 @@ declare_features! (
594
612
( active, cfg_panic, "1.49.0" , Some ( 77443 ) , None ) ,
595
613
596
614
/// Allows capturing disjoint fields in a closure/generator (RFC 2229).
597
- ( active , capture_disjoint_fields, "1.49.0" , Some ( 53488 ) , None ) ,
615
+ ( incomplete , capture_disjoint_fields, "1.49.0" , Some ( 53488 ) , None ) ,
598
616
599
617
/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
600
618
( active, const_generics_defaults, "1.51.0" , Some ( 44580 ) , None ) ,
@@ -618,7 +636,7 @@ declare_features! (
618
636
( active, min_type_alias_impl_trait, "1.52.0" , Some ( 63063 ) , None ) ,
619
637
620
638
/// Allows associated types in inherent impls.
621
- ( active , inherent_associated_types, "1.52.0" , Some ( 8995 ) , None ) ,
639
+ ( incomplete , inherent_associated_types, "1.52.0" , Some ( 8995 ) , None ) ,
622
640
623
641
// Allows setting the threshold for the `large_assignments` lint.
624
642
( active, large_assignments, "1.52.0" , Some ( 83518 ) , None ) ,
@@ -661,7 +679,7 @@ declare_features! (
661
679
( active, native_link_modifiers_as_needed, "1.53.0" , Some ( 81490 ) , None ) ,
662
680
663
681
/// Allows unnamed fields of struct and union type
664
- ( active , unnamed_fields, "1.53.0" , Some ( 49804 ) , None ) ,
682
+ ( incomplete , unnamed_fields, "1.53.0" , Some ( 49804 ) , None ) ,
665
683
666
684
/// Allows qualified paths in struct expressions, struct patterns and tuple struct patterns.
667
685
( active, more_qualified_paths, "1.54.0" , Some ( 80080 ) , None ) ,
@@ -671,30 +689,6 @@ declare_features! (
671
689
// -------------------------------------------------------------------------
672
690
) ;
673
691
674
- /// Some features are known to be incomplete and using them is likely to have
675
- /// unanticipated results, such as compiler crashes. We warn the user about these
676
- /// to alert them.
677
- pub const INCOMPLETE_FEATURES : & [ Symbol ] = & [
678
- sym:: if_let_guard,
679
- sym:: impl_trait_in_bindings,
680
- sym:: generic_associated_types,
681
- sym:: const_generics,
682
- sym:: let_chains,
683
- sym:: raw_dylib,
684
- sym:: const_evaluatable_checked,
685
- sym:: const_trait_impl,
686
- sym:: const_trait_bound_opt_out,
687
- sym:: lazy_normalization_consts,
688
- sym:: specialization,
689
- sym:: inline_const,
690
- sym:: repr128,
691
- sym:: unsized_locals,
692
- sym:: capture_disjoint_fields,
693
- sym:: inherent_associated_types,
694
- sym:: type_alias_impl_trait,
695
- sym:: unnamed_fields,
696
- ] ;
697
-
698
692
/// Some features are not allowed to be used together at the same time, if
699
693
/// the two are present, produce an error.
700
694
///
0 commit comments