File tree 1 file changed +2
-26
lines changed
1 file changed +2
-26
lines changed Original file line number Diff line number Diff line change @@ -645,31 +645,7 @@ impl AsMut<str> for str {
645
645
/// }
646
646
/// ```
647
647
///
648
- /// # Future compatibility
649
- ///
650
- /// This enum has the same role as [the `!` “never” type][never],
651
- /// which is unstable in this version of Rust.
652
- /// When `!` is stabilized, we plan to make `Infallible` a type alias to it:
653
- ///
654
- /// ```ignore (illustrates future std change)
655
- /// pub type Infallible = !;
656
- /// ```
657
- ///
658
- /// … and eventually deprecate `Infallible`.
659
- ///
660
- /// However there is one case where `!` syntax can be used
661
- /// before `!` is stabilized as a full-fledged type: in the position of a function’s return type.
662
- /// Specifically, it is possible implementations for two different function pointer types:
663
- ///
664
- /// ```
665
- /// trait MyTrait {}
666
- /// impl MyTrait for fn() -> ! {}
667
- /// impl MyTrait for fn() -> std::convert::Infallible {}
668
- /// ```
669
- ///
670
- /// With `Infallible` being an enum, this code is valid.
671
- /// However when `Infallible` becomes an alias for the never type,
672
- /// the two `impl`s will start to overlap
673
- /// and therefore will be disallowed by the language’s trait coherence rules.
648
+ /// This has the same role as [the `!` “never” type][never], and is in fact an
649
+ /// alias to it. Generally speaking, you should prefer the never type.
674
650
#[ stable( feature = "convert_infallible" , since = "1.34.0" ) ]
675
651
pub type Infallible = !;
You can’t perform that action at this time.
0 commit comments