Skip to content

Commit 80d8f29

Browse files
committed
Auto merge of #149322 - matthiaskrgr:rollup-uf0hmx6, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #147736 (Stabilize `asm_cfg`) - #148652 (Cleanup and refactor FnCtxt::report_no_match_method_error) - #149167 (skip checking supertraits in object candidate for `NormalizesTo` goal) - #149210 (fix: Do not ICE on normalization failure of an extern static item) - #149268 (add implementation-internal namespace for globalasm) - #149274 (Fix invalid link generation for type alias methods) - #149302 (Fix comment wording in simplify_comparison_integral.rs) - #149305 (Simplify OnceCell Clone impl) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0f6dae4 + f40d825 commit 80d8f29

File tree

25 files changed

+488
-305
lines changed

25 files changed

+488
-305
lines changed

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ builtin_macros_alloc_must_statics = allocators must be statics
33
44
builtin_macros_asm_attribute_not_supported =
55
this attribute is not supported on assembly
6-
builtin_macros_asm_cfg =
7-
the `#[cfg(/* ... */)]` and `#[cfg_attr(/* ... */)]` attributes on assembly are unstable
86
97
builtin_macros_asm_clobber_abi = clobber_abi
108
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ use rustc_expand::base::*;
66
use rustc_index::bit_set::GrowableBitSet;
77
use rustc_parse::parser::asm::*;
88
use rustc_session::lint;
9-
use rustc_session::parse::feature_err;
109
use rustc_span::{ErrorGuaranteed, InnerSpan, Span, Symbol, sym};
1110
use rustc_target::asm::InlineAsmArch;
1211
use smallvec::smallvec;
1312
use {rustc_ast as ast, rustc_parse_format as parse};
1413

14+
use crate::errors;
1515
use crate::util::{ExprToSpannedString, expr_to_spanned_string};
16-
use crate::{errors, fluent_generated as fluent};
1716

1817
/// Validated assembly arguments, ready for macro expansion.
1918
struct ValidatedAsmArgs {
@@ -64,22 +63,13 @@ fn validate_asm_args<'a>(
6463

6564
for arg in args {
6665
for attr in arg.attributes.0.iter() {
67-
match attr.name() {
68-
Some(sym::cfg | sym::cfg_attr) => {
69-
if !ecx.ecfg.features.asm_cfg() {
70-
let span = attr.span();
71-
feature_err(ecx.sess, sym::asm_cfg, span, fluent::builtin_macros_asm_cfg)
72-
.emit();
73-
}
74-
}
75-
_ => {
76-
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
77-
}
66+
if !matches!(attr.name(), Some(sym::cfg | sym::cfg_attr)) {
67+
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
7868
}
7969
}
8070

8171
// Skip arguments that are configured out.
82-
if ecx.ecfg.features.asm_cfg() && strip_unconfigured.configure(arg.attributes).is_none() {
72+
if strip_unconfigured.configure(arg.attributes).is_none() {
8373
continue;
8474
}
8575

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ declare_features! (
6060
(accepted, adx_target_feature, "1.61.0", Some(44839)),
6161
/// Allows explicit discriminants on non-unit enum variants.
6262
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
63+
/// Allows #[cfg(...)] on inline assembly templates and operands.
64+
(accepted, asm_cfg, "CURRENT_RUSTC_VERSION", Some(140364)),
6365
/// Allows using `const` operands in inline assembly.
6466
(accepted, asm_const, "1.82.0", Some(93332)),
6567
/// Allows using `label` operands in inline assembly.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ declare_features! (
382382
(unstable, arbitrary_self_types, "1.23.0", Some(44874)),
383383
/// Allows inherent and trait methods with arbitrary self types that are raw pointers.
384384
(unstable, arbitrary_self_types_pointers, "1.83.0", Some(44874)),
385-
/// Allows #[cfg(...)] on inline assembly templates and operands.
386-
(unstable, asm_cfg, "1.89.0", Some(140364)),
387385
/// Enables experimental inline assembly support for additional architectures.
388386
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
389387
/// Enables experimental register support in inline assembly.

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,14 +1186,21 @@ pub(crate) fn check_static_item<'tcx>(
11861186
) -> Result<(), ErrorGuaranteed> {
11871187
enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
11881188
let span = tcx.ty_span(item_id);
1189-
let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(item_id)), ty);
1189+
let loc = Some(WellFormedLoc::Ty(item_id));
1190+
let item_ty = wfcx.deeply_normalize(span, loc, ty);
11901191

11911192
let is_foreign_item = tcx.is_foreign_item(item_id);
1193+
let is_structurally_foreign_item = || {
1194+
let tail = tcx.struct_tail_raw(
1195+
item_ty,
1196+
&ObligationCause::dummy(),
1197+
|ty| wfcx.deeply_normalize(span, loc, ty),
1198+
|| {},
1199+
);
11921200

1193-
let forbid_unsized = !is_foreign_item || {
1194-
let tail = tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
1195-
!matches!(tail.kind(), ty::Foreign(_))
1201+
matches!(tail.kind(), ty::Foreign(_))
11961202
};
1203+
let forbid_unsized = !(is_foreign_item && is_structurally_foreign_item());
11971204

11981205
wfcx.register_wf_obligation(span, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
11991206
if forbid_unsized {

0 commit comments

Comments
 (0)