@@ -701,39 +701,6 @@ pub fn ensure_not_fmt_string_literal<'cx>(cx: &'cx mut ExtCtxt,
701
701
}
702
702
} ;
703
703
704
- let unstable_marker = cx. expr_path ( cx. path_global ( sp, vec ! [
705
- cx. ident_of_std( "core" ) ,
706
- cx. ident_of( "fmt" ) ,
707
- cx. ident_of( "ENSURE_NOT_FMT_STRING_LITERAL_IS_UNSTABLE" ) ] ) ) ;
708
-
709
- // Total hack: We do not (yet) have hygienic-marking of stabilty.
710
- // Thus an unstable macro (like `ensure_not_fmt_string!`) can leak
711
- // through another macro (like `panic!`), where the latter is just
712
- // using the former as an implementation detail.
713
- //
714
- // The `#[allow_internal_unstable]` system does not suffice to
715
- // address this; it explicitly (as described on Issue #22899)
716
- // disallows the use of unstable functionality via a helper macro
717
- // like `ensure_not_fmt_string!`, by design.
718
- //
719
- // So, the hack: the `ensure_not_fmt_string!` macro has just one
720
- // stable client: `panic!`. So we give `panic!` a backdoor: we
721
- // allow its name literal string to give it stable access. Any
722
- // other argument that is passed in will cause us to emit the
723
- // unstable-marker, which will then be checked against the enabled
724
- // feature-set.
725
- //
726
- // This, combined with the awkward actual name of the unstable
727
- // macro (hint: the real name is far more awkward than the one
728
- // given in this comment) should suffice to ensure that people do
729
- // not accidentally commit to using it.
730
- let marker = if name == "unary `panic!`" {
731
- cx. expr_tuple ( sp, vec ! [ ] ) // i.e. `()`
732
- } else {
733
- unstable_marker
734
- } ;
735
- let expr = cx. expr_tuple ( sp, vec ! [ marker, expr] ) ;
736
-
737
704
MacEager :: expr ( expr)
738
705
}
739
706
0 commit comments