Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
01f65af
diag: improve closure/generic parameter mismatch
davidtwco Sep 14, 2020
8aae1ee
Move cell exterior test into library unit tests
poliorcetics Sep 7, 2020
f69c5aa
Move more tests using Cell to unit tests
poliorcetics Sep 7, 2020
af44a2a
move 'cell does not clone' test
poliorcetics Sep 8, 2020
fc152cd
move 'test zip ...' tests
poliorcetics Sep 8, 2020
85b2d9b
fmt
poliorcetics Sep 8, 2020
949c966
move format! interface tests
poliorcetics Sep 8, 2020
ed52c7b
Move deref-lval test
poliorcetics Sep 8, 2020
ac39deb
Move panic safety traits tests
poliorcetics Sep 10, 2020
8904921
Move array cycle test
poliorcetics Sep 10, 2020
275eed7
Move vec-slice-drop test
poliorcetics Sep 10, 2020
6bc0357
Move vec-cycle test
poliorcetics Sep 10, 2020
f6a4189
Move vec-cycle-wrapped test
poliorcetics Sep 11, 2020
5be843f
Move format-ref-cell test
poliorcetics Sep 13, 2020
1994cee
Add alias for iterator fold
pickfire Sep 25, 2020
ea0065a
Reposition iterator doc alias reduce before inline
pickfire Sep 25, 2020
a61b963
review: fix nits and move panic safety tests to the correct place
poliorcetics Sep 25, 2020
71bc62b
Add option to pass a custom codegen backend from a driver
bjorn3 Sep 8, 2020
2532a7e
expand: Stop un-interpolating `NtIdent`s before passing them to built…
petrochenkov Sep 27, 2020
3b27799
expand: Minor fn ptr call cleanup
petrochenkov Sep 27, 2020
1ff1431
Add a feature gate for basic function pointer use in `const fn`
ecstatic-morse Sep 24, 2020
3cbd17f
Remove `rustc_allow_const_fn_ptr`
ecstatic-morse Sep 24, 2020
e2622b9
Update tests with new feature gate
ecstatic-morse Sep 24, 2020
54d3329
Bless tests
ecstatic-morse Sep 24, 2020
368502c
Mark `min_const_fn_fn_ptr` test as gate test
ecstatic-morse Sep 24, 2020
807260b
Remove feature gate test for `rustc_allow_const_fn_ptr`
ecstatic-morse Sep 27, 2020
dc8414b
fix building libstd for Miri on macOS
RalfJung Sep 28, 2020
f9dfbb4
Rollup merge of #76454 - poliorcetics:ui-to-unit-test-1, r=matklad
RalfJung Sep 28, 2020
94d13bb
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
RalfJung Sep 28, 2020
fef6a2d
Rollup merge of #76711 - davidtwco:issue-51154-param-closure, r=estebank
RalfJung Sep 28, 2020
a43ee0c
Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obk
RalfJung Sep 28, 2020
29ff334
Rollup merge of #77194 - pickfire:patch-7, r=withoutboats
RalfJung Sep 28, 2020
a9a364f
Rollup merge of #77275 - petrochenkov:interpid, r=varkor
RalfJung Sep 28, 2020
a99fb78
Rollup merge of #77288 - RalfJung:miri-macos, r=Amanieu
RalfJung Sep 28, 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
Remove rustc_allow_const_fn_ptr
This was a hack to work around the lack of an escape hatch for the "min
`const fn`" checks in const-stable functions. Now that we have co-opted
`allow_internal_unstable` for this purpose, we no longer need the
bespoke attribute.
  • Loading branch information
ecstatic-morse committed Sep 27, 2020
commit 3cbd17fcc6c5c816b59c1816008b0d4ae3ef2982
31 changes: 7 additions & 24 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ pub struct ConstStability {
pub feature: Symbol,
/// whether the function has a `#[rustc_promotable]` attribute
pub promotable: bool,
/// whether the function has a `#[rustc_allow_const_fn_ptr]` attribute
pub allow_const_fn_ptr: bool,
}

/// The available stability levels.
Expand Down Expand Up @@ -190,7 +188,6 @@ where
let mut stab: Option<Stability> = None;
let mut const_stab: Option<ConstStability> = None;
let mut promotable = false;
let mut allow_const_fn_ptr = false;
let diagnostic = &sess.parse_sess.span_diagnostic;

