Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal ci and extra #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Test
- name: Run tests
run: cargo test
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = ["enum-ptr*", "playground"]
resolver = "2"

[workspace.package]
version = "0.2.0-beta.0"
Expand Down
6 changes: 3 additions & 3 deletions enum-ptr-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ edition.workspace = true
proc-macro = true

[dependencies]
syn = { version = "2.0.23", features = ["extra-traits"] }
quote = "1.0.26"
darling = "0.20.1"
syn = { version = "2.0.79", features = ["extra-traits"] }
quote = "1.0.37"
darling = "0.20.10"
2 changes: 1 addition & 1 deletion enum-ptr-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ alloc = ["enum-ptr/alloc"]
enum-ptr = { path = "../enum-ptr", default-features = false }

[dev-dependencies]
trybuild = { version = "1.0.71", features = ["diff"] }
trybuild = { version = "1.0.99", features = ["diff"] }
25 changes: 23 additions & 2 deletions enum-ptr-test/tests/fail/compact_copy.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
error[E0277]: the trait bound `Foo<'a, 'b>: Copy` is not satisfied
--> tests/fail/compact_copy.rs:5:10
|
5 | #[derive(EnumPtr)]
| ^^^^^^^ the trait `Copy` is not implemented for `Foo<'a, 'b>`, which is required by `CompactInnerCopy<Foo<'a, 'b>>: enum_ptr::base::convert::private::Sealed`
|
= help: the trait `enum_ptr::base::convert::private::Sealed` is implemented for `CompactInnerCopy<T>`
= note: required for `CompactInnerCopy<Foo<'a, 'b>>` to implement `enum_ptr::base::convert::private::Sealed`
note: required by a bound in `enum_ptr::Compactable::Inner`
--> $WORKSPACE/enum-ptr/src/base/convert.rs
|
| type Inner: private::Sealed;
| ^^^^^^^^^^^^^^^ required by this bound in `Compactable::Inner`
= note: this error originates in the derive macro `EnumPtr` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Foo<'a, 'b>` with `#[derive(Copy)]`
|
8 + #[derive(Copy)]
9 | enum Foo<'a, 'b> {
|

error[E0277]: the trait bound `Foo<'a, 'b>: Copy` is not satisfied
--> tests/fail/compact_copy.rs:5:10
|
Expand All @@ -11,6 +31,7 @@ note: required by a bound in `CompactInnerCopy`
| ^^^^ required by this bound in `CompactInnerCopy`
= note: this error originates in the derive macro `EnumPtr` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Foo<'a, 'b>` with `#[derive(Copy)]`
|
8 | #[derive(Copy)]
|
8 + #[derive(Copy)]
9 | enum Foo<'a, 'b> {
|
4 changes: 2 additions & 2 deletions enum-ptr-test/tests/fail/lifetime_borrow.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `foo` because it is borrowed
14 | let foo: Compact<_> = Foo::A(None).into();
| --- binding `foo` declared here
15 | let foo_ref = foo.borrow();
| ------------ borrow of `foo` occurs here
| --- borrow of `foo` occurs here
16 | drop(foo);
| ^^^ move out of `foo` occurs here
17 | drop(foo_ref);
Expand All @@ -16,7 +16,7 @@ error[E0505]: cannot move out of `foo` because it is borrowed
21 | let mut foo: Compact<_> = Foo::A(None).into();
| ------- binding `foo` declared here
22 | let foo_mut = foo.borrow_mut();
| ---------------- borrow of `foo` occurs here
| --- borrow of `foo` occurs here
23 | drop(foo);
| ^^^ move out of `foo` occurs here
24 | drop(foo_mut);
Expand Down
10 changes: 10 additions & 0 deletions enum-ptr-test/tests/fail/lifetime_map.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ error: lifetime may not live long enough
| has type `&'1 Foo<'_, '_>`
15 | Foo::A(r) | Foo::B(r) => r,
| ^ returning this value requires that `'1` must outlive `'2`
|
help: dereference the return value
|
14 | foo.map_ref(|f| **match f {
| ++

error: lifetime may not live long enough
--> tests/fail/lifetime_map.rs:22:34
Expand All @@ -17,3 +22,8 @@ error: lifetime may not live long enough
| has type `&'1 mut Foo<'_, '_>`
22 | Foo::A(r) | Foo::B(r) => r,
| ^ returning this value requires that `'1` must outlive `'2`
|
help: dereference the return value
|
21 | foo.map_mut(|f| **match f {
| ++
Loading