diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-11-28 15:12:08 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-12-03 10:20:15 +0100 |
| commit | 1f20b4dc19347020f535fe3e731e35fe7bbf2d1e (patch) | |
| tree | be2e81d1d8bee3d02e2ae765b7ef165f5d2073df | |
| parent | cc5b3578f1711b124f6b1304d7e7c18bf960509d (diff) | |
| download | rust-1f20b4dc19347020f535fe3e731e35fe7bbf2d1e.tar.gz rust-1f20b4dc19347020f535fe3e731e35fe7bbf2d1e.zip | |
Explain the difference between the two whitelists
| -rw-r--r-- | src/librustc/ty/constness.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 8ec5120d6b3..1ea8cbba46e 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -40,6 +40,10 @@ impl<'tcx> TyCtxt<'tcx> { /// for being called from stable `const fn`s (`min_const_fn`). /// /// Adding more intrinsics requires sign-off from @rust-lang/lang. + /// + /// This list differs from the list in `is_const_intrinsic` in the sense that any item on this + /// list must be on the `is_const_intrinsic` list, too, because if an intrinsic is callable from + /// stable, it must be callable at all. fn is_intrinsic_min_const_fn(self, def_id: DefId) -> bool { match self.item_name(def_id) { | sym::size_of @@ -108,6 +112,11 @@ pub fn provide(providers: &mut Providers<'_>) { match tcx.item_name(def_id) { // Keep this list in the same order as the match patterns in // `librustc_mir/interpret/intrinsics.rs` + + // This whitelist is a list of intrinsics that have a miri-engine implementation + // and can thus be called when enabling enough feature gates. The similar + // whitelist in `is_intrinsic_min_const_fn` (in this file), exists for allowing + // the intrinsics to be transitively called by stable const fns. | sym::caller_location | sym::min_align_of |