'outer: for attr in attrs_iter {
Expand All @@ -200,7 +197,6 @@ where
sym::unstable,
sym::stable,
sym::rustc_promotable,
sym::rustc_allow_const_fn_ptr,
]
.iter()
.any(|&s| attr.has_name(s))
Expand All @@ -215,9 +211,6 @@ where
if attr.has_name(sym::rustc_promotable) {
promotable = true;
}
if attr.has_name(sym::rustc_allow_const_fn_ptr) {
allow_const_fn_ptr = true;
}
// attributes with data
else if let Some(MetaItem { kind: MetaItemKind::List(ref metas), .. }) = meta {
let meta = meta.as_ref().unwrap();
Expand Down Expand Up @@ -360,12 +353,8 @@ where
if sym::unstable == meta_name {
stab = Some(Stability { level, feature });
} else {
const_stab = Some(ConstStability {
level,
feature,
promotable: false,
allow_const_fn_ptr: false,
});
const_stab =
Some(ConstStability { level, feature, promotable: false });
}
}
(None, _, _) => {
Expand Down Expand Up @@ -440,12 +429,8 @@ where
if sym::stable == meta_name {
stab = Some(Stability { level, feature });
} else {
const_stab = Some(ConstStability {
level,
feature,
promotable: false,
allow_const_fn_ptr: false,
});
const_stab =
Some(ConstStability { level, feature, promotable: false });
}
}
(None, _) => {
Expand All @@ -464,18 +449,16 @@ where
}

// Merge the const-unstable info into the stability info
if promotable || allow_const_fn_ptr {
if promotable {
if let Some(ref mut stab) = const_stab {
stab.promotable = promotable;
stab.allow_const_fn_ptr = allow_const_fn_ptr;
} else {
struct_span_err!(
diagnostic,
item_sp,
E0717,
"rustc_promotable and rustc_allow_const_fn_ptr attributes \
must be paired with either a rustc_const_unstable or a rustc_const_stable \
attribute"
"`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` \
or a `rustc_const_stable` attribute"
)
.emit();
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// ==========================================================================

rustc_attr!(rustc_promotable, AssumedUsed, template!(Word), IMPL_DETAIL),
rustc_attr!(rustc_allow_const_fn_ptr, AssumedUsed, template!(Word), IMPL_DETAIL),
rustc_attr!(rustc_args_required_const, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE),

// ==========================================================================
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,6 @@ rustc_queries! {
desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
}

query const_fn_is_allowed_fn_ptr(key: DefId) -> bool {
desc { |tcx| "checking if const fn allows `fn()` types: `{}`", tcx.def_path_str(key) }
}

/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
query is_foreign_item(key: DefId) -> bool {
desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) }
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_mir/src/const_eval/fn_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,11 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
}
}

fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
is_const_fn(tcx, def_id)
&& tcx.lookup_const_stability(def_id).map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)
}

pub fn provide(providers: &mut Providers) {
*providers = Providers {
is_const_fn_raw,
is_const_impl_raw: |tcx, def_id| is_const_impl_raw(tcx, def_id.expect_local()),
is_promotable_const_fn,
const_fn_is_allowed_fn_ptr,
..*providers
};
}
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ symbols! {
rustc,
rustc_allocator,
rustc_allocator_nounwind,
rustc_allow_const_fn_ptr,
rustc_args_required_const,
rustc_attrs,
rustc_builtin_macro,
Expand Down
7 changes: 1 addition & 6 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,9 @@ impl RawWakerVTable {
/// associated task.
#[rustc_promotable]
#[stable(feature = "futures_api", since = "1.36.0")]
// `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else
// without first consulting with T-Lang.
//
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
#[rustc_allow_const_fn_ptr]
#[rustc_const_stable(feature = "futures_api", since = "1.36.0")]
#[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_fn_ptr_basics))]
#[cfg_attr(bootstrap, rustc_allow_const_fn_ptr)]
pub const fn new(
clone: unsafe fn(*const ()) -> RawWaker,
wake: unsafe fn(*const ()),
Expand Down