Skip to content

Commit 2350b22

Browse files
committed
Auto merge of #163244 - JonathanBrouwer:rollup-zSB1Zy6, r=JonathanBrouwer
Rollup of 14 pull requests Successful merges: - #162976 (fix quadratic naming of duplicate sidebar links) - #161275 (Refactor `core::cmp::{smallest, largest}` & add `mir-opt` test) - #163143 (cg_llvm: Use fewer FFI calls to check the target CPU's features) - #163188 (Adjust for Arm64EC name mangling when checking for exported symbols) - #163211 (`rustc_builtin_macros` cleanup, part 6) - #161386 (Don't merge distinct impl candidates) - #162942 (Remove `StashKey::AssociatedTypeSuggestion`) - #163096 (Don't suggest `std::` rustfix paths in `#![no_std]` crates) - #163110 (Mark `std::os::wasip2` with correct doc-cfgs, mark as unstable) - #163185 (properly decrement available_depth on cycles and provisional cache hits) - #163214 (revert r14 register names for arm) - #163226 (miri subtree update) - #163228 (Add regression test for trait predicate with escaping bounds) - #163234 (`rustc_dump_symbol_name`: add demangling information as a note instead)
2 parents ad2e756 + 6c262ac commit 2350b22

142 files changed

Lines changed: 3040 additions & 3307 deletions

File tree

Some content is hidden

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

‎compiler/rustc_builtin_macros/src/deriving/clone.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc_expand::base::ExtCtxt;
44
use rustc_span::{DUMMY_SP, Ident, Span, kw, sym};
55
use thin_vec::{ThinVec, thin_vec};
66

7-
use crate::deriving::generic::ty::*;
87
use crate::deriving::generic::*;
98
use crate::deriving::path_std;
109

@@ -68,7 +67,6 @@ pub(crate) fn expand_deriving_clone(
6867
additional_bounds: bounds.clone(),
6968
supports_unions: true,
7069
methods: SmallVec::new(),
71-
associated_types: SmallVec::new(),
7270
is_const,
7371
safety: Safety::Unsafe(DUMMY_SP),
7472
// `TrivialClone` is not part of an API guarantee, so it shouldn't
@@ -91,12 +89,12 @@ pub(crate) fn expand_deriving_clone(
9189
generics: cx.empty_generics(span),
9290
explicit_self: true,
9391
nonself_args: SmallVec::new(),
94-
ret_ty: Self_,
92+
has_other_selflike_arg: false,
93+
ret_ty: cx.ty_self(span),
9594
attributes: thin_vec![cx.attr_word(sym::inline, span)],
9695
fieldless_variants_strategy: FieldlessVariantsStrategy::Default,
9796
combine_substructure: substructure,
9897
}],
99-
associated_types: SmallVec::new(),
10098
is_const,
10199
safety: Safety::Default,
102100
document: true,

