Skip to content

Commit 5700240

Browse files
committedNov 12, 2024
Auto merge of #132943 - matthiaskrgr:rollup-164l3ej, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #132651 (Remove attributes from generics in built-in derive macros) - #132668 (Feature gate yield expressions not in 2024) - #132771 (test(configure): cover `parse_args` in `src/bootstrap/configure.py`) - #132895 (Generalize `NonNull::from_raw_parts` per ACP362) - #132914 (Update grammar in std::cell docs.) - #132927 (Consolidate type system const evaluation under `traits::evaluate_const`) - #132935 (Make sure to ignore elided lifetimes when pointing at args for fulfillment errors) - #132941 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.84.0
2 parents 9a9dadd + 38c2db4 commit 5700240

File tree

73 files changed

+914
-842
lines changed

Some content is hidden

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

73 files changed

+914
-842
lines changed
 

‎compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,18 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
523523
"consider removing `for<...>`"
524524
);
525525
gate_all!(more_qualified_paths, "usage of qualified paths in this context is experimental");
526-
for &span in spans.get(&sym::yield_expr).iter().copied().flatten() {
527-
if !span.at_least_rust_2024() {
528-
gate!(&visitor, coroutines, span, "yield syntax is experimental");
526+
// yield can be enabled either by `coroutines` or `gen_blocks`
527+
if let Some(spans) = spans.get(&sym::yield_expr) {
528+
for span in spans {
529+
if (!visitor.features.coroutines() && !span.allows_unstable(sym::coroutines))
530+
&& (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks))
531+
{
532+
#[allow(rustc::untranslatable_diagnostic)]
533+
// Don't know which of the two features to include in the
534+
// error message, so I am arbitrarily picking one.
535+
feature_err(&visitor.sess, sym::coroutines, *span, "yield syntax is experimental")
536+
.emit();
537+
}
529538
}
530539
}
531540
gate_all!(gen_blocks, "gen blocks are experimental");

‎compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,12 @@ impl<'a> TraitDef<'a> {
680680
param_clone
681681
}
682682
})
683+
.map(|mut param| {
684+
// Remove all attributes, because there might be helper attributes
685+
// from other macros that will not be valid in the expanded implementation.
686+
param.attrs.clear();
687+
param
688+
})
683689
.collect();
684690

685691
// and similarly for where clauses

0 commit comments

Comments
 (0)
Please sign in to comment.