forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#99698 - compiler-errors:no-doc-hidden, r=cj…
…gillot Prefer visibility map parents that are not `doc(hidden)` first Far simpler approach to rust-lang#98876. This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
- Loading branch information
Showing
7 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/auxiliary/hidden-child.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![crate_type = "lib"] | ||
|
||
extern crate core; | ||
|
||
pub mod __private { | ||
#[doc(hidden)] | ||
pub use core::option::Option::{self, None, Some}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/auxiliary/hidden-parent.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![crate_type = "lib"] | ||
|
||
extern crate core; | ||
|
||
#[doc(hidden)] | ||
pub mod __private { | ||
pub use core::option::Option::{self, None, Some}; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// aux-build:hidden-child.rs | ||
|
||
// FIXME(compiler-errors): This currently suggests the wrong thing. | ||
// UI test exists to track the problem. | ||
|
||
extern crate hidden_child; | ||
|
||
fn main() { | ||
let x: Option<i32> = 1i32; //~ ERROR mismatched types | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/hidden-child.rs:9:26 | ||
| | ||
LL | let x: Option<i32> = 1i32; | ||
| ----------- ^^^^ expected enum `Option`, found `i32` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected enum `Option<i32>` | ||
found type `i32` | ||
help: try wrapping the expression in `hidden_child::__private::Some` | ||
| | ||
LL | let x: Option<i32> = hidden_child::__private::Some(1i32); | ||
| ++++++++++++++++++++++++++++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
7 changes: 7 additions & 0 deletions
7
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// aux-build:hidden-parent.rs | ||
|
||
extern crate hidden_parent; | ||
|
||
fn main() { | ||
let x: Option<i32> = 1i32; //~ ERROR mismatched types | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/hidden-parent.rs:6:26 | ||
| | ||
LL | let x: Option<i32> = 1i32; | ||
| ----------- ^^^^ expected enum `Option`, found `i32` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected enum `Option<i32>` | ||
found type `i32` | ||
help: try wrapping the expression in `Some` | ||
| | ||
LL | let x: Option<i32> = Some(1i32); | ||
| +++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |