Auto merge of #140127 - ChrisDenton:rollup-2kye32h, r=ChrisDenton

Rollup of 11 pull requests

Successful merges:

 - #134213 (Stabilize `naked_functions`)
 - #139711 (Hermit: Unify `std::env::args` with Unix)
 - #139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - #140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - #140047 (remove a couple clones)
 - #140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - #140074 (rustdoc-json: Improve test for auto-trait impls)
 - #140076 (jsondocck: Require command is at start of line)
 - #140107 (rustc-dev-guide subtree update)
 - #140111 (cleanup redundant pattern instances)
 - #140118 ({B,C}Str: minor cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-04-21 19:28:16 +00:00
commit d6c1e454aa
90 changed files with 325 additions and 405 deletions

View file

@ -596,15 +596,14 @@ mod llvm_enzyme {
}
};
let arg = ty.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default];
let tmp = ecx.def_site_path(&sl);
let tmp = ecx.def_site_path(&[arg, kw::Default]);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
body.stmts.push(ecx.stmt_expr(default_call_expr));
return body;
}
let mut exprs: P<ast::Expr> = primal_call.clone();
let mut exprs: P<ast::Expr> = primal_call;
let d_ret_ty = match d_sig.decl.output {
FnRetTy::Ty(ref ty) => ty.clone(),
FnRetTy::Default(span) => {
@ -622,7 +621,7 @@ mod llvm_enzyme {
// type due to the Const return activity.
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
} else {
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 };
let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
let y =
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
let default_call_expr = ecx.expr(span, y);
@ -640,8 +639,7 @@ mod llvm_enzyme {
let mut exprs2 = thin_vec![exprs];
for arg in args.iter().skip(1) {
let arg = arg.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default];
let tmp = ecx.def_site_path(&sl);
let tmp = ecx.def_site_path(&[arg, kw::Default]);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr =
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);

View file

@ -1,13 +1,4 @@
#![feature(
no_core,
lang_items,
never_type,
linkage,
extern_types,
naked_functions,
thread_local,
repr_simd
)]
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
#![no_core]
#![allow(dead_code, non_camel_case_types, internal_features)]

View file

@ -3,8 +3,6 @@ An unsupported naked function definition.
Erroneous code example:
```compile_fail,E0787
#![feature(naked_functions)]
#[unsafe(naked)]
pub extern "C" fn f() -> u32 {
42

View file

@ -300,6 +300,8 @@ declare_features! (
/// Allows patterns with concurrent by-move and by-ref bindings.
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
(accepted, move_ref_pattern, "1.49.0", Some(68354)),
/// Allows using `#[naked]` on functions.
(accepted, naked_functions, "CURRENT_RUSTC_VERSION", Some(90957)),
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
(accepted, native_link_modifiers, "1.61.0", Some(81490)),
/// Allows specifying the bundle link modifier

View file

@ -443,6 +443,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
// Limits:
ungated!(
@ -515,12 +516,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// Unstable attributes:
// ==========================================================================
// Linking:
gated!(
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
naked_functions, experimental!(naked)
),
// Testing:
gated!(
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,

View file

@ -563,8 +563,6 @@ declare_features! (
(unstable, must_not_suspend, "1.57.0", Some(83310)),
/// Allows `mut ref` and `mut ref mut` identifier patterns.
(incomplete, mut_ref, "1.79.0", Some(123076)),
/// Allows using `#[naked]` on functions.
(unstable, naked_functions, "1.9.0", Some(90957)),
/// Allows using `#[naked]` on `extern "Rust"` functions.
(unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)),
/// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions.

View file

@ -246,6 +246,8 @@ impl AssocItems {
}
/// Returns an iterator over all associated items with the given name, ignoring hygiene.
///
/// Panics if `name.is_empty()` returns `true`.
pub fn filter_by_name_unhygienic(
&self,
name: Symbol,

View file

@ -1530,7 +1530,7 @@ fn build_scope_drops<'tcx>(
// path, then don't generate the drop. (We only take this into
// account for non-unwind paths so as not to disturb the
// caching mechanism.)
if scope.moved_locals.iter().any(|&o| o == local) {
if scope.moved_locals.contains(&local) {
continue;
}

View file

@ -690,13 +690,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}
}
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
// `#[naked]` attribute with just a lint, because we previously
// erroneously allowed it and some crates used it accidentally, to be compatible
// with crates depending on them, we can't throw an error here.
Target::Field | Target::Arm | Target::MacroDef => {
self.inline_attr_str_error_with_macro_def(hir_id, attr, "naked")
}
_ => {
self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
attr_span: attr.span(),

View file

@ -514,7 +514,7 @@ pub(crate) mod rustc {
}
}
ty::Tuple(fields) => fields[i.as_usize()],
kind @ _ => unimplemented!(
kind => unimplemented!(
"only a subset of `Ty::ty_and_layout_field`'s functionality is implemented. implementation needed for {:?}",
kind
),