Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 3560e3c

Browse files
committed
Auto merge of rust-lang#129210 - tgross35:rollup-571noi5, r=tgross35
Rollup of 6 pull requests Successful merges: - rust-lang#128771 (Stabilize `unsafe_attributes`) - rust-lang#128982 (Re-enable more debuginfo tests on Windows) - rust-lang#129115 (Re-enable `dump-ice-to-disk` for Windows) - rust-lang#129173 (Fix `is_val_statically_known` for floats) - rust-lang#129185 (Port `run-make/libtest-json/validate_json.py` to Rust) - rust-lang#129190 (Added f16 and f128 to tests/ui/consts/const-float-bits-conv.rs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents feeba19 + b657787 commit 3560e3c

File tree

55 files changed

+253
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+253
-171
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
887887

888888
impl<'a> Visitor<'a> for AstValidator<'a> {
889889
fn visit_attribute(&mut self, attr: &Attribute) {
890-
validate_attr::check_attr(&self.features, &self.session.psess, attr);
890+
validate_attr::check_attr(&self.session.psess, attr);
891891
}
892892

893893
fn visit_ty(&mut self, ty: &'a Ty) {

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
559559
gate_all!(mut_ref, "mutable by-reference bindings are experimental");
560560
gate_all!(precise_capturing, "precise captures on `impl Trait` are experimental");
561561
gate_all!(global_registration, "global registration is experimental");
562-
gate_all!(unsafe_attributes, "`#[unsafe()]` markers for attributes are experimental");
563562
gate_all!(return_type_notation, "return type notation is experimental");
564563

565564
if !visitor.features.never_patterns {

compiler/rustc_builtin_macros/src/cfg_accessible.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ impl MultiItemModifier for Expander {
4747
) -> ExpandResult<Vec<Annotatable>, Annotatable> {
4848
let template = AttributeTemplate { list: Some("path"), ..Default::default() };
4949
validate_attr::check_builtin_meta_item(
50-
&ecx.ecfg.features,
5150
&ecx.sess.psess,
5251
meta_item,
5352
ast::AttrStyle::Outer,

compiler/rustc_builtin_macros/src/derive.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ impl MultiItemModifier for Expander {
3838
let template =
3939
AttributeTemplate { list: Some("Trait1, Trait2, ..."), ..Default::default() };
4040
validate_attr::check_builtin_meta_item(
41-
features,
4241
&sess.psess,
4342
meta_item,
4443
ast::AttrStyle::Outer,

compiler/rustc_builtin_macros/src/util.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub(crate) fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaI
1717
// All the built-in macro attributes are "words" at the moment.
1818
let template = AttributeTemplate { word: true, ..Default::default() };
1919
validate_attr::check_builtin_meta_item(
20-
&ecx.ecfg.features,
2120
&ecx.sess.psess,
2221
meta_item,
2322
AttrStyle::Outer,

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,10 @@ impl<'ll> CodegenCx<'ll, '_> {
10001000
ifn!("llvm.is.constant.i64", fn(t_i64) -> i1);
10011001
ifn!("llvm.is.constant.i128", fn(t_i128) -> i1);
10021002
ifn!("llvm.is.constant.isize", fn(t_isize) -> i1);
1003+
ifn!("llvm.is.constant.f16", fn(t_f16) -> i1);
10031004
ifn!("llvm.is.constant.f32", fn(t_f32) -> i1);
10041005
ifn!("llvm.is.constant.f64", fn(t_f64) -> i1);
1006+
ifn!("llvm.is.constant.f128", fn(t_f128) -> i1);
10051007
ifn!("llvm.is.constant.ptr", fn(ptr) -> i1);
10061008

10071009
ifn!("llvm.expect.i1", fn(i1, i1) -> i1);

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,22 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
192192
}
193193
sym::is_val_statically_known => {
194194
let intrinsic_type = args[0].layout.immediate_llvm_type(self.cx);
195-
match self.type_kind(intrinsic_type) {
196-
TypeKind::Pointer | TypeKind::Integer | TypeKind::Float | TypeKind::Double => {
197-
self.call_intrinsic(
198-
&format!("llvm.is.constant.{:?}", intrinsic_type),
199-
&[args[0].immediate()],
200-
)
195+
let kind = self.type_kind(intrinsic_type);
196+
let intrinsic_name = match kind {
197+
TypeKind::Pointer | TypeKind::Integer => {
198+
Some(format!("llvm.is.constant.{intrinsic_type:?}"))
201199
}
202-
_ => self.const_bool(false),
200+
// LLVM float types' intrinsic names differ from their type names.
201+
TypeKind::Half => Some(format!("llvm.is.constant.f16")),
202+
TypeKind::Float => Some(format!("llvm.is.constant.f32")),
203+
TypeKind::Double => Some(format!("llvm.is.constant.f64")),
204+
TypeKind::FP128 => Some(format!("llvm.is.constant.f128")),
205+
_ => None,
206+
};
207+
if let Some(intrinsic_name) = intrinsic_name {
208+
self.call_intrinsic(&intrinsic_name, &[args[0].immediate()])
209+
} else {
210+
self.const_bool(false)
203211
}
204212
}
205213
sym::unlikely => self

compiler/rustc_expand/src/config.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,7 @@ impl<'a> StripUnconfigured<'a> {
265265
/// is in the original source file. Gives a compiler error if the syntax of
266266
/// the attribute is incorrect.
267267
pub(crate) fn expand_cfg_attr(&self, cfg_attr: &Attribute, recursive: bool) -> Vec<Attribute> {
268-
validate_attr::check_attribute_safety(
269-
self.features.unwrap_or(&Features::default()),
270-
&self.sess.psess,
271-
AttributeSafety::Normal,
272-
&cfg_attr,
273-
);
268+
validate_attr::check_attribute_safety(&self.sess.psess, AttributeSafety::Normal, &cfg_attr);
274269

275270
let Some((cfg_predicate, expanded_attrs)) =
276271
rustc_parse::parse_cfg_attr(cfg_attr, &self.sess.psess)
@@ -395,11 +390,7 @@ impl<'a> StripUnconfigured<'a> {
395390
}
396391
};
397392

398-
validate_attr::deny_builtin_meta_unsafety(
399-
self.features.unwrap_or(&Features::default()),
400-
&self.sess.psess,
401-
&meta_item,
402-
);
393+
validate_attr::deny_builtin_meta_unsafety(&self.sess.psess, &meta_item);
403394

404395
(
405396
parse_cfg(&meta_item, self.sess).map_or(true, |meta_item| {

compiler/rustc_expand/src/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
18821882
let mut span: Option<Span> = None;
18831883
while let Some(attr) = attrs.next() {
18841884
rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
1885-
validate_attr::check_attr(features, &self.cx.sess.psess, attr);
1885+
validate_attr::check_attr(&self.cx.sess.psess, attr);
18861886

18871887
let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span };
18881888
span = Some(current_span);

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ declare_features! (
392392
(accepted, universal_impl_trait, "1.26.0", Some(34511)),
393393
/// Allows arbitrary delimited token streams in non-macro attributes.
394394
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208)),
395+
/// Allows unsafe attributes.
396+
(accepted, unsafe_attributes, "CURRENT_RUSTC_VERSION", Some(123757)),
395397
/// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block.
396398
(accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668)),
397399
/// Allows unsafe on extern declarations and safety qualifiers over internal items.

0 commit comments

Comments
 (0)