Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 77fab24

Browse files
committed
Auto merge of rust-lang#134393 - GuillaumeGomez:rollup-tqhgy5d, r=GuillaumeGomez
Rollup of 9 pull requests Successful merges: - rust-lang#132056 (Stabilize `#[diagnostic::do_not_recommend]`) - rust-lang#134124 (CI: use free runners for x86_64-gnu-llvm jobs) - rust-lang#134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed') - rust-lang#134260 (Correctly handle comments in attributes in doctests source code) - rust-lang#134277 (rustdoc-search: handle `impl Into<X>` better) - rust-lang#134284 (Keep track of patterns that could have introduced a binding, but didn't) - rust-lang#134337 (reject unsound toggling of RISCV target features) - rust-lang#134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore) - rust-lang#134386 (Some trait method vs impl method signature difference diagnostic cleanups) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 83ab648 + 207fa96 commit 77fab24

File tree

119 files changed

+1475
-905
lines changed

Some content is hidden

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

119 files changed

+1475
-905
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,8 @@ pub enum PatKind {
859859
pub enum PatFieldsRest {
860860
/// `module::StructName { field, ..}`
861861
Rest,
862+
/// `module::StructName { field, syntax error }`
863+
Recovered(ErrorGuaranteed),
862864
/// `module::StructName { field }`
863865
None,
864866
}

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
9292
span: self.lower_span(f.span),
9393
}
9494
}));
95-
break hir::PatKind::Struct(qpath, fs, *etc == ast::PatFieldsRest::Rest);
95+
break hir::PatKind::Struct(
96+
qpath,
97+
fs,
98+
matches!(
99+
etc,
100+
ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_)
101+
),
102+
);
96103
}
97104
PatKind::Tuple(pats) => {
98105
let (pats, ddpos) = self.lower_pat_tuple(pats, "tuple");

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,11 +1654,14 @@ impl<'a> State<'a> {
16541654
},
16551655
|f| f.pat.span,
16561656
);
1657-
if *etc == ast::PatFieldsRest::Rest {
1657+
if let ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) = etc {
16581658
if !fields.is_empty() {
16591659
self.word_space(",");
16601660
}
16611661
self.word("..");
1662+
if let ast::PatFieldsRest::Recovered(_) = etc {
1663+
self.word("/* recovered parse error */");
1664+
}
16621665
}
16631666
if !empty {
16641667
self.space();

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
459459
) -> RegionNameHighlight {
460460
let mut highlight = RegionHighlightMode::default();
461461
highlight.highlighting_region_vid(self.infcx.tcx, needle_fr, counter);
462-
let type_name = self
463-
.infcx
464-
.err_ctxt()
465-
.extract_inference_diagnostics_data(ty.into(), Some(highlight))
466-
.name;
462+
let type_name =
463+
self.infcx.err_ctxt().extract_inference_diagnostics_data(ty.into(), highlight).name;
467464

468465
debug!(
469466
"highlight_if_we_cannot_match_hir_ty: type_name={:?} needle_fr={:?}",
@@ -874,7 +871,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
874871
let type_name = self
875872
.infcx
876873
.err_ctxt()
877-
.extract_inference_diagnostics_data(yield_ty.into(), Some(highlight))
874+
.extract_inference_diagnostics_data(yield_ty.into(), highlight)
878875
.name;
879876

880877
let yield_span = match tcx.hir_node(self.mir_hir_id()) {

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ declare_features! (
175175
(accepted, destructuring_assignment, "1.59.0", Some(71126)),
176176
/// Allows using the `#[diagnostic]` attribute tool namespace
177177
(accepted, diagnostic_namespace, "1.78.0", Some(111996)),
178+
/// Controls errors in trait implementations.
179+
(accepted, do_not_recommend, "CURRENT_RUSTC_VERSION", Some(51992)),
178180
/// Allows `#[doc(alias = "...")]`.
179181
(accepted, doc_alias, "1.48.0", Some(50146)),
180182
/// Allows `..` in tuple (struct) patterns.

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,10 +1188,9 @@ pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>>
11881188
map
11891189
});
11901190

1191-
pub fn is_stable_diagnostic_attribute(sym: Symbol, features: &Features) -> bool {
1191+
pub fn is_stable_diagnostic_attribute(sym: Symbol, _features: &Features) -> bool {
11921192
match sym {
1193-
sym::on_unimplemented => true,
1194-
sym::do_not_recommend => features.do_not_recommend(),
1193+
sym::on_unimplemented | sym::do_not_recommend => true,
11951194
_ => false,
11961195
}
11971196
}

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,6 @@ declare_features! (
466466
(unstable, deprecated_suggestion, "1.61.0", Some(94785)),
467467
/// Allows deref patterns.
468468
(incomplete, deref_patterns, "1.79.0", Some(87121)),
469-
/// Controls errors in trait implementations.
470-
(unstable, do_not_recommend, "1.67.0", Some(51992)),
471469
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.
472470
(unstable, doc_auto_cfg, "1.58.0", Some(43781)),
473471
/// Allows `#[doc(cfg(...))]`.

compiler/rustc_mir_build/src/thir/cx/expr.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ use crate::thir::cx::Cx;
2525
use crate::thir::util::UserAnnotatedTyHelpers;
2626

2727
impl<'tcx> Cx<'tcx> {
28+
/// Create a THIR expression for the given HIR expression. This expands all
29+
/// adjustments and directly adds the type information from the
30+
/// `typeck_results`. See the [dev-guide] for more details.
31+
///
32+
/// (The term "mirror" in this case does not refer to "flipped" or
33+
/// "reversed".)
34+
///
35+
/// [dev-guide]: https://rustc-dev-guide.rust-lang.org/thir.html
2836
pub(crate) fn mirror_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) -> ExprId {
2937
// `mirror_expr` is recursing very deep. Make sure the stack doesn't overflow.
3038
ensure_sufficient_stack(|| self.mirror_expr_inner(expr))

compiler/rustc_parse/src/parser/pat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,10 +1371,10 @@ impl<'a> Parser<'a> {
13711371
self.bump();
13721372
let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| {
13731373
e.span_label(path.span, "while parsing the fields for this pattern");
1374-
e.emit();
1374+
let guar = e.emit();
13751375
self.recover_stmt();
13761376
// When recovering, pretend we had `Foo { .. }`, to avoid cascading errors.
1377-
(ThinVec::new(), PatFieldsRest::Rest)
1377+
(ThinVec::new(), PatFieldsRest::Recovered(guar))
13781378
});
13791379
self.bump();
13801380
Ok(PatKind::Struct(qself, path, fields, etc))

compiler/rustc_passes/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ passes_ignored_derived_impls =
356356
passes_implied_feature_not_exist =
357357
feature `{$implied_by}` implying `{$feature}` does not exist
358358
359+
passes_incorrect_do_not_recommend_args =
360+
`#[diagnostic::do_not_recommend]` does not expect any arguments
361+
359362
passes_incorrect_do_not_recommend_location =
360363
`#[diagnostic::do_not_recommend]` can only be placed on trait implementations
361364

0 commit comments

Comments
 (0)