Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
261d7eb
stabilize `asm_cfg`
folkertdev Oct 15, 2025
e8a00a7
Add sub-fn for method call annotation in FnCtxt::report_no_match_meth…
rperier Nov 12, 2025
117d676
Add sub-fn for static method candidates in FnCtxt::report_no_match_me…
rperier Nov 12, 2025
f23675f
Add sub-fn for unsatisfied ty or trait in FnCtxt::report_no_match_met…
rperier Nov 12, 2025
56ce33f
Add sub-fn for surround method calls in FnCtxt::report_no_match_metho…
rperier Nov 12, 2025
d7a8f6b
Add sub-fn to find possible candidates for method in FnCtxt::report_n…
rperier Nov 12, 2025
a33555b
Add sub-fn for confusable or similarly named methods in FnCtxt::repor…
rperier Nov 12, 2025
ae2c070
Add sub-fn for not found methods with unsatisfied bounds in FnCtxt::r…
rperier Nov 12, 2025
4c952eb
Refactor and cleanup FnCtxt::report_no_match_method_error
rperier Nov 12, 2025
cf46682
fix: Do not ICE on normalization failure of an extern static item
ShoyuVanilla Nov 22, 2025
a21affa
Fix invalid link generation for type alias methods
GuillaumeGomez Nov 24, 2025
3181c21
Improve variable naming
GuillaumeGomez Nov 24, 2025
525cdc7
skip checking supertraits in assembly_object_bound_candidate for Norm…
adwinwhite Nov 21, 2025
d8c9d70
Fix comment wording in simplify_comparison_integral.rs
zjumathcode Nov 25, 2025
a700e47
Simplify OnceCell Clone impl
tisonkun Nov 25, 2025
8ed8f18
add implementation-internal namespace for globalasm
davidtwco Nov 24, 2025
04e4f95
Rollup merge of #147736 - folkertdev:stabilize-asm-cfg, r=jdonszelmann
matthiaskrgr Nov 25, 2025
7c96106
Rollup merge of #148652 - rperier:report_no_match_method_error-refact…
matthiaskrgr Nov 25, 2025
53276ad
Rollup merge of #149167 - adwinwhite:next-245, r=lcnr
matthiaskrgr Nov 25, 2025
2f566a8
Rollup merge of #149210 - ShoyuVanilla:issue-148161, r=jdonszelmann
matthiaskrgr Nov 25, 2025
50237b3
Rollup merge of #149268 - davidtwco:v0-mangling-global-asm-namespace,…
matthiaskrgr Nov 25, 2025
d6966fa
Rollup merge of #149274 - GuillaumeGomez:tyalias-method-link, r=lolbi…
matthiaskrgr Nov 25, 2025
ac7b0bd
Rollup merge of #149302 - zjumathcode:main, r=jackh726
matthiaskrgr Nov 25, 2025
f40d825
Rollup merge of #149305 - tisonkun:oncecell-simplify, r=chenyukang
matthiaskrgr Nov 25, 2025
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
2 changes: 0 additions & 2 deletions compiler/rustc_builtin_macros/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ builtin_macros_alloc_must_statics = allocators must be statics
builtin_macros_asm_attribute_not_supported =
this attribute is not supported on assembly
builtin_macros_asm_cfg =
the `#[cfg(/* ... */)]` and `#[cfg_attr(/* ... */)]` attributes on assembly are unstable
builtin_macros_asm_clobber_abi = clobber_abi
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs
Expand Down
18 changes: 4 additions & 14 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ use rustc_expand::base::*;
use rustc_index::bit_set::GrowableBitSet;
use rustc_parse::parser::asm::*;
use rustc_session::lint;
use rustc_session::parse::feature_err;
use rustc_span::{ErrorGuaranteed, InnerSpan, Span, Symbol, sym};
use rustc_target::asm::InlineAsmArch;
use smallvec::smallvec;
use {rustc_ast as ast, rustc_parse_format as parse};

use crate::errors;
use crate::util::{ExprToSpannedString, expr_to_spanned_string};
use crate::{errors, fluent_generated as fluent};

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

for arg in args {
for attr in arg.attributes.0.iter() {
match attr.name() {
Some(sym::cfg | sym::cfg_attr) => {
if !ecx.ecfg.features.asm_cfg() {
let span = attr.span();
feature_err(ecx.sess, sym::asm_cfg, span, fluent::builtin_macros_asm_cfg)
.emit();
}
}
_ => {
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
}
if !matches!(attr.name(), Some(sym::cfg | sym::cfg_attr)) {
ecx.dcx().emit_err(errors::AsmAttributeNotSupported { span: attr.span() });
}
}

// Skip arguments that are configured out.
if ecx.ecfg.features.asm_cfg() && strip_unconfigured.configure(arg.attributes).is_none() {
if strip_unconfigured.configure(arg.attributes).is_none() {
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ declare_features! (
(accepted, adx_target_feature, "1.61.0", Some(44839)),
/// Allows explicit discriminants on non-unit enum variants.
(accepted, arbitrary_enum_discriminant, "1.66.0", Some(60553)),
/// Allows #[cfg(...)] on inline assembly templates and operands.
(accepted, asm_cfg, "CURRENT_RUSTC_VERSION", Some(140364)),
/// Allows using `const` operands in inline assembly.
(accepted, asm_const, "1.82.0", Some(93332)),
/// Allows using `label` operands in inline assembly.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,6 @@ declare_features! (
(unstable, arbitrary_self_types, "1.23.0", Some(44874)),
/// Allows inherent and trait methods with arbitrary self types that are raw pointers.
(unstable, arbitrary_self_types_pointers, "1.83.0", Some(44874)),
/// Allows #[cfg(...)] on inline assembly templates and operands.
(unstable, asm_cfg, "1.89.0", Some(140364)),
/// Enables experimental inline assembly support for additional architectures.
(unstable, asm_experimental_arch, "1.58.0", Some(93335)),
/// Enables experimental register support in inline assembly.
Expand Down
15 changes: 11 additions & 4 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,14 +1186,21 @@ pub(crate) fn check_static_item<'tcx>(
) -> Result<(), ErrorGuaranteed> {
enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
let span = tcx.ty_span(item_id);
let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(item_id)), ty);
let loc = Some(WellFormedLoc::Ty(item_id));
let item_ty = wfcx.deeply_normalize(span, loc, ty);

let is_foreign_item = tcx.is_foreign_item(item_id);
let is_structurally_foreign_item = || {
let tail = tcx.struct_tail_raw(
item_ty,
&ObligationCause::dummy(),
|ty| wfcx.deeply_normalize(span, loc, ty),
|| {},
);

let forbid_unsized = !is_foreign_item || {
let tail = tcx.struct_tail_for_codegen(item_ty, wfcx.infcx.typing_env(wfcx.param_env));
!matches!(tail.kind(), ty::Foreign(_))
matches!(tail.kind(), ty::Foreign(_))
};
let forbid_unsized = !(is_foreign_item && is_structurally_foreign_item());

wfcx.register_wf_obligation(span, Some(WellFormedLoc::Ty(item_id)), item_ty.into());
if forbid_unsized {
Expand Down
Loading
Loading