Skip to content

Step 2.6: Sealing#17

Open
ziimakc wants to merge 2 commits intomainfrom
2_6_sealing
Open

Step 2.6: Sealing#17
ziimakc wants to merge 2 commits intomainfrom
2_6_sealing

Conversation

@ziimakc
Copy link
Owner

@ziimakc ziimakc commented Feb 9, 2026

Resolves Step 2.6

Task

Seal the traits defined in this step's crate in the following way:

  • Make the MyIteratorExt trait fully sealed. Do it manually, using the [sealed] crate or a similar one is not allowed.
  • Make the MyError trait partially sealed. Only seal the method marked with #[doc(hidden)] attribute.
  • Sealing should work on both module level (disallowing to implement the sealed trait or the sealed method in the root module of the crate or any other module outside the one where the traits are defined, prove it by providing commented implementations in the root module of the crate, which doesn't compile due to the seal, if uncommented) and crate level (prove it by creating [documentation tests which doesn't compile][12] due to the seal).

Solution

Added required seals and tests. For create root impl MyIteratorExt for Dummy {} would show conflicting implementation error because we have blanked implementation for iterators, but for external crates it would be sealed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant