Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2454e68

Browse files
committed
Auto merge of #144784 - GuillaumeGomez:rollup-89c02ag, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - #132748 (get rid of some false negatives in rustdoc::broken_intra_doc_links) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #143360 (loop match: error on `#[const_continue]` outside `#[loop_match]`) - #143662 ([rustdoc] Display unsafe attrs with edition 2024 `unsafe()` wrappers.) - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition) - #144614 (Fortify RemoveUnneededDrops test.) - #144703 ([test][AIX] ignore extern_weak linkage test) - #144738 (Remove the omit_gdb_pretty_printer_section attribute) - #144756 (detect infinite recursion with tail calls in ctfe) - #144766 (Add human readable name "Cygwin") r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4b55fe1 + 55bffb4 commit 2454e68

File tree

184 files changed

+1190
-812
lines changed

Some content is hidden

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

184 files changed

+1190
-812
lines changed

‎compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,3 @@ impl<S: Stage> CombineAttributeParser<S> for TargetFeatureParser {
374374
features
375375
}
376376
}
377-
378-
pub(crate) struct OmitGdbPrettyPrinterSectionParser;
379-
380-
impl<S: Stage> NoArgsAttributeParser<S> for OmitGdbPrettyPrinterSectionParser {
381-
const PATH: &[Symbol] = &[sym::omit_gdb_pretty_printer_section];
382-
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
383-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::OmitGdbPrettyPrinterSection;
384-
}

‎compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ use crate::attributes::allow_unstable::{
1717
AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser,
1818
};
1919
use crate::attributes::codegen_attrs::{
20-
ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser,
21-
OmitGdbPrettyPrinterSectionParser, OptimizeParser, TargetFeatureParser, TrackCallerParser,
22-
UsedParser,
20+
ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser,
21+
TargetFeatureParser, TrackCallerParser, UsedParser,
2322
};
2423
use crate::attributes::confusables::ConfusablesParser;
2524
use crate::attributes::deprecation::DeprecationParser;
@@ -187,7 +186,6 @@ attribute_parsers!(
187186
Single<WithoutArgs<NoImplicitPreludeParser>>,
188187
Single<WithoutArgs<NoMangleParser>>,
189188
Single<WithoutArgs<NonExhaustiveParser>>,
190-
Single<WithoutArgs<OmitGdbPrettyPrinterSectionParser>>,
191189
Single<WithoutArgs<ParenSugarParser>>,
192190
Single<WithoutArgs<PassByValueParser>>,
193191
Single<WithoutArgs<PointeeParser>>,

‎compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
use rustc_codegen_ssa::base::collect_debugger_visualizers_transitive;
44
use rustc_codegen_ssa::traits::*;
5-
use rustc_hir::attrs::AttributeKind;
65
use rustc_hir::def_id::LOCAL_CRATE;
7-
use rustc_hir::find_attr;
86
use rustc_middle::bug;
97
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerType;
108
use rustc_session::config::{CrateType, DebugInfo};
@@ -86,9 +84,6 @@ pub(crate) fn get_or_insert_gdb_debug_scripts_section_global<'ll>(
8684
}
8785

8886
pub(crate) fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool {
89-
let omit_gdb_pretty_printer_section =
90-
find_attr!(cx.tcx.hir_krate_attrs(), AttributeKind::OmitGdbPrettyPrinterSection);
91-
9287
// To ensure the section `__rustc_debug_gdb_scripts_section__` will not create
9388
// ODR violations at link time, this section will not be emitted for rlibs since
9489
// each rlib could produce a different set of visualizers that would be embedded
@@ -117,8 +112,7 @@ pub(crate) fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool {
117112
}
118113
});
119114

120-
!omit_gdb_pretty_printer_section
121-
&& cx.sess().opts.debuginfo != DebugInfo::None
115+
cx.sess().opts.debuginfo != DebugInfo::None
122116
&& cx.sess().target.emit_debug_gdb_scripts
123117
&& embed_visualizers
124118
}