‎compiler/rustc_builtin_macros/src/deriving/const_param_ty.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub(crate) fn expand_deriving_const_param_ty(
2020
additional_bounds: smallvec![path_std!(cx, span, cmp::Eq)],
2121
supports_unions: false,
2222
methods: SmallVec::new(),
23-
associated_types: SmallVec::new(),
2423
is_const,
2524
safety: Safety::Default,
2625
document: true,

‎compiler/rustc_builtin_macros/src/deriving/copy.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub(crate) fn expand_deriving_copy(
2020
additional_bounds: SmallVec::new(),
2121
supports_unions: true,
2222
methods: SmallVec::new(),
23-
associated_types: SmallVec::new(),
2423
is_const,
2524
safety: Safety::Default,
2625
document: true,

‎compiler/rustc_builtin_macros/src/deriving/debug.rs‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc_session::config::FmtDebug;
44
use rustc_span::{Ident, Span, Symbol, sym};
55
use thin_vec::{ThinVec, thin_vec};
66

7-
use crate::deriving::generic::ty::*;
87
use crate::deriving::generic::*;
98
use crate::deriving::path_std;
109

@@ -16,7 +15,12 @@ pub(crate) fn expand_deriving_debug(
1615
is_const: bool,
1716
) {
1817
// &mut ::std::fmt::Formatter
19-
let fmtr = Ref(Box::new(Path(path_std!(cx, span, fmt::Formatter))), ast::Mutability::Mut);
18+
let fmtr = cx.ty_ref(
19+
span,
20+
cx.ty_path(path_std!(cx, span, fmt::Formatter)),
21+
None,
22+
ast::Mutability::Mut,
23+
);
2024

2125
let trait_def = TraitDef {
2226
span,
@@ -30,7 +34,8 @@ pub(crate) fn expand_deriving_debug(
3034
generics: cx.empty_generics(span),
3135
explicit_self: true,
3236
nonself_args: smallvec![(fmtr, sym::character('f'))],
33-
ret_ty: Path(path_std!(cx, span, fmt::Result)),
37+
has_other_selflike_arg: false,
38+
ret_ty: cx.ty_path(path_std!(cx, span, fmt::Result)),
3439
attributes: thin_vec![cx.attr_word(sym::inline, span)],
3540
fieldless_variants_strategy:
3641
FieldlessVariantsStrategy::SpecializeIfAllVariantsFieldless,
@@ -41,7 +46,6 @@ pub(crate) fn expand_deriving_debug(
4146
item.kind.ident().unwrap()
4247
)),
4348
}],
44-
associated_types: SmallVec::new(),
4549
is_const,
4650
safety: Safety::Default,
4751
document: true,
@@ -50,7 +54,7 @@ pub(crate) fn expand_deriving_debug(
5054
}
5155

5256
fn formatter_ident(cx: &ExtCtxt<'_>, span: Span) -> Box<ast::Expr> {
53-
cx.expr_ident(span, Ident::new(sym::character('f'), span))
57+
cx.expr_ident_sym(span, sym::character('f'))
5458
}
5559

5660
fn show_substructure(
@@ -195,9 +199,9 @@ fn show_substructure(
195199
args.push(fmt);
196200
args.push(name);
197201
if is_struct {
198-
args.push(cx.expr_ident(span, Ident::new(sym::names, span)));
202+
args.push(cx.expr_ident_sym(span, sym::names));
199203
}
200-
args.push(cx.expr_ident(span, Ident::new(sym::values, span)));
204+
args.push(cx.expr_ident_sym(span, sym::values));
201205
let expr = cx.expr_call_global(span, fn_path_debug_internal, args);
202206

203207
let mut stmts = ThinVec::with_capacity(2);

‎compiler/rustc_builtin_macros/src/deriving/default.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use rustc_span::{ErrorGuaranteed, Ident, Span, kw, sym};
77
use smallvec::SmallVec;
88
use thin_vec::{ThinVec, thin_vec};
99

10-
use crate::deriving::generic::ty::*;
1110
use crate::deriving::generic::*;
11+
use crate::deriving::new_path;
1212
use crate::diagnostics;
1313

1414
pub(crate) fn expand_deriving_default(
@@ -22,7 +22,7 @@ pub(crate) fn expand_deriving_default(
2222

2323
let trait_def = TraitDef {
2424
span,
25-
path: new_path(cx, span, &[kw::Default, sym::Default], &[]),
25+
path: new_path(cx, span, &[kw::Default, sym::Default], vec![]),
2626
skip_path_as_bound: has_a_default_variant(item),
2727
needs_copy_as_bound_if_packed: false,
2828
additional_bounds: SmallVec::new(),
@@ -32,7 +32,8 @@ pub(crate) fn expand_deriving_default(
3232
generics: cx.empty_generics(span),
3333
explicit_self: false,
3434
nonself_args: SmallVec::new(),
35-
ret_ty: Self_,
35+
has_other_selflike_arg: false,
36+
ret_ty: cx.ty_self(span),
3637
attributes: thin_vec![cx.attr_word(sym::inline, span)],
3738
fieldless_variants_strategy: FieldlessVariantsStrategy::Default,
3839
combine_substructure: combine_substructure(|cx, trait_span, substr| {
@@ -49,7 +50,6 @@ pub(crate) fn expand_deriving_default(
4950
}
5051
}),
5152
}],
52-
associated_types: SmallVec::new(),
5353
is_const,
5454
safety: Safety::Default,
5555
document: true,

‎compiler/rustc_builtin_macros/src/deriving/eq.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc_expand::base::ExtCtxt;
44
use rustc_span::{Span, sym};
55
use thin_vec::{ThinVec, thin_vec};
66

7-
use crate::deriving::generic::ty::*;
87
use crate::deriving::generic::*;
98
use crate::deriving::path_std;
109

@@ -29,7 +28,8 @@ pub(crate) fn expand_deriving_eq(
2928
generics: cx.empty_generics(span),
3029
explicit_self: true,
3130
nonself_args: smallvec![],
32-
ret_ty: Unit,
31+
has_other_selflike_arg: false,
32+
ret_ty: cx.ty_unit(span),
3333
attributes: thin_vec![
3434
// This method will never be called, so doing codegen etc. for it is unnecessary.
3535
// We prevent this by adding `#[inline]`, which improves compile-time.
@@ -40,7 +40,6 @@ pub(crate) fn expand_deriving_eq(
4040
fieldless_variants_strategy: FieldlessVariantsStrategy::Unify,
4141
combine_substructure: combine_substructure(cs_total_eq_assert),
4242
}],
43-
associated_types: SmallVec::new(),
4443
is_const,
4544
safety: Safety::Default,
4645
document: true,

‎compiler/rustc_builtin_macros/src/deriving/from.rs‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ use rustc_expand::base::{DummyResult, ExtCtxt};
55
use rustc_span::{Ident, Span, kw, sym};
66
use thin_vec::thin_vec;
77

8-
use crate::deriving::generic::ty::*;
98
use crate::deriving::generic::*;
10-
use crate::deriving::pathvec;
9+
use crate::deriving::{new_path, pathvec};
1110
use crate::diagnostics;
1211

1312
/// Generate an implementation of the `From` trait, provided that `item`
@@ -47,12 +46,12 @@ pub(crate) fn expand_deriving_from(
4746
_ => cx.dcx().bug("Invalid derive(From) ADT input"),
4847
};
4948

50-
let from_type = Ty::AstTy(match field {
49+
let from_type = match field {
5150
Ok(ref field) => field.ty.clone(),
5251
Err(guar) => cx.ty(span, ast::TyKind::Err(guar)),
53-
});
52+
};
5453

55-
let path = new_path(cx, span, pathvec!(convert::From), &[from_type.clone()]);
54+
let path = new_path(cx, span, pathvec!(convert::From), vec![from_type.clone()]);
5655

5756
// Generate code like this:
5857
//
@@ -76,7 +75,8 @@ pub(crate) fn expand_deriving_from(
7675
generics: cx.empty_generics(span),
7776
explicit_self: false,
7877
nonself_args: smallvec![(from_type, sym::value)],
79-
ret_ty: Ty::Self_,
78+
has_other_selflike_arg: false,
79+
ret_ty: cx.ty_self(span),
8080
attributes: thin_vec![cx.attr_word(sym::inline, span)],
8181
fieldless_variants_strategy: FieldlessVariantsStrategy::Default,
8282
combine_substructure: combine_substructure(|cx, span, substructure| {
@@ -97,14 +97,14 @@ pub(crate) fn expand_deriving_from(
9797
thin_vec![cx.field_imm(
9898
span,
9999
field.ident.unwrap(),
100-
cx.expr_ident(span, Ident::new(sym::value, span))
100+
cx.expr_ident_sym(span, sym::value)
101101
)],
102102
),
103103
// Self(value)
104104
VariantData::Tuple(_, _) => cx.expr_call_ident(
105105
span,
106106
self_kw,
107-
thin_vec![cx.expr_ident(span, Ident::new(sym::value, span))],
107+
thin_vec![cx.expr_ident_sym(span, sym::value)],
108108
),
109109
variant => {
110110
cx.dcx().bug(format!("Invalid derive(From) ADT variant: {variant:?}"));
@@ -115,7 +115,6 @@ pub(crate) fn expand_deriving_from(
115115
BlockOrExpr::new_expr(expr)
116116
}),
117117
}],
118-
associated_types: SmallVec::new(),
119118
is_const,
120119
safety: Safety::Default,
121120
document: true,

0 commit comments

Comments
 (0)