Skip to content

Commit 3d01a43

Browse files
committed
Ignore #[doc(hidden)] items when computing trimmed paths
1 parent 8915c79 commit 3d01a43

Some content is hidden

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

41 files changed

+90
-81
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,13 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
34203420
def::Res::Def(DefKind::AssocTy, _) => {}
34213421
def::Res::Def(DefKind::TyAlias, _) => {}
34223422
def::Res::Def(defkind, def_id) => {
3423+
// Ignore external `#[doc(hidden)]` items and their descendants.
3424+
// They shouldn't prevent other items from being considered
3425+
// unique, and should be printed with a full path if necessary.
3426+
if tcx.is_doc_hidden(def_id) {
3427+
continue;
3428+
}
3429+
34233430
if let Some(ns) = defkind.ns() {
34243431
collect_fn(&child.ident, ns, def_id);
34253432
}

tests/ui/async-await/async-closures/def-path.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ LL | let x = async || {};
55
| -- the expected `async` closure body
66
LL |
77
LL | let () = x();
8-
| ^^ --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=ResumeTy yield_ty=() return_ty=()}`
8+
| ^^ --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=std::future::ResumeTy yield_ty=() return_ty=()}`
99
| |
1010
| expected `async` closure body, found `()`
1111
|
12-
= note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=ResumeTy yield_ty=() return_ty=()}`
12+
= note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=std::future::ResumeTy yield_ty=() return_ty=()}`
1313
found unit type `()`
1414

1515
error: aborting due to 1 previous error

tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)]
9999
| ^^ unsatisfied trait bound introduced in this `derive` macro
100100
= note: 1 redundant requirement hidden
101101
= note: required for `&'static Bar<dyn Debug>` to implement `Eq`
102-
note: required by a bound in `AssertParamIsEq`
102+
note: required by a bound in `std::cmp::AssertParamIsEq`
103103
--> $SRC_DIR/core/src/cmp.rs:LL:COL
104104

105105
error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time

tests/ui/consts/const-eval/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const fn failure() {
66
const fn print() {
77
println!("{:?}", 0);
88
//~^ ERROR cannot call non-const formatting macro in constant functions
9-
//~| ERROR cannot call non-const function `_print` in constant functions
9+
//~| ERROR cannot call non-const function `std::io::_print` in constant functions
1010
}
1111

1212
const fn format_args() {

tests/ui/consts/const-eval/format.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | println!("{:?}", 0);
1515
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
1616
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
1717

18-
error[E0015]: cannot call non-const function `_print` in constant functions
18+
error[E0015]: cannot call non-const function `std::io::_print` in constant functions
1919
--> $DIR/format.rs:7:5
2020
|
2121
LL | println!("{:?}", 0);

tests/ui/contracts/contract-captures-via-closure-noncopy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Baz {
1212
#[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })]
1313
// Relevant thing is this: ^^^^^^^^^^^
1414
// because we are capturing state that is non-Copy.
15-
//~^^^ ERROR trait bound `Baz: std::marker::Copy` is not satisfied
15+
//~^^^ ERROR trait bound `Baz: Copy` is not satisfied
1616
fn doubler(x: Baz) -> Baz {
1717
Baz { baz: x.baz + 10 }
1818
}

tests/ui/contracts/contract-captures-via-closure-noncopy.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | #![feature(contracts)]
77
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`
10+
error[E0277]: the trait bound `Baz: Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`
1111
--> $DIR/contract-captures-via-closure-noncopy.rs:12:1
1212
|
1313
LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })]
@@ -18,7 +18,7 @@ LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz
1818
| unsatisfied trait bound
1919
| required by a bound introduced by this call
2020
|
21-
= help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`, the trait `std::marker::Copy` is not implemented for `Baz`
21+
= help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`, the trait `Copy` is not implemented for `Baz`
2222
note: required because it's used within this closure
2323
--> $DIR/contract-captures-via-closure-noncopy.rs:12:42
2424
|

tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | #[derive(Eq,PartialEq)]
77
LL | x: Error
88
| ^^^^^^^^ the trait `Eq` is not implemented for `Error`
99
|
10-
note: required by a bound in `AssertParamIsEq`
10+
note: required by a bound in `std::cmp::AssertParamIsEq`
1111
--> $SRC_DIR/core/src/cmp.rs:LL:COL
1212
help: consider annotating `Error` with `#[derive(Eq)]`
1313
|

tests/ui/derives/derives-span-Eq-enum.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | #[derive(Eq,PartialEq)]
77
LL | Error
88
| ^^^^^ the trait `Eq` is not implemented for `Error`
99
|
10-
note: required by a bound in `AssertParamIsEq`
10+
note: required by a bound in `std::cmp::AssertParamIsEq`
1111
--> $SRC_DIR/core/src/cmp.rs:LL:COL
1212
help: consider annotating `Error` with `#[derive(Eq)]`
1313
|

tests/ui/derives/derives-span-Eq-struct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | struct Struct {
77
LL | x: Error
88
| ^^^^^^^^ the trait `Eq` is not implemented for `Error`
99
|
10-
note: required by a bound in `AssertParamIsEq`
10+
note: required by a bound in `std::cmp::AssertParamIsEq`
1111
--> $SRC_DIR/core/src/cmp.rs:LL:COL
1212
help: consider annotating `Error` with `#[derive(Eq)]`
1313
|

0 commit comments

Comments
 (0)