‎compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,11 +1257,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
12571257
TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/),
12581258
DuplicatesOk, EncodeCrossCrate::No
12591259
),
1260-
gated!(
1261-
omit_gdb_pretty_printer_section, Normal, template!(Word),
1262-
WarnFollowing, EncodeCrossCrate::No,
1263-
"the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite",
1264-
),
12651260
rustc_attr!(
12661261
TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"),
12671262
ErrorFollowing, EncodeCrossCrate::No,

‎compiler/rustc_feature/src/removed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ declare_features! (
199199
/// Renamed to `dyn_compatible_for_dispatch`.
200200
(removed, object_safe_for_dispatch, "1.83.0", Some(43561),
201201
Some("renamed to `dyn_compatible_for_dispatch`"), 131511),
202+
/// Allows using `#[omit_gdb_pretty_printer_section]`.
203+
(removed, omit_gdb_pretty_printer_section, "CURRENT_RUSTC_VERSION", None, None, 144738),
202204
/// Allows using `#[on_unimplemented(..)]` on traits.
203205
/// (Moved to `rustc_attrs`.)
204206
(removed, on_unimplemented, "1.40.0", None, None, 65794),

‎compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ declare_features! (
225225
(unstable, multiple_supertrait_upcastable, "1.69.0", None),
226226
/// Allow negative trait bounds. This is an internal-only feature for testing the trait solver!
227227
(internal, negative_bounds, "1.71.0", None),
228-
/// Allows using `#[omit_gdb_pretty_printer_section]`.
229-
(internal, omit_gdb_pretty_printer_section, "1.5.0", None),
230228
/// Set the maximum pattern complexity allowed (not limited by default).
231229
(internal, pattern_complexity_limit, "1.78.0", None),
232230
/// Allows using pattern types.

‎compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,6 @@ pub enum AttributeKind {
391391
/// Represents `#[non_exhaustive]`
392392
NonExhaustive(Span),
393393

394-
/// Represents `#[omit_gdb_pretty_printer_section]`
395-
OmitGdbPrettyPrinterSection,
396-
397394
/// Represents `#[optimize(size|speed)]`
398395
Optimize(OptimizeAttr, Span),
399396

‎compiler/rustc_hir/src/attrs/encode_cross_crate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ impl AttributeKind {
5555
NoImplicitPrelude(..) => No,
5656
NoMangle(..) => Yes, // Needed for rustdoc
5757
NonExhaustive(..) => Yes, // Needed for rustdoc
58-
OmitGdbPrettyPrinterSection => No,
5958
Optimize(..) => No,
6059
ParenSugar(..) => No,
6160
PassByValue(..) => Yes,

‎compiler/rustc_hir/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3016,7 +3016,7 @@ impl fmt::Display for LoopIdError {
30163016
}
30173017
}
30183018

3019-
#[derive(Copy, Clone, Debug, HashStable_Generic)]
3019+
#[derive(Copy, Clone, Debug, PartialEq,HashStable_Generic)]
30203020
pub struct Destination {
30213021
/// This is `Some(_)` iff there is an explicit user-specified 'label
30223022
pub label: Option<Label>,

‎compiler/rustc_hir_typeck/src/loops.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::collections::BTreeMap;
22
use std::fmt;
33

44
use Context::*;
5-
use rustc_ast::Label;
65
use rustc_hir as hir;
76
use rustc_hir::attrs::AttributeKind;
87
use rustc_hir::def::DefKind;
@@ -42,8 +41,8 @@ enum Context {
4241
ConstBlock,
4342
/// E.g. `#[loop_match] loop { state = 'label: { /* ... */ } }`.
4443
LoopMatch {
45-
/// The label of the labeled block (not of the loop itself).
46-
labeled_block: Label,
44+
/// The destination pointing to the labeled block (not to the loop itself).
45+
labeled_block: Destination,
4746
},
4847
}
4948

@@ -186,18 +185,18 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
186185
{
187186
self.with_context(UnlabeledBlock(b.span.shrink_to_lo()), |v| v.visit_block(b));
188187
}
189-
hir::ExprKind::Break(break_label, ref opt_expr) => {
188+
hir::ExprKind::Break(break_destination, ref opt_expr) => {
190189
if let Some(e) = opt_expr {
191190
self.visit_expr(e);
192191
}
193192

194-
if self.require_label_in_labeled_block(e.span, &break_label, "break") {
193+
if self.require_label_in_labeled_block(e.span, &break_destination, "break") {
195194
// If we emitted an error about an unlabeled break in a labeled
196195
// block, we don't need any further checking for this break any more
197196
return;
198197
}
199198

200-
let loop_id = match break_label.target_id {
199+
let loop_id = match break_destination.target_id {
201200
Ok(loop_id) => Some(loop_id),
202201
Err(hir::LoopIdError::OutsideLoopScope) => None,
203202
Err(hir::LoopIdError::UnlabeledCfInWhileCondition) => {
@@ -212,18 +211,25 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
212211

213212
// A `#[const_continue]` must break to a block in a `#[loop_match]`.
214213
if find_attr!(self.tcx.hir_attrs(e.hir_id), AttributeKind::ConstContinue(_)) {
215-
if let Some(break_label) = break_label.label {
216-
let is_target_label = |cx: &Context| match cx {
217-
Context::LoopMatch { labeled_block } => {
218-
break_label.ident.name == labeled_block.ident.name
219-
}
220-
_ => false,
221-
};
214+
let Some(label) = break_destination.label else {
215+
let span = e.span;
216+
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
217+
};
222218

223-
if !self.cx_stack.iter().rev().any(is_target_label) {
224-
let span = break_label.ident.span;
225-
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
219+
let is_target_label = |cx: &Context| match cx {
220+
Context::LoopMatch { labeled_block } => {
221+
// NOTE: with macro expansion, the label's span might be different here
222+
// even though it does still refer to the same HIR node. A block
223+
// can't have two labels, so the hir_id is a unique identifier.
224+
assert!(labeled_block.target_id.is_ok()); // see `is_loop_match`.
225+
break_destination.target_id == labeled_block.target_id
226226
}
227+
_ => false,
228+
};
229+
230+
if !self.cx_stack.iter().rev().any(is_target_label) {
231+
let span = label.ident.span;
232+
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
227233
}
228234
}
229235

@@ -249,7 +255,7 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
249255
Some(kind) => {
250256
let suggestion = format!(
251257
"break{}",
252-
break_label
258+
break_destination
253259
.label
254260
.map_or_else(String::new, |l| format!(" {}", l.ident))
255261
);
@@ -259,7 +265,7 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
259265
kind: kind.name(),
260266
suggestion,
261267
loop_label,
262-
break_label: break_label.label,
268+
break_label: break_destination.label,
263269
break_expr_kind: &break_expr.kind,
264270
break_expr_span: break_expr.span,
265271
});
@@ -268,7 +274,7 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
268274
}
269275

270276
let sp_lo = e.span.with_lo(e.span.lo() + BytePos("break".len() as u32));
271-
let label_sp = match break_label.label {
277+
let label_sp = match break_destination.label {
272278
Some(label) => sp_lo.with_hi(label.ident.span.hi()),
273279
None => sp_lo.shrink_to_lo(),
274280
};
@@ -416,7 +422,7 @@ impl<'hir> CheckLoopVisitor<'hir> {
416422
&self,
417423
e: &'hir hir::Expr<'hir>,
418424
body: &'hir hir::Block<'hir>,
419-
) -> Option<Label> {
425+
) -> Option<Destination> {
420426
if !find_attr!(self.tcx.hir_attrs(e.hir_id), AttributeKind::LoopMatch(_)) {
421427
return None;
422428
}
@@ -438,8 +444,8 @@ impl<'hir> CheckLoopVisitor<'hir> {
438444

439445
let hir::ExprKind::Assign(_, rhs_expr, _) = loop_body_expr.kind else { return None };
440446

441-
let hir::ExprKind::Block(_, label) = rhs_expr.kind else { return None };
447+
let hir::ExprKind::Block(block, label) = rhs_expr.kind else { return None };
442448

443-
label
449+
Some(Destination{label,target_id:Ok(block.hir_id)})
444450
}
445451
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /