Skip to content

Commit 13ef05e

Browse files
committed
Auto merge of #124139 - cuviper:beta-next, r=cuviper
[beta] backports - Silence `unused_imports` lint for redundant imports #123744 - Call the panic hook for non-unwind panics in proc-macros #123825 - rustdoc: check redundant explicit links with correct itemid #123905 - disable two debuginfo tests under gdb 15 #123963 r? cuviper
2 parents 6fd1912 + c623345 commit 13ef05e

28 files changed

+71
-251
lines changed

compiler/rustc_resolve/src/imports.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,13 +1368,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
13681368
let mut redundant_spans: Vec<_> = redundant_span.present_items().collect();
13691369
redundant_spans.sort();
13701370
redundant_spans.dedup();
1371+
/* FIXME(unused_imports): Add this back as a new lint
13711372
self.lint_buffer.buffer_lint_with_diagnostic(
13721373
UNUSED_IMPORTS,
13731374
id,
13741375
import.span,
13751376
format!("the item `{source}` is imported redundantly"),
13761377
BuiltinLintDiag::RedundantImport(redundant_spans, source),
13771378
);
1379+
*/
13781380
return true;
13791381
}
13801382

compiler/rustc_resolve/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ enum ImplTraitContext {
177177

178178
/// Used for tracking import use types which will be used for redundant import checking.
179179
/// ### Used::Scope Example
180-
/// ```rust,compile_fail
180+
/// ```rust,ignore (redundant_imports)
181181
/// #![deny(unused_imports)]
182182
/// use std::mem::drop;
183183
/// fn main() {

library/proc_macro/src/bridge/client.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,11 @@ fn maybe_install_panic_hook(force_show_panics: bool) {
286286
BridgeState::NotConnected => true,
287287
BridgeState::Connected(_) | BridgeState::InUse => force_show_panics,
288288
});
289-
if show {
289+
// We normally report panics by catching unwinds and passing the payload from the
290+
// unwind back to the compiler, but if the panic doesn't unwind we'll abort before
291+
// the compiler has a chance to print an error. So we special-case PanicInfo where
292+
// can_unwind is false.
293+
if show || !info.can_unwind() {
290294
prev(info)
291295
}
292296
}));

library/proc_macro/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#![feature(maybe_uninit_write_slice)]
3131
#![feature(negative_impls)]
3232
#![feature(new_uninit)]
33+
#![feature(panic_can_unwind)]
3334
#![feature(restricted_std)]
3435
#![feature(rustc_attrs)]
3536
#![feature(min_specialization)]

src/librustdoc/passes/lint/redundant_explicit_links.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_errors::SuggestionStyle;
66
use rustc_hir::def::{DefKind, DocLinkResMap, Namespace, Res};
77
use rustc_hir::HirId;
88
use rustc_lint_defs::Applicability;
9-
use rustc_resolve::rustdoc::source_span_for_markdown_range;
9+
use rustc_resolve::rustdoc::{prepare_to_doc_link_resolution, source_span_for_markdown_range};
1010
use rustc_span::def_id::DefId;
1111
use rustc_span::Symbol;
1212

@@ -29,16 +29,13 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
2929
return;
3030
};
3131

32-
let doc = item.doc_value();
33-
if doc.is_empty() {
34-
return;
35-
}
36-
37-
if let Some(item_id) = item.def_id() {
38-
check_redundant_explicit_link_for_did(cx, item, item_id, hir_id, &doc);
39-
}
40-
if let Some(item_id) = item.inline_stmt_id {
41-
check_redundant_explicit_link_for_did(cx, item, item_id, hir_id, &doc);
32+
let hunks = prepare_to_doc_link_resolution(&item.attrs.doc_strings);
33+
for (item_id, doc) in hunks {
34+
if let Some(item_id) = item_id.or(item.def_id())
35+
&& !doc.is_empty()
36+
{
37+
check_redundant_explicit_link_for_did(cx, item, item_id, hir_id, &doc);
38+
}
4239
}
4340
}
4441

tests/debuginfo/include_string.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ min-lldb-version: 310
2+
//@ ignore-gdb-version: 15.0 - 99.0
3+
// ^ test temporarily disabled as it fails under gdb 15
24

35
//@ compile-flags:-g
46
// gdb-command:run

tests/debuginfo/vec-slices.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ min-lldb-version: 310
2+
//@ ignore-gdb-version: 15.0 - 99.0
3+
// ^ test temporarily disabled as it fails under gdb 15
24

35
//@ compile-flags:-g
46

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ check-pass
2+
#![deny(rustdoc::redundant_explicit_links)]
3+
4+
mod bar {
5+
/// [`Rc`](std::rc::Rc)
6+
pub enum Baz {}
7+
}
8+
9+
pub use bar::*;
10+
11+
use std::rc::Rc;
12+
13+
/// [`Rc::allocator`] [foo](std::rc::Rc)
14+
pub fn winit_runner() {}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ check-pass
12
//@ compile-flags: --extern aux_issue_121915 --edition 2015
23
//@ aux-build: aux-issue-121915.rs
34

@@ -6,6 +7,6 @@ extern crate aux_issue_121915;
67
#[deny(unused_imports)]
78
fn main() {
89
use aux_issue_121915;
9-
//~^ ERROR the item `aux_issue_121915` is imported redundantly
10+
//FIXME(unused_imports): ~^ ERROR the item `aux_issue_121915` is imported redundantly
1011
aux_issue_121915::item();
1112
}

tests/ui/imports/redundant-import-issue-121915-2015.stderr

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)