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.
Auto merge of rust-lang#112686 - estebank:sealed-traits, r=petrochenkov
Account for sealed traits in privacy and trait bound errors On trait bound errors caused by super-traits, identify if the super-trait is publicly accessibly and if not, explain "sealed traits". ``` error[E0277]: the trait bound `S: Hidden` is not satisfied --> $DIR/sealed-trait-local.rs:17:20 | LL | impl a::Sealed for S {} | ^ the trait `Hidden` is not implemented for `S` | note: required by a bound in `Sealed` --> $DIR/sealed-trait-local.rs:3:23 | LL | pub trait Sealed: self::b::Hidden { | ^^^^^^^^^^^^^^^ required by this bound in `Sealed` = note: `Sealed` is a "sealed trait", because to implement it you also need to implelement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it ``` Deduplicate privacy errors that point to the same path segment even if their deduplication span are different. When encountering a path that is not reachable due to privacy constraints path segments other than the last, keep metadata for the last path segment's `Res` in order to look for alternative import paths for that item to suggest. If there are none, be explicit that the item is not accessible. ``` error[E0603]: module `b` is private --> $DIR/re-exported-trait.rs:11:9 | LL | impl a::b::Trait for S {} | ^ private module | note: the module `b` is defined here --> $DIR/re-exported-trait.rs:5:5 | LL | mod b { | ^^^^^ help: consider importing this trait through its public re-export instead | LL | impl a::Trait for S {} | ~~~~~~~~ ``` ``` error[E0603]: module `b` is private --> $DIR/private-trait.rs:8:9 | LL | impl a::b::Hidden for S {} | ^ ------ trait `b` is not publicly reachable | | | private module | note: the module `b` is defined here --> $DIR/private-trait.rs:2:5 | LL | mod b { | ^^^^^ ```
- Loading branch information
Showing
29 changed files
with
337 additions
and
54 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
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
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
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
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
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
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
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
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
Oops, something went wrong.