Skip to content

Commit eb165d0

Browse files
committed
Auto merge of #140112 - jieyouxu:rollup-srw76oc, r=jieyouxu
Rollup of 12 pull requests Successful merges: - #134213 (Stabilize `naked_functions`) - #139795 (Clarify why SGX code specifies linkage/symbol names for certain statics) - #139981 (Don't compute name of associated item if it's an RPITIT) - #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) - #140077 (Construct OutputType using macro and print [=FILENAME] help info) - #140081 (Update `libc` to 0.2.172) - #140091 (build_helper: try to rename dir before delete) - #140107 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c8f9423 + 043ee6f commit eb165d0

File tree

99 files changed

+656
-484
lines changed

Some content is hidden

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

99 files changed

+656
-484
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ dependencies = [
332332
name = "build_helper"
333333
version = "0.1.0"
334334
dependencies = [
335+
"fastrand",
335336
"serde",
336337
"serde_derive",
337338
]

compiler/rustc_builtin_macros/src/autodiff.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,14 @@ mod llvm_enzyme {
596596
}
597597
};
598598
let arg = ty.kind.is_simple_path().unwrap();
599-
let sl: Vec<Symbol> = vec![arg, kw::Default];
600-
let tmp = ecx.def_site_path(&sl);
599+
let tmp = ecx.def_site_path(&[arg, kw::Default]);
601600
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
602601
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
603602
body.stmts.push(ecx.stmt_expr(default_call_expr));
604603
return body;
605604
}
606605

607-
let mut exprs: P<ast::Expr> = primal_call.clone();
606+
let mut exprs: P<ast::Expr> = primal_call;
608607
let d_ret_ty = match d_sig.decl.output {
609608
FnRetTy::Ty(ref ty) => ty.clone(),
610609
FnRetTy::Default(span) => {
@@ -622,7 +621,7 @@ mod llvm_enzyme {
622621
// type due to the Const return activity.
623622
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
624623
} else {
625-
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 };
624+
let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
626625
let y =
627626
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
628627
let default_call_expr = ecx.expr(span, y);
@@ -640,8 +639,7 @@ mod llvm_enzyme {
640639
let mut exprs2 = thin_vec![exprs];
641640
for arg in args.iter().skip(1) {
642641
let arg = arg.kind.is_simple_path().unwrap();
643-
let sl: Vec<Symbol> = vec![arg, kw::Default];
644-
let tmp = ecx.def_site_path(&sl);
642+
let tmp = ecx.def_site_path(&[arg, kw::Default]);
645643
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
646644
let default_call_expr =
647645
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
#![feature(
2-
no_core,
3-
lang_items,
4-
never_type,
5-
linkage,
6-
extern_types,
7-
naked_functions,
8-
thread_local,
9-
repr_simd
10-
)]
1+
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
112
#![no_core]
123
#![allow(dead_code, non_camel_case_types, internal_features)]
134

compiler/rustc_error_codes/src/error_codes/E0787.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ An unsupported naked function definition.
33
Erroneous code example:
44

55
```compile_fail,E0787
6-
#![feature(naked_functions)]
7-
86
#[unsafe(naked)]
97
pub extern "C" fn f() -> u32 {
108
42

compiler/rustc_feature/src/accepted.rs

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

compiler/rustc_feature/src/builtin_attrs.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
443443
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
444444
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
445445
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
446+
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
446447

447448
// Limits:
448449
ungated!(
@@ -515,12 +516,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
515516
// Unstable attributes:
516517
// ==========================================================================
517518

518-
// Linking:
519-
gated!(
520-
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
521-
naked_functions, experimental!(naked)
522-
),
523-
524519
// Testing:
525520
gated!(
526521
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,

compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,6 @@ declare_features! (
563563
(unstable, must_not_suspend, "1.57.0", Some(83310)),
564564
/// Allows `mut ref` and `mut ref mut` identifier patterns.
565565
(incomplete, mut_ref, "1.79.0", Some(123076)),
566-
/// Allows using `#[naked]` on functions.
567-
(unstable, naked_functions, "1.9.0", Some(90957)),
568566
/// Allows using `#[naked]` on `extern "Rust"` functions.
569567
(unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)),
570568
/// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions.

compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
486486
let items: &AssocItems = self.tcx.associated_items(self.def_id);
487487
items
488488
.in_definition_order()
489-
.filter(|item| item.is_type())
490489
.filter(|item| {
491-
!self
492-
.gen_args
493-
.constraints
494-
.iter()
495-
.any(|constraint| constraint.ident.name == item.name())
490+
item.is_type()
491+
&& !item.is_impl_trait_in_trait()
492+
&& !self
493+
.gen_args
494+
.constraints
495+
.iter()
496+
.any(|constraint| constraint.ident.name == item.name())
496497
})
497-
.filter(|item| !item.is_impl_trait_in_trait())
498498
.map(|item| self.tcx.item_ident(item.def_id).to_string())
499499
.collect()
500500
} else {

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_errors::codes::*;
2929
use rustc_errors::{
3030
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err,
3131
};
32-
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
32+
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
3333
use rustc_hir::def_id::{DefId, LocalDefId};
3434
use rustc_hir::{self as hir, AnonConst, GenericArg, GenericArgs, HirId};
3535
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
@@ -1731,9 +1731,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
17311731
tcx.associated_items(*trait_def_id)
17321732
.in_definition_order()
17331733
.any(|i| {
1734-
i.namespace() == Namespace::TypeNS
1734+
i.is_type()
1735+
&& !i.is_impl_trait_in_trait()
17351736
&& i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
1736-
&& i.is_type()
17371737
})
17381738
// Consider only accessible traits
17391739
&& tcx.visibility(*trait_def_id)

compiler/rustc_middle/src/ty/assoc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ impl AssocItems {
246246
}
247247

248248
/// Returns an iterator over all associated items with the given name, ignoring hygiene.
249+
///
250+
/// Panics if `name.is_empty()` returns `true`.
249251
pub fn filter_by_name_unhygienic(
250252
&self,
251253
name: Symbol,

compiler/rustc_mir_build/src/builder/scope.rs

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

compiler/rustc_passes/src/check_attr.rs

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

0 commit comments

Comments
 (0)