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

some work #250

Merged
merged 3 commits into from
Aug 25, 2023
Merged
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
1,759 changes: 65 additions & 1,694 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ members = [
michie-macro = { path = "macro", version = "3.0.2" }

[dev-dependencies]
cargo-make = "0.36.2"
cargo_toml = "0.15.2"
conventional_commits_linter = "0.12.3"
itertools = "0.10.3"
jql = "5.1.1"
markdown = "0.3.0"
markdown-toc = "0.2.0"
regex = "1.5.5"
sd = "0.7.6"
semver = "1.0.9"
trybuild = "1.0.56"

[package.metadata.bin]
cargo-binstall = { version = "1.2.1", locked = true }
cargo-make = { version = "0.36.2", locked = true, bins = ["makers"] }
conventional_commits_linter = { version = "0.12.3", locked = true }
markdown-toc = { version = "0.2.0", locked = true, bins = ["md-toc"] }
sd = { version = "0.7.6", locked = true }

[features]
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.67.1"
channel = "1.72.0"
components = ["rustc", "cargo", "rustfmt", "rust-std", "clippy"]
17 changes: 8 additions & 9 deletions tests/compile_fail/failure_to_infer_store_type.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
error[E0282]: type annotations needed
--> tests/compile_fail/failure_to_infer_store_type.rs:3:1
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> tests/compile_fail/failure_to_infer_store_type.rs:3:40
|
3 | #[memoized(key_expr = (), store_init = Default::default())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `downcast_ref_with_inference_hint`
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use a fully-qualified path to a specific available implementation (271 found)
|
3 | #[memoized(key_expr = (), store_init = </* self type */ as Default>::default())]
| +++++++++++++++++++ +

error[E0283]: type annotations needed
--> tests/compile_fail/failure_to_infer_store_type.rs:3:1
|
3 | #[memoized(key_expr = (), store_init = Default::default())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Box`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
= note: multiple `impl`s satisfying `_: MemoizationStore<(), ()>` found in the `michie` crate:
- impl<I, R> MemoizationStore<I, R> for BTreeMap<I, R>
Expand All @@ -23,7 +26,3 @@ note: required by a bound in `inference_hint`
3 | #[memoized(key_expr = (), store_init = Default::default())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `inference_hint`
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider specifying the type arguments in the function call
|
3 | #[memoized(key_expr = (), store_init = Default::default())]::<K, R, S>
| +++++++++++
8 changes: 4 additions & 4 deletions tests/compile_fail/key_type_mismatch.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0308]: mismatched types
4 | #[memoized(key_expr = a, store_type = HashMap<usize, bool>)]
| ----------------------^-------------------------------------
| | |
| | expected `usize`, found `bool`
| | expected `&usize`, found `&bool`
| arguments to this function are incorrect
|
= note: expected reference `&usize`
Expand All @@ -22,12 +22,12 @@ error[E0308]: mismatched types
4 | #[memoized(key_expr = a, store_type = HashMap<usize, bool>)]
| ----------------------^-------------------------------------
| | |
| | expected `usize`, found `bool`
| | expected `&usize`, found `&bool`
| arguments to this function are incorrect
|
= note: expected reference `&usize`
found reference `&bool`
note: associated function defined here
note: method defined here
--> src/lib.rs
|
| fn get(&self, input: &I) -> Option<R>;
Expand All @@ -43,7 +43,7 @@ error[E0308]: mismatched types
| | expected `usize`, found `bool`
| arguments to this function are incorrect
|
note: associated function defined here
note: method defined here
--> src/lib.rs
|
| fn insert(&mut self, input: I, return_value: R) -> R;
Expand Down
16 changes: 10 additions & 6 deletions tests/compile_fail/key_type_not_send_nor_sync.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
= help: within `(Rc<()>, ())`, the trait `Send` is not implemented for `Rc<()>`
= note: required because it appears within the type `(Rc<()>, ())`
= note: required for `hashbrown::raw::RawTable<(Rc<()>, ())>` to implement `Send`
= note: required because it appears within the type `hashbrown::map::HashMap<Rc<()>, (), RandomState>`
= note: required because it appears within the type `HashMap<Rc<()>, ()>`
= note: required for the cast from `HashMap<Rc<()>, ()>` to the object type `dyn Any + Send + Sync`
note: required because it appears within the type `HashMap<Rc<()>, (), RandomState>`
--> $CARGO/hashbrown-0.14.0/src/map.rs
note: required because it appears within the type `HashMap<Rc<()>, ()>`
--> $RUST/std/src/collections/hash/map.rs
= note: required for the cast from `Box<HashMap<Rc<()>, ()>>` to `Box<(dyn Any + Send + Sync + 'static)>`
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `Rc<()>` cannot be shared between threads safely
Expand All @@ -21,7 +23,9 @@ error[E0277]: `Rc<()>` cannot be shared between threads safely
= help: within `(Rc<()>, ())`, the trait `Sync` is not implemented for `Rc<()>`
= note: required because it appears within the type `(Rc<()>, ())`
= note: required for `hashbrown::raw::RawTable<(Rc<()>, ())>` to implement `Sync`
= note: required because it appears within the type `hashbrown::map::HashMap<Rc<()>, (), RandomState>`
= note: required because it appears within the type `HashMap<Rc<()>, ()>`
= note: required for the cast from `HashMap<Rc<()>, ()>` to the object type `dyn Any + Send + Sync`
note: required because it appears within the type `HashMap<Rc<()>, (), RandomState>`
--> $CARGO/hashbrown-0.14.0/src/map.rs
note: required because it appears within the type `HashMap<Rc<()>, ()>`
--> $RUST/std/src/collections/hash/map.rs
= note: required for the cast from `Box<HashMap<Rc<()>, ()>>` to `Box<(dyn Any + Send + Sync + 'static)>`
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)
16 changes: 10 additions & 6 deletions tests/compile_fail/return_type_not_send_nor_sync.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
= help: within `((), Rc<()>)`, the trait `Send` is not implemented for `Rc<()>`
= note: required because it appears within the type `((), Rc<()>)`
= note: required for `hashbrown::raw::RawTable<((), Rc<()>)>` to implement `Send`
= note: required because it appears within the type `hashbrown::map::HashMap<(), Rc<()>, RandomState>`
= note: required because it appears within the type `HashMap<(), Rc<()>>`
= note: required for the cast from `HashMap<(), Rc<()>>` to the object type `dyn Any + Send + Sync`
note: required because it appears within the type `HashMap<(), Rc<()>, RandomState>`
--> $CARGO/hashbrown-0.14.0/src/map.rs
note: required because it appears within the type `HashMap<(), Rc<()>>`
--> $RUST/std/src/collections/hash/map.rs
= note: required for the cast from `Box<HashMap<(), Rc<()>>>` to `Box<(dyn Any + Send + Sync + 'static)>`
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `Rc<()>` cannot be shared between threads safely
Expand All @@ -21,7 +23,9 @@ error[E0277]: `Rc<()>` cannot be shared between threads safely
= help: within `((), Rc<()>)`, the trait `Sync` is not implemented for `Rc<()>`
= note: required because it appears within the type `((), Rc<()>)`
= note: required for `hashbrown::raw::RawTable<((), Rc<()>)>` to implement `Sync`
= note: required because it appears within the type `hashbrown::map::HashMap<(), Rc<()>, RandomState>`
= note: required because it appears within the type `HashMap<(), Rc<()>>`
= note: required for the cast from `HashMap<(), Rc<()>>` to the object type `dyn Any + Send + Sync`
note: required because it appears within the type `HashMap<(), Rc<()>, RandomState>`
--> $CARGO/hashbrown-0.14.0/src/map.rs
note: required because it appears within the type `HashMap<(), Rc<()>>`
--> $RUST/std/src/collections/hash/map.rs
= note: required for the cast from `Box<HashMap<(), Rc<()>>>` to `Box<(dyn Any + Send + Sync + 'static)>`
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ error[E0277]: the trait bound `Store: Default` is not satisfied
= note: this error originates in the attribute macro `memoized` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `Store` with `#[derive(Default)]`
|
3 | #[derive(Default)]
3 + #[derive(Default)]
4 | struct Store;
|