Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #77040

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift click to select a range
c5975e9
Reduce duplicate in liballoc reserve error handling
pickfire Aug 4, 2020
28db521
More implementations of Write for immutable refs
Sep 2, 2020
ec7f9b9
Deduplicates io::Write implementations
Sep 11, 2020
8f27e3c
Make some methods of `Pin` unstable const
CDirkx Sep 12, 2020
eede953
Only get ImplKind::Impl once
tesuji Sep 10, 2020
ed6c7ef
Use enum for status of non-const ops
ecstatic-morse Sep 2, 2020
c3607bd
Use helper function for searching `allow_internal_unstable`
ecstatic-morse Sep 2, 2020
e4edc16
Give name to extra `Span` in `LiveDrop` error
ecstatic-morse Sep 2, 2020
81b3b66
Error if an unstable const eval feature is used in a stable const fn
ecstatic-morse Sep 3, 2020
1e1257b
Bless `miri-unleashed` tests
ecstatic-morse Sep 16, 2020
abc7167
Test that `const_precise_live_drops` can't be depended upon stably
ecstatic-morse Sep 16, 2020
e3c6e46
Make some methods of `Pin<&mut T>` unstable const
CDirkx Sep 18, 2020
f7d5080
don't take `TyCtxt` by reference
lcnr Sep 18, 2020
a219ad6
extend `is_ty_or_ty_ctxt` to self types
lcnr Sep 19, 2020
67f319c
take `TyCtxt` by value
lcnr Sep 19, 2020
2a00dda
miri: correctly deal with `ConstKind::Bound`
lcnr Sep 10, 2020
6734230
do not ICE on `ty::Bound` in Layout::compute
lcnr Sep 11, 2020
65b3419
update stderr file
lcnr Sep 20, 2020
c690c82
use if let instead of single match arm expressions to compact code an…
matthiaskrgr Sep 18, 2020
88a29e6
Updates stability attributes to the current nightly version
Sep 21, 2020
0acb0ed
Update library/std/src/process.rs
FedericoPonzi Sep 21, 2020
60b102d
Don't recommend ManuallyDrop to customize drop order
matklad Aug 31, 2020
b4b4a2f
Reduce boilerplate for BytePos and CharPos
Juici Sep 21, 2020
8fc782a
add test
lcnr Sep 21, 2020
9a1f177
Remove cast to usize for BytePos and CharPos
Juici Sep 21, 2020
63195ec
Add explanation for E0756
GuillaumeGomez Sep 8, 2020
f5d71a9
Don't use `zip` to compare iterators during pretty-print hack
Aaron1011 Aug 30, 2020
d452744
lint missing docs for extern items
lcnr Sep 21, 2020
851ce56
Rollup merge of #72734 - pickfire:liballoc, r=KodrAus
ecstatic-morse Sep 22, 2020
46ef65c
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
ecstatic-morse Sep 22, 2020
17f9928
Rollup merge of #76150 - matklad:droporder, r=withoutboats
ecstatic-morse Sep 22, 2020
cc99c2a
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=…
ecstatic-morse Sep 22, 2020
fe6ab6c
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
ecstatic-morse Sep 22, 2020
bc90edf
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
ecstatic-morse Sep 22, 2020
2776eb8
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
d55b6e8
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
ecstatic-morse Sep 22, 2020
3eb7818
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=…
ecstatic-morse Sep 22, 2020
af279e1
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
ecstatic-morse Sep 22, 2020
a6d4bf7
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
9a1fa7d
Rollup merge of #77022 - Juici:master, r=lcnr
ecstatic-morse Sep 22, 2020
e146fcf
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
ecstatic-morse Sep 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use helper function for searching allow_internal_unstable
  • Loading branch information
ecstatic-morse committed Sep 16, 2020
commit c3607bd7dd323a898b8cc9d2c603dfd14172c73c
8 changes: 8 additions & 0 deletions compiler/rustc_mir/src/transform/check_consts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 4,12 @@
//! has interior mutability or needs to be dropped, as well as the visitor that emits errors when
//! it finds operations that are invalid in a certain context.

use rustc_attr as attr;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::mir;
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::Symbol;

pub use self::qualifs::Qualif;

Expand Down Expand Up @@ -55,3 57,9 @@ impl ConstCx<'mir, 'tcx> {
pub fn is_lang_panic_fn(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
Some(def_id) == tcx.lang_items().panic_fn() || Some(def_id) == tcx.lang_items().begin_panic_fn()
}

pub fn allow_internal_unstable(tcx: TyCtxt<'tcx>, def_id: DefId, feature_gate: Symbol) -> bool {
let attrs = tcx.get_attrs(def_id);
attr::allow_internal_unstable(&tcx.sess, attrs)
.map_or(false, |mut features| features.any(|name| name == feature_gate))
}
7 changes: 2 additions & 5 deletions compiler/rustc_mir/src/transform/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
@@ -1,4 1,3 @@
use rustc_attr as attr;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_middle::mir::*;
Expand Down Expand Up @@ -344,8 343,7 @@ fn feature_allowed(tcx: TyCtxt<'tcx>, def_id: DefId, feature_gate: Symbol) -> bo

// However, we cannot allow stable `const fn`s to use unstable features without an explicit
// opt-in via `allow_internal_unstable`.
attr::allow_internal_unstable(&tcx.sess, &tcx.get_attrs(def_id))
.map_or(false, |mut features| features.any(|name| name == feature_gate))
super::check_consts::allow_internal_unstable(tcx, def_id, feature_gate)
}

/// Returns `true` if the given library feature gate is allowed within the function with the given `DefId`.
Expand All @@ -364,8 362,7 @@ pub fn lib_feature_allowed(tcx: TyCtxt<'tcx>, def_id: DefId, feature_gate: Symbo

// However, we cannot allow stable `const fn`s to use unstable features without an explicit
// opt-in via `allow_internal_unstable`.
attr::allow_internal_unstable(&tcx.sess, &tcx.get_attrs(def_id))
.map_or(false, |mut features| features.any(|name| name == feature_gate))
super::check_consts::allow_internal_unstable(tcx, def_id, feature_gate)
}

fn check_terminator(
Expand Down