Skip to content

Commit 5f4e73c

Browse files
committed
Auto merge of #104310 - Dylan-DPC:rollup-wgt1z4a, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #102049 (Add the `#[derive_const]` attribute) - #103970 (Unhide unknown spans) - #104206 (Remove `save_and_restore_in_snapshot_flag`, use `ObligationCtxt` more) - #104214 (Emit error in `collecting_trait_impl_trait_tys` on mismatched signatures) - #104267 (rustdoc: use checkbox instead of switch for settings toggles) - #104302 (Update cargo) - #104303 (UI tests can be assigned to T-compiler) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 825f8ed + feff57b commit 5f4e73c

File tree

64 files changed

+796
-476
lines changed

Some content is hidden

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

64 files changed

+796
-476
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ dependencies = [
273273

274274
[[package]]
275275
name = "cargo"
276-
version = "0.67.0"
276+
version = "0.68.0"
277277
dependencies = [
278278
"anyhow",
279279
"atty",

compiler/rustc_builtin_macros/src/cfg_accessible.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl MultiItemModifier for Expander {
3434
span: Span,
3535
meta_item: &ast::MetaItem,
3636
item: Annotatable,
37+
_is_derive_const: bool,
3738
) -> ExpandResult<Vec<Annotatable>, Annotatable> {
3839
let template = AttributeTemplate { list: Some("path"), ..Default::default() };
3940
let attr = &ecx.attribute(meta_item.clone());

compiler/rustc_builtin_macros/src/derive.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_session::Session;
1010
use rustc_span::symbol::{sym, Ident};
1111
use rustc_span::Span;
1212

13-
pub(crate) struct Expander;
13+
pub(crate) struct Expander(pub bool);
1414

1515
impl MultiItemModifier for Expander {
1616
fn expand(
@@ -19,6 +19,7 @@ impl MultiItemModifier for Expander {
1919
span: Span,
2020
meta_item: &ast::MetaItem,
2121
item: Annotatable,
22+
_: bool,
2223
) -> ExpandResult<Vec<Annotatable>, Annotatable> {
2324
let sess = ecx.sess;
2425
if report_bad_target(sess, &item, span) {
@@ -58,20 +59,20 @@ impl MultiItemModifier for Expander {
5859
report_path_args(sess, &meta);
5960
meta.path
6061
})
61-
.map(|path| (path, dummy_annotatable(), None))
62+
.map(|path| (path, dummy_annotatable(), None, self.0))
6263
.collect();
6364

6465
// Do not configure or clone items unless necessary.
6566
match &mut resolutions[..] {
6667
[] => {}
67-
[(_, first_item, _), others @ ..] => {
68+
[(_, first_item, ..), others @ ..] => {
6869
*first_item = cfg_eval(
6970
sess,
7071
features,
7172
item.clone(),
7273
ecx.current_expansion.lint_node_id,
7374
);
74-
for (_, item, _) in others {
75+
for (_, item, _, _) in others {
7576
*item = first_item.clone();
7677
}
7778
}

compiler/rustc_builtin_macros/src/deriving/bounds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn expand_deriving_copy(
1212
mitem: &MetaItem,
1313
item: &Annotatable,
1414
push: &mut dyn FnMut(Annotatable),
15+
is_const: bool,
1516
) {
1617
let trait_def = TraitDef {
1718
span,
@@ -22,6 +23,7 @@ pub fn expand_deriving_copy(
2223
supports_unions: true,
2324
methods: Vec::new(),
2425
associated_types: Vec::new(),
26+
is_const,
2527
};
2628

2729
trait_def.expand(cx, mitem, item, push);

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub fn expand_deriving_clone(
1414
mitem: &MetaItem,
1515
item: &Annotatable,
1616
push: &mut dyn FnMut(Annotatable),
17+
is_const: bool,
1718
) {
1819
// The simple form is `fn clone(&self) -> Self { *self }`, possibly with
1920
// some additional `AssertParamIsClone` assertions.
@@ -87,6 +88,7 @@ pub fn expand_deriving_clone(
8788
combine_substructure: substructure,
8889
}],
8990
associated_types: Vec::new(),
91+
is_const,
9092
};
9193

9294
trait_def.expand_ext(cx, mitem, item, push, is_simple)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn expand_deriving_eq(
1515
mitem: &MetaItem,
1616
item: &Annotatable,
1717
push: &mut dyn FnMut(Annotatable),
18+
is_const: bool,
1819
) {
1920
let span = cx.with_def_site_ctxt(span);
2021
let inline = cx.meta_word(span, sym::inline);
@@ -42,6 +43,7 @@ pub fn expand_deriving_eq(
4243
})),
4344
}],
4445
associated_types: Vec::new(),
46+
is_const,
4547
};
4648

4749
super::inject_impl_of_structural_trait(cx, span, item, path_std!(marker::StructuralEq), push);

compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn expand_deriving_ord(
1313
mitem: &MetaItem,
1414
item: &Annotatable,
1515
push: &mut dyn FnMut(Annotatable),
16+
is_const: bool,
1617
) {
1718
let inline = cx.meta_word(span, sym::inline);
1819
let attrs = thin_vec![cx.attribute(inline)];
@@ -34,6 +35,7 @@ pub fn expand_deriving_ord(
3435
combine_substructure: combine_substructure(Box::new(|a, b, c| cs_cmp(a, b, c))),
3536
}],
3637
associated_types: Vec::new(),
38+
is_const,
3739
};
3840

3941
trait_def.expand(cx, mitem, item, push)

compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub fn expand_deriving_partial_eq(
1414
mitem: &MetaItem,
1515
item: &Annotatable,
1616
push: &mut dyn FnMut(Annotatable),
17+
is_const: bool,
1718
) {
1819
fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
1920
let base = true;
@@ -89,6 +90,7 @@ pub fn expand_deriving_partial_eq(
8990
supports_unions: false,
9091
methods,
9192
associated_types: Vec::new(),
93+
is_const,
9294
};
9395
trait_def.expand(cx, mitem, item, push)
9496
}

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn expand_deriving_partial_ord(
1313
mitem: &MetaItem,
1414
item: &Annotatable,
1515
push: &mut dyn FnMut(Annotatable),
16+
is_const: bool,
1617
) {
1718
let ordering_ty = Path(path_std!(cmp::Ordering));
1819
let ret_ty =
@@ -43,6 +44,7 @@ pub fn expand_deriving_partial_ord(
4344
supports_unions: false,
4445
methods: vec![partial_cmp_def],
4546
associated_types: Vec::new(),
47+
is_const,
4648
};
4749
trait_def.expand(cx, mitem, item, push)
4850
}

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn expand_deriving_debug(
1313
mitem: &MetaItem,
1414
item: &Annotatable,
1515
push: &mut dyn FnMut(Annotatable),
16+
is_const: bool,
1617
) {
1718
// &mut ::std::fmt::Formatter
1819
let fmtr = Ref(Box::new(Path(path_std!(fmt::Formatter))), ast::Mutability::Mut);
@@ -37,6 +38,7 @@ pub fn expand_deriving_debug(
3738
})),
3839
}],
3940
associated_types: Vec::new(),
41+
is_const,
4042
};
4143
trait_def.expand(cx, mitem, item, push)
4244
}

0 commit comments

Comments
 (0)