Skip to content

Commit

Permalink
Fixed tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLazyDutchman committed Dec 18, 2023
1 parent 875acc3 commit fea6ee7
Show file tree
Hide file tree
Showing 9 changed files with 318 additions and 355 deletions.
598 changes: 290 additions & 308 deletions src/lib.rs

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions tests/fail/01-general.stderr
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
error[E0277]: the trait bound `C: Sealed` is not satisfied
--> tests/fail/01-general.rs:20:12
--> tests/fail/01-general.rs:20:6
|
20 | impl T for C {}
| ^ the trait `Sealed` is not implemented for `C`
| ^ the trait `Sealed` is not implemented for `C`
|
= help: the following other types implement trait `Sealed`:
A
B
note: required by a bound in `T`
--> tests/fail/01-general.rs:11:1
|
11 | #[sealed]
| ^^^^^^^^^ required by this bound in `T`
12 | trait T {}
| - required by a bound in this trait
= note: `T` is a "sealed trait", because to implement it you also need to implement `__seal_t::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
= help: the following types implement the trait:
A
B
| - required by a bound in this
= note: this error originates in the attribute macro `sealed` (in Nightly builds, run with -Z macro-backtrace for more info)
13 changes: 3 additions & 10 deletions tests/fail/02-nesting.stderr
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
error[E0277]: the trait bound `C: Sealed` is not satisfied
--> tests/fail/02-nesting.rs:26:42
--> tests/fail/02-nesting.rs:26:6
|
26 | impl lets::attempt::some::nesting::T for C {}
| ^ the trait `Sealed` is not implemented for `C`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Sealed` is not implemented for `C`
|
= help: the following other types implement trait `Sealed`:
A
B
note: required by a bound in `T`
--> tests/fail/02-nesting.rs:8:17
|
8 | #[sealed(pub(crate))]
| ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T`
9 | pub trait T {}
| - required by a bound in this trait
= note: `T` is a "sealed trait", because to implement it you also need to implement `lets::attempt::some::nesting::__seal_t::Sealed`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
= help: the following types implement the trait:
A
B
| - required by a bound in this
= note: this error originates in the attribute macro `sealed` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 1 addition & 4 deletions tests/fail/03-private-by-default.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ error[E0603]: module `__seal_t` is private
--> tests/fail/03-private-by-default.rs:17:1
|
17 | #[sealed]
| ^^^^^^^^^
| |
| private module
| trait `Sealed` is not publicly re-exported
| ^^^^^^^^^ private module
|
note: the module `__seal_t` is defined here
--> tests/fail/03-private-by-default.rs:8:17
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/04-no-full-pub.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `pub` visibility breaks the seal as allows to use it outside its crate.
Consider tightening the visibility (e.g. `pub(crate)`) if you actually need sealing.
Consider tightening the visibility (e.g. `pub(crate)`) if you actually need sealing.
--> tests/fail/04-no-full-pub.rs:8:26
|
8 | #[sealed(pub)]
Expand Down
12 changes: 6 additions & 6 deletions tests/fail/06-wrong-argument.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ error: unknown `erased` attribute argument
3 | #[sealed(erased)]
| ^^^^^^

error[E0405]: cannot find trait `T` in this scope
--> tests/fail/06-wrong-argument.rs:9:6
|
9 | impl T for A {}
| ^ not found in this scope

error[E0433]: failed to resolve: use of undeclared crate or module `__seal_t`
--> tests/fail/06-wrong-argument.rs:8:1
|
8 | #[sealed]
| ^^^^^^^^^ use of undeclared crate or module `__seal_t`
|
= note: this error originates in the attribute macro `sealed` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0405]: cannot find trait `T` in this scope
--> tests/fail/06-wrong-argument.rs:9:6
|
9 | impl T for A {}
| ^ not found in this scope
16 changes: 6 additions & 10 deletions tests/fail/07-sealed-function.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@ error[E0425]: cannot find value `Token` in this scope
27 | inner::A::a(Token);
| ^^^^^ not found in this scope
|
note: unit struct `crate::inner::__seal_partial_sealed::Token` exists but is inaccessible
--> tests/fail/07-sealed-function.rs:4:2
help: consider importing this unit struct
|
23 | use crate::inner::__seal_partial_sealed::Token;
|
4 | #[sealed]
| ^^^^^^^^^ not accessible
= note: this error originates in the attribute macro `sealed` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> tests/fail/07-sealed-function.rs:26:2
|
26 | inner::A::a();
| ^^^^^^^^^^^-- an argument of type `Token` is missing
| ^^^^^^^^^^^-- supplied 0 arguments
| |
| expected 1 argument
|
note: associated function defined here
--> tests/fail/07-sealed-function.rs:7:6
|
7 | fn a();
| ^
help: provide the argument
|
26 | inner::A::a(/* Token */);
| ~~~~~~~~~~~~~
8 changes: 5 additions & 3 deletions tests/fail/08-partial-seal.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
error: Sealing a function from implementation but allowing it to be called is already done by sealing the trait itself. If you want to seal this function, but not others, consider adding `partial` to the `sealed` attr on the trait: `#[sealed(partial)]`
--> tests/fail/08-partial-seal.rs:5:2
--> tests/fail/08-partial-seal.rs:3:1
|
5 | #[seal(callable)]
| ^^^^^^^^^^^^^^^^^
3 | #[sealed]
| ^^^^^^^^^
|
= note: this error originates in the attribute macro `sealed` (in Nightly builds, run with -Z macro-backtrace for more info)
6 changes: 3 additions & 3 deletions tests/fail/10-partial-without-default.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: This function is sealed from implementation, but it does not have a default implementation. This effectively seals the entire trait, which would be clearer to do by not having the trait seal be partial.
--> tests/fail/10-partial-without-default.rs:5:2
--> tests/fail/10-partial-without-default.rs:6:5
|
5 | #[seal]
| ^^^^^^^
6 | fn sealed();
| ^^^^^^

0 comments on commit fea6ee7

Please sign in to comment.