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 14 pull requests #130177

Closed
wants to merge 46 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f693910
Partially stabilize `io_error_more`
GrigorenkoPV Jul 28, 2024
893413d
Add a run-make test for checking that certain `rustc_` crates build o…
Kobzol Aug 24, 2024
7957140
inhibit proc-macro2 nightly detection
lqd Aug 24, 2024
d9794a9
run test in tmp dir and emit artifacts there
lqd Aug 24, 2024
2190c28
remove use of RUSTC_BOOTSTRAP and cargo nightly features
lqd Aug 25, 2024
0577035
separate the crates to test from the test setup
lqd Aug 25, 2024
f1df0c5
remove unneeded type ascription
lqd Aug 25, 2024
a178559
address review comments
lqd Sep 2, 2024
7dd1be1
Also emit `missing_docs` lint with `--test` to fulfill expectations
Urgau Sep 6, 2024
5f367bb
Make `download-ci-llvm = true` check if CI llvm is available
Urgau Aug 23, 2024
fa60ea7
interpret: remove Readable trait, we can use Projectable instead
RalfJung Aug 28, 2024
8ad808d
interpret: make Writeable trait about a to_place operation
RalfJung Aug 28, 2024
85dc22f
interpret: factor out common code for place mutation
RalfJung Aug 29, 2024
cbdcbf0
interpret: reset provenance on typed copies
RalfJung Aug 29, 2024
8cd982c
interpret: reset padding during validation
RalfJung Aug 29, 2024
a241042
clarify comments and names in check_validity_requirement
RalfJung Sep 5, 2024
11bd99d
IntervalSet: add comment about representation
RalfJung Sep 5, 2024
bbe28cf
Remove `serialized_bitcode` from `LtoModuleCodegen`.
nnethercote Sep 5, 2024
54672ac
[illumos] enable SIGSEGV handler to detect stack overflows
sunshowers Sep 9, 2024
0237899
bootstrap `naked_asm!` for `compiler-builtins`
folkertdev Sep 9, 2024
db63611
Helper function for formatting with `LifetimeSuggestionPosition`
GrigorenkoPV Sep 9, 2024
843708a
Add missing `#[allow(missing_docs)]` on hack functions in alloc
Urgau Sep 6, 2024
65c7090
union padding computation: add fast-path for ZST
RalfJung Sep 9, 2024
a1a8627
Allow `missing_docs` lint on the generated test harness
Urgau Sep 9, 2024
0f9cb07
Add test about missing docs at crate level
Urgau Sep 9, 2024
383f506
adapt a test for llvm 20
krasimirgg Sep 9, 2024
0a70924
fix UB in a test
RalfJung Sep 9, 2024
0e59075
unify `llvm-bitcode-linker`, `wasm-component-ld` and llvm-tools logics
onur-ozkan Sep 7, 2024
667cf22
bump download-ci-llvm-stamp
onur-ozkan Sep 9, 2024
720bd0d
move some const fn out of the const_ptr_as_ref feature
RalfJung Sep 9, 2024
e10224a
move const fn with a null check into const_ptr_is_null gate
RalfJung Sep 9, 2024
d243c8f
compiler: Inform the solver of concurrency
workingjubilee Sep 8, 2024
2df9ae7
Rollup merge of #128316 - GrigorenkoPV:io_error_a_bit_more, r=dtolnay
workingjubilee Sep 10, 2024
3abb55d
Rollup merge of #129473 - Urgau:fix-llvm-if-unchanged, r=onur-ozkan
workingjubilee Sep 10, 2024
4532b7c
Rollup merge of #129529 - lqd:stable-new-solver, r=Kobzol
workingjubilee Sep 10, 2024
b0a7fa8
Rollup merge of #129778 - RalfJung:interp-lossy-typed-copy, r=saethlin
workingjubilee Sep 10, 2024
431a890
Rollup merge of #129981 - nnethercote:rm-serialize_bitcode, r=antoyo,…
workingjubilee Sep 10, 2024
bdcc49a
Rollup merge of #130025 - Urgau:missing_docs-expect, r=petrochenkov
workingjubilee Sep 10, 2024
961fa10
Rollup merge of #130040 - onur-ozkan:llvm-tools-with-ci-rustc, r=Kobzol
workingjubilee Sep 10, 2024
c3977ab
Rollup merge of #130094 - workingjubilee:concurrency-is-real, r=lcnr
workingjubilee Sep 10, 2024
0d63d03
Rollup merge of #130132 - sunshowers:illumos-sigsegv, r=Noratrieb
workingjubilee Sep 10, 2024
91a3cf1
Rollup merge of #130146 - folkertdev:bootstrap-naked-asm, r=Amanieu
workingjubilee Sep 10, 2024
96140e5
Rollup merge of #130149 - GrigorenkoPV:lifetime-suggestion, r=cjgillot
workingjubilee Sep 10, 2024
1e42b4d
Rollup merge of #130152 - krasimirgg:nsan, r=nikic
workingjubilee Sep 10, 2024
0ee8a56
Rollup merge of #130162 - onur-ozkan:bump-ci-llvm-stamp, r=Kobzol
workingjubilee Sep 10, 2024
c1d1aef
Rollup merge of #130164 - RalfJung:const_ptr_as_ref, r=dtolnay
workingjubilee Sep 10, 2024
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
38 changes: 38 additions & 0 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
@@ -812,6 +812,44 @@ pub(super) fn expand_asm<'cx>(
})
}

pub(super) fn expand_naked_asm<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
ExpandResult::Ready(match parse_args(ecx, sp, tts, false) {
Ok(args) => {
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, args) else {
return ExpandResult::Retry(());
};
let expr = match mac {
Ok(mut inline_asm) => {
// for future compatibility, we always set the NORETURN option.
//
// When we turn `asm!` into `naked_asm!` with this implementation, we can drop
// the `options(noreturn)`, which makes the upgrade smooth when `naked_asm!`
// starts disallowing the `noreturn` option in the future
inline_asm.options |= ast::InlineAsmOptions::NORETURN;

P(ast::Expr {
id: ast::DUMMY_NODE_ID,
kind: ast::ExprKind::InlineAsm(P(inline_asm)),
span: sp,
attrs: ast::AttrVec::new(),
tokens: None,
})
}
Err(guar) => DummyResult::raw_expr(sp, Some(guar)),
};
MacEager::expr(expr)
}
Err(err) => {
let guar = err.emit();
DummyResult::any(sp, guar)
}
})
}

pub(super) fn expand_global_asm<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
sp: Span,
1 change: 1 addition & 0 deletions compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
line: source_util::expand_line,
log_syntax: log_syntax::expand_log_syntax,
module_path: source_util::expand_mod,
naked_asm: asm::expand_naked_asm,
option_env: env::expand_option_env,
pattern_type: pattern_type::expand,
std_panic: edition_panic::expand_panic,
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -1256,6 +1256,7 @@ symbols! {
mut_preserve_binding_mode_2024,
mut_ref,
naked,
naked_asm,
naked_functions,
name,
names,
14 changes: 14 additions & 0 deletions library/core/src/arch.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,20 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */
}

/// Inline assembly used in combination with `#[naked]` functions.
///
/// Refer to [Rust By Example] for a usage guide and the [reference] for
/// detailed information about the syntax and available options.
///
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
#[unstable(feature = "naked_functions", issue = "90957")]
#[rustc_builtin_macro]
#[cfg(not(bootstrap))]
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */
}

/// Module-level inline assembly.
///
/// Refer to [Rust By Example] for a usage guide and the [reference] for
12 changes: 6 additions & 6 deletions tests/ui/asm/naked-functions-inline.rs
Original file line number Diff line number Diff line change
@@ -2,37 +2,37 @@
#![feature(naked_functions)]
#![crate_type = "lib"]

use std::arch::asm;
use std::arch::naked_asm;

#[naked]
pub unsafe extern "C" fn inline_none() {
asm!("", options(noreturn));
naked_asm!("");
}

#[naked]
#[inline]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_hint() {
asm!("", options(noreturn));
naked_asm!("");
}

#[naked]
#[inline(always)]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_always() {
asm!("", options(noreturn));
naked_asm!("");
}

#[naked]
#[inline(never)]
//~^ ERROR [E0736]
pub unsafe extern "C" fn inline_never() {
asm!("", options(noreturn));
naked_asm!("");
}

#[naked]
#[cfg_attr(all(), inline(never))]
//~^ ERROR [E0736]
pub unsafe extern "C" fn conditional_inline_never() {
asm!("", options(noreturn));
naked_asm!("");
}