From 8ea2b0fbc03d7f5f354f8e1d1f9567e476aa5ca7 Mon Sep 17 00:00:00 2001 From: saschagrunert <695473+saschagrunert@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:43:44 +0000 Subject: [PATCH] Update cargo dependencies Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .cargo-vendor/anyhow/.cargo-checksum.json | 2 +- .cargo-vendor/anyhow/Cargo.toml | 2 +- .cargo-vendor/anyhow/README.md | 8 +- .cargo-vendor/anyhow/build.rs | 7 + .cargo-vendor/anyhow/src/error.rs | 10 + .cargo-vendor/anyhow/src/lib.rs | 10 +- .cargo-vendor/anyhow/tests/test_autotrait.rs | 19 + .cargo-vendor/capnp-rpc/.cargo-checksum.json | 2 +- .cargo-vendor/capnp-rpc/CHANGELOG.md | 3 + .cargo-vendor/capnp-rpc/Cargo.toml | 4 +- .cargo-vendor/capnp-rpc/src/local.rs | 41 +- .cargo-vendor/capnp-rpc/src/queued.rs | 50 +- .cargo-vendor/capnp-rpc/src/rpc.rs | 30 +- .cargo-vendor/capnp/.cargo-checksum.json | 2 +- .cargo-vendor/capnp/CHANGELOG.md | 3 + .cargo-vendor/capnp/Cargo.toml | 43 +- .cargo-vendor/capnp/src/capability.rs | 9 +- .cargo-vendor/capnp/src/lib.rs | 2 +- .cargo-vendor/capnp/src/private/capability.rs | 6 + .cargo-vendor/capnp/src/serialize.rs | 6 +- .cargo-vendor/getset/.cargo-checksum.json | 2 +- .cargo-vendor/getset/Cargo.lock | 50 +- .cargo-vendor/getset/Cargo.toml | 39 +- .cargo-vendor/getset/src/generate.rs | 117 +- .cargo-vendor/getset/src/lib.rs | 76 +- .../.cargo-checksum.json | 1 - .../proc-macro-error-attr/Cargo.toml | 33 - .cargo-vendor/proc-macro-error-attr/build.rs | 5 - .../.cargo-checksum.json | 1 + .../proc-macro-error-attr2/Cargo.toml | 44 + .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../src/lib.rs | 28 +- .../src/parse.rs | 2 +- .../src/settings.rs | 4 +- .../proc-macro-error/.cargo-checksum.json | 1 - .cargo-vendor/proc-macro-error/Cargo.toml | 56 - .cargo-vendor/proc-macro-error/build.rs | 11 - .../proc-macro-error/tests/ui/abort.stderr | 48 - .../tests/ui/append_dummy.stderr | 5 - .../tests/ui/children_messages.stderr | 23 - .../proc-macro-error/tests/ui/dummy.stderr | 5 - .../proc-macro-error/tests/ui/emit.stderr | 48 - .../tests/ui/explicit_span_range.stderr | 5 - .../proc-macro-error/tests/ui/misuse.stderr | 13 - .../tests/ui/multiple_tokens.stderr | 5 - .../tests/ui/not_proc_macro.rs | 4 - .../tests/ui/not_proc_macro.stderr | 10 - .../tests/ui/option_ext.stderr | 7 - .../tests/ui/proc_macro_hack.rs | 10 - .../tests/ui/proc_macro_hack.stderr | 26 - .../tests/ui/to_tokens_span.stderr | 11 - .../tests/ui/unrelated_panic.stderr | 7 - .../proc-macro-error2/.cargo-checksum.json | 1 + .../CHANGELOG.md | 18 + .cargo-vendor/proc-macro-error2/Cargo.toml | 91 + .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 34 +- .../src/diagnostic.rs | 35 +- .../src/dummy.rs | 7 +- .../src/imp/delegate.rs | 1 - .../src/imp/fallback.rs | 2 +- .../src/lib.rs | 55 +- .../src/macros.rs | 0 .../src/sealed.rs | 0 .../tests/macro-errors.rs | 4 +- .../tests/ok.rs | 2 - .../tests/runtime-errors.rs | 6 +- .../tests/ui/abort.rs | 1 - .../proc-macro-error2/tests/ui/abort.stderr | 48 + .../tests/ui/append_dummy.rs | 3 +- .../tests/ui/append_dummy.stderr | 5 + .../tests/ui/children_messages.rs | 1 - .../tests/ui/children_messages.stderr | 23 + .../tests/ui/dummy.rs | 3 +- .../proc-macro-error2/tests/ui/dummy.stderr | 5 + .../tests/ui/emit.rs | 1 - .../proc-macro-error2/tests/ui/emit.stderr | 48 + .../tests/ui/explicit_span_range.rs | 1 - .../tests/ui/explicit_span_range.stderr | 5 + .../tests/ui/misuse.rs | 3 +- .../proc-macro-error2/tests/ui/misuse.stderr | 24 + .../tests/ui/multiple_tokens.rs | 4 +- .../tests/ui/multiple_tokens.stderr | 5 + .../tests/ui/not_proc_macro.rs | 4 + .../tests/ui/not_proc_macro.stderr | 9 + .../tests/ui/option_ext.rs | 1 - .../tests/ui/option_ext.stderr | 7 + .../tests/ui/result_ext.rs | 1 - .../tests/ui/result_ext.stderr | 8 +- .../tests/ui/to_tokens_span.rs | 1 - .../tests/ui/to_tokens_span.stderr | 11 + .../tests/ui/unknown_setting.rs | 2 +- .../tests/ui/unknown_setting.stderr | 2 +- .../tests/ui/unrelated_panic.rs | 1 - .../tests/ui/unrelated_panic.stderr | 7 + .../syn-1.0.109/.cargo-checksum.json | 1 - .cargo-vendor/syn-1.0.109/Cargo.toml | 147 - .cargo-vendor/syn-1.0.109/LICENSE-APACHE | 201 - .cargo-vendor/syn-1.0.109/LICENSE-MIT | 23 - .cargo-vendor/syn-1.0.109/README.md | 285 - .cargo-vendor/syn-1.0.109/benches/file.rs | 55 - .cargo-vendor/syn-1.0.109/benches/rust.rs | 170 - .cargo-vendor/syn-1.0.109/build.rs | 51 - .cargo-vendor/syn-1.0.109/src/attr.rs | 662 -- .cargo-vendor/syn-1.0.109/src/await.rs | 2 - .cargo-vendor/syn-1.0.109/src/bigint.rs | 66 - .cargo-vendor/syn-1.0.109/src/buffer.rs | 398 -- .../syn-1.0.109/src/custom_keyword.rs | 253 - .../syn-1.0.109/src/custom_punctuation.rs | 300 - .cargo-vendor/syn-1.0.109/src/data.rs | 493 -- .cargo-vendor/syn-1.0.109/src/derive.rs | 274 - .cargo-vendor/syn-1.0.109/src/discouraged.rs | 194 - .cargo-vendor/syn-1.0.109/src/drops.rs | 58 - .cargo-vendor/syn-1.0.109/src/error.rs | 428 -- .cargo-vendor/syn-1.0.109/src/export.rs | 39 - .cargo-vendor/syn-1.0.109/src/expr.rs | 3558 ----------- .cargo-vendor/syn-1.0.109/src/ext.rs | 139 - .cargo-vendor/syn-1.0.109/src/file.rs | 125 - .cargo-vendor/syn-1.0.109/src/gen/clone.rs | 2241 ------- .cargo-vendor/syn-1.0.109/src/gen/debug.rs | 3042 --------- .cargo-vendor/syn-1.0.109/src/gen/eq.rs | 2195 ------- .cargo-vendor/syn-1.0.109/src/gen/fold.rs | 3341 ---------- .cargo-vendor/syn-1.0.109/src/gen/hash.rs | 2869 --------- .cargo-vendor/syn-1.0.109/src/gen/visit.rs | 3786 ----------- .../syn-1.0.109/src/gen/visit_mut.rs | 3786 ----------- .cargo-vendor/syn-1.0.109/src/gen_helper.rs | 154 - .cargo-vendor/syn-1.0.109/src/generics.rs | 1362 ---- .cargo-vendor/syn-1.0.109/src/group.rs | 282 - .cargo-vendor/syn-1.0.109/src/ident.rs | 101 - .cargo-vendor/syn-1.0.109/src/item.rs | 3313 ---------- .cargo-vendor/syn-1.0.109/src/lib.rs | 984 --- .cargo-vendor/syn-1.0.109/src/lifetime.rs | 154 - .cargo-vendor/syn-1.0.109/src/lit.rs | 1599 ----- .cargo-vendor/syn-1.0.109/src/lookahead.rs | 169 - .cargo-vendor/syn-1.0.109/src/mac.rs | 219 - .cargo-vendor/syn-1.0.109/src/macros.rs | 177 - .cargo-vendor/syn-1.0.109/src/op.rs | 234 - .cargo-vendor/syn-1.0.109/src/parse.rs | 1314 ---- .../syn-1.0.109/src/parse_macro_input.rs | 179 - .cargo-vendor/syn-1.0.109/src/parse_quote.rs | 167 - .cargo-vendor/syn-1.0.109/src/pat.rs | 927 --- .cargo-vendor/syn-1.0.109/src/path.rs | 854 --- .cargo-vendor/syn-1.0.109/src/print.rs | 16 - .cargo-vendor/syn-1.0.109/src/punctuated.rs | 1087 ---- .cargo-vendor/syn-1.0.109/src/reserved.rs | 44 - .cargo-vendor/syn-1.0.109/src/sealed.rs | 4 - .cargo-vendor/syn-1.0.109/src/span.rs | 67 - .cargo-vendor/syn-1.0.109/src/spanned.rs | 114 - .cargo-vendor/syn-1.0.109/src/stmt.rs | 349 - .cargo-vendor/syn-1.0.109/src/thread.rs | 41 - .cargo-vendor/syn-1.0.109/src/token.rs | 1013 --- .cargo-vendor/syn-1.0.109/src/tt.rs | 107 - .cargo-vendor/syn-1.0.109/src/ty.rs | 1304 ---- .cargo-vendor/syn-1.0.109/src/verbatim.rs | 33 - .cargo-vendor/syn-1.0.109/src/whitespace.rs | 65 - .cargo-vendor/syn-1.0.109/tests/common/eq.rs | 806 --- .cargo-vendor/syn-1.0.109/tests/common/mod.rs | 28 - .../syn-1.0.109/tests/common/parse.rs | 48 - .cargo-vendor/syn-1.0.109/tests/debug/gen.rs | 5640 ----------------- .cargo-vendor/syn-1.0.109/tests/debug/mod.rs | 125 - .cargo-vendor/syn-1.0.109/tests/macros/mod.rs | 79 - .cargo-vendor/syn-1.0.109/tests/regression.rs | 3 - .../syn-1.0.109/tests/regression/issue1108.rs | 5 - .../syn-1.0.109/tests/regression/issue1235.rs | 32 - .cargo-vendor/syn-1.0.109/tests/repo/mod.rs | 215 - .../syn-1.0.109/tests/repo/progress.rs | 37 - .../syn-1.0.109/tests/test_asyncness.rs | 37 - .../syn-1.0.109/tests/test_attribute.rs | 336 - .../syn-1.0.109/tests/test_derive_input.rs | 894 --- .cargo-vendor/syn-1.0.109/tests/test_expr.rs | 306 - .../syn-1.0.109/tests/test_generics.rs | 285 - .../syn-1.0.109/tests/test_grouping.rs | 52 - .cargo-vendor/syn-1.0.109/tests/test_ident.rs | 85 - .cargo-vendor/syn-1.0.109/tests/test_item.rs | 336 - .../syn-1.0.109/tests/test_iterators.rs | 68 - .cargo-vendor/syn-1.0.109/tests/test_lit.rs | 270 - .cargo-vendor/syn-1.0.109/tests/test_meta.rs | 378 -- .../syn-1.0.109/tests/test_parse_buffer.rs | 92 - .../syn-1.0.109/tests/test_parse_stream.rs | 12 - .cargo-vendor/syn-1.0.109/tests/test_pat.rs | 67 - .cargo-vendor/syn-1.0.109/tests/test_path.rs | 126 - .../syn-1.0.109/tests/test_precedence.rs | 460 -- .../syn-1.0.109/tests/test_receiver.rs | 127 - .../syn-1.0.109/tests/test_round_trip.rs | 241 - .../syn-1.0.109/tests/test_shebang.rs | 59 - .../syn-1.0.109/tests/test_should_parse.rs | 45 - .cargo-vendor/syn-1.0.109/tests/test_size.rs | 29 - .cargo-vendor/syn-1.0.109/tests/test_stmt.rs | 93 - .../syn-1.0.109/tests/test_token_trees.rs | 30 - .cargo-vendor/syn-1.0.109/tests/test_ty.rs | 352 - .../syn-1.0.109/tests/test_visibility.rs | 148 - .cargo-vendor/syn-1.0.109/tests/zzz_stable.rs | 33 - .../unicode-ident/.cargo-checksum.json | 2 +- .cargo-vendor/unicode-ident/Cargo.toml | 18 +- .cargo-vendor/unicode-ident/README.md | 8 +- .cargo-vendor/unicode-ident/benches/xid.rs | 5 +- .cargo-vendor/unicode-ident/src/lib.rs | 10 +- .cargo-vendor/unicode-ident/src/tables.rs | 178 +- .cargo-vendor/unicode-ident/tests/compare.rs | 6 +- .../unicode-ident/tests/fst/xid_continue.fst | Bin 73249 -> 76404 bytes .../unicode-ident/tests/fst/xid_start.fst | Bin 65487 -> 67736 bytes .../unicode-ident/tests/static_size.rs | 8 +- .../unicode-ident/tests/tables/tables.rs | 242 +- .../unicode-ident/tests/trie/trie.rs | 247 +- Cargo.lock | 85 +- conmon-rs/client/Cargo.toml | 4 +- conmon-rs/common/Cargo.toml | 4 +- conmon-rs/server/Cargo.toml | 8 +- 210 files changed, 1246 insertions(+), 58619 deletions(-) delete mode 100644 .cargo-vendor/proc-macro-error-attr/.cargo-checksum.json delete mode 100644 .cargo-vendor/proc-macro-error-attr/Cargo.toml delete mode 100644 .cargo-vendor/proc-macro-error-attr/build.rs create mode 100644 .cargo-vendor/proc-macro-error-attr2/.cargo-checksum.json create mode 100644 .cargo-vendor/proc-macro-error-attr2/Cargo.toml rename .cargo-vendor/{proc-macro-error-attr => proc-macro-error-attr2}/LICENSE-APACHE (100%) rename .cargo-vendor/{proc-macro-error-attr => proc-macro-error-attr2}/LICENSE-MIT (100%) rename .cargo-vendor/{proc-macro-error-attr => proc-macro-error-attr2}/src/lib.rs (74%) rename .cargo-vendor/{proc-macro-error-attr => proc-macro-error-attr2}/src/parse.rs (97%) rename .cargo-vendor/{proc-macro-error-attr => proc-macro-error-attr2}/src/settings.rs (96%) delete mode 100644 .cargo-vendor/proc-macro-error/.cargo-checksum.json delete mode 100644 .cargo-vendor/proc-macro-error/Cargo.toml delete mode 100644 .cargo-vendor/proc-macro-error/build.rs delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/abort.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/append_dummy.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/children_messages.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/dummy.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/emit.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/misuse.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.rs delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/option_ext.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.rs delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.stderr delete mode 100644 .cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.stderr create mode 100644 .cargo-vendor/proc-macro-error2/.cargo-checksum.json rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/CHANGELOG.md (89%) create mode 100644 .cargo-vendor/proc-macro-error2/Cargo.toml rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/LICENSE-APACHE (100%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/LICENSE-MIT (100%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/README.md (86%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/diagnostic.rs (93%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/dummy.rs (95%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/imp/delegate.rs (98%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/imp/fallback.rs (87%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/lib.rs (94%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/macros.rs (100%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/src/sealed.rs (100%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/macro-errors.rs (62%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ok.rs (76%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/runtime-errors.rs (50%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/abort.rs (88%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/abort.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/append_dummy.rs (80%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/append_dummy.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/children_messages.rs (75%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/children_messages.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/dummy.rs (79%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/dummy.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/emit.rs (78%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/emit.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/explicit_span_range.rs (75%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/misuse.rs (58%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/misuse.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/multiple_tokens.rs (54%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.stderr create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.rs create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/option_ext.rs (69%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/option_ext.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/result_ext.rs (80%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/result_ext.stderr (51%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/to_tokens_span.rs (74%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.stderr rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/unknown_setting.rs (66%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/unknown_setting.stderr (86%) rename .cargo-vendor/{proc-macro-error => proc-macro-error2}/tests/ui/unrelated_panic.rs (68%) create mode 100644 .cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.stderr delete mode 100644 .cargo-vendor/syn-1.0.109/.cargo-checksum.json delete mode 100644 .cargo-vendor/syn-1.0.109/Cargo.toml delete mode 100644 .cargo-vendor/syn-1.0.109/LICENSE-APACHE delete mode 100644 .cargo-vendor/syn-1.0.109/LICENSE-MIT delete mode 100644 .cargo-vendor/syn-1.0.109/README.md delete mode 100644 .cargo-vendor/syn-1.0.109/benches/file.rs delete mode 100644 .cargo-vendor/syn-1.0.109/benches/rust.rs delete mode 100644 .cargo-vendor/syn-1.0.109/build.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/attr.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/await.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/bigint.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/buffer.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/custom_keyword.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/custom_punctuation.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/data.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/derive.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/discouraged.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/drops.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/error.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/export.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/expr.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/ext.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/file.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/clone.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/debug.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/eq.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/fold.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/hash.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/visit.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen/visit_mut.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/gen_helper.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/generics.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/group.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/ident.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/item.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/lib.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/lifetime.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/lit.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/lookahead.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/mac.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/macros.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/op.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/parse.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/parse_macro_input.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/parse_quote.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/pat.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/path.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/print.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/punctuated.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/reserved.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/sealed.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/span.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/spanned.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/stmt.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/thread.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/token.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/tt.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/ty.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/verbatim.rs delete mode 100644 .cargo-vendor/syn-1.0.109/src/whitespace.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/common/eq.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/common/mod.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/common/parse.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/debug/gen.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/debug/mod.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/macros/mod.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/regression.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/regression/issue1108.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/regression/issue1235.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/repo/mod.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/repo/progress.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_asyncness.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_attribute.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_derive_input.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_expr.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_generics.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_grouping.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_ident.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_item.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_iterators.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_lit.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_meta.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_parse_buffer.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_parse_stream.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_pat.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_path.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_precedence.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_receiver.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_round_trip.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_shebang.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_should_parse.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_size.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_stmt.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_token_trees.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_ty.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/test_visibility.rs delete mode 100644 .cargo-vendor/syn-1.0.109/tests/zzz_stable.rs diff --git a/.cargo-vendor/anyhow/.cargo-checksum.json b/.cargo-vendor/anyhow/.cargo-checksum.json index 8d1b06acee..f09e421f53 100644 --- a/.cargo-vendor/anyhow/.cargo-checksum.json +++ b/.cargo-vendor/anyhow/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"50daeb84465695fb01975f29be1529b1c09010d9e6440d0f92034285f00e8203","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"6e608b9068b4ebab4b85944f047ea386f0288a99c615ac4a32ac45a7da4e5e33","build.rs":"914eb6158687216432aed82e357af5dff2d957d8c7746d075f7a778ba39df146","build/probe.rs":"ee0a4518493c0b3cca121ed2e937b1779eb7e8313a5c4d5fc5aea28ff015366b","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"578b395a66b21d0e90c503546011138b057f6f27147c51667490da66d22edd54","src/chain.rs":"85af447405f075633fab186b7f1c94d7f33a36474f239c50a961b2d6197d5426","src/context.rs":"1be432c32752778041e8acf0e7d98d4f6291ce53fd7df5bbb0167824bbea57f7","src/ensure.rs":"9763f418b5397764549866c111ec6db3a7bdc4c30ad95c3bbfc56c5434ea8c09","src/error.rs":"cb47593520baa6dc9372bea3d0e8e318f7ec09734f88e7d9d6b9b0c1e17c1507","src/fmt.rs":"adf4be906b29900153bfb4b767a6049d58697dc3bcce7dfbb85ca773f5de5b33","src/kind.rs":"d8cc91e73653049ca0b5593f36aee8632fcc85847b36005b90ecd9a6f0de13cb","src/lib.rs":"8647691e7cf073cb8df0a5c69d55b6adfebf9f2ab93b7c0817621021c0762384","src/macros.rs":"17fb103e68a5befa768857314c3ca4d81d1dacfea0738bbb9c7597a485243499","src/ptr.rs":"4cb31d2f815b178daf951bfb94a1930383e056c0ca68d494603f45d8eea35d50","src/wrapper.rs":"d4e45caee3c2d861d4609a8141310d5c901af59a57d5f0a0de30251347dbd23c","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"4e381aa8ca3eabb7ac14d1e0c3700b3223e47640547a6988cfa13ad68255f60f","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"ecccf9202a33611f64b76598806aa82abec2560ae058e32f63fb2fb3ef225be9","tests/test_backtrace.rs":"60afdd7ee5850dc22625ff486fe41c47fd322db874a93c4871ddfed2bf603930","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"3a8a8d7569913bd98c0e27c69d0bda35101e7fde7c056ed57cdd8ed018e4cbcb","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"4014ead6596793f5eecd55cbaafa49286b75cee7b7092a8b9b8286fcd813a6da","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"0e49b48f08e4faaf03e2f202e1efc5250018876c4e1b01b8379d7a38ae8df870","tests/test_macros.rs":"68673942662a43bceee62aaed69c25d7ddbc55e25d62d528e13033c3e2e756cd","tests/test_repr.rs":"034dee888abd08741e11ac2e95ef4fcb2ab3943d0a76e8e976db404658e1a252","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"315782f5f4246290fe190e3767b22c3dcaffaabc19c5ace0373537d53e765278","tests/ui/ensure-nonbool.rs":"7e57cb93fbcd82959b36586ed6bd2ad978b051fe5facd5274651fde6b1600905","tests/ui/ensure-nonbool.stderr":"0b4d1611e3bb65081bf38c1e49b1f12e5096738f276608661016e68f1fe13f7c","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"c2848c5f254b4c061eea6714d9baf709924aba06619eaf2a8b3aee1266b75f9e","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"0d8ed712d25de898eae18cfdffc575a47f4d5596346058cf6cd50d016c4f8ce8","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"171f6c1c962503855480696e5d39e68946ec2a027b61a6f36ca1ad1b40265c5d","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8"} \ No newline at end of file +{"files":{"Cargo.toml":"602edfd1fcc210659c9488a570d28ef98b06acab5e0ea55245955b846f54925f","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"136d2b44cc4060192516f18e43ec3eafb65693c1819a80a867e7a00c60a45ee6","build.rs":"1de78cc91e63321318aa336cb550e3acdcda9b39f0648436a884d783247cfcd2","build/probe.rs":"ee0a4518493c0b3cca121ed2e937b1779eb7e8313a5c4d5fc5aea28ff015366b","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"578b395a66b21d0e90c503546011138b057f6f27147c51667490da66d22edd54","src/chain.rs":"85af447405f075633fab186b7f1c94d7f33a36474f239c50a961b2d6197d5426","src/context.rs":"1be432c32752778041e8acf0e7d98d4f6291ce53fd7df5bbb0167824bbea57f7","src/ensure.rs":"9763f418b5397764549866c111ec6db3a7bdc4c30ad95c3bbfc56c5434ea8c09","src/error.rs":"274c175ec92f4aa8bf479d39cf3023d1ead9865a242a0a63ad3998aea57219a6","src/fmt.rs":"adf4be906b29900153bfb4b767a6049d58697dc3bcce7dfbb85ca773f5de5b33","src/kind.rs":"d8cc91e73653049ca0b5593f36aee8632fcc85847b36005b90ecd9a6f0de13cb","src/lib.rs":"9147b9e8b304a5ddac5d3f78b9912aec109553a3fda74f9495a78ad543a91d31","src/macros.rs":"17fb103e68a5befa768857314c3ca4d81d1dacfea0738bbb9c7597a485243499","src/ptr.rs":"4cb31d2f815b178daf951bfb94a1930383e056c0ca68d494603f45d8eea35d50","src/wrapper.rs":"d4e45caee3c2d861d4609a8141310d5c901af59a57d5f0a0de30251347dbd23c","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"4e381aa8ca3eabb7ac14d1e0c3700b3223e47640547a6988cfa13ad68255f60f","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"ba9bc18416115cb48fd08675a3e7fc89584de7926dad6b2be6645dc13d5931df","tests/test_backtrace.rs":"60afdd7ee5850dc22625ff486fe41c47fd322db874a93c4871ddfed2bf603930","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"3a8a8d7569913bd98c0e27c69d0bda35101e7fde7c056ed57cdd8ed018e4cbcb","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"4014ead6596793f5eecd55cbaafa49286b75cee7b7092a8b9b8286fcd813a6da","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"0e49b48f08e4faaf03e2f202e1efc5250018876c4e1b01b8379d7a38ae8df870","tests/test_macros.rs":"68673942662a43bceee62aaed69c25d7ddbc55e25d62d528e13033c3e2e756cd","tests/test_repr.rs":"034dee888abd08741e11ac2e95ef4fcb2ab3943d0a76e8e976db404658e1a252","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"315782f5f4246290fe190e3767b22c3dcaffaabc19c5ace0373537d53e765278","tests/ui/ensure-nonbool.rs":"7e57cb93fbcd82959b36586ed6bd2ad978b051fe5facd5274651fde6b1600905","tests/ui/ensure-nonbool.stderr":"0b4d1611e3bb65081bf38c1e49b1f12e5096738f276608661016e68f1fe13f7c","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"c2848c5f254b4c061eea6714d9baf709924aba06619eaf2a8b3aee1266b75f9e","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"0d8ed712d25de898eae18cfdffc575a47f4d5596346058cf6cd50d016c4f8ce8","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"171f6c1c962503855480696e5d39e68946ec2a027b61a6f36ca1ad1b40265c5d","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"} \ No newline at end of file diff --git a/.cargo-vendor/anyhow/Cargo.toml b/.cargo-vendor/anyhow/Cargo.toml index d1f3e3efcb..83b7f34609 100644 --- a/.cargo-vendor/anyhow/Cargo.toml +++ b/.cargo-vendor/anyhow/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.39" name = "anyhow" -version = "1.0.87" +version = "1.0.89" authors = ["David Tolnay "] build = "build.rs" autobins = false diff --git a/.cargo-vendor/anyhow/README.md b/.cargo-vendor/anyhow/README.md index 4106dcb2df..ff83168d6b 100644 --- a/.cargo-vendor/anyhow/README.md +++ b/.cargo-vendor/anyhow/README.md @@ -136,10 +136,10 @@ Cargo.toml. A global allocator is required. anyhow = { version = "1.0", default-features = false } ``` -Since the `?`-based error conversions would normally rely on the -`std::error::Error` trait which is only available through std, no_std mode will -require an explicit `.map_err(Error::msg)` when working with a non-Anyhow error -type inside a function that returns Anyhow's error type. +With versions of Rust older than 1.81, no_std mode may require an additional +`.map_err(Error::msg)` when working with a non-Anyhow error type inside a +function that returns Anyhow's error type, as the trait that `?`-based error +conversions are defined by is only available in std in those old versions.
diff --git a/.cargo-vendor/anyhow/build.rs b/.cargo-vendor/anyhow/build.rs index a065e04c53..200b2bfd7a 100644 --- a/.cargo-vendor/anyhow/build.rs +++ b/.cargo-vendor/anyhow/build.rs @@ -68,6 +68,7 @@ fn main() { if rustc >= 80 { println!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_error)"); + println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_unwind_safe)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_ptr_addr_of)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)"); @@ -91,6 +92,12 @@ fn main() { println!("cargo:rustc-cfg=anyhow_no_unsafe_op_in_unsafe_fn_lint"); } + if rustc < 56 { + // core::panic::{UnwindSafe, RefUnwindSafe} + // https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html#stabilized-apis + println!("cargo:rustc-cfg=anyhow_no_core_unwind_safe"); + } + if !error_generic_member_access && cfg!(feature = "std") && rustc >= 65 { // std::backtrace::Backtrace // https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#stabilized-apis diff --git a/.cargo-vendor/anyhow/src/error.rs b/.cargo-vendor/anyhow/src/error.rs index 6d8b54dbe1..a83eb7eeb8 100644 --- a/.cargo-vendor/anyhow/src/error.rs +++ b/.cargo-vendor/anyhow/src/error.rs @@ -12,9 +12,13 @@ use core::fmt::{self, Debug, Display}; use core::mem::ManuallyDrop; #[cfg(any(feature = "std", not(anyhow_no_core_error)))] use core::ops::{Deref, DerefMut}; +#[cfg(not(anyhow_no_core_unwind_safe))] +use core::panic::{RefUnwindSafe, UnwindSafe}; #[cfg(not(anyhow_no_ptr_addr_of))] use core::ptr; use core::ptr::NonNull; +#[cfg(all(feature = "std", anyhow_no_core_unwind_safe))] +use std::panic::{RefUnwindSafe, UnwindSafe}; impl Error { /// Create a new error object from any error type. @@ -1015,3 +1019,9 @@ impl AsRef for Error { &**self } } + +#[cfg(any(feature = "std", not(anyhow_no_core_unwind_safe)))] +impl UnwindSafe for Error {} + +#[cfg(any(feature = "std", not(anyhow_no_core_unwind_safe)))] +impl RefUnwindSafe for Error {} diff --git a/.cargo-vendor/anyhow/src/lib.rs b/.cargo-vendor/anyhow/src/lib.rs index c0e20f3505..e0e676e352 100644 --- a/.cargo-vendor/anyhow/src/lib.rs +++ b/.cargo-vendor/anyhow/src/lib.rs @@ -201,12 +201,12 @@ //! anyhow = { version = "1.0", default-features = false } //! ``` //! -//! Since the `?`-based error conversions would normally rely on the -//! `std::error::Error` trait which is only available through std, no_std mode -//! will require an explicit `.map_err(Error::msg)` when working with a -//! non-Anyhow error type inside a function that returns Anyhow's error type. +//! With versions of Rust older than 1.81, no_std mode may require an additional +//! `.map_err(Error::msg)` when working with a non-Anyhow error type inside a +//! function that returns Anyhow's error type, as the trait that `?`-based error +//! conversions are defined by is only available in std in those old versions. -#![doc(html_root_url = "https://docs.rs/anyhow/1.0.87")] +#![doc(html_root_url = "https://docs.rs/anyhow/1.0.89")] #![cfg_attr(error_generic_member_access, feature(error_generic_member_access))] #![no_std] #![deny(dead_code, unused_imports, unused_mut)] diff --git a/.cargo-vendor/anyhow/tests/test_autotrait.rs b/.cargo-vendor/anyhow/tests/test_autotrait.rs index 94d7a59847..080b3b9e00 100644 --- a/.cargo-vendor/anyhow/tests/test_autotrait.rs +++ b/.cargo-vendor/anyhow/tests/test_autotrait.rs @@ -1,6 +1,7 @@ #![allow(clippy::extra_unused_type_parameters)] use anyhow::Error; +use std::panic::{RefUnwindSafe, UnwindSafe}; #[test] fn test_send() { @@ -13,3 +14,21 @@ fn test_sync() { fn assert_sync() {} assert_sync::(); } + +#[test] +fn test_unwind_safe() { + fn assert_unwind_safe() {} + assert_unwind_safe::(); +} + +#[test] +fn test_ref_unwind_safe() { + fn assert_ref_unwind_safe() {} + assert_ref_unwind_safe::(); +} + +#[test] +fn test_unpin() { + fn assert_unpin() {} + assert_unpin::(); +} diff --git a/.cargo-vendor/capnp-rpc/.cargo-checksum.json b/.cargo-vendor/capnp-rpc/.cargo-checksum.json index eefa3a61aa..fdd97c7395 100644 --- a/.cargo-vendor/capnp-rpc/.cargo-checksum.json +++ b/.cargo-vendor/capnp-rpc/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"6c050bab9297fb7b1e7a035555649561bf3774c5a0e368b7e684eef0d3d031a4","Cargo.toml":"51ddfa517b37c08ef9337425510e59624b8e4e9672e4840f88e00a46731d329d","LICENSE":"4c2dafff9370c57598f847969a8240b901226315bac3aff066955ce922361bbf","README.md":"c07aab049c8e08b8df0233871b4c9ffa9d03ff88f35a3b019183cef67ab1b8da","schema/rpc-twoparty.capnp":"a28328408261d476403acb1f3861a7d88075ffaefca1996c21c746b580527223","schema/rpc.capnp":"026845b4658ac5c3ef40d0c892060241ba1caed09b8219c158ee609ccfcfadf5","src/attach.rs":"d5aa5be3a4e6f351ae92726d13c3c235fe2e8e05dec4604ffc21cf7b2bcefe4a","src/broken.rs":"bbb1594cb9c8131c052bd06c137d739c2d6eca920417b6ed10f08f68b465150a","src/lib.rs":"7ecb23b3e62cb952f32dd5aa48c40a9fa13993984d3dafd284852198ecdfaca1","src/local.rs":"89ba8ce91125952bba77e0e07a8afac6167415e3b00b7bcdda771c15136f228f","src/queued.rs":"b53eebb10d63d1512aa4de65e7b68dcd002921f17105a048174c7e503e382bee","src/reconnect.rs":"297db6e8232890fd880c60f7681499b61dc2fe0d0dc4a3543a7ab98ca1722353","src/rpc.rs":"370456a5f7b770dd2af27b6a5ec0a8a7cc564f173abe6bee8d852303cf82930a","src/rpc_capnp.rs":"c5faeee47cd090f19aeeddd5d606c8c8679c150499883eb5c896cfa5b434d8ae","src/rpc_twoparty_capnp.rs":"8c63372455cd209fd69f45903b748e8fef8197beb6fe0a59b4eb096a8c2830de","src/sender_queue.rs":"a49dda2fe5d228c9e56092f7e046a04af0eb1cd00accbf2842d0253d2c8a18b4","src/split.rs":"97a408c97a86654560484af3ac368ee7a615439ba55a9f905c84b7618dad327c","src/task_set.rs":"f06f9ce3bd0f23bf551aa82a7894d06aaafe79fbec819939a66a3e81d4527433","src/twoparty.rs":"8c58931b8182d92825083721bacc826383953f9a3fb9b348f766a359f0e27bdd"},"package":"04f09758ec79a2825c9bc87cbe1c8ded306c99a83b52cf89577667ebff2d3ff7"} \ No newline at end of file +{"files":{"CHANGELOG.md":"1dc70d86061bae653a29ba460238a450881b0bc396b07827f40a36a822a0498f","Cargo.toml":"a1d45302a52c8f4303a0447895cd9051523645f2080f67bf5db9bd37752e0674","LICENSE":"4c2dafff9370c57598f847969a8240b901226315bac3aff066955ce922361bbf","README.md":"c07aab049c8e08b8df0233871b4c9ffa9d03ff88f35a3b019183cef67ab1b8da","schema/rpc-twoparty.capnp":"a28328408261d476403acb1f3861a7d88075ffaefca1996c21c746b580527223","schema/rpc.capnp":"026845b4658ac5c3ef40d0c892060241ba1caed09b8219c158ee609ccfcfadf5","src/attach.rs":"d5aa5be3a4e6f351ae92726d13c3c235fe2e8e05dec4604ffc21cf7b2bcefe4a","src/broken.rs":"bbb1594cb9c8131c052bd06c137d739c2d6eca920417b6ed10f08f68b465150a","src/lib.rs":"7ecb23b3e62cb952f32dd5aa48c40a9fa13993984d3dafd284852198ecdfaca1","src/local.rs":"a9fdf7620cf0cb1fdd15ff60439095be1f357cdcdd607bb85dcd544622851707","src/queued.rs":"1890653f766a7644dfeb5cc8d7a4e2079fd3c4867a6e9fd55ce40356977e1ffe","src/reconnect.rs":"297db6e8232890fd880c60f7681499b61dc2fe0d0dc4a3543a7ab98ca1722353","src/rpc.rs":"e7406e81384e09d09fbef611ad6fbc81557988aefc4a8571517570532156bac2","src/rpc_capnp.rs":"c5faeee47cd090f19aeeddd5d606c8c8679c150499883eb5c896cfa5b434d8ae","src/rpc_twoparty_capnp.rs":"8c63372455cd209fd69f45903b748e8fef8197beb6fe0a59b4eb096a8c2830de","src/sender_queue.rs":"a49dda2fe5d228c9e56092f7e046a04af0eb1cd00accbf2842d0253d2c8a18b4","src/split.rs":"97a408c97a86654560484af3ac368ee7a615439ba55a9f905c84b7618dad327c","src/task_set.rs":"f06f9ce3bd0f23bf551aa82a7894d06aaafe79fbec819939a66a3e81d4527433","src/twoparty.rs":"8c58931b8182d92825083721bacc826383953f9a3fb9b348f766a359f0e27bdd"},"package":"fe57ab22a5e121e6fddaf36e837514aab9ae888bcff2baa6fda5630820dfc501"} \ No newline at end of file diff --git a/.cargo-vendor/capnp-rpc/CHANGELOG.md b/.cargo-vendor/capnp-rpc/CHANGELOG.md index 9b0b919b84..19078606a1 100644 --- a/.cargo-vendor/capnp-rpc/CHANGELOG.md +++ b/.cargo-vendor/capnp-rpc/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.19.5 +- Add support for `Request::set_pipeline()`. + ## v0.19.4 - Use the `noFinishNeeded` field to elide Finish messages when possible. diff --git a/.cargo-vendor/capnp-rpc/Cargo.toml b/.cargo-vendor/capnp-rpc/Cargo.toml index 04d0b02ed3..f78569a64d 100644 --- a/.cargo-vendor/capnp-rpc/Cargo.toml +++ b/.cargo-vendor/capnp-rpc/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2021" name = "capnp-rpc" -version = "0.19.4" +version = "0.19.5" authors = ["David Renshaw "] build = false autobins = false @@ -31,7 +31,7 @@ name = "capnp_rpc" path = "src/lib.rs" [dependencies.capnp] -version = "0.19.0" +version = "0.19.7" [dependencies.capnp-futures] version = "0.19.0" diff --git a/.cargo-vendor/capnp-rpc/src/local.rs b/.cargo-vendor/capnp-rpc/src/local.rs index 50ac0d1287..bd8dbe8b37 100644 --- a/.cargo-vendor/capnp-rpc/src/local.rs +++ b/.cargo-vendor/capnp-rpc/src/local.rs @@ -85,14 +85,19 @@ struct Results { message: Option>, cap_table: Vec>>, results_done_fulfiller: Option>>, + pipeline_sender: Option, } impl Results { - fn new(fulfiller: oneshot::Sender>) -> Self { + fn new( + fulfiller: oneshot::Sender>, + pipeline_sender: crate::queued::PipelineInnerSender, + ) -> Self { Self { message: Some(::capnp::message::Builder::new_default()), cap_table: Vec::new(), results_done_fulfiller: Some(fulfiller), + pipeline_sender: Some(pipeline_sender), } } } @@ -126,6 +131,25 @@ impl ResultsHook for Results { } } + fn set_pipeline(&mut self) -> capnp::Result<()> { + use ::capnp::traits::ImbueMut; + let root = self.get()?; + let size = root.target_size()?; + let mut message2 = capnp::message::Builder::new( + capnp::message::HeapAllocator::new().first_segment_words(size.word_count as u32 + 1), + ); + let mut root2: capnp::any_pointer::Builder = message2.init_root(); + let mut cap_table2 = vec![]; + root2.imbue_mut(&mut cap_table2); + root2.set_as(root.into_reader())?; + let hook = Box::new(ResultsDone::new(message2, cap_table2)) as Box; + let Some(sender) = self.pipeline_sender.take() else { + return Err(Error::failed("set_pipeline() called twice".into())); + }; + sender.complete(Box::new(Pipeline::new(hook))); + Ok(()) + } + fn tail_call(self: Box, _request: Box) -> Promise<(), Error> { unimplemented!() } @@ -147,12 +171,12 @@ struct ResultsDoneInner { cap_table: Vec>>, } -struct ResultsDone { +pub(crate) struct ResultsDone { inner: Rc, } impl ResultsDone { - fn new( + pub(crate) fn new( message: message::Builder, cap_table: Vec>>, ) -> Self { @@ -181,6 +205,8 @@ pub struct Request { interface_id: u64, method_id: u16, client: Box, + pipeline: crate::queued::Pipeline, + pipeline_sender: crate::queued::PipelineInnerSender, } impl Request { @@ -190,12 +216,15 @@ impl Request { _size_hint: Option<::capnp::MessageSize>, client: Box, ) -> Self { + let (pipeline_sender, pipeline) = crate::queued::Pipeline::new(); Self { message: message::Builder::new_default(), cap_table: Vec::new(), interface_id, method_id, client, + pipeline, + pipeline_sender, } } } @@ -217,17 +246,17 @@ impl RequestHook for Request { interface_id, method_id, client, + mut pipeline, + pipeline_sender, } = tmp; let params = Params::new(message, cap_table); let (results_done_fulfiller, results_done_promise) = oneshot::channel::>(); let results_done_promise = results_done_promise.map_err(crate::canceled_to_error); - let results = Results::new(results_done_fulfiller); + let results = Results::new(results_done_fulfiller, pipeline_sender.weak_clone()); let promise = client.call(interface_id, method_id, Box::new(params), Box::new(results)); - let (pipeline_sender, mut pipeline) = crate::queued::Pipeline::new(); - let p = futures::future::try_join(promise, results_done_promise).and_then( move |((), results_done_hook)| { pipeline_sender diff --git a/.cargo-vendor/capnp-rpc/src/queued.rs b/.cargo-vendor/capnp-rpc/src/queued.rs index 40322f352a..701c0b3bc8 100644 --- a/.cargo-vendor/capnp-rpc/src/queued.rs +++ b/.cargo-vendor/capnp-rpc/src/queued.rs @@ -44,7 +44,11 @@ pub struct PipelineInner { impl PipelineInner { fn resolve(this: &Rc>, result: Result, Error>) { - assert!(this.borrow().redirect.is_none()); + if this.borrow().redirect.is_some() { + // Already resolved, probably by set_pipeline(). + return; + } + let pipeline = match result { Ok(pipeline_hook) => pipeline_hook, Err(e) => Box::new(broken::Pipeline::new(e)), @@ -66,18 +70,30 @@ impl PipelineInner { pub struct PipelineInnerSender { inner: Option>>, + resolve_on_drop: bool, +} + +impl PipelineInnerSender { + pub(crate) fn weak_clone(&self) -> Self { + Self { + inner: self.inner.clone(), + resolve_on_drop: false, + } + } } impl Drop for PipelineInnerSender { fn drop(&mut self) { - if let Some(weak_queued) = self.inner.take() { - if let Some(pipeline_inner) = weak_queued.upgrade() { - PipelineInner::resolve( - &pipeline_inner, - Ok(Box::new(crate::broken::Pipeline::new(Error::failed( - "PipelineInnerSender was canceled".into(), - )))), - ); + if self.resolve_on_drop { + if let Some(weak_queued) = self.inner.take() { + if let Some(pipeline_inner) = weak_queued.upgrade() { + PipelineInner::resolve( + &pipeline_inner, + Ok(Box::new(crate::broken::Pipeline::new(Error::failed( + "PipelineInnerSender was canceled".into(), + )))), + ); + } } } } @@ -108,6 +124,7 @@ impl Pipeline { ( PipelineInnerSender { inner: Some(Rc::downgrade(&inner)), + resolve_on_drop: true, }, Self { inner }, ) @@ -271,9 +288,22 @@ impl ClientHook for Client { .attach(inner_clone) .and_then(|x| x); + // We need to drive `promise_to_drive` until we have a result. match self.inner.borrow().promise_to_drive { Some(ref p) => { - Promise::from_future(futures::future::try_join(p.clone(), promise).map_ok(|v| v.1)) + let p1 = p.clone(); + Promise::from_future(async move { + match futures::future::select(p1, promise).await { + futures::future::Either::Left((Ok(()), promise)) => promise.await, + futures::future::Either::Left((Err(e), _)) => Err(e), + futures::future::Either::Right((r, _)) => { + // Don't bother waiting for `promise_to_drive` to resolve. + // If we're here because set_pipeline() was called, then + // `promise_to_drive` might in fact never resolve. + r + } + } + }) } None => Promise::from_future(promise), } diff --git a/.cargo-vendor/capnp-rpc/src/rpc.rs b/.cargo-vendor/capnp-rpc/src/rpc.rs index 86d39af679..6d80810767 100644 --- a/.cargo-vendor/capnp-rpc/src/rpc.rs +++ b/.cargo-vendor/capnp-rpc/src/rpc.rs @@ -938,12 +938,15 @@ impl ConnectionState { let (results_inner_fulfiller, results_inner_promise) = oneshot::channel(); let results_inner_promise = results_inner_promise.map_err(crate::canceled_to_error); + + let (pipeline_sender, mut pipeline) = queued::Pipeline::new(); let results = Results::new( &connection_state, question_id, redirect_results, results_inner_fulfiller, answer.received_finish.clone(), + Some(pipeline_sender.weak_clone()), ); let (redirected_results_done_promise, redirected_results_done_fulfiller) = @@ -965,7 +968,6 @@ impl ConnectionState { let call_promise = capability.call(interface_id, method_id, Box::new(params), Box::new(results)); - let (pipeline_sender, mut pipeline) = queued::Pipeline::new(); let promise = call_promise .then(move |call_result| { @@ -2141,6 +2143,7 @@ where redirect_results: bool, answer_id: AnswerId, finish_received: Rc>, + pipeline_sender: Option, } impl ResultsInner @@ -2195,6 +2198,7 @@ where redirect_results: bool, fulfiller: oneshot::Sender>, finish_received: Rc>, + pipeline_sender: Option, ) -> Self { Self { inner: Some(ResultsInner { @@ -2203,6 +2207,7 @@ where redirect_results, answer_id, finish_received, + pipeline_sender, }), results_done_fulfiller: Some(fulfiller), } @@ -2250,6 +2255,29 @@ impl ResultsHook for Results { } } + fn set_pipeline(&mut self) -> ::capnp::Result<()> { + use ::capnp::traits::ImbueMut; + let root = self.get()?; + let size = root.target_size()?; + let mut message2 = capnp::message::Builder::new( + capnp::message::HeapAllocator::new().first_segment_words(size.word_count as u32 + 1), + ); + let mut root2: capnp::any_pointer::Builder = message2.init_root(); + let mut cap_table2 = vec![]; + root2.imbue_mut(&mut cap_table2); + root2.set_as(root.into_reader())?; + let hook = + Box::new(local::ResultsDone::new(message2, cap_table2)) as Box; + let Some(ref mut inner) = self.inner else { + unreachable!(); + }; + let Some(sender) = inner.pipeline_sender.take() else { + return Err(Error::failed("set_pipeline() called twice".into())); + }; + sender.complete(Box::new(local::Pipeline::new(hook))); + Ok(()) + } + fn tail_call(self: Box, _request: Box) -> Promise<(), Error> { unimplemented!() } diff --git a/.cargo-vendor/capnp/.cargo-checksum.json b/.cargo-vendor/capnp/.cargo-checksum.json index 2c46e107d4..9aca15a988 100644 --- a/.cargo-vendor/capnp/.cargo-checksum.json +++ b/.cargo-vendor/capnp/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"4af0c7ff9d6a88025823f074150ccda4dff86c9fe74af4cf155b44fa4c5379c3","Cargo.toml":"8b03412c32676b5600c35b1a93cd34fd6a48ed926ae0f4dcb9ca8949b7a7cdc3","LICENSE":"4c2dafff9370c57598f847969a8240b901226315bac3aff066955ce922361bbf","README.md":"e7209f3cbedcc10c248c58548ebe84e5c59233f8c2c89a77704b7c215b5f0e9d","c++.capnp":"52ead0eaa560b21e692d6f3d9966a52dfc99e19f53ae2d7c7bd2944a240d86de","schema.capnp":"3cd91a6ee4f22684cf378d295b4d7616d321446bf2fd6bd87c84aac1b8ebc677","src/any_pointer.rs":"be7b5dafb7ad1c5a9a343af7b553bbaf05b936da723370981ba14842b5e36bdc","src/any_pointer_list.rs":"70daf3cfea11c313bbb46ad449adfd26bda5999f7b90688c040476ad25570f28","src/capability.rs":"42cc62697c48a78039035fb4042846e2872f1b173c3bdd82c00f96c5fe2a8869","src/capability_list.rs":"338646a7e89b094dbc7aa9cae2f52a3493e8a1957c2c195a0d383f82737096d8","src/constant.rs":"4c875492ffce55600dc0c629c8068be782cfefd0792945525f9f0f92a0583bd0","src/data.rs":"134359b11a600dec0905660e498f9f835af06d12dda373164119a22ff1a35119","src/data_list.rs":"df287906a3b8ae5cd44a898d49bd539f6db006f39b83a21d4d622efe340dff3a","src/dynamic_list.rs":"fcfb819d0cd5abdd5839b148b9b0c4de56ddfdb38d56080947b7bbf983e6a7fe","src/dynamic_struct.rs":"b6eca759df61b47c7bf6b9ceed31b69debeb4b0df6ea3f59f1e10ee7893bdb5d","src/dynamic_value.rs":"570312d906d69ed85f1ab0904e68fd130339c80f5b5e6b2091d362bbc5eca3a2","src/enum_list.rs":"993daf0340323a9ebec5029f18f319062e2477b29b16f5e71ba638a64d57f882","src/introspect.rs":"06ace54cea63ac9563a5746c667b1033fb93cf2f39f389520f8d0bf8d4449107","src/io.rs":"34b39ff014308e8abb5651eee29968ec8414ac559df39f71cbb07444ccdb4a5d","src/lib.rs":"ae336e69a8f4cae497874b9b5459c19cb2f053899da6d4679fd5cb04df5e0263","src/list_list.rs":"03d5efee1f34bbe35b79ca71d2f50518a19b71d3fccaf5a5a591642f1da2899f","src/message.rs":"074c97136b69a404d86423827e594bd9c88e1cc56934fbe3b6ceab7044c70a4a","src/primitive_list.rs":"8c8a5e77048cbd909f00e981f060929a58004a717e05ca5a15a6b64cb0fe233e","src/private/arena.rs":"9bfc2e4275a459e15cc152292ab613e2bd3288cb0cfa29e91ed1ad8101d31b14","src/private/capability.rs":"074f00060841d2a7ac8c943dfc126ba6072a19d0e2abf4b4324bd639bd04679e","src/private/layout.rs":"fe9831bc5d24b8243899a7d17e08a994c2204bd84e981df2f3ac1ec5673433bb","src/private/layout_test.rs":"93129424451695e50b1f1498ded8434094dbc90f4923da979c9229cd15f5b2af","src/private/mask.rs":"bb942ff4ad0b67406ec6283eb174b2e13b8435462bf8a027aaf3412276a794d0","src/private/mod.rs":"7b3acd2c80e204f576509a3a7bdad60df234fa9d9412d869762494132b965fd3","src/private/primitive.rs":"bc7c1d93d4dbff3cdc06e3a890565238aa61668ed559c348d8f905e405bcea08","src/private/read_limiter.rs":"3413e2549f46d756f22a464c0596aacf252da1d049f7eca616393e5bf0c1e04e","src/private/units.rs":"2724987138950538050f8e14d000f5c3d8372ef975e1e6c2d33f745d126ecdcb","src/private/zero.rs":"6d6fa39e7aacef6b97e961e650870a1df17e6bb166147b8c9bdf3a129e104bad","src/raw.rs":"3c70a0a111c51939a9dfaff0e0bf454d3d482e923457e9ff222a95823e1cd1e2","src/schema.rs":"bef95ee57f6b0a0fe6d1f6ce2129bad7bf3c6a93070b97271cd80e248164b2a3","src/schema_capnp.rs":"14f6f80b82c8d91c764b33d3b684d3c3acc089a02a888ac8510765d29a7239b0","src/serialize.rs":"651b401b49bb552c656a5e837127a7ffb2781bdec4116419c76440d0589ef4ac","src/serialize/no_alloc_buffer_segments.rs":"be2f1299b45ea10a96258f30ddb8f53cd449cf093c1c7ebe01a86d521f9e8691","src/serialize_packed.rs":"b21d8935124c49d9d2b22208df65acb9f34ebd3d8274eaa5b12e1bada3d46f4e","src/stringify.rs":"607889bfb9853da70b11c4860dcf2e13b3013c1241ed2ab8ffda36e4a5a473da","src/struct_list.rs":"2596ea931ef560538df31202a4ffdb43581dad4f5b32a5b9944d57d783c9b2e8","src/text.rs":"6ce264d57d38f53901b088ef21bd7f83187f4fc2ae944b0c30f61921336cd450","src/text_list.rs":"3045980b966041a0a8c2e9088be84b9d43dc8fe1acb4a57a3bf708b144aa395a","src/traits.rs":"af8f5abdba056e609ebfa00b64b7fcae8e449634018181d6c91a6b70eb09d2d5","tests/README.md":"9797633f3f3a835cd88f73ec6c5f3c15c43e55f9a83f1cbd22dcf62418e12c27","tests/canonicalize.rs":"9558049df7c8bc35747292b9ee92976821068adb898d331f41c0ad8c0a6ee98d","tests/primitive_list_as_slice.rs":"7f080266d6bbb0623540887bd1f855d4dc2bc727fbe646d8ba1694075bcee512","tests/primitive_list_as_slice_unaligned.rs":"ef745ac7eecdcdc46a0cdbcc533ffa97ff47b88cecf954e92f6684564947e750","tests/scratch_space_heap_allocator.rs":"2ea0b7972c3a2a0c6ad91eaaf0db2b7bfce7916d56f66c8b47c8679d9fd891c9","tests/serialize_read_message_no_alloc.rs":"f7c0adb6b65b2cb91960776198ec1e820f4ef056e573d9b0300fd8101a9ceecd","tests/single_segment_allocator.rs":"893ab03664455dc037f9e420e7bc8b41f2c7835afca608d9a94fcd4747619262","tests/text_comparisons.rs":"227b4d240bfb720353f62c9c717b33acb58c26d0a001a6c0a7425c45b44793cb","tests/total_size.rs":"7a9cd9ac6ae6d948bc01f7f8f552d651f59c5ac1f8cead6a6c941e9029e603d4"},"package":"de71387912cac7dd3cb7c219e09628411620a18061bba58c71453c26ae7bf66a"} \ No newline at end of file +{"files":{"CHANGELOG.md":"11fd4fbbef8cee35ef79440bc2abafa3e97c315f6a5fa77f4efa2bb8d80bb9fc","Cargo.toml":"9ca72a7956df0d91fd96211e1feb8106371de0d86be021803437c20a121361e2","LICENSE":"4c2dafff9370c57598f847969a8240b901226315bac3aff066955ce922361bbf","README.md":"e7209f3cbedcc10c248c58548ebe84e5c59233f8c2c89a77704b7c215b5f0e9d","c++.capnp":"52ead0eaa560b21e692d6f3d9966a52dfc99e19f53ae2d7c7bd2944a240d86de","schema.capnp":"3cd91a6ee4f22684cf378d295b4d7616d321446bf2fd6bd87c84aac1b8ebc677","src/any_pointer.rs":"be7b5dafb7ad1c5a9a343af7b553bbaf05b936da723370981ba14842b5e36bdc","src/any_pointer_list.rs":"70daf3cfea11c313bbb46ad449adfd26bda5999f7b90688c040476ad25570f28","src/capability.rs":"35215668a0d406c056a18f76a82b1da5bb1192a49d86a3ce2f3c8a0c876497c4","src/capability_list.rs":"338646a7e89b094dbc7aa9cae2f52a3493e8a1957c2c195a0d383f82737096d8","src/constant.rs":"4c875492ffce55600dc0c629c8068be782cfefd0792945525f9f0f92a0583bd0","src/data.rs":"134359b11a600dec0905660e498f9f835af06d12dda373164119a22ff1a35119","src/data_list.rs":"df287906a3b8ae5cd44a898d49bd539f6db006f39b83a21d4d622efe340dff3a","src/dynamic_list.rs":"fcfb819d0cd5abdd5839b148b9b0c4de56ddfdb38d56080947b7bbf983e6a7fe","src/dynamic_struct.rs":"b6eca759df61b47c7bf6b9ceed31b69debeb4b0df6ea3f59f1e10ee7893bdb5d","src/dynamic_value.rs":"570312d906d69ed85f1ab0904e68fd130339c80f5b5e6b2091d362bbc5eca3a2","src/enum_list.rs":"993daf0340323a9ebec5029f18f319062e2477b29b16f5e71ba638a64d57f882","src/introspect.rs":"06ace54cea63ac9563a5746c667b1033fb93cf2f39f389520f8d0bf8d4449107","src/io.rs":"34b39ff014308e8abb5651eee29968ec8414ac559df39f71cbb07444ccdb4a5d","src/lib.rs":"dd60b3f8ee4f9453c0cda75a069d40c1e4519e297ba1b2a794929d5ed41858af","src/list_list.rs":"03d5efee1f34bbe35b79ca71d2f50518a19b71d3fccaf5a5a591642f1da2899f","src/message.rs":"074c97136b69a404d86423827e594bd9c88e1cc56934fbe3b6ceab7044c70a4a","src/primitive_list.rs":"8c8a5e77048cbd909f00e981f060929a58004a717e05ca5a15a6b64cb0fe233e","src/private/arena.rs":"9bfc2e4275a459e15cc152292ab613e2bd3288cb0cfa29e91ed1ad8101d31b14","src/private/capability.rs":"1c97a5f546d0edf2ba5d69ed67a2686ce3665d24e0bc6e1dccc27e583c76e0e8","src/private/layout.rs":"fe9831bc5d24b8243899a7d17e08a994c2204bd84e981df2f3ac1ec5673433bb","src/private/layout_test.rs":"93129424451695e50b1f1498ded8434094dbc90f4923da979c9229cd15f5b2af","src/private/mask.rs":"bb942ff4ad0b67406ec6283eb174b2e13b8435462bf8a027aaf3412276a794d0","src/private/mod.rs":"7b3acd2c80e204f576509a3a7bdad60df234fa9d9412d869762494132b965fd3","src/private/primitive.rs":"bc7c1d93d4dbff3cdc06e3a890565238aa61668ed559c348d8f905e405bcea08","src/private/read_limiter.rs":"3413e2549f46d756f22a464c0596aacf252da1d049f7eca616393e5bf0c1e04e","src/private/units.rs":"2724987138950538050f8e14d000f5c3d8372ef975e1e6c2d33f745d126ecdcb","src/private/zero.rs":"6d6fa39e7aacef6b97e961e650870a1df17e6bb166147b8c9bdf3a129e104bad","src/raw.rs":"3c70a0a111c51939a9dfaff0e0bf454d3d482e923457e9ff222a95823e1cd1e2","src/schema.rs":"bef95ee57f6b0a0fe6d1f6ce2129bad7bf3c6a93070b97271cd80e248164b2a3","src/schema_capnp.rs":"14f6f80b82c8d91c764b33d3b684d3c3acc089a02a888ac8510765d29a7239b0","src/serialize.rs":"df7561f0859678661690f1ef3ee6691d05bb954dc800ed5d31220b3c13c3f3a7","src/serialize/no_alloc_buffer_segments.rs":"be2f1299b45ea10a96258f30ddb8f53cd449cf093c1c7ebe01a86d521f9e8691","src/serialize_packed.rs":"b21d8935124c49d9d2b22208df65acb9f34ebd3d8274eaa5b12e1bada3d46f4e","src/stringify.rs":"607889bfb9853da70b11c4860dcf2e13b3013c1241ed2ab8ffda36e4a5a473da","src/struct_list.rs":"2596ea931ef560538df31202a4ffdb43581dad4f5b32a5b9944d57d783c9b2e8","src/text.rs":"6ce264d57d38f53901b088ef21bd7f83187f4fc2ae944b0c30f61921336cd450","src/text_list.rs":"3045980b966041a0a8c2e9088be84b9d43dc8fe1acb4a57a3bf708b144aa395a","src/traits.rs":"af8f5abdba056e609ebfa00b64b7fcae8e449634018181d6c91a6b70eb09d2d5","tests/README.md":"9797633f3f3a835cd88f73ec6c5f3c15c43e55f9a83f1cbd22dcf62418e12c27","tests/canonicalize.rs":"9558049df7c8bc35747292b9ee92976821068adb898d331f41c0ad8c0a6ee98d","tests/primitive_list_as_slice.rs":"7f080266d6bbb0623540887bd1f855d4dc2bc727fbe646d8ba1694075bcee512","tests/primitive_list_as_slice_unaligned.rs":"ef745ac7eecdcdc46a0cdbcc533ffa97ff47b88cecf954e92f6684564947e750","tests/scratch_space_heap_allocator.rs":"2ea0b7972c3a2a0c6ad91eaaf0db2b7bfce7916d56f66c8b47c8679d9fd891c9","tests/serialize_read_message_no_alloc.rs":"f7c0adb6b65b2cb91960776198ec1e820f4ef056e573d9b0300fd8101a9ceecd","tests/single_segment_allocator.rs":"893ab03664455dc037f9e420e7bc8b41f2c7835afca608d9a94fcd4747619262","tests/text_comparisons.rs":"227b4d240bfb720353f62c9c717b33acb58c26d0a001a6c0a7425c45b44793cb","tests/total_size.rs":"7a9cd9ac6ae6d948bc01f7f8f552d651f59c5ac1f8cead6a6c941e9029e603d4"},"package":"ff5e468996c73ea6d3d2bffc2b738782487f878286615b7f76e11af15a9ada3f"} \ No newline at end of file diff --git a/.cargo-vendor/capnp/CHANGELOG.md b/.cargo-vendor/capnp/CHANGELOG.md index 1bffb3005b..ba82d594f8 100644 --- a/.cargo-vendor/capnp/CHANGELOG.md +++ b/.cargo-vendor/capnp/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.19.7 +- Add `Results::set_pipeline()` and `ResultsHook::set_pipeline()`. + ## v0.19.6 - Fix ExactSizeIterator implementations so that they return the number of remaining elements instead of the total length of the underlying list. diff --git a/.cargo-vendor/capnp/Cargo.toml b/.cargo-vendor/capnp/Cargo.toml index 56268db872..24335095b9 100644 --- a/.cargo-vendor/capnp/Cargo.toml +++ b/.cargo-vendor/capnp/Cargo.toml @@ -13,8 +13,13 @@ edition = "2021" rust-version = "1.65.0" name = "capnp" -version = "0.19.6" +version = "0.19.7" authors = ["David Renshaw "] +build = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "runtime library for Cap'n Proto data encoding" documentation = "https://docs.rs/capnp/" readme = "README.md" @@ -26,6 +31,42 @@ keywords = [ license = "MIT" repository = "https://github.com/capnproto/capnproto-rust" +[lib] +name = "capnp" +path = "src/lib.rs" + +[[test]] +name = "canonicalize" +path = "tests/canonicalize.rs" + +[[test]] +name = "primitive_list_as_slice" +path = "tests/primitive_list_as_slice.rs" + +[[test]] +name = "primitive_list_as_slice_unaligned" +path = "tests/primitive_list_as_slice_unaligned.rs" + +[[test]] +name = "scratch_space_heap_allocator" +path = "tests/scratch_space_heap_allocator.rs" + +[[test]] +name = "serialize_read_message_no_alloc" +path = "tests/serialize_read_message_no_alloc.rs" + +[[test]] +name = "single_segment_allocator" +path = "tests/single_segment_allocator.rs" + +[[test]] +name = "text_comparisons" +path = "tests/text_comparisons.rs" + +[[test]] +name = "total_size" +path = "tests/total_size.rs" + [dependencies.embedded-io] version = "0.6.1" optional = true diff --git a/.cargo-vendor/capnp/src/capability.rs b/.cargo-vendor/capnp/src/capability.rs index 0a4b726f12..d87dc248b3 100644 --- a/.cargo-vendor/capnp/src/capability.rs +++ b/.cargo-vendor/capnp/src/capability.rs @@ -19,7 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -//! Hooks for for the RPC system. +//! Hooks for the RPC system. //! //! Roughly corresponds to capability.h in the C++ implementation. @@ -263,6 +263,13 @@ where pub fn set(&mut self, other: T::Reader<'_>) -> crate::Result<()> { self.hook.get().unwrap().set_as(other) } + + /// Call this method to signal that all of the capabilities have been filled in for this + /// `Results` and that pipelined calls should be allowed to start using those capabilities. + /// (Usually pipelined calls are enqueued until the initial call completes.) + pub fn set_pipeline(&mut self) -> crate::Result<()> { + self.hook.set_pipeline() + } } pub trait FromTypelessPipeline { diff --git a/.cargo-vendor/capnp/src/lib.rs b/.cargo-vendor/capnp/src/lib.rs index b979cf6848..3bb7703b7a 100644 --- a/.cargo-vendor/capnp/src/lib.rs +++ b/.cargo-vendor/capnp/src/lib.rs @@ -189,7 +189,7 @@ pub enum ErrorKind { /// may simply exacerbate the problem. Overloaded, - /// The call required communication over a connection that has been lost. The callee will need + /// The call required communication over a connection that has been lost. The caller will need /// to re-establish connections and try again. Disconnected, diff --git a/.cargo-vendor/capnp/src/private/capability.rs b/.cargo-vendor/capnp/src/private/capability.rs index f5f393e7ea..996f5678f2 100644 --- a/.cargo-vendor/capnp/src/private/capability.rs +++ b/.cargo-vendor/capnp/src/private/capability.rs @@ -92,6 +92,12 @@ impl Clone for alloc::boxed::Box { pub trait ResultsHook { fn get(&mut self) -> crate::Result>; + + // TODO(version bump): remove this default impl. + fn set_pipeline(&mut self) -> crate::Result<()> { + unimplemented!() + } + fn allow_cancellation(&self); fn tail_call( self: alloc::boxed::Box, diff --git a/.cargo-vendor/capnp/src/serialize.rs b/.cargo-vendor/capnp/src/serialize.rs index 61258db861..6322897f56 100644 --- a/.cargo-vendor/capnp/src/serialize.rs +++ b/.cargo-vendor/capnp/src/serialize.rs @@ -80,7 +80,7 @@ pub fn read_message_from_flat_slice<'a>( /// The slice is allowed to extend beyond the end of the message. On success, updates `slice` to point /// to the remaining bytes beyond the end of the message. /// -/// Unlike read_message_from_flat_slice_no_alloc it does not do heap allocation +/// Unlike [read_message_from_flat_slice], it does not do heap allocation. /// /// ALIGNMENT: If the "unaligned" feature is enabled, then there are no alignment requirements on `slice`. /// Otherwise, `slice` must be 8-byte aligned (attempts to read the message will trigger errors). @@ -1012,7 +1012,7 @@ pub mod test { #[test] fn read_message_from_flat_slice_with_remainder() { - let segments = vec![ + let segments = [ vec![123, 0, 0, 0, 0, 0, 0, 0], vec![4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0], ]; @@ -1044,7 +1044,7 @@ pub mod test { #[test] fn read_message_from_flat_slice_too_short() { - let segments = vec![ + let segments = [ vec![1, 0, 0, 0, 0, 0, 0, 0], vec![2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0], ]; diff --git a/.cargo-vendor/getset/.cargo-checksum.json b/.cargo-vendor/getset/.cargo-checksum.json index bad76e99ed..487d65f9dc 100644 --- a/.cargo-vendor/getset/.cargo-checksum.json +++ b/.cargo-vendor/getset/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"dd13ec808744fc9779779893ccb9c6fc6729854f92e5526929e3e36edb12c68e","Cargo.toml":"f5b72f5bcdf4e42992b713399ef3c9a98a53d68327850cb0d3a213acb4d668f3","LICENSE":"002c2696d92b5c8cf956c11072baa58eaf9f6ade995c031ea635c6a1ee342ad1","README.md":"5bf6b35c76402b58a6012076236aeb243a892b14a2f697e1aa3010eadef5f46a","examples/simple.rs":"274f17da11ba85b4b7d86387544469ca449b040252a5198282cc4836e8870ffb","src/generate.rs":"eb0c776cddedc7059f8274b80a79e342327634a25fae2a056a5a4ee0d3f62d56","src/lib.rs":"8f0f8567d0b06274de55a80eb499a25f200c9efb21a996e05d6ce9973b002fb6","tests/copy_getters.rs":"4c892b3383edece8e5c91162af8afeddb27899341b862e10e26a86c045e5283c","tests/getset.rs":"173221e13e58c51f7ce3f29fa77b68a61c910e92f7a15ce7d4a7880f5d872485","tests/getters.rs":"23d3d60341aa3019e98cc80175588fa9d97255c1563f000a4f3bd64d9140edab","tests/mut_getters.rs":"fc79c52059be4d680db0a7b69defa6431f5b22e8010ae244d858cc6efc2242f0","tests/raw_identifiers.rs":"87d9adb03ed0a975507bf338552a4b6fd2da10d96f99106da071d8079571151f","tests/setters.rs":"2d531df45c36b2aaa83c51cae0f9957e3d5334a3948817b936c67dc8b763ccb1","tests/skip.rs":"cbffad70e5b9a34bad8bcf2c87d21f8d8d2023b9cf91f87b14c59b3b1f6c7607"},"package":"e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9"} \ No newline at end of file +{"files":{"Cargo.lock":"da4b5271452b125b5622ebdfdab9ecee5db49244839f3464e96e00f7d580401c","Cargo.toml":"d95e814e5dfbefd211a8e5d21031399a817baea40d1d89d834c86373d079527d","LICENSE":"002c2696d92b5c8cf956c11072baa58eaf9f6ade995c031ea635c6a1ee342ad1","README.md":"5bf6b35c76402b58a6012076236aeb243a892b14a2f697e1aa3010eadef5f46a","examples/simple.rs":"274f17da11ba85b4b7d86387544469ca449b040252a5198282cc4836e8870ffb","src/generate.rs":"f8ed16c71bf01026e55484431426ace385b70f93750d0ef415cb7a9c3bc01145","src/lib.rs":"753748643124cd3af160c750be3b7a9df2121d0092bd9aafb8ebfc29d16f5185","tests/copy_getters.rs":"4c892b3383edece8e5c91162af8afeddb27899341b862e10e26a86c045e5283c","tests/getset.rs":"173221e13e58c51f7ce3f29fa77b68a61c910e92f7a15ce7d4a7880f5d872485","tests/getters.rs":"23d3d60341aa3019e98cc80175588fa9d97255c1563f000a4f3bd64d9140edab","tests/mut_getters.rs":"fc79c52059be4d680db0a7b69defa6431f5b22e8010ae244d858cc6efc2242f0","tests/raw_identifiers.rs":"87d9adb03ed0a975507bf338552a4b6fd2da10d96f99106da071d8079571151f","tests/setters.rs":"2d531df45c36b2aaa83c51cae0f9957e3d5334a3948817b936c67dc8b763ccb1","tests/skip.rs":"cbffad70e5b9a34bad8bcf2c87d21f8d8d2023b9cf91f87b14c59b3b1f6c7607"},"package":"f636605b743120a8d32ed92fc27b6cde1a769f8f936c065151eb66f88ded513c"} \ No newline at end of file diff --git a/.cargo-vendor/getset/Cargo.lock b/.cargo-vendor/getset/Cargo.lock index c004139a39..278cb506d9 100644 --- a/.cargo-vendor/getset/Cargo.lock +++ b/.cargo-vendor/getset/Cargo.lock @@ -4,75 +4,67 @@ version = 3 [[package]] name = "getset" -version = "0.1.2" +version = "0.1.3" dependencies = [ - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn", ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.10" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "syn" -version = "1.0.82" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - -[[package]] -name = "version_check" -version = "0.9.3" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/.cargo-vendor/getset/Cargo.toml b/.cargo-vendor/getset/Cargo.toml index 13ef290c21..df6c9277dc 100644 --- a/.cargo-vendor/getset/Cargo.toml +++ b/.cargo-vendor/getset/Cargo.toml @@ -3,29 +3,42 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "getset" -version = "0.1.2" -authors = ["Ana Hobden "] -description = "Getset, we're ready to go!\n\nA procedural macro for generating the most basic getters and setters on fields.\n" +version = "0.1.3" +authors = [ + "Ana Hobden ", + "John Baublitz , meta_name: &str) -> Option { - match attr { - // `#[get = "pub"]` or `#[set = "pub"]` - Some(Meta::NameValue(MetaNameValue { - lit: Lit::Str(ref s), - path, - .. - })) => { - if path.is_ident(meta_name) { - s.value().split(' ').find(|v| *v != "with_prefix").map(|v| { - syn::parse_str(v) - .map_err(|e| syn::Error::new(s.span(), e)) - .expect_or_abort("invalid visibility found") - }) - } else { - None - } +// Helper function to extract string from Expr +fn expr_to_string(expr: &Expr) -> Option { + if let Expr::Lit(expr_lit) = expr { + if let Lit::Str(s) = &expr_lit.lit { + Some(s.value()) + } else { + None } - _ => None, + } else { + None + } +} + +// Helper function to parse visibility +fn parse_vis_str(s: &str, span: proc_macro2::Span) -> Visibility { + match syn::parse_str(s) { + Ok(vis) => vis, + Err(e) => abort!(span, "Invalid visibility found: {}", e), + } +} + +// Helper function to parse visibility attribute +pub fn parse_visibility(attr: Option<&Meta>, meta_name: &str) -> Option { + let meta = attr?; + let Meta::NameValue(MetaNameValue { value, path, .. }) = meta else { + return None; + }; + + if !path.is_ident(meta_name) { + return None; } + + let value_str = expr_to_string(value)?; + let vis_str = value_str.split(' ').find(|v| *v != "with_prefix")?; + + Some(parse_vis_str(vis_str, value.span())) } -/// Some users want legacy/compatability. +/// Some users want legacy/compatibility. /// (Getters are often prefixed with `get_`) fn has_prefix_attr(f: &Field, params: &GenParams) -> bool { - let inner = f - .attrs - .iter() - .filter_map(|v| parse_attr(v, params.mode)) - .filter(|meta| { - ["get", "get_copy"] - .iter() - .any(|ident| meta.path().is_ident(ident)) - }) - .last(); - - // Check it the attr includes `with_prefix` - let wants_prefix = |possible_meta: &Option| -> bool { - match possible_meta { - Some(Meta::NameValue(meta)) => { - if let Lit::Str(lit_str) = &meta.lit { - // Naive tokenization to avoid a possible visibility mod named `with_prefix`. - lit_str.value().split(' ').any(|v| v == "with_prefix") - } else { - false - } + // helper function to check if meta has `with_prefix` attribute + let meta_has_prefix = |meta: &Meta| -> bool { + if let Meta::NameValue(name_value) = meta { + if let Some(s) = expr_to_string(&name_value.value) { + return s.split(" ").any(|v| v == "with_prefix"); } - _ => false, } + false }; - // `with_prefix` can either be on the local or global attr - wants_prefix(&inner) || wants_prefix(¶ms.global_attr) + let field_attr_has_prefix = f + .attrs + .iter() + .filter_map(|attr| parse_attr(attr, params.mode)) + .find(|meta| meta.path().is_ident("get") || meta.path().is_ident("get_copy")) + .as_ref() + .map_or(false, meta_has_prefix); + + let global_attr_has_prefix = params.global_attr.as_ref().map_or(false, meta_has_prefix); + + field_attr_has_prefix || global_attr_has_prefix } pub fn implement(field: &Field, params: &GenParams) -> TokenStream2 { let field_name = field - .clone() .ident + .clone() .unwrap_or_else(|| abort!(field.span(), "Expected the field to have a name")); let fn_name = if !has_prefix_attr(field, params) @@ -136,11 +146,7 @@ pub fn implement(field: &Field, params: &GenParams) -> TokenStream2 { }; let ty = field.ty.clone(); - let doc = field.attrs.iter().filter(|v| { - v.parse_meta() - .map(|meta| meta.path().is_ident("doc")) - .unwrap_or(false) - }); + let doc = field.attrs.iter().filter(|v| v.meta.path().is_ident("doc")); let attr = field .attrs @@ -151,7 +157,7 @@ pub fn implement(field: &Field, params: &GenParams) -> TokenStream2 { let visibility = parse_visibility(attr.as_ref(), params.mode.name()); match attr { - // Generate nothing for skipped field. + // Generate nothing for skipped field Some(meta) if meta.path().is_ident("skip") => quote! {}, Some(_) => match params.mode { GenMode::Get => { @@ -192,7 +198,6 @@ pub fn implement(field: &Field, params: &GenParams) -> TokenStream2 { } } }, - // Don't need to do anything. None => quote! {}, } } diff --git a/.cargo-vendor/getset/src/lib.rs b/.cargo-vendor/getset/src/lib.rs index faf8c08612..d09086859f 100644 --- a/.cargo-vendor/getset/src/lib.rs +++ b/.cargo-vendor/getset/src/lib.rs @@ -175,101 +175,81 @@ impl Foo { ``` */ -extern crate proc_macro; -extern crate syn; #[macro_use] extern crate quote; -extern crate proc_macro2; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; -use proc_macro_error::{abort, abort_call_site, proc_macro_error, ResultExt}; -use syn::{spanned::Spanned, DataStruct, DeriveInput, Meta}; +use proc_macro_error2::{abort, abort_call_site, proc_macro_error}; +use syn::{parse_macro_input, spanned::Spanned, DataStruct, DeriveInput, Meta}; -mod generate; use crate::generate::{GenMode, GenParams}; +mod generate; + #[proc_macro_derive(Getters, attributes(get, with_prefix, getset))] #[proc_macro_error] pub fn getters(input: TokenStream) -> TokenStream { - // Parse the string representation - let ast: DeriveInput = syn::parse(input).expect_or_abort("Couldn't parse for getters"); + let ast = parse_macro_input!(input as DeriveInput); let params = GenParams { mode: GenMode::Get, global_attr: parse_global_attr(&ast.attrs, GenMode::Get), }; - // Build the impl - let gen = produce(&ast, ¶ms); - - // Return the generated impl - gen.into() + produce(&ast, ¶ms).into() } #[proc_macro_derive(CopyGetters, attributes(get_copy, with_prefix, getset))] #[proc_macro_error] pub fn copy_getters(input: TokenStream) -> TokenStream { - // Parse the string representation - let ast: DeriveInput = syn::parse(input).expect_or_abort("Couldn't parse for getters"); + let ast = parse_macro_input!(input as DeriveInput); let params = GenParams { mode: GenMode::GetCopy, global_attr: parse_global_attr(&ast.attrs, GenMode::GetCopy), }; - // Build the impl - let gen = produce(&ast, ¶ms); - - // Return the generated impl - gen.into() + produce(&ast, ¶ms).into() } #[proc_macro_derive(MutGetters, attributes(get_mut, getset))] #[proc_macro_error] pub fn mut_getters(input: TokenStream) -> TokenStream { - // Parse the string representation - let ast: DeriveInput = syn::parse(input).expect_or_abort("Couldn't parse for getters"); + let ast = parse_macro_input!(input as DeriveInput); let params = GenParams { mode: GenMode::GetMut, global_attr: parse_global_attr(&ast.attrs, GenMode::GetMut), }; - // Build the impl - let gen = produce(&ast, ¶ms); - // Return the generated impl - gen.into() + produce(&ast, ¶ms).into() } #[proc_macro_derive(Setters, attributes(set, getset))] #[proc_macro_error] pub fn setters(input: TokenStream) -> TokenStream { - // Parse the string representation - let ast: DeriveInput = syn::parse(input).expect_or_abort("Couldn't parse for setters"); + let ast = parse_macro_input!(input as DeriveInput); let params = GenParams { mode: GenMode::Set, global_attr: parse_global_attr(&ast.attrs, GenMode::Set), }; - // Build the impl - let gen = produce(&ast, ¶ms); - - // Return the generated impl - gen.into() + produce(&ast, ¶ms).into() } fn parse_global_attr(attrs: &[syn::Attribute], mode: GenMode) -> Option { - attrs - .iter() - .filter_map(|v| parse_attr(v, mode)) // non "meta" attributes are not our concern - .last() + attrs.iter().filter_map(|v| parse_attr(v, mode)).last() } -fn parse_attr(attr: &syn::Attribute, mode: GenMode) -> Option { +fn parse_attr(attr: &syn::Attribute, mode: GenMode) -> Option { use syn::{punctuated::Punctuated, Token}; - if attr.path.is_ident("getset") { - let (last, skip, mut collected) = attr - .parse_args_with(Punctuated::::parse_terminated) - .unwrap_or_abort() + if attr.path().is_ident("getset") { + let meta_list = + match attr.parse_args_with(Punctuated::::parse_terminated) { + Ok(list) => list, + Err(e) => abort!(attr.span(), "Failed to parse getset attribute: {}", e), + }; + + let (last, skip, mut collected) = meta_list .into_iter() .inspect(|meta| { if !(meta.path().is_ident("get") @@ -289,8 +269,6 @@ fn parse_attr(attr: &syn::Attribute, mode: GenMode) -> Option { } else if meta.path().is_ident("skip") { (last, Some(meta), collected) } else { - // Store inapplicable item for potential error message - // if used with skip. collected.push(meta); (last, skip, collected) } @@ -309,14 +287,14 @@ fn parse_attr(attr: &syn::Attribute, mode: GenMode) -> Option { ); } } else { - // If skip is not used, return the last occurrence of matching - // setter/getter, if there is any. last } + } else if attr.path().is_ident(mode.name()) { + // If skip is not used, return the last occurrence of matching + // setter/getter, if there is any. + attr.meta.clone().into() } else { - attr.parse_meta() - .ok() - .filter(|meta| meta.path().is_ident(mode.name())) + None } } diff --git a/.cargo-vendor/proc-macro-error-attr/.cargo-checksum.json b/.cargo-vendor/proc-macro-error-attr/.cargo-checksum.json deleted file mode 100644 index c30b5418a8..0000000000 --- a/.cargo-vendor/proc-macro-error-attr/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"fbd3ce928441a0b43859bbbe36549f05e7a1ebfee62e5982710671a8f41de527","LICENSE-APACHE":"6fd0f3522047150ca7c1939f02bc4a15662a4741a89bc03ae784eefa18caa299","LICENSE-MIT":"544b3aed1fd723d0cadea567affdcfe0431e43e18d997a718f9d67256b814fde","build.rs":"37b0aca3c4a14dfc050c2df38ae633311d7a1532cdbb8eb57182802c4a1983eb","src/lib.rs":"9e3d13c266376b688642572bb4091e094ff5277fce4bee72bcc3c5f982dd831c","src/parse.rs":"2d8f220f91235be8ed0ddcab55ec3699b9d3b28d538ed24197797cc20194c473","src/settings.rs":"be9382479d7a857b55e5a0b1014f72150c9ee7f2bbb5a5bdeabc0f8de2d95c26"},"package":"a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"} \ No newline at end of file diff --git a/.cargo-vendor/proc-macro-error-attr/Cargo.toml b/.cargo-vendor/proc-macro-error-attr/Cargo.toml deleted file mode 100644 index a2c766de9b..0000000000 --- a/.cargo-vendor/proc-macro-error-attr/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies -# -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) - -[package] -edition = "2018" -name = "proc-macro-error-attr" -version = "1.0.4" -authors = ["CreepySkeleton "] -build = "build.rs" -description = "Attribute macro for proc-macro-error crate" -license = "MIT OR Apache-2.0" -repository = "https://gitlab.com/CreepySkeleton/proc-macro-error" -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[lib] -proc-macro = true -[dependencies.proc-macro2] -version = "1" - -[dependencies.quote] -version = "1" -[build-dependencies.version_check] -version = "0.9" diff --git a/.cargo-vendor/proc-macro-error-attr/build.rs b/.cargo-vendor/proc-macro-error-attr/build.rs deleted file mode 100644 index f2ac6a70ee..0000000000 --- a/.cargo-vendor/proc-macro-error-attr/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - if version_check::is_max_version("1.36.0").unwrap_or(false) { - println!("cargo:rustc-cfg=always_assert_unwind"); - } -} diff --git a/.cargo-vendor/proc-macro-error-attr2/.cargo-checksum.json b/.cargo-vendor/proc-macro-error-attr2/.cargo-checksum.json new file mode 100644 index 0000000000..50fbba8fd4 --- /dev/null +++ b/.cargo-vendor/proc-macro-error-attr2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"8584e30fb2d9e38659e27d3b7b7e9e69c093b8f84de0bc1d7ff96735de8be22d","LICENSE-APACHE":"6fd0f3522047150ca7c1939f02bc4a15662a4741a89bc03ae784eefa18caa299","LICENSE-MIT":"544b3aed1fd723d0cadea567affdcfe0431e43e18d997a718f9d67256b814fde","src/lib.rs":"0a7709be2204e227cedb390121b7802f0d1dd533cd7f2745aee0656f4f788e0a","src/parse.rs":"ea729b99efa701153d3d5a248e1a6a82de7eb7a839e9e069c1f8fdc25d319c36","src/settings.rs":"1a7d1b941869712c78e1758abdc5df8720828265f318033d1820f57c2cf74094"},"package":"96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"} \ No newline at end of file diff --git a/.cargo-vendor/proc-macro-error-attr2/Cargo.toml b/.cargo-vendor/proc-macro-error-attr2/Cargo.toml new file mode 100644 index 0000000000..45223d0887 --- /dev/null +++ b/.cargo-vendor/proc-macro-error-attr2/Cargo.toml @@ -0,0 +1,44 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.61" +name = "proc-macro-error-attr2" +version = "2.0.0" +authors = [ + "CreepySkeleton ", + "GnomedDev ", +] +build = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Attribute macro for the proc-macro-error2 crate" +readme = false +license = "MIT OR Apache-2.0" +repository = "https://github.com/GnomedDev/proc-macro-error-2" + +[lib] +name = "proc_macro_error_attr2" +path = "src/lib.rs" +proc-macro = true + +[dependencies.proc-macro2] +version = "1" + +[dependencies.quote] +version = "1" + +[lints.clippy.pedantic] +level = "warn" +priority = -1 diff --git a/.cargo-vendor/proc-macro-error-attr/LICENSE-APACHE b/.cargo-vendor/proc-macro-error-attr2/LICENSE-APACHE similarity index 100% rename from .cargo-vendor/proc-macro-error-attr/LICENSE-APACHE rename to .cargo-vendor/proc-macro-error-attr2/LICENSE-APACHE diff --git a/.cargo-vendor/proc-macro-error-attr/LICENSE-MIT b/.cargo-vendor/proc-macro-error-attr2/LICENSE-MIT similarity index 100% rename from .cargo-vendor/proc-macro-error-attr/LICENSE-MIT rename to .cargo-vendor/proc-macro-error-attr2/LICENSE-MIT diff --git a/.cargo-vendor/proc-macro-error-attr/src/lib.rs b/.cargo-vendor/proc-macro-error-attr2/src/lib.rs similarity index 74% rename from .cargo-vendor/proc-macro-error-attr/src/lib.rs rename to .cargo-vendor/proc-macro-error-attr2/src/lib.rs index ac0ac21a26..0f2593141f 100644 --- a/.cargo-vendor/proc-macro-error-attr/src/lib.rs +++ b/.cargo-vendor/proc-macro-error-attr2/src/lib.rs @@ -1,7 +1,5 @@ //! This is `#[proc_macro_error]` attribute to be used with -//! [`proc-macro-error`](https://docs.rs/proc-macro-error/). There you go. - -extern crate proc_macro; +//! [`proc-macro-error`](https://docs.rs/proc-macro-error2/). There you go. use crate::parse::parse_input; use crate::parse::Attribute; @@ -9,7 +7,11 @@ use proc_macro::TokenStream; use proc_macro2::{Literal, Span, TokenStream as TokenStream2, TokenTree}; use quote::{quote, quote_spanned}; -use crate::settings::{Setting::*, *}; +use crate::settings::{ + parse_settings, + Setting::{AllowNotMacro, AssertUnwindSafe, ProcMacroHack}, + Settings, +}; mod parse; mod settings; @@ -73,7 +75,7 @@ fn impl_proc_macro_error(attr: TokenStream2, input: TokenStream2) -> Result Result proc_macro2::TokenStream { +fn gen_body(block: &TokenTree, settings: &Settings) -> proc_macro2::TokenStream { let is_proc_macro_hack = settings.is_set(ProcMacroHack); let closure = if settings.is_set(AssertUnwindSafe) { quote!(::std::panic::AssertUnwindSafe(|| #block )) @@ -92,18 +93,7 @@ fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream { quote!(|| #block) }; - quote!( ::proc_macro_error::entry_point(#closure, #is_proc_macro_hack) ) -} - -// FIXME: -// proc_macro::TokenStream does not implement UnwindSafe until 1.37.0. -// Considering this is the closure's return type the unwind safety check would fail -// for virtually every closure possible, the check is meaningless. -#[cfg(always_assert_unwind)] -fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream { - let is_proc_macro_hack = settings.is_set(ProcMacroHack); - let closure = quote!(::std::panic::AssertUnwindSafe(|| #block )); - quote!( ::proc_macro_error::entry_point(#closure, #is_proc_macro_hack) ) + quote!( ::proc_macro_error2::entry_point(#closure, #is_proc_macro_hack) ) } fn detect_proc_macro_hack(attrs: &[Attribute]) -> bool { diff --git a/.cargo-vendor/proc-macro-error-attr/src/parse.rs b/.cargo-vendor/proc-macro-error-attr2/src/parse.rs similarity index 97% rename from .cargo-vendor/proc-macro-error-attr/src/parse.rs rename to .cargo-vendor/proc-macro-error-attr2/src/parse.rs index 6f4663f80e..eedb495351 100644 --- a/.cargo-vendor/proc-macro-error-attr/src/parse.rs +++ b/.cargo-vendor/proc-macro-error-attr2/src/parse.rs @@ -39,7 +39,7 @@ fn parse_next_attr( res } other => { - let span = other.map_or(Span::call_site(), |tt| tt.span()); + let span = other.map_or(Span::call_site(), TokenTree::span); return Err(Error::new(span, "expected `[`".to_string())); } }; diff --git a/.cargo-vendor/proc-macro-error-attr/src/settings.rs b/.cargo-vendor/proc-macro-error-attr2/src/settings.rs similarity index 96% rename from .cargo-vendor/proc-macro-error-attr/src/settings.rs rename to .cargo-vendor/proc-macro-error-attr2/src/settings.rs index 0b7ec766f6..f87bd0b586 100644 --- a/.cargo-vendor/proc-macro-error-attr/src/settings.rs +++ b/.cargo-vendor/proc-macro-error-attr2/src/settings.rs @@ -3,7 +3,7 @@ use proc_macro2::{Ident, Span, TokenStream, TokenTree}; macro_rules! decl_settings { ($($val:expr => $variant:ident),+ $(,)*) => { - #[derive(PartialEq)] + #[derive(PartialEq, Clone, Copy)] pub(crate) enum Setting { $($variant),* } @@ -67,6 +67,6 @@ impl Settings { } pub(crate) fn set(&mut self, setting: Setting) { - self.0.push(setting) + self.0.push(setting); } } diff --git a/.cargo-vendor/proc-macro-error/.cargo-checksum.json b/.cargo-vendor/proc-macro-error/.cargo-checksum.json deleted file mode 100644 index 79bcfa696f..0000000000 --- a/.cargo-vendor/proc-macro-error/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"b84c4baa5fb093c6aaca44b98f9f28ef54d399ef6dd43c91f1dca618ab366b45","Cargo.toml":"50db093e1a4617606939dfb1f098cb59babbea0d7b390e973a3ed6bb1406170d","LICENSE-APACHE":"4665f973ccb9393807a7fb1264add6b3513d19abc6b357e4cb52c6fe59cc6a3b","LICENSE-MIT":"544b3aed1fd723d0cadea567affdcfe0431e43e18d997a718f9d67256b814fde","README.md":"72d59787d0a1f7bf161e292d0bc1bc25fdfb08cd6ad379a34cc3ed1b388d11fa","build.rs":"6238a0ad4f1146fbf55112419609e6449986154cf7ded1b5fdc978b06f4413b3","src/diagnostic.rs":"cb8724bb0bf9d2eee2f7119d0960fd5349edaa80e147abdef060ebf4572eca01","src/dummy.rs":"b44728091ddcdf9786523c01178efcedd83462bfe8bac6b97b1c2ffb19c96d09","src/imp/delegate.rs":"81da3a602a883240161dd98deb52b3b4ae29e626bfd2e1e07ef5e38d1be00679","src/imp/fallback.rs":"c3d333aba1122ac7e26f038f69750aa02e6a1222433a7cffd1c2f961befedd93","src/lib.rs":"e563d5dceaeb81551a5cb2610c1a3ad1a46200a6cbf8c3c3b394d8ac307b8cfa","src/macros.rs":"3be6feccd343cd9dc4bf03780f3107909bf70e02c6c7c72912e4b160dc6a68fc","src/sealed.rs":"dcf569c4c7ce1d372ff51b0fa73fa67f995bdca8e520cb225cde789c71276439","tests/macro-errors.rs":"7f793921dfbec692bfb2bbb067faf0480c0e7eeec83982b5e9fcddd817817616","tests/ok.rs":"a8c1925ac8647d185c7490ed1e33e3ce3203f5945bd3db4dcaf50ea55078df29","tests/runtime-errors.rs":"e53aa7d8e6c0e5128a90e856105eb05e4e7e72ea6db1bd580f3fe439bff62f24","tests/ui/abort.rs":"e209c8dd9dde6bde7440f8795624ad84b0f8486f563c8fe838238818f459bb67","tests/ui/abort.stderr":"dd0605e79be0309f92b251d055f087b0375c48ec60da978df354b48e8563fa10","tests/ui/append_dummy.rs":"ecaf939c8aabd94eef2dd1c10e9515489ba78e4db5b25195e19833b020d2483c","tests/ui/append_dummy.stderr":"ef03b01fc823aba8cfb9eb6d116640ca953fec569e61ed6ed6b7b7fa3bbad686","tests/ui/children_messages.rs":"32299679804133cb5295ed7a9341bf1ab86a4f1277679ee9738a83115c6b1d2b","tests/ui/children_messages.stderr":"dadeb86e1c7094d5fb38664b1766212b3d083fbe04962c137f8281fb3f5d162e","tests/ui/dummy.rs":"ba51c9158cef88ff2ddf0185be26fcd35a641d73c7124fab9ace0bbd546de847","tests/ui/dummy.stderr":"0635fd563d26691d07a2a875111f0b5e155caa45c37ad9cbaefe5fe617eac703","tests/ui/emit.rs":"82aaf06bcee56b7e139bbcba3a92c29448af14974d6806a28c9961aa764026e5","tests/ui/emit.stderr":"d3daa6d304453d436317495b7fc1d9d36bbebb7705bef75a5260d6d8fcfad5b1","tests/ui/explicit_span_range.rs":"3c37d5fc75b2bd460a091acd97a19acc80a40ba8d1d4ac7f36cd2f0e171bf5e7","tests/ui/explicit_span_range.stderr":"d7562847c326badbce2df8546e6f625eef0725b1dd2c786a037cc46357e4d2e8","tests/ui/misuse.rs":"0d66c61ab5c9723cf2f85cd12216751ab09722e9386cc27928034ee17f1c34e3","tests/ui/misuse.stderr":"52568a2208423e8e4050774559f269e79181a350f0805a34880bfa208e08c6bb","tests/ui/multiple_tokens.rs":"74997da1fdd3bce88a04ab42866c651723861fba4f59e826ee602d905398dcca","tests/ui/multiple_tokens.stderr":"e347ef1c18949711ce41957848e255095132f855c94db1e7e28d32e7d2c79a74","tests/ui/not_proc_macro.rs":"ca448d832ccf0cfdcda6f04281d8134a76c61b3ad96437e972b2cb5c6e0844c4","tests/ui/not_proc_macro.stderr":"a22c53a7dd5a03ddfaee5a7fb7fe5d61cb588b2d81a30c1e935b789baf0d2676","tests/ui/option_ext.rs":"1db81c17172f155c0ca8bcf92d55b5852b92107a3ba1d4b2ae6d14020df67f96","tests/ui/option_ext.stderr":"3b363759db60ee4f249dfde4d4571963032d5f0043249de40bd3b38eecc65404","tests/ui/proc_macro_hack.rs":"1d08c3e2c4c331e230c7cdaa2635ca1e43077252f90d3a430dcd091c646a842c","tests/ui/proc_macro_hack.stderr":"65e887dc208b92bfcd44405e76d5d05e315c3c5c5f637070954b7d593c723731","tests/ui/result_ext.rs":"ef398e76aab82a574ca5a988a91353e1a87fcfcb459d30314eceed3cbcf6fcd8","tests/ui/result_ext.stderr":"9e1e387b1378d9ec40ccb29be9f8cdaa5b42060c3f4f9b3c09fb307d5dcf7d85","tests/ui/to_tokens_span.rs":"d017a3c4cd583defe9806cdc51220bde89ced871ddd4d65b7cd089882feb1f61","tests/ui/to_tokens_span.stderr":"0b88e659ab214d6c7dfcd99274d327fe72da4b9bd009477e0e65165ddde65e02","tests/ui/unknown_setting.rs":"16fe9631b51023909497e857a6c674cd216ba9802fbdba360bb8273d6e00fa31","tests/ui/unknown_setting.stderr":"d605f151ce8eba5b2f867667394bd2d2adf0a233145516a9d6b801817521e587","tests/ui/unrelated_panic.rs":"438db25f8f14f1263152545a1c5135e20b3f5063dc4ab223fd8145b891039b24","tests/ui/unrelated_panic.stderr":"04cd814f2bd57d5271f93f90f0dd078b09ee3fd73137245a914d698e4a33ed57"},"package":"da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"} \ No newline at end of file diff --git a/.cargo-vendor/proc-macro-error/Cargo.toml b/.cargo-vendor/proc-macro-error/Cargo.toml deleted file mode 100644 index 869585ffc2..0000000000 --- a/.cargo-vendor/proc-macro-error/Cargo.toml +++ /dev/null @@ -1,56 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies -# -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) - -[package] -edition = "2018" -name = "proc-macro-error" -version = "1.0.4" -authors = ["CreepySkeleton "] -build = "build.rs" -description = "Almost drop-in replacement to panics in proc-macros" -readme = "README.md" -keywords = ["proc-macro", "error", "errors"] -categories = ["development-tools::procedural-macro-helpers"] -license = "MIT OR Apache-2.0" -repository = "https://gitlab.com/CreepySkeleton/proc-macro-error" -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] -[dependencies.proc-macro-error-attr] -version = "=1.0.4" - -[dependencies.proc-macro2] -version = "1" - -[dependencies.quote] -version = "1" - -[dependencies.syn] -version = "1" -optional = true -default-features = false -[dev-dependencies.serde_derive] -version = "=1.0.107" - -[dev-dependencies.toml] -version = "=0.5.2" - -[dev-dependencies.trybuild] -version = "1.0.19" -features = ["diff"] -[build-dependencies.version_check] -version = "0.9" - -[features] -default = ["syn-error"] -syn-error = ["syn"] -[badges.maintenance] -status = "passively-maintained" diff --git a/.cargo-vendor/proc-macro-error/build.rs b/.cargo-vendor/proc-macro-error/build.rs deleted file mode 100644 index 3c1196f269..0000000000 --- a/.cargo-vendor/proc-macro-error/build.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - if !version_check::is_feature_flaggable().unwrap_or(false) { - println!("cargo:rustc-cfg=use_fallback"); - } - - if version_check::is_max_version("1.38.0").unwrap_or(false) - || !version_check::Channel::read().unwrap().is_stable() - { - println!("cargo:rustc-cfg=skip_ui_tests"); - } -} diff --git a/.cargo-vendor/proc-macro-error/tests/ui/abort.stderr b/.cargo-vendor/proc-macro-error/tests/ui/abort.stderr deleted file mode 100644 index c5399d9d91..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/abort.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error: abort!(span, from) test - --> $DIR/abort.rs:4:13 - | -4 | abort_from!(one, two); - | ^^^ - -error: abort!(span, single_expr) test - --> $DIR/abort.rs:5:18 - | -5 | abort_to_string!(one, two); - | ^^^ - -error: abort!(span, expr1, expr2) test - --> $DIR/abort.rs:6:15 - | -6 | abort_format!(one, two); - | ^^^ - -error: Diagnostic::abort() test - --> $DIR/abort.rs:7:15 - | -7 | direct_abort!(one, two); - | ^^^ - -error: This is an error - - = note: simple note - = help: simple help - = help: simple hint - = note: simple yay - = note: format note - = note: Some note - = note: spanned simple note - = note: spanned format note - = note: Some note - - --> $DIR/abort.rs:8:14 - | -8 | abort_notes!(one, two); - | ^^^ - -error: abort_call_site! test - --> $DIR/abort.rs:9:1 - | -9 | abort_call_site_test!(one, two); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/append_dummy.stderr b/.cargo-vendor/proc-macro-error/tests/ui/append_dummy.stderr deleted file mode 100644 index 8a47ddaac4..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/append_dummy.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: append_dummy test - --> $DIR/append_dummy.rs:9:15 - | -9 | append_dummy!(need_default); - | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/children_messages.stderr b/.cargo-vendor/proc-macro-error/tests/ui/children_messages.stderr deleted file mode 100644 index 3b49d83165..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/children_messages.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: main macro message - --> $DIR/children_messages.rs:4:20 - | -4 | children_messages!(one, two, three, four); - | ^^^ - -error: child message - --> $DIR/children_messages.rs:4:25 - | -4 | children_messages!(one, two, three, four); - | ^^^ - -error: main syn::Error - --> $DIR/children_messages.rs:4:30 - | -4 | children_messages!(one, two, three, four); - | ^^^^^ - -error: child syn::Error - --> $DIR/children_messages.rs:4:37 - | -4 | children_messages!(one, two, three, four); - | ^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/dummy.stderr b/.cargo-vendor/proc-macro-error/tests/ui/dummy.stderr deleted file mode 100644 index bae078afa8..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/dummy.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: set_dummy test - --> $DIR/dummy.rs:9:8 - | -9 | dummy!(need_default); - | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/emit.stderr b/.cargo-vendor/proc-macro-error/tests/ui/emit.stderr deleted file mode 100644 index 9484bd628b..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/emit.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error: emit!(span, from) test - --> $DIR/emit.rs:4:7 - | -4 | emit!(one, two, three, four, five); - | ^^^ - -error: emit!(span, expr1, expr2) test - --> $DIR/emit.rs:4:12 - | -4 | emit!(one, two, three, four, five); - | ^^^ - -error: emit!(span, single_expr) test - --> $DIR/emit.rs:4:17 - | -4 | emit!(one, two, three, four, five); - | ^^^^^ - -error: Diagnostic::emit() test - --> $DIR/emit.rs:4:24 - | -4 | emit!(one, two, three, four, five); - | ^^^^ - -error: emit_call_site_error!(expr) test - --> $DIR/emit.rs:4:1 - | -4 | emit!(one, two, three, four, five); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: This is an error - - = note: simple note - = help: simple help - = help: simple hint - = note: simple yay - = note: format note - = note: Some note - = note: spanned simple note - = note: spanned format note - = note: Some note - - --> $DIR/emit.rs:5:13 - | -5 | emit_notes!(one, two); - | ^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.stderr b/.cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.stderr deleted file mode 100644 index 781a71e76a..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: explicit SpanRange - --> $DIR/explicit_span_range.rs:4:22 - | -4 | explicit_span_range!(one, two, three, four); - | ^^^^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/misuse.stderr b/.cargo-vendor/proc-macro-error/tests/ui/misuse.stderr deleted file mode 100644 index 8eaf6456fd..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/misuse.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange` found for reference `&Foo` in the current scope - --> $DIR/misuse.rs:8:5 - | -4 | struct Foo; - | ----------- doesn't satisfy `Foo: quote::to_tokens::ToTokens` -... -8 | abort!(Foo, "BOOM"); - | ^^^^^^^^^^^^^^^^^^^^ method not found in `&Foo` - | - = note: the method `FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange` exists but the following trait bounds were not satisfied: - `Foo: quote::to_tokens::ToTokens` - which is required by `&Foo: proc_macro_error::__export::ToTokensAsSpanRange` - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.stderr b/.cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.stderr deleted file mode 100644 index c6172c6cc6..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: ... - --> $DIR/multiple_tokens.rs:4:1 - | -4 | type T = (); - | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.rs b/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.rs deleted file mode 100644 index e241c5cd28..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.rs +++ /dev/null @@ -1,4 +0,0 @@ -use proc_macro_error::proc_macro_error; - -#[proc_macro_error] -fn main() {} diff --git a/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.stderr b/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.stderr deleted file mode 100644 index f19f01bd8e..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/not_proc_macro.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: #[proc_macro_error] attribute can be used only with procedural macros - - = hint: if you are really sure that #[proc_macro_error] should be applied to this exact function, use #[proc_macro_error(allow_not_macro)] - - --> $DIR/not_proc_macro.rs:3:1 - | -3 | #[proc_macro_error] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/option_ext.stderr b/.cargo-vendor/proc-macro-error/tests/ui/option_ext.stderr deleted file mode 100644 index 91b151ec2f..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/option_ext.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: Option::expect_or_abort() test - --> $DIR/option_ext.rs:4:1 - | -4 | option_ext!(one, two); - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.rs b/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.rs deleted file mode 100644 index 2504bdd401..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Adapted from https://github.com/dtolnay/proc-macro-hack/blob/master/example/src/main.rs -// Licensed under either of Apache License, Version 2.0 or MIT license at your option. - -use proc_macro_hack_test::add_one; - -fn main() { - let two = 2; - let nine = add_one!(two) + add_one!(2 + 3); - println!("nine = {}", nine); -} diff --git a/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.stderr b/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.stderr deleted file mode 100644 index 0e984f918d..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/proc_macro_hack.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: BOOM - --> $DIR/proc_macro_hack.rs:8:25 - | -8 | let nine = add_one!(two) + add_one!(2 + 3); - | ^^^ - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: BOOM - --> $DIR/proc_macro_hack.rs:8:41 - | -8 | let nine = add_one!(two) + add_one!(2 + 3); - | ^^^^^ - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: unreachable expression - --> $DIR/proc_macro_hack.rs:8:32 - | -8 | let nine = add_one!(two) + add_one!(2 + 3); - | ------------- ^^^^^^^^^^^^^^^ unreachable expression - | | - | any code following this expression is unreachable - | - = note: `#[warn(unreachable_code)]` on by default - = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.stderr b/.cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.stderr deleted file mode 100644 index b8c4968263..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: whole type - --> $DIR/to_tokens_span.rs:4:17 - | -4 | to_tokens_span!(std::option::Option); - | ^^^^^^^^^^^^^^^^^^^ - -error: explicit .span() - --> $DIR/to_tokens_span.rs:4:17 - | -4 | to_tokens_span!(std::option::Option); - | ^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.stderr b/.cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.stderr deleted file mode 100644 index d46d689f2f..0000000000 --- a/.cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: proc macro panicked - --> $DIR/unrelated_panic.rs:4:1 - | -4 | unrelated_panic!(); - | ^^^^^^^^^^^^^^^^^^^ - | - = help: message: unrelated panic test diff --git a/.cargo-vendor/proc-macro-error2/.cargo-checksum.json b/.cargo-vendor/proc-macro-error2/.cargo-checksum.json new file mode 100644 index 0000000000..08229a115d --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"be4c548354e0713a7ce362a6d668d5304c940e02c9e7c95c0f58763691088e8d","Cargo.toml":"9419aea8db386d6d06fabe4b2b808b853e233e84df0484d598b81a1836d64ae8","LICENSE-APACHE":"4665f973ccb9393807a7fb1264add6b3513d19abc6b357e4cb52c6fe59cc6a3b","LICENSE-MIT":"544b3aed1fd723d0cadea567affdcfe0431e43e18d997a718f9d67256b814fde","README.md":"186fa2911fda58f18b9c012f844e6110cc497791643dd01854988b2bf4f36b45","src/diagnostic.rs":"638f2c7113f71694d4249e1c61b814d60e65cabca771eb197b531a9e33fd5926","src/dummy.rs":"ae20aeaa2262067b281492db68cbc8669ae65bfcbac91f6d471d0f8f89047148","src/imp/delegate.rs":"ba738cf74ae42fbe058bf3251a412c6131f332d74eed0c1644877a35565cf8dd","src/imp/fallback.rs":"125aa1d68c96c471f39af2c441891a7fc61ca8366635bccb6eea94027d9aa084","src/lib.rs":"eeada6be6ecd1172526ffd680372e9a1d5667a68820a85d91b8719f39ab879d4","src/macros.rs":"3be6feccd343cd9dc4bf03780f3107909bf70e02c6c7c72912e4b160dc6a68fc","src/sealed.rs":"dcf569c4c7ce1d372ff51b0fa73fa67f995bdca8e520cb225cde789c71276439","tests/macro-errors.rs":"ff16f408bd53576995522af1bd6919ef5791d571c03dabd19aed44d7f08e7058","tests/ok.rs":"8379b6066c0b8bd939fee7d92bf6306f19f8300b0b03c201cc78a45f4a58f831","tests/runtime-errors.rs":"fdab67272feaa97fb853e5f015325cd411dca59e4d2f6fe00d0aeaf8546e3760","tests/ui/abort.rs":"25629a3319c8dec464b8bd37d243379348a4c974b22c0df01b55bca499b66ecf","tests/ui/abort.stderr":"41dfc53c80681a3fedc334663e45a3d5237212458800fa4ff5914e24b1e15080","tests/ui/append_dummy.rs":"42942587c0720f3cfca2de7a2a1a38b1c14b35bcfd737c0f95a445884332df95","tests/ui/append_dummy.stderr":"9ea462a1fcc5cc10571c86920c24cc8f223e0fe60d33be55c02005d57faeb6ee","tests/ui/children_messages.rs":"aac44ffcfc73726d9e347735a8a7dea32c7cc0decb2360e3cbdbdcfe46d15f09","tests/ui/children_messages.stderr":"0b09c7eeefa62c31ecd07670980fd8345c243dac89cb1402415ff7f800798bb8","tests/ui/dummy.rs":"e7134b23dc19ef9a58d4b253483e45bcfa882c5c373ce1811cba5acdc5e6287c","tests/ui/dummy.stderr":"3d9394b1a4ce864276ee24be2e3c828f79f76f137bfe0ed9dca6a9b6b7e6ef2f","tests/ui/emit.rs":"ae9dfcc4dbc3e4571db627b8940ae5f448db87c1bf7bc6927c85ec9b9c58b53d","tests/ui/emit.stderr":"03be9ee199a6819d30ed340f64c558fe05214739060ada29c09e48cf55ee0d3a","tests/ui/explicit_span_range.rs":"64e7a187856475d1ad501124355db46ee73cfc3250a0da9b5112338100334b0d","tests/ui/explicit_span_range.stderr":"d8a1288274101ee06baad91280d023732acac0f2a5843c65ea107720698549ad","tests/ui/misuse.rs":"e504820bf8c52854073a6ecfd3486c2759deee7514079ec80ebee5a614a7ccea","tests/ui/misuse.stderr":"d6ec6d638f0f107e8faa97741cd5354583a1ffa4bee07eccc8a4069dd838f9f3","tests/ui/multiple_tokens.rs":"c212bcd27d8551a42bbf2e83a254bc13adb02fbb09cb7df82777b1b426f07451","tests/ui/multiple_tokens.stderr":"c7026c7931c42e204f2c67623cc2755137720182bfc5e4b79e61ae0d7d647f72","tests/ui/not_proc_macro.rs":"23034d95ba47cda5a349b672c3ce5c93fe5ed0d51b4cdb3bf17f9cdad434de32","tests/ui/not_proc_macro.stderr":"12dbf434f8f6f2c4517cba2b07e1f28e0d87f4e87f27527c0c4341373fd6563c","tests/ui/option_ext.rs":"38a7377e4ff1858a5b95116e285c744daf6a010e1deb8fdd9d53532ac745ee70","tests/ui/option_ext.stderr":"986b9d212ad26e7e4854991fa2107fb0d52274b8a92ead4aadab2bb41ac2281b","tests/ui/result_ext.rs":"84f6dfe83fa619d2eac4a6df1f285b0e36755d15ecff75445b1d0dc96ebd2b28","tests/ui/result_ext.stderr":"006105f86d2533309191dbce61f6f388e5d03c94474f1bcd1481db314e4a66ec","tests/ui/to_tokens_span.rs":"4b89ddd4a727422da558c02887ffd712da9534d230593eb7b8e367a0f62eb2cf","tests/ui/to_tokens_span.stderr":"41cc86b25d20bf568b8f14c8572f991e4cf2a0f7c4e35978d35191974a0fa2b4","tests/ui/unknown_setting.rs":"ac88d5775207ed57b921a3139586e055ddcf5f683227fad5723a2a8ddfb7392e","tests/ui/unknown_setting.stderr":"746ef8d8cf2a60acf84b4ba81ae034682aaa8b5f5275803a34fce63378a0f0df","tests/ui/unrelated_panic.rs":"444e74b52373e260ec150de951b27b72f93b0acc3763e064cefbf320189d4bf1","tests/ui/unrelated_panic.stderr":"a21b02875cfc58271c2d8cbdde40a77f41f82c4b829a985f42f579c6e85c4524"},"package":"11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"} \ No newline at end of file diff --git a/.cargo-vendor/proc-macro-error/CHANGELOG.md b/.cargo-vendor/proc-macro-error2/CHANGELOG.md similarity index 89% rename from .cargo-vendor/proc-macro-error/CHANGELOG.md rename to .cargo-vendor/proc-macro-error2/CHANGELOG.md index 3c422f1c45..4f22c85ae0 100644 --- a/.cargo-vendor/proc-macro-error/CHANGELOG.md +++ b/.cargo-vendor/proc-macro-error2/CHANGELOG.md @@ -1,3 +1,21 @@ +# v2.0.1 (2024-09-06) + +* Fixed a span location issue due to mistake in refactoring (#2) + +# v2.0.0 (2024-09-05) + +No changes, simply releasing pre-release as full release. + +# v2.0.0-pre.1 (2024-09-01) + +* __Crate has been renamed to `proc-macro-error2`, due to the old maintainer's inactivity.__ + +* `syn` has been upgraded to `2` +* MSRV has been bumped to `1.61` +* Warnings have been fixed, including `clippy::pedantic` lints +* CI has been converted to GitHub actions, and testing infrastructure significantly simplified. +* Automatic nightly detection has been removed, use the `nightly` feature for improved diagnostics at the cost of stablity. + # v1.0.4 (2020-7-31) * `SpanRange` facility is now public. diff --git a/.cargo-vendor/proc-macro-error2/Cargo.toml b/.cargo-vendor/proc-macro-error2/Cargo.toml new file mode 100644 index 0000000000..f623e6c119 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/Cargo.toml @@ -0,0 +1,91 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.61" +name = "proc-macro-error2" +version = "2.0.1" +authors = [ + "CreepySkeleton ", + "GnomedDev ", +] +build = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Almost drop-in replacement to panics in proc-macros" +readme = "README.md" +keywords = [ + "proc-macro", + "error", + "errors", +] +categories = ["development-tools::procedural-macro-helpers"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/GnomedDev/proc-macro-error-2" + +[lib] +name = "proc_macro_error2" +path = "src/lib.rs" + +[[test]] +name = "macro-errors" +path = "tests/macro-errors.rs" + +[[test]] +name = "ok" +path = "tests/ok.rs" + +[[test]] +name = "runtime-errors" +path = "tests/runtime-errors.rs" + +[dependencies.proc-macro-error-attr2] +version = "=2.0.0" + +[dependencies.proc-macro2] +version = "1" + +[dependencies.quote] +version = "1" + +[dependencies.syn] +version = "2" +optional = true +default-features = false + +[dev-dependencies.syn] +version = "2" +features = ["full"] + +[dev-dependencies.trybuild] +version = "1.0.99" +features = ["diff"] + +[features] +default = ["syn-error"] +nightly = [] +syn-error = ["dep:syn"] + +[lints.clippy.module_name_repetitions] +level = "allow" +priority = 0 + +[lints.clippy.pedantic] +level = "warn" +priority = -1 + +[lints.rust.unexpected_cfgs] +level = "warn" +priority = 0 +check-cfg = ["cfg(run_ui_tests)"] diff --git a/.cargo-vendor/proc-macro-error/LICENSE-APACHE b/.cargo-vendor/proc-macro-error2/LICENSE-APACHE similarity index 100% rename from .cargo-vendor/proc-macro-error/LICENSE-APACHE rename to .cargo-vendor/proc-macro-error2/LICENSE-APACHE diff --git a/.cargo-vendor/proc-macro-error/LICENSE-MIT b/.cargo-vendor/proc-macro-error2/LICENSE-MIT similarity index 100% rename from .cargo-vendor/proc-macro-error/LICENSE-MIT rename to .cargo-vendor/proc-macro-error2/LICENSE-MIT diff --git a/.cargo-vendor/proc-macro-error/README.md b/.cargo-vendor/proc-macro-error2/README.md similarity index 86% rename from .cargo-vendor/proc-macro-error/README.md rename to .cargo-vendor/proc-macro-error2/README.md index 7fbe07c53a..0910eacb8d 100644 --- a/.cargo-vendor/proc-macro-error/README.md +++ b/.cargo-vendor/proc-macro-error2/README.md @@ -1,7 +1,6 @@ # Makes error reporting in procedural macros nice and easy -[![travis ci](https://travis-ci.org/CreepySkeleton/proc-macro-error.svg?branch=master)](https://travis-ci.org/CreepySkeleton/proc-macro-error) -[![docs.rs](https://docs.rs/proc-macro-error/badge.svg)](https://docs.rs/proc-macro-error) +[![docs.rs](https://docs.rs/proc-macro-error2/badge.svg)](https://docs.rs/proc-macro-error2) [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) This crate aims to make error reporting in proc-macros simple and easy to use. @@ -9,7 +8,7 @@ Migrate from `panic!`-based errors for as little effort as possible! Also, you can explicitly [append a dummy token stream][crate::dummy] to your errors. -To achieve his, this crate serves as a tiny shim around `proc_macro::Diagnostic` and +To achieve this, this crate serves as a tiny shim around `proc_macro::Diagnostic` and `compile_error!`. It detects the most preferable way to emit errors based on compiler's version. When the underlying diagnostic type is finally stabilized, this crate will be simply delegating to it, requiring no changes in your code! @@ -19,10 +18,10 @@ available on stable ahead of time and your error-reporting code future-proof. ```toml [dependencies] -proc-macro-error = "1.0" +proc-macro-error2 = "2.0" ``` -*Supports rustc 1.31 and up* +*Supports rustc 1.61 and up* [Documentation and guide][guide] @@ -65,7 +64,7 @@ And this is what your users will see in their IDE: ### Panic-like usage ```rust -use proc_macro_error::{ +use proc_macro_error2::{ proc_macro_error, abort, abort_call_site, @@ -112,7 +111,7 @@ pub fn make_answer(input: TokenStream) -> TokenStream { ### `proc_macro::Diagnostic`-like usage ```rust -use proc_macro_error::*; +use proc_macro_error2::*; use proc_macro::TokenStream; use syn::{spanned::Spanned, DeriveInput, ItemStruct, Fields, Attribute , parse_macro_input}; use quote::quote; @@ -171,16 +170,9 @@ pub fn make_answer(input: TokenStream) -> TokenStream { ## MSRV policy -`proc_macro_error` will always be compatible with proc-macro Holy Trinity: -`proc_macro2`, `syn`, `quote` crates. In other words, if the Trinity is available -to you - `proc_macro_error` is available too. +The MSRV is currently `1.61`, and this is considered a breaking change to increase. -> **Important!** -> -> If you want to use `#[proc_macro_error]` with `synstructure`, you're going -> to have to put the attribute inside the `decl_derive!` invocation. Unfortunately, -> due to some bug in pre-1.34 rustc, putting proc-macro attributes inside macro -> invocations doesn't work, so your MSRV is effectively 1.34. +However, if an existing dependency requires a higher MSRV without a semver breaking update, this may be raised. ## Motivation @@ -250,9 +242,9 @@ be dual licensed as above, without any additional terms or conditions. [compl_err]: https://doc.rust-lang.org/std/macro.compile_error.html [`proc_macro::Diagnostic`]: https://doc.rust-lang.org/proc_macro/struct.Diagnostic.html -[crate::dummy]: https://docs.rs/proc-macro-error/1/proc_macro_error/dummy/index.html -[crate::multi]: https://docs.rs/proc-macro-error/1/proc_macro_error/multi/index.html +[crate::dummy]: https://docs.rs/proc-macro-error2/1/proc_macro_error/dummy/index.html +[crate::multi]: https://docs.rs/proc-macro-error2/1/proc_macro_error/multi/index.html -[`abort_call_site!`]: https://docs.rs/proc-macro-error/1/proc_macro_error/macro.abort_call_site.html -[`abort!`]: https://docs.rs/proc-macro-error/1/proc_macro_error/macro.abort.html -[guide]: https://docs.rs/proc-macro-error +[`abort_call_site!`]: https://docs.rs/proc-macro-error2/1/proc_macro_error/macro.abort_call_site.html +[`abort!`]: https://docs.rs/proc-macro-error2/1/proc_macro_error/macro.abort.html +[guide]: https://docs.rs/proc-macro-error2 diff --git a/.cargo-vendor/proc-macro-error/src/diagnostic.rs b/.cargo-vendor/proc-macro-error2/src/diagnostic.rs similarity index 93% rename from .cargo-vendor/proc-macro-error/src/diagnostic.rs rename to .cargo-vendor/proc-macro-error2/src/diagnostic.rs index 983e6174fe..04555112f8 100644 --- a/.cargo-vendor/proc-macro-error/src/diagnostic.rs +++ b/.cargo-vendor/proc-macro-error2/src/diagnostic.rs @@ -10,15 +10,15 @@ use quote::{quote_spanned, ToTokens}; /// /// Warnings are ignored on stable/beta #[derive(Debug, PartialEq)] +#[non_exhaustive] pub enum Level { Error, Warning, - #[doc(hidden)] - NonExhaustive, } /// Represents a single diagnostic message #[derive(Debug)] +#[must_use = "A diagnostic does nothing unless emitted"] pub struct Diagnostic { pub(crate) level: Level, pub(crate) span_range: SpanRange, @@ -43,6 +43,7 @@ pub trait DiagnosticExt: Sealed { /// /// This function is the same as `Diagnostic::span_error` but produces considerably /// better error messages for multi-token spans on stable. + #[must_use] fn span_range_error(self, span_range: SpanRange, msg: String) -> Self; /// Attach a "help" note to your main message, the note will have it's own span on nightly. @@ -53,6 +54,7 @@ pub trait DiagnosticExt: Sealed { /// # Span /// /// The span is ignored on stable, the note effectively inherits its parent's (main message) span + #[must_use] fn span_range_help(self, span_range: SpanRange, msg: String) -> Self; /// Attach a note to your main message, the note will have it's own span on nightly. @@ -63,6 +65,7 @@ pub trait DiagnosticExt: Sealed { /// # Span /// /// The span is ignored on stable, the note effectively inherits its parent's (main message) span + #[must_use] fn span_range_note(self, span_range: SpanRange, msg: String) -> Self; } @@ -168,6 +171,7 @@ impl Diagnostic { } /// The message of main warning/error (no notes attached) + #[must_use] pub fn message(&self) -> &str { &self.msg } @@ -267,7 +271,7 @@ impl ToTokens for Diagnostic { ts.extend( self.children .iter() - .map(|(span_range, msg)| diag_to_tokens(*span_range, &Level::Error, &msg, &[])), + .map(|(span_range, msg)| diag_to_tokens(*span_range, &Level::Error, msg, &[])), ); } } @@ -293,12 +297,13 @@ impl From for Diagnostic { use proc_macro2::{Delimiter, TokenTree}; fn gut_error(ts: &mut impl Iterator) -> Option<(SpanRange, String)> { - let first = match ts.next() { - // compile_error - None => return None, - Some(tt) => tt.span(), - }; - ts.next().unwrap(); // ! + let start_span = ts.next()?.span(); + ts.next().expect(":1"); + ts.next().expect("core"); + ts.next().expect(":2"); + ts.next().expect(":3"); + ts.next().expect("compile_error"); + ts.next().expect("!"); let lit = match ts.next().unwrap() { TokenTree::Group(group) => { @@ -319,10 +324,10 @@ impl From for Diagnostic { match group.stream().into_iter().next().unwrap() { TokenTree::Literal(lit) => lit, - _ => unreachable!(), + _ => unreachable!(""), } } - _ => unreachable!(), + _ => unreachable!(""), }; let last = lit.span(); @@ -332,7 +337,13 @@ impl From for Diagnostic { msg.pop(); msg.remove(0); - Some((SpanRange { first, last }, msg)) + Some(( + SpanRange { + first: start_span, + last, + }, + msg, + )) } let mut ts = err.to_compile_error().into_iter(); diff --git a/.cargo-vendor/proc-macro-error/src/dummy.rs b/.cargo-vendor/proc-macro-error2/src/dummy.rs similarity index 95% rename from .cargo-vendor/proc-macro-error/src/dummy.rs rename to .cargo-vendor/proc-macro-error2/src/dummy.rs index 571a595aa9..5bc98bd01e 100644 --- a/.cargo-vendor/proc-macro-error/src/dummy.rs +++ b/.cargo-vendor/proc-macro-error2/src/dummy.rs @@ -9,7 +9,7 @@ //! //! ```rust,ignore //! use proc_macro::TokenStream; -//! use proc_macro_error::*; +//! use proc_macro_error2::*; //! //! trait MyTrait { //! fn do_thing(); @@ -72,7 +72,7 @@ //! //! ```rust,ignore //! use proc_macro::TokenStream; -//! use proc_macro_error::*; +//! use proc_macro_error2::*; //! //! trait MyTrait { //! fn do_thing(); @@ -119,13 +119,14 @@ use std::cell::RefCell; use crate::check_correctness; thread_local! { - static DUMMY_IMPL: RefCell> = RefCell::new(None); + static DUMMY_IMPL: RefCell> = const { RefCell::new(None) }; } /// Sets dummy token stream which will be appended to `compile_error!(msg);...` /// invocations in case you'll emit any errors. /// /// See [guide](../index.html#guide). +#[allow(clippy::must_use_candidate)] // Mutates thread local state pub fn set_dummy(dummy: TokenStream) -> Option { check_correctness(); DUMMY_IMPL.with(|old_dummy| old_dummy.replace(Some(dummy))) diff --git a/.cargo-vendor/proc-macro-error/src/imp/delegate.rs b/.cargo-vendor/proc-macro-error2/src/imp/delegate.rs similarity index 98% rename from .cargo-vendor/proc-macro-error/src/imp/delegate.rs rename to .cargo-vendor/proc-macro-error2/src/imp/delegate.rs index 07def2b98e..a3e6a80d12 100644 --- a/.cargo-vendor/proc-macro-error/src/imp/delegate.rs +++ b/.cargo-vendor/proc-macro-error2/src/imp/delegate.rs @@ -38,7 +38,6 @@ pub(crate) fn emit_diagnostic(diag: Diagnostic) { IS_DIRTY.with(|c| c.set(true)); PLevel::Error } - _ => unreachable!(), }; let mut res = PDiag::spanned(span, level, msg); diff --git a/.cargo-vendor/proc-macro-error/src/imp/fallback.rs b/.cargo-vendor/proc-macro-error2/src/imp/fallback.rs similarity index 87% rename from .cargo-vendor/proc-macro-error/src/imp/fallback.rs rename to .cargo-vendor/proc-macro-error2/src/imp/fallback.rs index ad1f730bfc..c10eb9a9d7 100644 --- a/.cargo-vendor/proc-macro-error/src/imp/fallback.rs +++ b/.cargo-vendor/proc-macro-error2/src/imp/fallback.rs @@ -26,5 +26,5 @@ pub(crate) fn emit_diagnostic(diag: Diagnostic) { } thread_local! { - static ERR_STORAGE: RefCell> = RefCell::new(Vec::new()); + static ERR_STORAGE: RefCell> = const { RefCell::new(Vec::new()) }; } diff --git a/.cargo-vendor/proc-macro-error/src/lib.rs b/.cargo-vendor/proc-macro-error2/src/lib.rs similarity index 94% rename from .cargo-vendor/proc-macro-error/src/lib.rs rename to .cargo-vendor/proc-macro-error2/src/lib.rs index fb867fdc03..a00c9243ed 100644 --- a/.cargo-vendor/proc-macro-error/src/lib.rs +++ b/.cargo-vendor/proc-macro-error2/src/lib.rs @@ -1,4 +1,4 @@ -//! # proc-macro-error +//! # proc-macro-error2 //! //! This crate aims to make error reporting in proc-macros simple and easy to use. //! Migrate from `panic!`-based errors for as little effort as possible! @@ -21,7 +21,7 @@ //! //! ```toml //! [dependencies] -//! proc-macro-error = { version = "1", default-features = false } +//! proc-macro-error2 = { version = "2.0.0", default-features = false } //! ``` //! //! ***Please note that disabling this feature makes sense only if you don't depend on `syn` @@ -206,7 +206,7 @@ //! > If you have some type from `proc_macro` or `syn` to point to, do not call `.span()` //! > on it but rather use it directly: //! > ```no_run -//! > # use proc_macro_error::abort; +//! > # use proc_macro_error2::abort; //! > # let input = proc_macro2::TokenStream::new(); //! > let ty: syn::Type = syn::parse2(input).unwrap(); //! > abort!(ty, "BOOM"); @@ -271,9 +271,8 @@ //! [`ToTokens`]: https://docs.rs/quote/1.0.3/quote/trait.ToTokens.html //! -#![cfg_attr(not(use_fallback), feature(proc_macro_diagnostic))] +#![cfg_attr(feature = "nightly", feature(proc_macro_diagnostic))] #![forbid(unsafe_code)] -#![allow(clippy::needless_doctest_main)] extern crate proc_macro; @@ -281,7 +280,7 @@ pub use crate::{ diagnostic::{Diagnostic, DiagnosticExt, Level}, dummy::{append_dummy, set_dummy}, }; -pub use proc_macro_error_attr::proc_macro_error; +pub use proc_macro_error_attr2::proc_macro_error; use proc_macro2::Span; use quote::{quote, ToTokens}; @@ -295,15 +294,16 @@ mod diagnostic; mod macros; mod sealed; -#[cfg(use_fallback)] +#[cfg(not(feature = "nightly"))] #[path = "imp/fallback.rs"] mod imp; -#[cfg(not(use_fallback))] +#[cfg(feature = "nightly")] #[path = "imp/delegate.rs"] mod imp; #[derive(Debug, Clone, Copy)] +#[must_use = "A SpanRange does nothing unless used"] pub struct SpanRange { pub first: Span, pub last: Span, @@ -333,7 +333,7 @@ impl SpanRange { /// that doesn't lose anything. pub fn from_tokens(ts: &dyn ToTokens) -> Self { let mut spans = ts.to_token_stream().into_iter().map(|tt| tt.span()); - let first = spans.next().unwrap_or_else(|| Span::call_site()); + let first = spans.next().unwrap_or_else(Span::call_site); let last = spans.last().unwrap_or(first); SpanRange { first, last } @@ -349,6 +349,7 @@ impl SpanRange { } /// Collapse the range into single span, preserving as much information as possible. + #[must_use] pub fn collapse(self) -> Span { self.first.join(self.last).unwrap_or(self.first) } @@ -469,30 +470,29 @@ where fn abort_now() -> ! { check_correctness(); - panic!(AbortNow) + std::panic::panic_any(AbortNow) } thread_local! { - static ENTERED_ENTRY_POINT: Cell = Cell::new(0); + static ENTERED_ENTRY_POINT: Cell = const { Cell::new(0) }; } struct AbortNow; fn check_correctness() { - if ENTERED_ENTRY_POINT.with(|flag| flag.get()) == 0 { - panic!( - "proc-macro-error API cannot be used outside of `entry_point` invocation, \ + assert!( + ENTERED_ENTRY_POINT.with(Cell::get) != 0, + "proc-macro-error2 API cannot be used outside of `entry_point` invocation, \ perhaps you forgot to annotate your #[proc_macro] function with `#[proc_macro_error]" - ); - } + ); } /// **ALL THE STUFF INSIDE IS NOT PUBLIC API!!!** #[doc(hidden)] pub mod __export { // reexports for use in macros - pub extern crate proc_macro; - pub extern crate proc_macro2; + pub use proc_macro; + pub use proc_macro2; use proc_macro2::Span; use quote::ToTokens; @@ -525,11 +525,16 @@ pub mod __export { impl ToTokensAsSpanRange for &T { fn FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange(&self) -> SpanRange { let mut ts = self.to_token_stream().into_iter(); - let first = ts - .next() - .map(|tt| tt.span()) - .unwrap_or_else(Span::call_site); - let last = ts.last().map(|tt| tt.span()).unwrap_or(first); + let first = match ts.next() { + Some(t) => t.span(), + None => Span::call_site(), + }; + + let last = match ts.last() { + Some(t) => t.span(), + None => first, + }; + SpanRange { first, last } } } @@ -546,8 +551,8 @@ pub mod __export { impl SpanAsSpanRange for proc_macro::Span { fn FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange(&self) -> SpanRange { SpanRange { - first: self.clone().into(), - last: self.clone().into(), + first: (*self).into(), + last: (*self).into(), } } } diff --git a/.cargo-vendor/proc-macro-error/src/macros.rs b/.cargo-vendor/proc-macro-error2/src/macros.rs similarity index 100% rename from .cargo-vendor/proc-macro-error/src/macros.rs rename to .cargo-vendor/proc-macro-error2/src/macros.rs diff --git a/.cargo-vendor/proc-macro-error/src/sealed.rs b/.cargo-vendor/proc-macro-error2/src/sealed.rs similarity index 100% rename from .cargo-vendor/proc-macro-error/src/sealed.rs rename to .cargo-vendor/proc-macro-error2/src/sealed.rs diff --git a/.cargo-vendor/proc-macro-error/tests/macro-errors.rs b/.cargo-vendor/proc-macro-error2/tests/macro-errors.rs similarity index 62% rename from .cargo-vendor/proc-macro-error/tests/macro-errors.rs rename to .cargo-vendor/proc-macro-error2/tests/macro-errors.rs index dd60f88a80..bfe1ea33ae 100644 --- a/.cargo-vendor/proc-macro-error/tests/macro-errors.rs +++ b/.cargo-vendor/proc-macro-error2/tests/macro-errors.rs @@ -1,7 +1,5 @@ -extern crate trybuild; - -#[cfg_attr(skip_ui_tests, ignore)] #[test] +#[cfg(run_ui_tests)] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/*.rs"); diff --git a/.cargo-vendor/proc-macro-error/tests/ok.rs b/.cargo-vendor/proc-macro-error2/tests/ok.rs similarity index 76% rename from .cargo-vendor/proc-macro-error/tests/ok.rs rename to .cargo-vendor/proc-macro-error2/tests/ok.rs index cf64c027f8..402edbe914 100644 --- a/.cargo-vendor/proc-macro-error/tests/ok.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ok.rs @@ -1,5 +1,3 @@ -extern crate test_crate; - use test_crate::*; ok!(it_works); diff --git a/.cargo-vendor/proc-macro-error/tests/runtime-errors.rs b/.cargo-vendor/proc-macro-error2/tests/runtime-errors.rs similarity index 50% rename from .cargo-vendor/proc-macro-error/tests/runtime-errors.rs rename to .cargo-vendor/proc-macro-error2/tests/runtime-errors.rs index 13108a2d91..bb7e726a36 100644 --- a/.cargo-vendor/proc-macro-error/tests/runtime-errors.rs +++ b/.cargo-vendor/proc-macro-error2/tests/runtime-errors.rs @@ -1,13 +1,13 @@ -use proc_macro_error::*; +use proc_macro_error2::*; #[test] -#[should_panic = "proc-macro-error API cannot be used outside of"] +#[should_panic = "proc-macro-error2 API cannot be used outside of"] fn missing_attr_emit() { emit_call_site_error!("You won't see me"); } #[test] -#[should_panic = "proc-macro-error API cannot be used outside of"] +#[should_panic = "proc-macro-error2 API cannot be used outside of"] fn missing_attr_abort() { abort_call_site!("You won't see me"); } diff --git a/.cargo-vendor/proc-macro-error/tests/ui/abort.rs b/.cargo-vendor/proc-macro-error2/tests/ui/abort.rs similarity index 88% rename from .cargo-vendor/proc-macro-error/tests/ui/abort.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/abort.rs index f63118251e..e998e9024a 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/abort.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/abort.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; abort_from!(one, two); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/abort.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/abort.stderr new file mode 100644 index 0000000000..2a210c5e43 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/abort.stderr @@ -0,0 +1,48 @@ +error: abort!(span, from) test + --> tests/ui/abort.rs:3:13 + | +3 | abort_from!(one, two); + | ^^^ + +error: abort!(span, single_expr) test + --> tests/ui/abort.rs:4:18 + | +4 | abort_to_string!(one, two); + | ^^^ + +error: abort!(span, expr1, expr2) test + --> tests/ui/abort.rs:5:15 + | +5 | abort_format!(one, two); + | ^^^ + +error: Diagnostic::abort() test + --> tests/ui/abort.rs:6:15 + | +6 | direct_abort!(one, two); + | ^^^ + +error: This is an error + + = note: simple note + = help: simple help + = help: simple hint + = note: simple yay + = note: format note + = note: Some note + = note: spanned simple note + = note: spanned format note + = note: Some note + + --> tests/ui/abort.rs:7:14 + | +7 | abort_notes!(one, two); + | ^^^ + +error: abort_call_site! test + --> tests/ui/abort.rs:8:1 + | +8 | abort_call_site_test!(one, two); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `abort_call_site_test` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/append_dummy.rs b/.cargo-vendor/proc-macro-error2/tests/ui/append_dummy.rs similarity index 80% rename from .cargo-vendor/proc-macro-error/tests/ui/append_dummy.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/append_dummy.rs index 53d6feacc1..8838404308 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/append_dummy.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/append_dummy.rs @@ -1,9 +1,8 @@ -extern crate test_crate; use test_crate::*; enum NeedDefault { A, - B + B, } append_dummy!(need_default); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/append_dummy.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/append_dummy.stderr new file mode 100644 index 0000000000..c53708b3dd --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/append_dummy.stderr @@ -0,0 +1,5 @@ +error: append_dummy test + --> tests/ui/append_dummy.rs:8:15 + | +8 | append_dummy!(need_default); + | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/children_messages.rs b/.cargo-vendor/proc-macro-error2/tests/ui/children_messages.rs similarity index 75% rename from .cargo-vendor/proc-macro-error/tests/ui/children_messages.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/children_messages.rs index fb9e6dc697..a10ca7c1a1 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/children_messages.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/children_messages.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; children_messages!(one, two, three, four); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/children_messages.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/children_messages.stderr new file mode 100644 index 0000000000..092eb05320 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/children_messages.stderr @@ -0,0 +1,23 @@ +error: main macro message + --> tests/ui/children_messages.rs:3:20 + | +3 | children_messages!(one, two, three, four); + | ^^^ + +error: child message + --> tests/ui/children_messages.rs:3:25 + | +3 | children_messages!(one, two, three, four); + | ^^^ + +error: main syn::Error + --> tests/ui/children_messages.rs:3:30 + | +3 | children_messages!(one, two, three, four); + | ^^^^^ + +error: child syn::Error + --> tests/ui/children_messages.rs:3:37 + | +3 | children_messages!(one, two, three, four); + | ^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/dummy.rs b/.cargo-vendor/proc-macro-error2/tests/ui/dummy.rs similarity index 79% rename from .cargo-vendor/proc-macro-error/tests/ui/dummy.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/dummy.rs index caa4827886..ba146a5a7b 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/dummy.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/dummy.rs @@ -1,9 +1,8 @@ -extern crate test_crate; use test_crate::*; enum NeedDefault { A, - B + B, } dummy!(need_default); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/dummy.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/dummy.stderr new file mode 100644 index 0000000000..197d5cacb5 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/dummy.stderr @@ -0,0 +1,5 @@ +error: set_dummy test + --> tests/ui/dummy.rs:8:8 + | +8 | dummy!(need_default); + | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/emit.rs b/.cargo-vendor/proc-macro-error2/tests/ui/emit.rs similarity index 78% rename from .cargo-vendor/proc-macro-error/tests/ui/emit.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/emit.rs index c5c7db095f..6f1e389c2a 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/emit.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/emit.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; emit!(one, two, three, four, five); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/emit.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/emit.stderr new file mode 100644 index 0000000000..02fc95ee6c --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/emit.stderr @@ -0,0 +1,48 @@ +error: emit!(span, from) test + --> tests/ui/emit.rs:3:7 + | +3 | emit!(one, two, three, four, five); + | ^^^ + +error: emit!(span, expr1, expr2) test + --> tests/ui/emit.rs:3:12 + | +3 | emit!(one, two, three, four, five); + | ^^^ + +error: emit!(span, single_expr) test + --> tests/ui/emit.rs:3:17 + | +3 | emit!(one, two, three, four, five); + | ^^^^^ + +error: Diagnostic::emit() test + --> tests/ui/emit.rs:3:24 + | +3 | emit!(one, two, three, four, five); + | ^^^^ + +error: emit_call_site_error!(expr) test + --> tests/ui/emit.rs:3:1 + | +3 | emit!(one, two, three, four, five); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `emit` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: This is an error + + = note: simple note + = help: simple help + = help: simple hint + = note: simple yay + = note: format note + = note: Some note + = note: spanned simple note + = note: spanned format note + = note: Some note + + --> tests/ui/emit.rs:4:13 + | +4 | emit_notes!(one, two); + | ^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.rs b/.cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.rs similarity index 75% rename from .cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.rs index 82bbebcc55..7f0ff2459d 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/explicit_span_range.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; explicit_span_range!(one, two, three, four); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.stderr new file mode 100644 index 0000000000..dd480c62d9 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/explicit_span_range.stderr @@ -0,0 +1,5 @@ +error: explicit SpanRange + --> tests/ui/explicit_span_range.rs:3:22 + | +3 | explicit_span_range!(one, two, three, four); + | ^^^^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/misuse.rs b/.cargo-vendor/proc-macro-error2/tests/ui/misuse.rs similarity index 58% rename from .cargo-vendor/proc-macro-error/tests/ui/misuse.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/misuse.rs index e6d2d24971..dd86c0f086 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/misuse.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/misuse.rs @@ -1,5 +1,4 @@ -extern crate proc_macro_error; -use proc_macro_error::abort; +use proc_macro_error2::abort; struct Foo; diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/misuse.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/misuse.stderr new file mode 100644 index 0000000000..ac17d0fa1a --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/misuse.stderr @@ -0,0 +1,24 @@ +error[E0599]: the method `FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange` exists for reference `&Foo`, but its trait bounds were not satisfied + --> tests/ui/misuse.rs:7:5 + | +3 | struct Foo; + | ---------- doesn't satisfy `Foo: quote::to_tokens::ToTokens` +... +7 | abort!(Foo, "BOOM"); + | ^^^^^^^^^^^^^^^^^^^ method cannot be called on `&Foo` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `Foo: quote::to_tokens::ToTokens` + which is required by `&Foo: ToTokensAsSpanRange` +note: the trait `quote::to_tokens::ToTokens` must be implemented + --> $CARGO/quote-1.0.37/src/to_tokens.rs + | + | pub trait ToTokens { + | ^^^^^^^^^^^^^^^^^^ + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following traits define an item `FIRST_ARG_MUST_EITHER_BE_Span_OR_IMPLEMENT_ToTokens_OR_BE_SpanRange`, perhaps you need to implement one of them: + candidate #1: `Span2AsSpanRange` + candidate #2: `SpanAsSpanRange` + candidate #3: `SpanRangeAsSpanRange` + candidate #4: `ToTokensAsSpanRange` + = note: this error originates in the macro `$crate::diagnostic` which comes from the expansion of the macro `abort` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.rs b/.cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.rs similarity index 54% rename from .cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.rs index 215928f6f4..50fc2dd88a 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/multiple_tokens.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.rs @@ -1,6 +1,4 @@ -extern crate test_crate; - #[test_crate::multiple_tokens] type T = (); -fn main() {} \ No newline at end of file +fn main() {} diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.stderr new file mode 100644 index 0000000000..af0cab0d9a --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/multiple_tokens.stderr @@ -0,0 +1,5 @@ +error: ... + --> tests/ui/multiple_tokens.rs:2:1 + | +2 | type T = (); + | ^^^^^^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.rs b/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.rs new file mode 100644 index 0000000000..03c596b6c1 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.rs @@ -0,0 +1,4 @@ +use proc_macro_error2::proc_macro_error; + +#[proc_macro_error] +fn main() {} diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.stderr new file mode 100644 index 0000000000..67012aabb7 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/not_proc_macro.stderr @@ -0,0 +1,9 @@ +error: #[proc_macro_error] attribute can be used only with procedural macros + + = hint: if you are really sure that #[proc_macro_error] should be applied to this exact function, use #[proc_macro_error(allow_not_macro)] + --> tests/ui/not_proc_macro.rs:3:1 + | +3 | #[proc_macro_error] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the attribute macro `proc_macro_error` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/option_ext.rs b/.cargo-vendor/proc-macro-error2/tests/ui/option_ext.rs similarity index 69% rename from .cargo-vendor/proc-macro-error/tests/ui/option_ext.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/option_ext.rs index dfbfc03835..19a650db1c 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/option_ext.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/option_ext.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; option_ext!(one, two); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/option_ext.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/option_ext.stderr new file mode 100644 index 0000000000..49bb22dc92 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/option_ext.stderr @@ -0,0 +1,7 @@ +error: Option::expect_or_abort() test + --> tests/ui/option_ext.rs:3:1 + | +3 | option_ext!(one, two); + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `option_ext` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/.cargo-vendor/proc-macro-error/tests/ui/result_ext.rs b/.cargo-vendor/proc-macro-error2/tests/ui/result_ext.rs similarity index 80% rename from .cargo-vendor/proc-macro-error/tests/ui/result_ext.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/result_ext.rs index bdd560dba9..b5a7951b86 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/result_ext.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/result_ext.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; result_unwrap_or_abort!(one, two); diff --git a/.cargo-vendor/proc-macro-error/tests/ui/result_ext.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/result_ext.stderr similarity index 51% rename from .cargo-vendor/proc-macro-error/tests/ui/result_ext.stderr rename to .cargo-vendor/proc-macro-error2/tests/ui/result_ext.stderr index f2dc0e4235..f9321f91e0 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/result_ext.stderr +++ b/.cargo-vendor/proc-macro-error2/tests/ui/result_ext.stderr @@ -1,11 +1,11 @@ error: Result::unwrap_or_abort() test - --> $DIR/result_ext.rs:4:25 + --> tests/ui/result_ext.rs:3:25 | -4 | result_unwrap_or_abort!(one, two); +3 | result_unwrap_or_abort!(one, two); | ^^^ error: BOOM: Result::expect_or_abort() test - --> $DIR/result_ext.rs:5:25 + --> tests/ui/result_ext.rs:4:25 | -5 | result_expect_or_abort!(one, two); +4 | result_expect_or_abort!(one, two); | ^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.rs b/.cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.rs similarity index 74% rename from .cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.rs index a7c3fc976c..942e94a41b 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/to_tokens_span.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; to_tokens_span!(std::option::Option); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.stderr new file mode 100644 index 0000000000..bb3b543075 --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/to_tokens_span.stderr @@ -0,0 +1,11 @@ +error: whole type + --> tests/ui/to_tokens_span.rs:3:17 + | +3 | to_tokens_span!(std::option::Option); + | ^^^^^^^^^^^^^^^^^^^ + +error: explicit .span() + --> tests/ui/to_tokens_span.rs:3:17 + | +3 | to_tokens_span!(std::option::Option); + | ^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/unknown_setting.rs b/.cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.rs similarity index 66% rename from .cargo-vendor/proc-macro-error/tests/ui/unknown_setting.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.rs index d8e58eaf87..5e54a8952c 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/unknown_setting.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.rs @@ -1,4 +1,4 @@ -use proc_macro_error::proc_macro_error; +use proc_macro_error2::proc_macro_error; #[proc_macro_error(allow_not_macro, assert_unwind_safe, trololo)] fn main() {} diff --git a/.cargo-vendor/proc-macro-error/tests/ui/unknown_setting.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.stderr similarity index 86% rename from .cargo-vendor/proc-macro-error/tests/ui/unknown_setting.stderr rename to .cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.stderr index a55de0b31b..eb349cc82f 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/unknown_setting.stderr +++ b/.cargo-vendor/proc-macro-error2/tests/ui/unknown_setting.stderr @@ -1,5 +1,5 @@ error: unknown setting `trololo`, expected one of `assert_unwind_safe`, `allow_not_macro`, `proc_macro_hack` - --> $DIR/unknown_setting.rs:3:57 + --> tests/ui/unknown_setting.rs:3:57 | 3 | #[proc_macro_error(allow_not_macro, assert_unwind_safe, trololo)] | ^^^^^^^ diff --git a/.cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.rs b/.cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.rs similarity index 68% rename from .cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.rs rename to .cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.rs index c74e3e0623..9d450fffef 100644 --- a/.cargo-vendor/proc-macro-error/tests/ui/unrelated_panic.rs +++ b/.cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.rs @@ -1,4 +1,3 @@ -extern crate test_crate; use test_crate::*; unrelated_panic!(); diff --git a/.cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.stderr b/.cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.stderr new file mode 100644 index 0000000000..a1dec9c5fa --- /dev/null +++ b/.cargo-vendor/proc-macro-error2/tests/ui/unrelated_panic.stderr @@ -0,0 +1,7 @@ +error: proc macro panicked + --> tests/ui/unrelated_panic.rs:3:1 + | +3 | unrelated_panic!(); + | ^^^^^^^^^^^^^^^^^^ + | + = help: message: unrelated panic test diff --git a/.cargo-vendor/syn-1.0.109/.cargo-checksum.json b/.cargo-vendor/syn-1.0.109/.cargo-checksum.json deleted file mode 100644 index 27e4b5ca83..0000000000 --- a/.cargo-vendor/syn-1.0.109/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"139a7e42e4c95f9730d4dfe05dd5e09ee59f713eacc310921a61d9fdfc0bdce0","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"ea9f2b6340b302b5608d2bedcda7e2d707f3eaebf4cc983c02d55071ead7096f","benches/file.rs":"3d737ef3878f6e242b003af9bd539e565f98439a12ee44d9548d84e3fdd7af0c","benches/rust.rs":"11ac9fe898a7bf1bd63e8a8cc9c08bd795b01f0248215cff99afaaf28ce87fab","build.rs":"b815649fd2929d3debd93a58f5da2fb8eba506047a6a5ba538347305828a87b0","src/attr.rs":"234d9cebe2c5e92cd0f5e1117bf5755037e2e905788a337000a65d4bd82b63aa","src/await.rs":"8aa22e3c201cb2bdb6b4817fa00901f308ab06817607aa7b884c58c957705969","src/bigint.rs":"efc7f64959980653d73fe4f8bc2a3a2904dc05f45b02c6dc15cd316fa3d7c338","src/buffer.rs":"4d15f35273d485261be4f1a765ae03abc1daee9fc9dac5fb4f9b624d6b22cb58","src/custom_keyword.rs":"5c706fc3611e73d16b8c019d7ecb848a86b1ccfcd9e556f80bb6e6a4abe058a8","src/custom_punctuation.rs":"8a666298e774b0d326642f0f73284f6677d0d0a7c9e4a712c9c98d010b4d8a2c","src/data.rs":"75d2c2b5d6a01bf8a6fa2845e41663d8045a78b4b191f1a1bd7c93619d20017a","src/derive.rs":"ee24a202be2d36ccdff576dd9cd765e94b33ef2286946e6725d75b08e777d462","src/discouraged.rs":"6c6a9298f8d24f578da119557bc588f3bd928f7b79fca27d6bdfe3e786dd005f","src/drops.rs":"013385f1dd95663f1afab41abc1e2eea04181998644828935ca564c74d6462ae","src/error.rs":"b30e738fdab7d10e126350e09f7ad907bf4dc14e684b9ed9eeea001c7ee356e0","src/export.rs":"0cf50d70c32d5fddba8b1193032df62e560237c113df3e86ba26b565cc82838e","src/expr.rs":"5eea3828f3291b0ce5463ed5f0c23fc8a39aeceae68a3247ae02ae467dd35a98","src/ext.rs":"1f648cff1d705a1cea64b32b77482b97a82d2fe0aaf63b40cade91e5c02dc969","src/file.rs":"f86697655222ae294215114f4eae8e6b0b5e2a935d6c479ff8f8f889c4efd2e2","src/gen/clone.rs":"76e89fe155fedf43bc4a252af7e35319b82ce455f584bad8698fdc3f9b7f5d4e","src/gen/debug.rs":"4b05e474e864ce6bf1a5a6ab48ee6c0ecdf41a0d750237990cf2e31963bc1208","src/gen/eq.rs":"79f84836fdcd5cfa352f38055dab7c3246c7757650946c1c701234b11021652a","src/gen/fold.rs":"fcd6a05c8c8e0c36e7ede8593002528b553c8b648fbed452106fd6a8a8c9212a","src/gen/hash.rs":"575e8beae303c1eabda12bf76cbd82672268c502a8ebb8517aab18b40fdbc44e","src/gen/visit.rs":"ced9f6c17d2b3eb3553faab710cb2b3d44d6bca7d1862c8c5da09c3d45debecb","src/gen/visit_mut.rs":"966ea340c53461bf8a1c6bed3c882e4ab8b8907fd18ac35531266f7891ae5f46","src/gen_helper.rs":"ea6c66388365971db6a2fc86cbb208f7eacde77e245bc8623f27a3642a3d7741","src/generics.rs":"b81ce0d3ea0f7accef4590d5181cecc4589395865abaea60b0470da727f17340","src/group.rs":"166f0fbb365471ffa3e4f554b72c2b460cbf7e3a1f9bec6c01ef6bbbcd751041","src/ident.rs":"2443e43561abea7eea577b141422258237a663499c839923d8a5ca6fea2470db","src/item.rs":"419c4d6135a7ca7b8f94b5ba038b6af8fcb3939ae807153a19e3c82e9b01e0b7","src/lib.rs":"de155fed49dffb1756ca8b76d82209fe8bc80c4dda6684f669e98835147869a5","src/lifetime.rs":"b18862ef1e690037a4f308ea897debad7bc5038584e3b26c6d8809752ea0e3c2","src/lit.rs":"667d90787fefac4d25e88509799e8423b9f87125027740c30644dd28adfab95d","src/lookahead.rs":"e2c2b6d55906421e83dab51463b58bc6dcb582f1bff9303c8b62afefb8d71e5f","src/mac.rs":"004cb89f9697564f6c9ee837e08ead68463ef946fb4c13c6c105adf2ba364b2b","src/macros.rs":"936f503c2fcde602f05220954ecaf87625c6138d0af13d33d56c7b6530110084","src/op.rs":"9d499022902743a6a0a19223b356449a979b90e60552d0446497d72750e646a4","src/parse.rs":"7b2f8caddf25a5734cbcdf7cbf043cbf9afbc07b484966cd59ddfcec9f970fb3","src/parse_macro_input.rs":"a5d16859b782bb6a2754c1066468a2f1ea05b57390caa32175bb84064973be7b","src/parse_quote.rs":"d7d996f1382c68b5fbfd4b7327ce1d389cd43c3bb3c4f382a35994d0bb79d8ab","src/pat.rs":"b2de04ae6c01df50eab9d1c3908287aca8424adc2007b926c7bcf74d1f64d40a","src/path.rs":"58a4fb3b1ff76d32cfd84a3914f8cadbf55b363c1929222b362b7465385520ac","src/print.rs":"da6529c1d9d21aaf6c835f66b4e67eacb7cf91a10eb5e9a2143b49bf99b3b5e1","src/punctuated.rs":"44c29523dee76605be2531674fe21ed2f1bbd02559aac8b7a49c70af23129ca1","src/reserved.rs":"e70e028bd55cfa43e23cab4ba29e4dc53a3d91eff685ef2b6e57efc2b87a3428","src/sealed.rs":"896a495a5340eec898527f18bd4ddca408ea03ea0ee3af30074ff48deace778d","src/span.rs":"748c51c6feb223c26d3b1701f5bb98aee823666c775c98106cfa24fe29d8cec1","src/spanned.rs":"3ca016a943637653ab98e373dfb826a120f3c159867346fa38a844439944eb39","src/stmt.rs":"601a6914f1e0bf97ae0d31d474a531d195b8c251a4ded11aa8746ac0018d367b","src/thread.rs":"815eca6bd64f4eef7c447f0809e84108f5428ff50225224b373efd8fbb696874","src/token.rs":"5e423a696f80e281c322f37c87577f9fdc28607e9c007e24896a2b12da62d5ad","src/tt.rs":"32402645b6e82ef1e882945721b59b5fb7b0ee337d1972876362ecacef643d0f","src/ty.rs":"9befd22f8c8ac731b7f68008552a1335797a3ef19184190eec0e103e4ebe18a7","src/verbatim.rs":"96d4280e4556a1841b8dcb306bc35a94d18f71dceb63f3c27a4fe7f776191760","src/whitespace.rs":"e63dd0aa3d34029f17766a8b09c1a6e4479e36c552c8b7023d710a399333aace","tests/common/eq.rs":"e930fb0bdcec3e787986b56785b1db580e5a26a5131df2f2b91a6da37069de15","tests/common/mod.rs":"432ad35577f836a20b517d8c26ed994ac25fe73ef2f461c67688b61b99762015","tests/common/parse.rs":"81580f23583723f7a2a337c4d13ebc021057cd825562fb4e474caa7cc641fed9","tests/debug/gen.rs":"1b7f875344cb04a7dd3df62deac2f410a9d107c097986e68006d87465f5f5306","tests/debug/mod.rs":"3a6bb799f478101f71c84c6f1a854a58afe2f9db43c39017909346ca20262d94","tests/macros/mod.rs":"aff805b35cfd55aef6a1359ff747e4023afcb08d69d86aff4c19465d29dda088","tests/regression.rs":"86731134bfb9bb693d9a4fc62393027de80a8bf031109ea6c7ea475b1ebdde8d","tests/regression/issue1108.rs":"adcc55a42239d344da74216ed85fc14153ddd6ca4dec4872d8339604ba78c185","tests/regression/issue1235.rs":"a2266b10c3f7c7af5734817ab0a3e8b309b51e7d177b63f26e67e6b744d280b0","tests/repo/mod.rs":"159c2c4b6416d26ac42ffc35f6cb587c4c1e2b0f24de9aa42b0337a534d7d86d","tests/repo/progress.rs":"c08d0314a7f3ecf760d471f27da3cd2a500aeb9f1c8331bffb2aa648f9fabf3f","tests/test_asyncness.rs":"cff01db49d28ab23b0b258bc6c0a5cc4071be4fe7248eef344a5d79d2fb649b7","tests/test_attribute.rs":"0ffd99384e1a52ae17d9fed5c4053e411e8f9018decef07ffa621d1faa7329d8","tests/test_derive_input.rs":"62bb86aaaaf730187a46ff700a8e3b2d1a163039b109b6a483aa44ed2b6806fe","tests/test_expr.rs":"41eb343829ad36cdea40cd06d45a90765e7fe6f1e47dd550daf1b6096c3a7b44","tests/test_generics.rs":"54b7d2afc19aa6e9049585f4c8f7d3f0c29ac3bd11a2c769e9df76f18a4f5ecb","tests/test_grouping.rs":"6276c3c73bba649dec5c97904ad2492879f918bc887a2c425d095c654ca0d925","tests/test_ident.rs":"9eb53d1e21edf23e7c9e14dc74dcc2b2538e9221e19dbcc0a44e3acc2e90f3f6","tests/test_item.rs":"a3642c80066f1e7787becfd0278af90a6b7968d6c1249e25e81663aa454cfb2a","tests/test_iterators.rs":"9cf6fde17853ce7d5617e1de9ef901c47ca35c0f1c2dd668c0d0604d7b48598c","tests/test_lit.rs":"137cc9f882cca58f0f2c109535b7ad03c5a35a0aee0cbb9e98ad94710d64e265","tests/test_meta.rs":"65d4586d131f6cac66694ca5e936748ec4e7f7423af6d8da509240e6be14800b","tests/test_parse_buffer.rs":"68d857f776396d064fcc0023c37093c2fbf75ee68e8241d4014d00d1423c18e9","tests/test_parse_stream.rs":"bf1db6fab7ac396fa61012faccbe6ffbc9c3d795ed2900be75e91c5b09b0c62f","tests/test_pat.rs":"d4465f4fc3fd5d6e534ba8efabe1e0ed6da89de4ac7c96effa6bfb880c4287cf","tests/test_path.rs":"71092a5ae2c9143b92a8fe15a92d39958b3c28bd4d4275cfb2d22cbdd53ada07","tests/test_precedence.rs":"736eee861c4c7a3d7d4387d2fb1b5eced1541790d34974f72b0a5532797e73c3","tests/test_receiver.rs":"084eca59984b9a18651da52f2c4407355da3de1335916a12477652999e2d01cc","tests/test_round_trip.rs":"c3c415413d5177a728c7cbbfb7ef44aebbc6a2c821dd56695156e9e33636fd57","tests/test_shebang.rs":"f5772cadad5b56e3112cb16308b779f92bce1c3a48091fc9933deb2276a69331","tests/test_should_parse.rs":"1d3535698a446e2755bfc360676bdb161841a1f454cdef6e7556c6d06a95c89d","tests/test_size.rs":"6720d55569808244ab011364c39931f06aa509cd05f98ab908b0670e8501b3c8","tests/test_stmt.rs":"0601fc32131b5501dfcdc4b4248d46bf21e0a98a49eb19439e1a46869dfb30b7","tests/test_token_trees.rs":"43e56a701817e3c3bfd0cae54a457dd7a38ccb3ca19da41e2b995fdf20e6ed18","tests/test_ty.rs":"f71d7f7f1c038aaabea8dd4c03c0d5752c76d570f8b4885a81659825bbb4d576","tests/test_visibility.rs":"7456fcb3a6634db509748aededff9c2d8b242d511a3e5ee3022e40b232892704","tests/zzz_stable.rs":"2a862e59cb446235ed99aec0e6ada8e16d3ecc30229b29d825b7c0bbc2602989"},"package":"72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"} \ No newline at end of file diff --git a/.cargo-vendor/syn-1.0.109/Cargo.toml b/.cargo-vendor/syn-1.0.109/Cargo.toml deleted file mode 100644 index cd26cef0ad..0000000000 --- a/.cargo-vendor/syn-1.0.109/Cargo.toml +++ /dev/null @@ -1,147 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. -# -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. - -[package] -edition = "2018" -rust-version = "1.31" -name = "syn" -version = "1.0.109" -authors = ["David Tolnay "] -include = [ - "/benches/**", - "/build.rs", - "/Cargo.toml", - "/LICENSE-APACHE", - "/LICENSE-MIT", - "/README.md", - "/src/**", - "/tests/**", -] -description = "Parser for Rust source code" -documentation = "https://docs.rs/syn" -readme = "README.md" -keywords = [ - "macros", - "syn", -] -categories = [ - "development-tools::procedural-macro-helpers", - "parser-implementations", -] -license = "MIT OR Apache-2.0" -repository = "https://github.com/dtolnay/syn" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = [ - "--cfg", - "doc_cfg", -] -targets = ["x86_64-unknown-linux-gnu"] - -[package.metadata.playground] -features = [ - "full", - "visit", - "visit-mut", - "fold", - "extra-traits", -] - -[lib] -doc-scrape-examples = false - -[[bench]] -name = "rust" -harness = false -required-features = [ - "full", - "parsing", -] - -[[bench]] -name = "file" -required-features = [ - "full", - "parsing", -] - -[dependencies.proc-macro2] -version = "1.0.46" -default-features = false - -[dependencies.quote] -version = "1.0" -optional = true -default-features = false - -[dependencies.unicode-ident] -version = "1.0" - -[dev-dependencies.anyhow] -version = "1.0" - -[dev-dependencies.automod] -version = "1.0" - -[dev-dependencies.flate2] -version = "1.0" - -[dev-dependencies.insta] -version = "1.0" - -[dev-dependencies.rayon] -version = "1.0" - -[dev-dependencies.ref-cast] -version = "1.0" - -[dev-dependencies.regex] -version = "1.0" - -[dev-dependencies.reqwest] -version = "0.11" -features = ["blocking"] - -[dev-dependencies.syn-test-suite] -version = "0" - -[dev-dependencies.tar] -version = "0.4.16" - -[dev-dependencies.termcolor] -version = "1.0" - -[dev-dependencies.walkdir] -version = "2.1" - -[features] -clone-impls = [] -default = [ - "derive", - "parsing", - "printing", - "clone-impls", - "proc-macro", -] -derive = [] -extra-traits = [] -fold = [] -full = [] -parsing = [] -printing = ["quote"] -proc-macro = [ - "proc-macro2/proc-macro", - "quote/proc-macro", -] -test = ["syn-test-suite/all-features"] -visit = [] -visit-mut = [] diff --git a/.cargo-vendor/syn-1.0.109/LICENSE-APACHE b/.cargo-vendor/syn-1.0.109/LICENSE-APACHE deleted file mode 100644 index 16fe87b06e..0000000000 --- a/.cargo-vendor/syn-1.0.109/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/.cargo-vendor/syn-1.0.109/LICENSE-MIT b/.cargo-vendor/syn-1.0.109/LICENSE-MIT deleted file mode 100644 index 31aa79387f..0000000000 --- a/.cargo-vendor/syn-1.0.109/LICENSE-MIT +++ /dev/null @@ -1,23 +0,0 @@ -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/.cargo-vendor/syn-1.0.109/README.md b/.cargo-vendor/syn-1.0.109/README.md deleted file mode 100644 index eeef83dd58..0000000000 --- a/.cargo-vendor/syn-1.0.109/README.md +++ /dev/null @@ -1,285 +0,0 @@ -Parser for Rust source code -=========================== - -[github](https://github.com/dtolnay/syn) -[crates.io](https://crates.io/crates/syn) -[docs.rs](https://docs.rs/syn) -[build status](https://github.com/dtolnay/syn/actions?query=branch%3Amaster) - -Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree -of Rust source code. - -Currently this library is geared toward use in Rust procedural macros, but -contains some APIs that may be useful more generally. - -- **Data structures** — Syn provides a complete syntax tree that can represent - any valid Rust source code. The syntax tree is rooted at [`syn::File`] which - represents a full source file, but there are other entry points that may be - useful to procedural macros including [`syn::Item`], [`syn::Expr`] and - [`syn::Type`]. - -- **Derives** — Of particular interest to derive macros is [`syn::DeriveInput`] - which is any of the three legal input items to a derive macro. An example - below shows using this type in a library that can derive implementations of a - user-defined trait. - -- **Parsing** — Parsing in Syn is built around [parser functions] with the - signature `fn(ParseStream) -> Result`. Every syntax tree node defined by - Syn is individually parsable and may be used as a building block for custom - syntaxes, or you may dream up your own brand new syntax without involving any - of our syntax tree types. - -- **Location information** — Every token parsed by Syn is associated with a - `Span` that tracks line and column information back to the source of that - token. These spans allow a procedural macro to display detailed error messages - pointing to all the right places in the user's code. There is an example of - this below. - -- **Feature flags** — Functionality is aggressively feature gated so your - procedural macros enable only what they need, and do not pay in compile time - for all the rest. - -[`syn::File`]: https://docs.rs/syn/1.0/syn/struct.File.html -[`syn::Item`]: https://docs.rs/syn/1.0/syn/enum.Item.html -[`syn::Expr`]: https://docs.rs/syn/1.0/syn/enum.Expr.html -[`syn::Type`]: https://docs.rs/syn/1.0/syn/enum.Type.html -[`syn::DeriveInput`]: https://docs.rs/syn/1.0/syn/struct.DeriveInput.html -[parser functions]: https://docs.rs/syn/1.0/syn/parse/index.html - -*Version requirement: Syn supports rustc 1.31 and up.* - -[*Release notes*](https://github.com/dtolnay/syn/releases) - -
- -## Resources - -The best way to learn about procedural macros is by writing some. Consider -working through [this procedural macro workshop][workshop] to get familiar with -the different types of procedural macros. The workshop contains relevant links -into the Syn documentation as you work through each project. - -[workshop]: https://github.com/dtolnay/proc-macro-workshop - -
- -## Example of a derive macro - -The canonical derive macro using Syn looks like this. We write an ordinary Rust -function tagged with a `proc_macro_derive` attribute and the name of the trait -we are deriving. Any time that derive appears in the user's code, the Rust -compiler passes their data structure as tokens into our macro. We get to execute -arbitrary Rust code to figure out what to do with those tokens, then hand some -tokens back to the compiler to compile into the user's crate. - -[`TokenStream`]: https://doc.rust-lang.org/proc_macro/struct.TokenStream.html - -```toml -[dependencies] -syn = "1.0" -quote = "1.0" - -[lib] -proc-macro = true -``` - -```rust -use proc_macro::TokenStream; -use quote::quote; -use syn::{parse_macro_input, DeriveInput}; - -#[proc_macro_derive(MyMacro)] -pub fn my_macro(input: TokenStream) -> TokenStream { - // Parse the input tokens into a syntax tree - let input = parse_macro_input!(input as DeriveInput); - - // Build the output, possibly using quasi-quotation - let expanded = quote! { - // ... - }; - - // Hand the output tokens back to the compiler - TokenStream::from(expanded) -} -``` - -The [`heapsize`] example directory shows a complete working implementation of a -derive macro. It works on any Rust compiler 1.31+. The example derives a -`HeapSize` trait which computes an estimate of the amount of heap memory owned -by a value. - -[`heapsize`]: examples/heapsize - -```rust -pub trait HeapSize { - /// Total number of bytes of heap memory owned by `self`. - fn heap_size_of_children(&self) -> usize; -} -``` - -The derive macro allows users to write `#[derive(HeapSize)]` on data structures -in their program. - -```rust -#[derive(HeapSize)] -struct Demo<'a, T: ?Sized> { - a: Box, - b: u8, - c: &'a str, - d: String, -} -``` - -
- -## Spans and error reporting - -The token-based procedural macro API provides great control over where the -compiler's error messages are displayed in user code. Consider the error the -user sees if one of their field types does not implement `HeapSize`. - -```rust -#[derive(HeapSize)] -struct Broken { - ok: String, - bad: std::thread::Thread, -} -``` - -By tracking span information all the way through the expansion of a procedural -macro as shown in the `heapsize` example, token-based macros in Syn are able to -trigger errors that directly pinpoint the source of the problem. - -```console -error[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied - --> src/main.rs:7:5 - | -7 | bad: std::thread::Thread, - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HeapSize` is not implemented for `std::thread::Thread` -``` - -
- -## Parsing a custom syntax - -The [`lazy-static`] example directory shows the implementation of a -`functionlike!(...)` procedural macro in which the input tokens are parsed using -Syn's parsing API. - -[`lazy-static`]: examples/lazy-static - -The example reimplements the popular `lazy_static` crate from crates.io as a -procedural macro. - -```rust -lazy_static! { - static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap(); -} -``` - -The implementation shows how to trigger custom warnings and error messages on -the macro input. - -```console -warning: come on, pick a more creative name - --> src/main.rs:10:16 - | -10 | static ref FOO: String = "lazy_static".to_owned(); - | ^^^ -``` - -
- -## Testing - -When testing macros, we often care not just that the macro can be used -successfully but also that when the macro is provided with invalid input it -produces maximally helpful error messages. Consider using the [`trybuild`] crate -to write tests for errors that are emitted by your macro or errors detected by -the Rust compiler in the expanded code following misuse of the macro. Such tests -help avoid regressions from later refactors that mistakenly make an error no -longer trigger or be less helpful than it used to be. - -[`trybuild`]: https://github.com/dtolnay/trybuild - -
- -## Debugging - -When developing a procedural macro it can be helpful to look at what the -generated code looks like. Use `cargo rustc -- -Zunstable-options ---pretty=expanded` or the [`cargo expand`] subcommand. - -[`cargo expand`]: https://github.com/dtolnay/cargo-expand - -To show the expanded code for some crate that uses your procedural macro, run -`cargo expand` from that crate. To show the expanded code for one of your own -test cases, run `cargo expand --test the_test_case` where the last argument is -the name of the test file without the `.rs` extension. - -This write-up by Brandon W Maister discusses debugging in more detail: -[Debugging Rust's new Custom Derive system][debugging]. - -[debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/ - -
- -## Optional features - -Syn puts a lot of functionality behind optional features in order to optimize -compile time for the most common use cases. The following features are -available. - -- **`derive`** *(enabled by default)* — Data structures for representing the - possible input to a derive macro, including structs and enums and types. -- **`full`** — Data structures for representing the syntax tree of all valid - Rust source code, including items and expressions. -- **`parsing`** *(enabled by default)* — Ability to parse input tokens into a - syntax tree node of a chosen type. -- **`printing`** *(enabled by default)* — Ability to print a syntax tree node as - tokens of Rust source code. -- **`visit`** — Trait for traversing a syntax tree. -- **`visit-mut`** — Trait for traversing and mutating in place a syntax tree. -- **`fold`** — Trait for transforming an owned syntax tree. -- **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree - types. -- **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree - types. -- **`proc-macro`** *(enabled by default)* — Runtime dependency on the dynamic - library libproc_macro from rustc toolchain. - -
- -## Proc macro shim - -Syn operates on the token representation provided by the [proc-macro2] crate -from crates.io rather than using the compiler's built in proc-macro crate -directly. This enables code using Syn to execute outside of the context of a -procedural macro, such as in unit tests or build.rs, and we avoid needing -incompatible ecosystems for proc macros vs non-macro use cases. - -In general all of your code should be written against proc-macro2 rather than -proc-macro. The one exception is in the signatures of procedural macro entry -points, which are required by the language to use `proc_macro::TokenStream`. - -The proc-macro2 crate will automatically detect and use the compiler's data -structures when a procedural macro is active. - -[proc-macro2]: https://docs.rs/proc-macro2/1.0/proc_macro2/ - -
- -#### License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - diff --git a/.cargo-vendor/syn-1.0.109/benches/file.rs b/.cargo-vendor/syn-1.0.109/benches/file.rs deleted file mode 100644 index bd4a247df6..0000000000 --- a/.cargo-vendor/syn-1.0.109/benches/file.rs +++ /dev/null @@ -1,55 +0,0 @@ -// $ cargo bench --features full,test --bench file - -#![feature(rustc_private, test)] -#![recursion_limit = "1024"] -#![allow( - clippy::items_after_statements, - clippy::missing_panics_doc, - clippy::must_use_candidate -)] - -extern crate test; - -#[macro_use] -#[path = "../tests/macros/mod.rs"] -mod macros; - -#[path = "../tests/common/mod.rs"] -mod common; -#[path = "../tests/repo/mod.rs"] -pub mod repo; - -use proc_macro2::{Span, TokenStream}; -use std::fs; -use std::str::FromStr; -use syn::parse::{ParseStream, Parser}; -use test::Bencher; - -const FILE: &str = "tests/rust/library/core/src/str/mod.rs"; - -fn get_tokens() -> TokenStream { - repo::clone_rust(); - let content = fs::read_to_string(FILE).unwrap(); - TokenStream::from_str(&content).unwrap() -} - -#[bench] -fn baseline(b: &mut Bencher) { - let tokens = get_tokens(); - b.iter(|| drop(tokens.clone())); -} - -#[bench] -fn create_token_buffer(b: &mut Bencher) { - let tokens = get_tokens(); - fn immediate_fail(_input: ParseStream) -> syn::Result<()> { - Err(syn::Error::new(Span::call_site(), "")) - } - b.iter(|| immediate_fail.parse2(tokens.clone())); -} - -#[bench] -fn parse_file(b: &mut Bencher) { - let tokens = get_tokens(); - b.iter(|| syn::parse2::(tokens.clone())); -} diff --git a/.cargo-vendor/syn-1.0.109/benches/rust.rs b/.cargo-vendor/syn-1.0.109/benches/rust.rs deleted file mode 100644 index e3f8f550ab..0000000000 --- a/.cargo-vendor/syn-1.0.109/benches/rust.rs +++ /dev/null @@ -1,170 +0,0 @@ -// $ cargo bench --features full,test --bench rust -// -// Syn only, useful for profiling: -// $ RUSTFLAGS='--cfg syn_only' cargo build --release --features full,test --bench rust - -#![cfg_attr(not(syn_only), feature(rustc_private))] -#![recursion_limit = "1024"] -#![allow(clippy::cast_lossless, clippy::unnecessary_wraps)] - -#[macro_use] -#[path = "../tests/macros/mod.rs"] -mod macros; - -#[path = "../tests/common/mod.rs"] -mod common; -#[path = "../tests/repo/mod.rs"] -mod repo; - -use std::fs; -use std::time::{Duration, Instant}; - -#[cfg(not(syn_only))] -mod tokenstream_parse { - use proc_macro2::TokenStream; - use std::str::FromStr; - - pub fn bench(content: &str) -> Result<(), ()> { - TokenStream::from_str(content).map(drop).map_err(drop) - } -} - -mod syn_parse { - pub fn bench(content: &str) -> Result<(), ()> { - syn::parse_file(content).map(drop).map_err(drop) - } -} - -#[cfg(not(syn_only))] -mod librustc_parse { - extern crate rustc_data_structures; - extern crate rustc_error_messages; - extern crate rustc_errors; - extern crate rustc_parse; - extern crate rustc_session; - extern crate rustc_span; - - use rustc_data_structures::sync::Lrc; - use rustc_error_messages::FluentBundle; - use rustc_errors::{emitter::Emitter, translation::Translate, Diagnostic, Handler}; - use rustc_session::parse::ParseSess; - use rustc_span::source_map::{FilePathMapping, SourceMap}; - use rustc_span::{edition::Edition, FileName}; - - pub fn bench(content: &str) -> Result<(), ()> { - struct SilentEmitter; - - impl Emitter for SilentEmitter { - fn emit_diagnostic(&mut self, _diag: &Diagnostic) {} - fn source_map(&self) -> Option<&Lrc> { - None - } - } - - impl Translate for SilentEmitter { - fn fluent_bundle(&self) -> Option<&Lrc> { - None - } - fn fallback_fluent_bundle(&self) -> &FluentBundle { - panic!("silent emitter attempted to translate a diagnostic"); - } - } - - rustc_span::create_session_if_not_set_then(Edition::Edition2018, |_| { - let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); - let emitter = Box::new(SilentEmitter); - let handler = Handler::with_emitter(false, None, emitter); - let sess = ParseSess::with_span_handler(handler, cm); - if let Err(diagnostic) = rustc_parse::parse_crate_from_source_str( - FileName::Custom("bench".to_owned()), - content.to_owned(), - &sess, - ) { - diagnostic.cancel(); - return Err(()); - }; - Ok(()) - }) - } -} - -#[cfg(not(syn_only))] -mod read_from_disk { - pub fn bench(content: &str) -> Result<(), ()> { - _ = content; - Ok(()) - } -} - -fn exec(mut codepath: impl FnMut(&str) -> Result<(), ()>) -> Duration { - let begin = Instant::now(); - let mut success = 0; - let mut total = 0; - - walkdir::WalkDir::new("tests/rust/src") - .into_iter() - .filter_entry(repo::base_dir_filter) - .for_each(|entry| { - let entry = entry.unwrap(); - let path = entry.path(); - if path.is_dir() { - return; - } - let content = fs::read_to_string(path).unwrap(); - let ok = codepath(&content).is_ok(); - success += ok as usize; - total += 1; - if !ok { - eprintln!("FAIL {}", path.display()); - } - }); - - assert_eq!(success, total); - begin.elapsed() -} - -fn main() { - repo::clone_rust(); - - macro_rules! testcases { - ($($(#[$cfg:meta])* $name:ident,)*) => { - [ - $( - $(#[$cfg])* - (stringify!($name), $name::bench as fn(&str) -> Result<(), ()>), - )* - ] - }; - } - - #[cfg(not(syn_only))] - { - let mut lines = 0; - let mut files = 0; - exec(|content| { - lines += content.lines().count(); - files += 1; - Ok(()) - }); - eprintln!("\n{} lines in {} files", lines, files); - } - - for (name, f) in testcases!( - #[cfg(not(syn_only))] - read_from_disk, - #[cfg(not(syn_only))] - tokenstream_parse, - syn_parse, - #[cfg(not(syn_only))] - librustc_parse, - ) { - eprint!("{:20}", format!("{}:", name)); - let elapsed = exec(f); - eprintln!( - "elapsed={}.{:03}s", - elapsed.as_secs(), - elapsed.subsec_millis(), - ); - } - eprintln!(); -} diff --git a/.cargo-vendor/syn-1.0.109/build.rs b/.cargo-vendor/syn-1.0.109/build.rs deleted file mode 100644 index 1a2c077bf0..0000000000 --- a/.cargo-vendor/syn-1.0.109/build.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::env; -use std::process::Command; -use std::str; - -// The rustc-cfg strings below are *not* public API. Please let us know by -// opening a GitHub issue if your build environment requires some way to enable -// these cfgs other than by executing our build script. -fn main() { - let compiler = match rustc_version() { - Some(compiler) => compiler, - None => return, - }; - - if compiler.minor < 36 { - println!("cargo:rustc-cfg=syn_omit_await_from_token_macro"); - } - - if compiler.minor < 39 { - println!("cargo:rustc-cfg=syn_no_const_vec_new"); - } - - if compiler.minor < 40 { - println!("cargo:rustc-cfg=syn_no_non_exhaustive"); - } - - if compiler.minor < 56 { - println!("cargo:rustc-cfg=syn_no_negative_literal_parse"); - } - - if !compiler.nightly { - println!("cargo:rustc-cfg=syn_disable_nightly_tests"); - } -} - -struct Compiler { - minor: u32, - nightly: bool, -} - -fn rustc_version() -> Option { - let rustc = env::var_os("RUSTC")?; - let output = Command::new(rustc).arg("--version").output().ok()?; - let version = str::from_utf8(&output.stdout).ok()?; - let mut pieces = version.split('.'); - if pieces.next() != Some("rustc 1") { - return None; - } - let minor = pieces.next()?.parse().ok()?; - let nightly = version.contains("nightly") || version.ends_with("-dev"); - Some(Compiler { minor, nightly }) -} diff --git a/.cargo-vendor/syn-1.0.109/src/attr.rs b/.cargo-vendor/syn-1.0.109/src/attr.rs deleted file mode 100644 index bace94f43c..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/attr.rs +++ /dev/null @@ -1,662 +0,0 @@ -use super::*; -use crate::punctuated::Punctuated; -use proc_macro2::TokenStream; -use std::iter; -use std::slice; - -#[cfg(feature = "parsing")] -use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result}; -#[cfg(feature = "parsing")] -use crate::punctuated::Pair; - -ast_struct! { - /// An attribute like `#[repr(transparent)]`. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - /// - ///
- /// - /// # Syntax - /// - /// Rust has six types of attributes. - /// - /// - Outer attributes like `#[repr(transparent)]`. These appear outside or - /// in front of the item they describe. - /// - Inner attributes like `#![feature(proc_macro)]`. These appear inside - /// of the item they describe, usually a module. - /// - Outer doc comments like `/// # Example`. - /// - Inner doc comments like `//! Please file an issue`. - /// - Outer block comments `/** # Example */`. - /// - Inner block comments `/*! Please file an issue */`. - /// - /// The `style` field of type `AttrStyle` distinguishes whether an attribute - /// is outer or inner. Doc comments and block comments are promoted to - /// attributes, as this is how they are processed by the compiler and by - /// `macro_rules!` macros. - /// - /// The `path` field gives the possibly colon-delimited path against which - /// the attribute is resolved. It is equal to `"doc"` for desugared doc - /// comments. The `tokens` field contains the rest of the attribute body as - /// tokens. - /// - /// ```text - /// #[derive(Copy)] #[crate::precondition x < 5] - /// ^^^^^^~~~~~~ ^^^^^^^^^^^^^^^^^^^ ~~~~~ - /// path tokens path tokens - /// ``` - /// - ///
- /// - /// # Parsing from tokens to Attribute - /// - /// This type does not implement the [`Parse`] trait and thus cannot be - /// parsed directly by [`ParseStream::parse`]. Instead use - /// [`ParseStream::call`] with one of the two parser functions - /// [`Attribute::parse_outer`] or [`Attribute::parse_inner`] depending on - /// which you intend to parse. - /// - /// [`Parse`]: parse::Parse - /// [`ParseStream::parse`]: parse::ParseBuffer::parse - /// [`ParseStream::call`]: parse::ParseBuffer::call - /// - /// ``` - /// use syn::{Attribute, Ident, Result, Token}; - /// use syn::parse::{Parse, ParseStream}; - /// - /// // Parses a unit struct with attributes. - /// // - /// // #[path = "s.tmpl"] - /// // struct S; - /// struct UnitStruct { - /// attrs: Vec, - /// struct_token: Token![struct], - /// name: Ident, - /// semi_token: Token![;], - /// } - /// - /// impl Parse for UnitStruct { - /// fn parse(input: ParseStream) -> Result { - /// Ok(UnitStruct { - /// attrs: input.call(Attribute::parse_outer)?, - /// struct_token: input.parse()?, - /// name: input.parse()?, - /// semi_token: input.parse()?, - /// }) - /// } - /// } - /// ``` - /// - ///


- /// - /// # Parsing from Attribute to structured arguments - /// - /// The grammar of attributes in Rust is very flexible, which makes the - /// syntax tree not that useful on its own. In particular, arguments of the - /// attribute are held in an arbitrary `tokens: TokenStream`. Macros are - /// expected to check the `path` of the attribute, decide whether they - /// recognize it, and then parse the remaining tokens according to whatever - /// grammar they wish to require for that kind of attribute. - /// - /// If the attribute you are parsing is expected to conform to the - /// conventional structured form of attribute, use [`parse_meta()`] to - /// obtain that structured representation. If the attribute follows some - /// other grammar of its own, use [`parse_args()`] to parse that into the - /// expected data structure. - /// - /// [`parse_meta()`]: Attribute::parse_meta - /// [`parse_args()`]: Attribute::parse_args - /// - ///


- /// - /// # Doc comments - /// - /// The compiler transforms doc comments, such as `/// comment` and `/*! - /// comment */`, into attributes before macros are expanded. Each comment is - /// expanded into an attribute of the form `#[doc = r"comment"]`. - /// - /// As an example, the following `mod` items are expanded identically: - /// - /// ``` - /// # use syn::{ItemMod, parse_quote}; - /// let doc: ItemMod = parse_quote! { - /// /// Single line doc comments - /// /// We write so many! - /// /** - /// * Multi-line comments... - /// * May span many lines - /// */ - /// mod example { - /// //! Of course, they can be inner too - /// /*! And fit in a single line */ - /// } - /// }; - /// let attr: ItemMod = parse_quote! { - /// #[doc = r" Single line doc comments"] - /// #[doc = r" We write so many!"] - /// #[doc = r" - /// * Multi-line comments... - /// * May span many lines - /// "] - /// mod example { - /// #![doc = r" Of course, they can be inner too"] - /// #![doc = r" And fit in a single line "] - /// } - /// }; - /// assert_eq!(doc, attr); - /// ``` - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct Attribute { - pub pound_token: Token![#], - pub style: AttrStyle, - pub bracket_token: token::Bracket, - pub path: Path, - pub tokens: TokenStream, - } -} - -impl Attribute { - /// Parses the content of the attribute, consisting of the path and tokens, - /// as a [`Meta`] if possible. - /// - /// *This function is available only if Syn is built with the `"parsing"` - /// feature.* - #[cfg(feature = "parsing")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_meta(&self) -> Result { - fn clone_ident_segment(segment: &PathSegment) -> PathSegment { - PathSegment { - ident: segment.ident.clone(), - arguments: PathArguments::None, - } - } - - let path = Path { - leading_colon: self - .path - .leading_colon - .as_ref() - .map(|colon| Token![::](colon.spans)), - segments: self - .path - .segments - .pairs() - .map(|pair| match pair { - Pair::Punctuated(seg, punct) => { - Pair::Punctuated(clone_ident_segment(seg), Token![::](punct.spans)) - } - Pair::End(seg) => Pair::End(clone_ident_segment(seg)), - }) - .collect(), - }; - - let parser = |input: ParseStream| parsing::parse_meta_after_path(path, input); - parse::Parser::parse2(parser, self.tokens.clone()) - } - - /// Parse the arguments to the attribute as a syntax tree. - /// - /// This is similar to `syn::parse2::(attr.tokens)` except that: - /// - /// - the surrounding delimiters are *not* included in the input to the - /// parser; and - /// - the error message has a more useful span when `tokens` is empty. - /// - /// ```text - /// #[my_attr(value < 5)] - /// ^^^^^^^^^ what gets parsed - /// ``` - /// - /// *This function is available only if Syn is built with the `"parsing"` - /// feature.* - #[cfg(feature = "parsing")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_args(&self) -> Result { - self.parse_args_with(T::parse) - } - - /// Parse the arguments to the attribute using the given parser. - /// - /// *This function is available only if Syn is built with the `"parsing"` - /// feature.* - #[cfg(feature = "parsing")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_args_with(&self, parser: F) -> Result { - let parser = |input: ParseStream| { - let args = enter_args(self, input)?; - parse::parse_stream(parser, &args) - }; - parser.parse2(self.tokens.clone()) - } - - /// Parses zero or more outer attributes from the stream. - /// - /// *This function is available only if Syn is built with the `"parsing"` - /// feature.* - #[cfg(feature = "parsing")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_outer(input: ParseStream) -> Result> { - let mut attrs = Vec::new(); - while input.peek(Token![#]) { - attrs.push(input.call(parsing::single_parse_outer)?); - } - Ok(attrs) - } - - /// Parses zero or more inner attributes from the stream. - /// - /// *This function is available only if Syn is built with the `"parsing"` - /// feature.* - #[cfg(feature = "parsing")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_inner(input: ParseStream) -> Result> { - let mut attrs = Vec::new(); - parsing::parse_inner(input, &mut attrs)?; - Ok(attrs) - } -} - -#[cfg(feature = "parsing")] -fn expected_parentheses(attr: &Attribute) -> String { - let style = match attr.style { - AttrStyle::Outer => "#", - AttrStyle::Inner(_) => "#!", - }; - - let mut path = String::new(); - for segment in &attr.path.segments { - if !path.is_empty() || attr.path.leading_colon.is_some() { - path += "::"; - } - path += &segment.ident.to_string(); - } - - format!("{}[{}(...)]", style, path) -} - -#[cfg(feature = "parsing")] -fn enter_args<'a>(attr: &Attribute, input: ParseStream<'a>) -> Result> { - if input.is_empty() { - let expected = expected_parentheses(attr); - let msg = format!("expected attribute arguments in parentheses: {}", expected); - return Err(crate::error::new2( - attr.pound_token.span, - attr.bracket_token.span, - msg, - )); - } else if input.peek(Token![=]) { - let expected = expected_parentheses(attr); - let msg = format!("expected parentheses: {}", expected); - return Err(input.error(msg)); - }; - - let content; - if input.peek(token::Paren) { - parenthesized!(content in input); - } else if input.peek(token::Bracket) { - bracketed!(content in input); - } else if input.peek(token::Brace) { - braced!(content in input); - } else { - return Err(input.error("unexpected token in attribute arguments")); - } - - if input.is_empty() { - Ok(content) - } else { - Err(input.error("unexpected token in attribute arguments")) - } -} - -ast_enum! { - /// Distinguishes between attributes that decorate an item and attributes - /// that are contained within an item. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - /// - /// # Outer attributes - /// - /// - `#[repr(transparent)]` - /// - `/// # Example` - /// - `/** Please file an issue */` - /// - /// # Inner attributes - /// - /// - `#![feature(proc_macro)]` - /// - `//! # Example` - /// - `/*! Please file an issue */` - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub enum AttrStyle { - Outer, - Inner(Token![!]), - } -} - -ast_enum_of_structs! { - /// Content of a compile-time structured attribute. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - /// - /// ## Path - /// - /// A meta path is like the `test` in `#[test]`. - /// - /// ## List - /// - /// A meta list is like the `derive(Copy)` in `#[derive(Copy)]`. - /// - /// ## NameValue - /// - /// A name-value meta is like the `path = "..."` in `#[path = - /// "sys/windows.rs"]`. - /// - /// # Syntax tree enum - /// - /// This type is a [syntax tree enum]. - /// - /// [syntax tree enum]: Expr#syntax-tree-enums - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub enum Meta { - Path(Path), - - /// A structured list within an attribute, like `derive(Copy, Clone)`. - List(MetaList), - - /// A name-value pair within an attribute, like `feature = "nightly"`. - NameValue(MetaNameValue), - } -} - -ast_struct! { - /// A structured list within an attribute, like `derive(Copy, Clone)`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct MetaList { - pub path: Path, - pub paren_token: token::Paren, - pub nested: Punctuated, - } -} - -ast_struct! { - /// A name-value pair within an attribute, like `feature = "nightly"`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct MetaNameValue { - pub path: Path, - pub eq_token: Token![=], - pub lit: Lit, - } -} - -impl Meta { - /// Returns the identifier that begins this structured meta item. - /// - /// For example this would return the `test` in `#[test]`, the `derive` in - /// `#[derive(Copy)]`, and the `path` in `#[path = "sys/windows.rs"]`. - pub fn path(&self) -> &Path { - match self { - Meta::Path(path) => path, - Meta::List(meta) => &meta.path, - Meta::NameValue(meta) => &meta.path, - } - } -} - -ast_enum_of_structs! { - /// Element of a compile-time attribute list. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub enum NestedMeta { - /// A structured meta item, like the `Copy` in `#[derive(Copy)]` which - /// would be a nested `Meta::Path`. - Meta(Meta), - - /// A Rust literal, like the `"new_name"` in `#[rename("new_name")]`. - Lit(Lit), - } -} - -/// Conventional argument type associated with an invocation of an attribute -/// macro. -/// -/// For example if we are developing an attribute macro that is intended to be -/// invoked on function items as follows: -/// -/// ``` -/// # const IGNORE: &str = stringify! { -/// #[my_attribute(path = "/v1/refresh")] -/// # }; -/// pub fn refresh() { -/// /* ... */ -/// } -/// ``` -/// -/// The implementation of this macro would want to parse its attribute arguments -/// as type `AttributeArgs`. -/// -/// ``` -/// # extern crate proc_macro; -/// # -/// use proc_macro::TokenStream; -/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; -/// -/// # const IGNORE: &str = stringify! { -/// #[proc_macro_attribute] -/// # }; -/// pub fn my_attribute(args: TokenStream, input: TokenStream) -> TokenStream { -/// let args = parse_macro_input!(args as AttributeArgs); -/// let input = parse_macro_input!(input as ItemFn); -/// -/// /* ... */ -/// # "".parse().unwrap() -/// } -/// ``` -#[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] -pub type AttributeArgs = Vec; - -pub trait FilterAttrs<'a> { - type Ret: Iterator; - - fn outer(self) -> Self::Ret; - fn inner(self) -> Self::Ret; -} - -impl<'a> FilterAttrs<'a> for &'a [Attribute] { - type Ret = iter::Filter, fn(&&Attribute) -> bool>; - - fn outer(self) -> Self::Ret { - fn is_outer(attr: &&Attribute) -> bool { - match attr.style { - AttrStyle::Outer => true, - AttrStyle::Inner(_) => false, - } - } - self.iter().filter(is_outer) - } - - fn inner(self) -> Self::Ret { - fn is_inner(attr: &&Attribute) -> bool { - match attr.style { - AttrStyle::Inner(_) => true, - AttrStyle::Outer => false, - } - } - self.iter().filter(is_inner) - } -} - -#[cfg(feature = "parsing")] -pub mod parsing { - use super::*; - use crate::ext::IdentExt; - use crate::parse::{Parse, ParseStream, Result}; - - pub fn parse_inner(input: ParseStream, attrs: &mut Vec) -> Result<()> { - while input.peek(Token![#]) && input.peek2(Token![!]) { - attrs.push(input.call(parsing::single_parse_inner)?); - } - Ok(()) - } - - pub fn single_parse_inner(input: ParseStream) -> Result { - let content; - Ok(Attribute { - pound_token: input.parse()?, - style: AttrStyle::Inner(input.parse()?), - bracket_token: bracketed!(content in input), - path: content.call(Path::parse_mod_style)?, - tokens: content.parse()?, - }) - } - - pub fn single_parse_outer(input: ParseStream) -> Result { - let content; - Ok(Attribute { - pound_token: input.parse()?, - style: AttrStyle::Outer, - bracket_token: bracketed!(content in input), - path: content.call(Path::parse_mod_style)?, - tokens: content.parse()?, - }) - } - - // Like Path::parse_mod_style but accepts keywords in the path. - fn parse_meta_path(input: ParseStream) -> Result { - Ok(Path { - leading_colon: input.parse()?, - segments: { - let mut segments = Punctuated::new(); - while input.peek(Ident::peek_any) { - let ident = Ident::parse_any(input)?; - segments.push_value(PathSegment::from(ident)); - if !input.peek(Token![::]) { - break; - } - let punct = input.parse()?; - segments.push_punct(punct); - } - if segments.is_empty() { - return Err(input.error("expected path")); - } else if segments.trailing_punct() { - return Err(input.error("expected path segment")); - } - segments - }, - }) - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for Meta { - fn parse(input: ParseStream) -> Result { - let path = input.call(parse_meta_path)?; - parse_meta_after_path(path, input) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for MetaList { - fn parse(input: ParseStream) -> Result { - let path = input.call(parse_meta_path)?; - parse_meta_list_after_path(path, input) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for MetaNameValue { - fn parse(input: ParseStream) -> Result { - let path = input.call(parse_meta_path)?; - parse_meta_name_value_after_path(path, input) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for NestedMeta { - fn parse(input: ParseStream) -> Result { - if input.peek(Lit) && !(input.peek(LitBool) && input.peek2(Token![=])) { - input.parse().map(NestedMeta::Lit) - } else if input.peek(Ident::peek_any) - || input.peek(Token![::]) && input.peek3(Ident::peek_any) - { - input.parse().map(NestedMeta::Meta) - } else { - Err(input.error("expected identifier or literal")) - } - } - } - - pub fn parse_meta_after_path(path: Path, input: ParseStream) -> Result { - if input.peek(token::Paren) { - parse_meta_list_after_path(path, input).map(Meta::List) - } else if input.peek(Token![=]) { - parse_meta_name_value_after_path(path, input).map(Meta::NameValue) - } else { - Ok(Meta::Path(path)) - } - } - - fn parse_meta_list_after_path(path: Path, input: ParseStream) -> Result { - let content; - Ok(MetaList { - path, - paren_token: parenthesized!(content in input), - nested: content.parse_terminated(NestedMeta::parse)?, - }) - } - - fn parse_meta_name_value_after_path(path: Path, input: ParseStream) -> Result { - Ok(MetaNameValue { - path, - eq_token: input.parse()?, - lit: input.parse()?, - }) - } -} - -#[cfg(feature = "printing")] -mod printing { - use super::*; - use proc_macro2::TokenStream; - use quote::ToTokens; - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for Attribute { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.pound_token.to_tokens(tokens); - if let AttrStyle::Inner(b) = &self.style { - b.to_tokens(tokens); - } - self.bracket_token.surround(tokens, |tokens| { - self.path.to_tokens(tokens); - self.tokens.to_tokens(tokens); - }); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for MetaList { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.path.to_tokens(tokens); - self.paren_token.surround(tokens, |tokens| { - self.nested.to_tokens(tokens); - }); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for MetaNameValue { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.path.to_tokens(tokens); - self.eq_token.to_tokens(tokens); - self.lit.to_tokens(tokens); - } - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/await.rs b/.cargo-vendor/syn-1.0.109/src/await.rs deleted file mode 100644 index 038c6a5d12..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/await.rs +++ /dev/null @@ -1,2 +0,0 @@ -// See include!("await.rs") in token.rs. -export_token_macro! {[await]} diff --git a/.cargo-vendor/syn-1.0.109/src/bigint.rs b/.cargo-vendor/syn-1.0.109/src/bigint.rs deleted file mode 100644 index 5397d6beee..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/bigint.rs +++ /dev/null @@ -1,66 +0,0 @@ -use std::ops::{AddAssign, MulAssign}; - -// For implementing base10_digits() accessor on LitInt. -pub struct BigInt { - digits: Vec, -} - -impl BigInt { - pub fn new() -> Self { - BigInt { digits: Vec::new() } - } - - pub fn to_string(&self) -> String { - let mut repr = String::with_capacity(self.digits.len()); - - let mut has_nonzero = false; - for digit in self.digits.iter().rev() { - has_nonzero |= *digit != 0; - if has_nonzero { - repr.push((*digit + b'0') as char); - } - } - - if repr.is_empty() { - repr.push('0'); - } - - repr - } - - fn reserve_two_digits(&mut self) { - let len = self.digits.len(); - let desired = - len + !self.digits.ends_with(&[0, 0]) as usize + !self.digits.ends_with(&[0]) as usize; - self.digits.resize(desired, 0); - } -} - -impl AddAssign for BigInt { - // Assumes increment <16. - fn add_assign(&mut self, mut increment: u8) { - self.reserve_two_digits(); - - let mut i = 0; - while increment > 0 { - let sum = self.digits[i] + increment; - self.digits[i] = sum % 10; - increment = sum / 10; - i += 1; - } - } -} - -impl MulAssign for BigInt { - // Assumes base <=16. - fn mul_assign(&mut self, base: u8) { - self.reserve_two_digits(); - - let mut carry = 0; - for digit in &mut self.digits { - let prod = *digit * base + carry; - *digit = prod % 10; - carry = prod / 10; - } - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/buffer.rs b/.cargo-vendor/syn-1.0.109/src/buffer.rs deleted file mode 100644 index 0d5cf30d57..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/buffer.rs +++ /dev/null @@ -1,398 +0,0 @@ -//! A stably addressed token buffer supporting efficient traversal based on a -//! cheaply copyable cursor. -//! -//! *This module is available only if Syn is built with the `"parsing"` feature.* - -// This module is heavily commented as it contains most of the unsafe code in -// Syn, and caution should be used when editing it. The public-facing interface -// is 100% safe but the implementation is fragile internally. - -#[cfg(all( - not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), - feature = "proc-macro" -))] -use crate::proc_macro as pm; -use crate::Lifetime; -use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree}; -use std::cmp::Ordering; -use std::marker::PhantomData; - -/// Internal type which is used instead of `TokenTree` to represent a token tree -/// within a `TokenBuffer`. -enum Entry { - // Mimicking types from proc-macro. - // Group entries contain the offset to the matching End entry. - Group(Group, usize), - Ident(Ident), - Punct(Punct), - Literal(Literal), - // End entries contain the offset (negative) to the start of the buffer. - End(isize), -} - -/// A buffer that can be efficiently traversed multiple times, unlike -/// `TokenStream` which requires a deep copy in order to traverse more than -/// once. -/// -/// *This type is available only if Syn is built with the `"parsing"` feature.* -pub struct TokenBuffer { - // NOTE: Do not implement clone on this - while the current design could be - // cloned, other designs which could be desirable may not be cloneable. - entries: Box<[Entry]>, -} - -impl TokenBuffer { - fn recursive_new(entries: &mut Vec, stream: TokenStream) { - for tt in stream { - match tt { - TokenTree::Ident(ident) => entries.push(Entry::Ident(ident)), - TokenTree::Punct(punct) => entries.push(Entry::Punct(punct)), - TokenTree::Literal(literal) => entries.push(Entry::Literal(literal)), - TokenTree::Group(group) => { - let group_start_index = entries.len(); - entries.push(Entry::End(0)); // we replace this below - Self::recursive_new(entries, group.stream()); - let group_end_index = entries.len(); - entries.push(Entry::End(-(group_end_index as isize))); - let group_end_offset = group_end_index - group_start_index; - entries[group_start_index] = Entry::Group(group, group_end_offset); - } - } - } - } - - /// Creates a `TokenBuffer` containing all the tokens from the input - /// `proc_macro::TokenStream`. - /// - /// *This method is available only if Syn is built with both the `"parsing"` and - /// `"proc-macro"` features.* - #[cfg(all( - not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), - feature = "proc-macro" - ))] - pub fn new(stream: pm::TokenStream) -> Self { - Self::new2(stream.into()) - } - - /// Creates a `TokenBuffer` containing all the tokens from the input - /// `proc_macro2::TokenStream`. - pub fn new2(stream: TokenStream) -> Self { - let mut entries = Vec::new(); - Self::recursive_new(&mut entries, stream); - entries.push(Entry::End(-(entries.len() as isize))); - Self { - entries: entries.into_boxed_slice(), - } - } - - /// Creates a cursor referencing the first token in the buffer and able to - /// traverse until the end of the buffer. - pub fn begin(&self) -> Cursor { - let ptr = self.entries.as_ptr(); - unsafe { Cursor::create(ptr, ptr.add(self.entries.len() - 1)) } - } -} - -/// A cheaply copyable cursor into a `TokenBuffer`. -/// -/// This cursor holds a shared reference into the immutable data which is used -/// internally to represent a `TokenStream`, and can be efficiently manipulated -/// and copied around. -/// -/// An empty `Cursor` can be created directly, or one may create a `TokenBuffer` -/// object and get a cursor to its first token with `begin()`. -/// -/// Two cursors are equal if they have the same location in the same input -/// stream, and have the same scope. -/// -/// *This type is available only if Syn is built with the `"parsing"` feature.* -pub struct Cursor<'a> { - // The current entry which the `Cursor` is pointing at. - ptr: *const Entry, - // This is the only `Entry::End` object which this cursor is allowed to - // point at. All other `End` objects are skipped over in `Cursor::create`. - scope: *const Entry, - // Cursor is covariant in 'a. This field ensures that our pointers are still - // valid. - marker: PhantomData<&'a Entry>, -} - -impl<'a> Cursor<'a> { - /// Creates a cursor referencing a static empty TokenStream. - pub fn empty() -> Self { - // It's safe in this situation for us to put an `Entry` object in global - // storage, despite it not actually being safe to send across threads - // (`Ident` is a reference into a thread-local table). This is because - // this entry never includes a `Ident` object. - // - // This wrapper struct allows us to break the rules and put a `Sync` - // object in global storage. - struct UnsafeSyncEntry(Entry); - unsafe impl Sync for UnsafeSyncEntry {} - static EMPTY_ENTRY: UnsafeSyncEntry = UnsafeSyncEntry(Entry::End(0)); - - Cursor { - ptr: &EMPTY_ENTRY.0, - scope: &EMPTY_ENTRY.0, - marker: PhantomData, - } - } - - /// This create method intelligently exits non-explicitly-entered - /// `None`-delimited scopes when the cursor reaches the end of them, - /// allowing for them to be treated transparently. - unsafe fn create(mut ptr: *const Entry, scope: *const Entry) -> Self { - // NOTE: If we're looking at a `End`, we want to advance the cursor - // past it, unless `ptr == scope`, which means that we're at the edge of - // our cursor's scope. We should only have `ptr != scope` at the exit - // from None-delimited groups entered with `ignore_none`. - while let Entry::End(_) = *ptr { - if ptr == scope { - break; - } - ptr = ptr.add(1); - } - - Cursor { - ptr, - scope, - marker: PhantomData, - } - } - - /// Get the current entry. - fn entry(self) -> &'a Entry { - unsafe { &*self.ptr } - } - - /// Bump the cursor to point at the next token after the current one. This - /// is undefined behavior if the cursor is currently looking at an - /// `Entry::End`. - /// - /// If the cursor is looking at an `Entry::Group`, the bumped cursor will - /// point at the first token in the group (with the same scope end). - unsafe fn bump_ignore_group(self) -> Cursor<'a> { - Cursor::create(self.ptr.offset(1), self.scope) - } - - /// While the cursor is looking at a `None`-delimited group, move it to look - /// at the first token inside instead. If the group is empty, this will move - /// the cursor past the `None`-delimited group. - /// - /// WARNING: This mutates its argument. - fn ignore_none(&mut self) { - while let Entry::Group(group, _) = self.entry() { - if group.delimiter() == Delimiter::None { - unsafe { *self = self.bump_ignore_group() }; - } else { - break; - } - } - } - - /// Checks whether the cursor is currently pointing at the end of its valid - /// scope. - pub fn eof(self) -> bool { - // We're at eof if we're at the end of our scope. - self.ptr == self.scope - } - - /// If the cursor is pointing at a `Group` with the given delimiter, returns - /// a cursor into that group and one pointing to the next `TokenTree`. - pub fn group(mut self, delim: Delimiter) -> Option<(Cursor<'a>, Span, Cursor<'a>)> { - // If we're not trying to enter a none-delimited group, we want to - // ignore them. We have to make sure to _not_ ignore them when we want - // to enter them, of course. For obvious reasons. - if delim != Delimiter::None { - self.ignore_none(); - } - - if let Entry::Group(group, end_offset) = self.entry() { - if group.delimiter() == delim { - let end_of_group = unsafe { self.ptr.add(*end_offset) }; - let inside_of_group = unsafe { Cursor::create(self.ptr.add(1), end_of_group) }; - let after_group = unsafe { Cursor::create(end_of_group, self.scope) }; - return Some((inside_of_group, group.span(), after_group)); - } - } - - None - } - - /// If the cursor is pointing at a `Ident`, returns it along with a cursor - /// pointing at the next `TokenTree`. - pub fn ident(mut self) -> Option<(Ident, Cursor<'a>)> { - self.ignore_none(); - match self.entry() { - Entry::Ident(ident) => Some((ident.clone(), unsafe { self.bump_ignore_group() })), - _ => None, - } - } - - /// If the cursor is pointing at a `Punct`, returns it along with a cursor - /// pointing at the next `TokenTree`. - pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> { - self.ignore_none(); - match self.entry() { - Entry::Punct(punct) if punct.as_char() != '\'' => { - Some((punct.clone(), unsafe { self.bump_ignore_group() })) - } - _ => None, - } - } - - /// If the cursor is pointing at a `Literal`, return it along with a cursor - /// pointing at the next `TokenTree`. - pub fn literal(mut self) -> Option<(Literal, Cursor<'a>)> { - self.ignore_none(); - match self.entry() { - Entry::Literal(literal) => Some((literal.clone(), unsafe { self.bump_ignore_group() })), - _ => None, - } - } - - /// If the cursor is pointing at a `Lifetime`, returns it along with a - /// cursor pointing at the next `TokenTree`. - pub fn lifetime(mut self) -> Option<(Lifetime, Cursor<'a>)> { - self.ignore_none(); - match self.entry() { - Entry::Punct(punct) if punct.as_char() == '\'' && punct.spacing() == Spacing::Joint => { - let next = unsafe { self.bump_ignore_group() }; - let (ident, rest) = next.ident()?; - let lifetime = Lifetime { - apostrophe: punct.span(), - ident, - }; - Some((lifetime, rest)) - } - _ => None, - } - } - - /// Copies all remaining tokens visible from this cursor into a - /// `TokenStream`. - pub fn token_stream(self) -> TokenStream { - let mut tts = Vec::new(); - let mut cursor = self; - while let Some((tt, rest)) = cursor.token_tree() { - tts.push(tt); - cursor = rest; - } - tts.into_iter().collect() - } - - /// If the cursor is pointing at a `TokenTree`, returns it along with a - /// cursor pointing at the next `TokenTree`. - /// - /// Returns `None` if the cursor has reached the end of its stream. - /// - /// This method does not treat `None`-delimited groups as transparent, and - /// will return a `Group(None, ..)` if the cursor is looking at one. - pub fn token_tree(self) -> Option<(TokenTree, Cursor<'a>)> { - let (tree, len) = match self.entry() { - Entry::Group(group, end_offset) => (group.clone().into(), *end_offset), - Entry::Literal(literal) => (literal.clone().into(), 1), - Entry::Ident(ident) => (ident.clone().into(), 1), - Entry::Punct(punct) => (punct.clone().into(), 1), - Entry::End(_) => return None, - }; - - let rest = unsafe { Cursor::create(self.ptr.add(len), self.scope) }; - Some((tree, rest)) - } - - /// Returns the `Span` of the current token, or `Span::call_site()` if this - /// cursor points to eof. - pub fn span(self) -> Span { - match self.entry() { - Entry::Group(group, _) => group.span(), - Entry::Literal(literal) => literal.span(), - Entry::Ident(ident) => ident.span(), - Entry::Punct(punct) => punct.span(), - Entry::End(_) => Span::call_site(), - } - } - - /// Skip over the next token without cloning it. Returns `None` if this - /// cursor points to eof. - /// - /// This method treats `'lifetimes` as a single token. - pub(crate) fn skip(self) -> Option> { - let len = match self.entry() { - Entry::End(_) => return None, - - // Treat lifetimes as a single tt for the purposes of 'skip'. - Entry::Punct(punct) if punct.as_char() == '\'' && punct.spacing() == Spacing::Joint => { - match unsafe { &*self.ptr.add(1) } { - Entry::Ident(_) => 2, - _ => 1, - } - } - - Entry::Group(_, end_offset) => *end_offset, - _ => 1, - }; - - Some(unsafe { Cursor::create(self.ptr.add(len), self.scope) }) - } -} - -impl<'a> Copy for Cursor<'a> {} - -impl<'a> Clone for Cursor<'a> { - fn clone(&self) -> Self { - *self - } -} - -impl<'a> Eq for Cursor<'a> {} - -impl<'a> PartialEq for Cursor<'a> { - fn eq(&self, other: &Self) -> bool { - self.ptr == other.ptr - } -} - -impl<'a> PartialOrd for Cursor<'a> { - fn partial_cmp(&self, other: &Self) -> Option { - if same_buffer(*self, *other) { - Some(self.ptr.cmp(&other.ptr)) - } else { - None - } - } -} - -pub(crate) fn same_scope(a: Cursor, b: Cursor) -> bool { - a.scope == b.scope -} - -pub(crate) fn same_buffer(a: Cursor, b: Cursor) -> bool { - unsafe { - match (&*a.scope, &*b.scope) { - (Entry::End(a_offset), Entry::End(b_offset)) => { - a.scope.offset(*a_offset) == b.scope.offset(*b_offset) - } - _ => unreachable!(), - } - } -} - -#[cfg(any(feature = "full", feature = "derive"))] -pub(crate) fn cmp_assuming_same_buffer(a: Cursor, b: Cursor) -> Ordering { - a.ptr.cmp(&b.ptr) -} - -pub(crate) fn open_span_of_group(cursor: Cursor) -> Span { - match cursor.entry() { - Entry::Group(group, _) => group.span_open(), - _ => cursor.span(), - } -} - -pub(crate) fn close_span_of_group(cursor: Cursor) -> Span { - match cursor.entry() { - Entry::Group(group, _) => group.span_close(), - _ => cursor.span(), - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/custom_keyword.rs b/.cargo-vendor/syn-1.0.109/src/custom_keyword.rs deleted file mode 100644 index a3ec9d4cb7..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/custom_keyword.rs +++ /dev/null @@ -1,253 +0,0 @@ -/// Define a type that supports parsing and printing a given identifier as if it -/// were a keyword. -/// -/// # Usage -/// -/// As a convention, it is recommended that this macro be invoked within a -/// module called `kw` or `keyword` and that the resulting parser be invoked -/// with a `kw::` or `keyword::` prefix. -/// -/// ``` -/// mod kw { -/// syn::custom_keyword!(whatever); -/// } -/// ``` -/// -/// The generated syntax tree node supports the following operations just like -/// any built-in keyword token. -/// -/// - [Peeking] — `input.peek(kw::whatever)` -/// -/// - [Parsing] — `input.parse::()?` -/// -/// - [Printing] — `quote!( ... #whatever_token ... )` -/// -/// - Construction from a [`Span`] — `let whatever_token = kw::whatever(sp)` -/// -/// - Field access to its span — `let sp = whatever_token.span` -/// -/// [Peeking]: crate::parse::ParseBuffer::peek -/// [Parsing]: crate::parse::ParseBuffer::parse -/// [Printing]: quote::ToTokens -/// [`Span`]: proc_macro2::Span -/// -/// # Example -/// -/// This example parses input that looks like `bool = true` or `str = "value"`. -/// The key must be either the identifier `bool` or the identifier `str`. If -/// `bool`, the value may be either `true` or `false`. If `str`, the value may -/// be any string literal. -/// -/// The symbols `bool` and `str` are not reserved keywords in Rust so these are -/// not considered keywords in the `syn::token` module. Like any other -/// identifier that is not a keyword, these can be declared as custom keywords -/// by crates that need to use them as such. -/// -/// ``` -/// use syn::{LitBool, LitStr, Result, Token}; -/// use syn::parse::{Parse, ParseStream}; -/// -/// mod kw { -/// syn::custom_keyword!(bool); -/// syn::custom_keyword!(str); -/// } -/// -/// enum Argument { -/// Bool { -/// bool_token: kw::bool, -/// eq_token: Token![=], -/// value: LitBool, -/// }, -/// Str { -/// str_token: kw::str, -/// eq_token: Token![=], -/// value: LitStr, -/// }, -/// } -/// -/// impl Parse for Argument { -/// fn parse(input: ParseStream) -> Result { -/// let lookahead = input.lookahead1(); -/// if lookahead.peek(kw::bool) { -/// Ok(Argument::Bool { -/// bool_token: input.parse::()?, -/// eq_token: input.parse()?, -/// value: input.parse()?, -/// }) -/// } else if lookahead.peek(kw::str) { -/// Ok(Argument::Str { -/// str_token: input.parse::()?, -/// eq_token: input.parse()?, -/// value: input.parse()?, -/// }) -/// } else { -/// Err(lookahead.error()) -/// } -/// } -/// } -/// ``` -#[macro_export] -macro_rules! custom_keyword { - ($ident:ident) => { - #[allow(non_camel_case_types)] - pub struct $ident { - pub span: $crate::__private::Span, - } - - #[doc(hidden)] - #[allow(dead_code, non_snake_case)] - pub fn $ident<__S: $crate::__private::IntoSpans<[$crate::__private::Span; 1]>>( - span: __S, - ) -> $ident { - $ident { - span: $crate::__private::IntoSpans::into_spans(span)[0], - } - } - - impl $crate::__private::Default for $ident { - fn default() -> Self { - $ident { - span: $crate::__private::Span::call_site(), - } - } - } - - $crate::impl_parse_for_custom_keyword!($ident); - $crate::impl_to_tokens_for_custom_keyword!($ident); - $crate::impl_clone_for_custom_keyword!($ident); - $crate::impl_extra_traits_for_custom_keyword!($ident); - }; -} - -// Not public API. -#[cfg(feature = "parsing")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_parse_for_custom_keyword { - ($ident:ident) => { - // For peek. - impl $crate::token::CustomToken for $ident { - fn peek(cursor: $crate::buffer::Cursor) -> $crate::__private::bool { - if let $crate::__private::Some((ident, _rest)) = cursor.ident() { - ident == stringify!($ident) - } else { - false - } - } - - fn display() -> &'static $crate::__private::str { - concat!("`", stringify!($ident), "`") - } - } - - impl $crate::parse::Parse for $ident { - fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { - input.step(|cursor| { - if let $crate::__private::Some((ident, rest)) = cursor.ident() { - if ident == stringify!($ident) { - return $crate::__private::Ok(($ident { span: ident.span() }, rest)); - } - } - $crate::__private::Err(cursor.error(concat!( - "expected `", - stringify!($ident), - "`" - ))) - }) - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "parsing"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_parse_for_custom_keyword { - ($ident:ident) => {}; -} - -// Not public API. -#[cfg(feature = "printing")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_to_tokens_for_custom_keyword { - ($ident:ident) => { - impl $crate::__private::ToTokens for $ident { - fn to_tokens(&self, tokens: &mut $crate::__private::TokenStream2) { - let ident = $crate::Ident::new(stringify!($ident), self.span); - $crate::__private::TokenStreamExt::append(tokens, ident); - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "printing"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_to_tokens_for_custom_keyword { - ($ident:ident) => {}; -} - -// Not public API. -#[cfg(feature = "clone-impls")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_clone_for_custom_keyword { - ($ident:ident) => { - impl $crate::__private::Copy for $ident {} - - #[allow(clippy::expl_impl_clone_on_copy)] - impl $crate::__private::Clone for $ident { - fn clone(&self) -> Self { - *self - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "clone-impls"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_clone_for_custom_keyword { - ($ident:ident) => {}; -} - -// Not public API. -#[cfg(feature = "extra-traits")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_extra_traits_for_custom_keyword { - ($ident:ident) => { - impl $crate::__private::Debug for $ident { - fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result { - $crate::__private::Formatter::write_str( - f, - concat!("Keyword [", stringify!($ident), "]"), - ) - } - } - - impl $crate::__private::Eq for $ident {} - - impl $crate::__private::PartialEq for $ident { - fn eq(&self, _other: &Self) -> $crate::__private::bool { - true - } - } - - impl $crate::__private::Hash for $ident { - fn hash<__H: $crate::__private::Hasher>(&self, _state: &mut __H) {} - } - }; -} - -// Not public API. -#[cfg(not(feature = "extra-traits"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_extra_traits_for_custom_keyword { - ($ident:ident) => {}; -} diff --git a/.cargo-vendor/syn-1.0.109/src/custom_punctuation.rs b/.cargo-vendor/syn-1.0.109/src/custom_punctuation.rs deleted file mode 100644 index 118a8453da..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/custom_punctuation.rs +++ /dev/null @@ -1,300 +0,0 @@ -/// Define a type that supports parsing and printing a multi-character symbol -/// as if it were a punctuation token. -/// -/// # Usage -/// -/// ``` -/// syn::custom_punctuation!(LeftRightArrow, <=>); -/// ``` -/// -/// The generated syntax tree node supports the following operations just like -/// any built-in punctuation token. -/// -/// - [Peeking] — `input.peek(LeftRightArrow)` -/// -/// - [Parsing] — `input.parse::()?` -/// -/// - [Printing] — `quote!( ... #lrarrow ... )` -/// -/// - Construction from a [`Span`] — `let lrarrow = LeftRightArrow(sp)` -/// -/// - Construction from multiple [`Span`] — `let lrarrow = LeftRightArrow([sp, sp, sp])` -/// -/// - Field access to its spans — `let spans = lrarrow.spans` -/// -/// [Peeking]: crate::parse::ParseBuffer::peek -/// [Parsing]: crate::parse::ParseBuffer::parse -/// [Printing]: quote::ToTokens -/// [`Span`]: proc_macro2::Span -/// -/// # Example -/// -/// ``` -/// use proc_macro2::{TokenStream, TokenTree}; -/// use syn::parse::{Parse, ParseStream, Peek, Result}; -/// use syn::punctuated::Punctuated; -/// use syn::Expr; -/// -/// syn::custom_punctuation!(PathSeparator, ); -/// -/// // expr expr expr ... -/// struct PathSegments { -/// segments: Punctuated, -/// } -/// -/// impl Parse for PathSegments { -/// fn parse(input: ParseStream) -> Result { -/// let mut segments = Punctuated::new(); -/// -/// let first = parse_until(input, PathSeparator)?; -/// segments.push_value(syn::parse2(first)?); -/// -/// while input.peek(PathSeparator) { -/// segments.push_punct(input.parse()?); -/// -/// let next = parse_until(input, PathSeparator)?; -/// segments.push_value(syn::parse2(next)?); -/// } -/// -/// Ok(PathSegments { segments }) -/// } -/// } -/// -/// fn parse_until(input: ParseStream, end: E) -> Result { -/// let mut tokens = TokenStream::new(); -/// while !input.is_empty() && !input.peek(end) { -/// let next: TokenTree = input.parse()?; -/// tokens.extend(Some(next)); -/// } -/// Ok(tokens) -/// } -/// -/// fn main() { -/// let input = r#" a::b c::d::e "#; -/// let _: PathSegments = syn::parse_str(input).unwrap(); -/// } -/// ``` -#[macro_export] -macro_rules! custom_punctuation { - ($ident:ident, $($tt:tt)+) => { - pub struct $ident { - pub spans: $crate::custom_punctuation_repr!($($tt)+), - } - - #[doc(hidden)] - #[allow(dead_code, non_snake_case)] - pub fn $ident<__S: $crate::__private::IntoSpans<$crate::custom_punctuation_repr!($($tt)+)>>( - spans: __S, - ) -> $ident { - let _validate_len = 0 $(+ $crate::custom_punctuation_len!(strict, $tt))*; - $ident { - spans: $crate::__private::IntoSpans::into_spans(spans) - } - } - - impl $crate::__private::Default for $ident { - fn default() -> Self { - $ident($crate::__private::Span::call_site()) - } - } - - $crate::impl_parse_for_custom_punctuation!($ident, $($tt)+); - $crate::impl_to_tokens_for_custom_punctuation!($ident, $($tt)+); - $crate::impl_clone_for_custom_punctuation!($ident, $($tt)+); - $crate::impl_extra_traits_for_custom_punctuation!($ident, $($tt)+); - }; -} - -// Not public API. -#[cfg(feature = "parsing")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_parse_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => { - impl $crate::token::CustomToken for $ident { - fn peek(cursor: $crate::buffer::Cursor) -> bool { - $crate::token::parsing::peek_punct(cursor, $crate::stringify_punct!($($tt)+)) - } - - fn display() -> &'static $crate::__private::str { - concat!("`", $crate::stringify_punct!($($tt)+), "`") - } - } - - impl $crate::parse::Parse for $ident { - fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { - let spans: $crate::custom_punctuation_repr!($($tt)+) = - $crate::token::parsing::punct(input, $crate::stringify_punct!($($tt)+))?; - Ok($ident(spans)) - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "parsing"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_parse_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => {}; -} - -// Not public API. -#[cfg(feature = "printing")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_to_tokens_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => { - impl $crate::__private::ToTokens for $ident { - fn to_tokens(&self, tokens: &mut $crate::__private::TokenStream2) { - $crate::token::printing::punct($crate::stringify_punct!($($tt)+), &self.spans, tokens) - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "printing"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_to_tokens_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => {}; -} - -// Not public API. -#[cfg(feature = "clone-impls")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_clone_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => { - impl $crate::__private::Copy for $ident {} - - #[allow(clippy::expl_impl_clone_on_copy)] - impl $crate::__private::Clone for $ident { - fn clone(&self) -> Self { - *self - } - } - }; -} - -// Not public API. -#[cfg(not(feature = "clone-impls"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_clone_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => {}; -} - -// Not public API. -#[cfg(feature = "extra-traits")] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_extra_traits_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => { - impl $crate::__private::Debug for $ident { - fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::fmt::Result { - $crate::__private::Formatter::write_str(f, stringify!($ident)) - } - } - - impl $crate::__private::Eq for $ident {} - - impl $crate::__private::PartialEq for $ident { - fn eq(&self, _other: &Self) -> $crate::__private::bool { - true - } - } - - impl $crate::__private::Hash for $ident { - fn hash<__H: $crate::__private::Hasher>(&self, _state: &mut __H) {} - } - }; -} - -// Not public API. -#[cfg(not(feature = "extra-traits"))] -#[doc(hidden)] -#[macro_export] -macro_rules! impl_extra_traits_for_custom_punctuation { - ($ident:ident, $($tt:tt)+) => {}; -} - -// Not public API. -#[doc(hidden)] -#[macro_export] -macro_rules! custom_punctuation_repr { - ($($tt:tt)+) => { - [$crate::__private::Span; 0 $(+ $crate::custom_punctuation_len!(lenient, $tt))+] - }; -} - -// Not public API. -#[doc(hidden)] -#[macro_export] -#[rustfmt::skip] -macro_rules! custom_punctuation_len { - ($mode:ident, +) => { 1 }; - ($mode:ident, +=) => { 2 }; - ($mode:ident, &) => { 1 }; - ($mode:ident, &&) => { 2 }; - ($mode:ident, &=) => { 2 }; - ($mode:ident, @) => { 1 }; - ($mode:ident, !) => { 1 }; - ($mode:ident, ^) => { 1 }; - ($mode:ident, ^=) => { 2 }; - ($mode:ident, :) => { 1 }; - ($mode:ident, ::) => { 2 }; - ($mode:ident, ,) => { 1 }; - ($mode:ident, /) => { 1 }; - ($mode:ident, /=) => { 2 }; - ($mode:ident, .) => { 1 }; - ($mode:ident, ..) => { 2 }; - ($mode:ident, ...) => { 3 }; - ($mode:ident, ..=) => { 3 }; - ($mode:ident, =) => { 1 }; - ($mode:ident, ==) => { 2 }; - ($mode:ident, >=) => { 2 }; - ($mode:ident, >) => { 1 }; - ($mode:ident, <=) => { 2 }; - ($mode:ident, <) => { 1 }; - ($mode:ident, *=) => { 2 }; - ($mode:ident, !=) => { 2 }; - ($mode:ident, |) => { 1 }; - ($mode:ident, |=) => { 2 }; - ($mode:ident, ||) => { 2 }; - ($mode:ident, #) => { 1 }; - ($mode:ident, ?) => { 1 }; - ($mode:ident, ->) => { 2 }; - ($mode:ident, <-) => { 2 }; - ($mode:ident, %) => { 1 }; - ($mode:ident, %=) => { 2 }; - ($mode:ident, =>) => { 2 }; - ($mode:ident, ;) => { 1 }; - ($mode:ident, <<) => { 2 }; - ($mode:ident, <<=) => { 3 }; - ($mode:ident, >>) => { 2 }; - ($mode:ident, >>=) => { 3 }; - ($mode:ident, *) => { 1 }; - ($mode:ident, -) => { 1 }; - ($mode:ident, -=) => { 2 }; - ($mode:ident, ~) => { 1 }; - (lenient, $tt:tt) => { 0 }; - (strict, $tt:tt) => {{ $crate::custom_punctuation_unexpected!($tt); 0 }}; -} - -// Not public API. -#[doc(hidden)] -#[macro_export] -macro_rules! custom_punctuation_unexpected { - () => {}; -} - -// Not public API. -#[doc(hidden)] -#[macro_export] -macro_rules! stringify_punct { - ($($tt:tt)+) => { - concat!($(stringify!($tt)),+) - }; -} diff --git a/.cargo-vendor/syn-1.0.109/src/data.rs b/.cargo-vendor/syn-1.0.109/src/data.rs deleted file mode 100644 index 3b466618f8..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/data.rs +++ /dev/null @@ -1,493 +0,0 @@ -use super::*; -use crate::punctuated::Punctuated; - -ast_struct! { - /// An enum variant. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct Variant { - /// Attributes tagged on the variant. - pub attrs: Vec, - - /// Name of the variant. - pub ident: Ident, - - /// Content stored in the variant. - pub fields: Fields, - - /// Explicit discriminant: `Variant = 1` - pub discriminant: Option<(Token![=], Expr)>, - } -} - -ast_enum_of_structs! { - /// Data stored within an enum variant or struct. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - /// - /// # Syntax tree enum - /// - /// This type is a [syntax tree enum]. - /// - /// [syntax tree enum]: Expr#syntax-tree-enums - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub enum Fields { - /// Named fields of a struct or struct variant such as `Point { x: f64, - /// y: f64 }`. - Named(FieldsNamed), - - /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. - Unnamed(FieldsUnnamed), - - /// Unit struct or unit variant such as `None`. - Unit, - } -} - -ast_struct! { - /// Named fields of a struct or struct variant such as `Point { x: f64, - /// y: f64 }`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct FieldsNamed { - pub brace_token: token::Brace, - pub named: Punctuated, - } -} - -ast_struct! { - /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct FieldsUnnamed { - pub paren_token: token::Paren, - pub unnamed: Punctuated, - } -} - -impl Fields { - /// Get an iterator over the borrowed [`Field`] items in this object. This - /// iterator can be used to iterate over a named or unnamed struct or - /// variant's fields uniformly. - pub fn iter(&self) -> punctuated::Iter { - match self { - Fields::Unit => crate::punctuated::empty_punctuated_iter(), - Fields::Named(f) => f.named.iter(), - Fields::Unnamed(f) => f.unnamed.iter(), - } - } - - /// Get an iterator over the mutably borrowed [`Field`] items in this - /// object. This iterator can be used to iterate over a named or unnamed - /// struct or variant's fields uniformly. - pub fn iter_mut(&mut self) -> punctuated::IterMut { - match self { - Fields::Unit => crate::punctuated::empty_punctuated_iter_mut(), - Fields::Named(f) => f.named.iter_mut(), - Fields::Unnamed(f) => f.unnamed.iter_mut(), - } - } - - /// Returns the number of fields. - pub fn len(&self) -> usize { - match self { - Fields::Unit => 0, - Fields::Named(f) => f.named.len(), - Fields::Unnamed(f) => f.unnamed.len(), - } - } - - /// Returns `true` if there are zero fields. - pub fn is_empty(&self) -> bool { - match self { - Fields::Unit => true, - Fields::Named(f) => f.named.is_empty(), - Fields::Unnamed(f) => f.unnamed.is_empty(), - } - } -} - -impl IntoIterator for Fields { - type Item = Field; - type IntoIter = punctuated::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - match self { - Fields::Unit => Punctuated::::new().into_iter(), - Fields::Named(f) => f.named.into_iter(), - Fields::Unnamed(f) => f.unnamed.into_iter(), - } - } -} - -impl<'a> IntoIterator for &'a Fields { - type Item = &'a Field; - type IntoIter = punctuated::Iter<'a, Field>; - - fn into_iter(self) -> Self::IntoIter { - self.iter() - } -} - -impl<'a> IntoIterator for &'a mut Fields { - type Item = &'a mut Field; - type IntoIter = punctuated::IterMut<'a, Field>; - - fn into_iter(self) -> Self::IntoIter { - self.iter_mut() - } -} - -ast_struct! { - /// A field of a struct or enum variant. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct Field { - /// Attributes tagged on the field. - pub attrs: Vec, - - /// Visibility of the field. - pub vis: Visibility, - - /// Name of the field, if any. - /// - /// Fields of tuple structs have no names. - pub ident: Option, - - pub colon_token: Option, - - /// Type of the field. - pub ty: Type, - } -} - -ast_enum_of_structs! { - /// The visibility level of an item: inherited or `pub` or - /// `pub(restricted)`. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature.* - /// - /// # Syntax tree enum - /// - /// This type is a [syntax tree enum]. - /// - /// [syntax tree enum]: Expr#syntax-tree-enums - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub enum Visibility { - /// A public visibility level: `pub`. - Public(VisPublic), - - /// A crate-level visibility: `crate`. - Crate(VisCrate), - - /// A visibility level restricted to some path: `pub(self)` or - /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. - Restricted(VisRestricted), - - /// An inherited visibility, which usually means private. - Inherited, - } -} - -ast_struct! { - /// A public visibility level: `pub`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct VisPublic { - pub pub_token: Token![pub], - } -} - -ast_struct! { - /// A crate-level visibility: `crate`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct VisCrate { - pub crate_token: Token![crate], - } -} - -ast_struct! { - /// A visibility level restricted to some path: `pub(self)` or - /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct VisRestricted { - pub pub_token: Token![pub], - pub paren_token: token::Paren, - pub in_token: Option, - pub path: Box, - } -} - -#[cfg(feature = "parsing")] -pub mod parsing { - use super::*; - use crate::ext::IdentExt; - use crate::parse::discouraged::Speculative; - use crate::parse::{Parse, ParseStream, Result}; - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for Variant { - fn parse(input: ParseStream) -> Result { - let attrs = input.call(Attribute::parse_outer)?; - let _visibility: Visibility = input.parse()?; - let ident: Ident = input.parse()?; - let fields = if input.peek(token::Brace) { - Fields::Named(input.parse()?) - } else if input.peek(token::Paren) { - Fields::Unnamed(input.parse()?) - } else { - Fields::Unit - }; - let discriminant = if input.peek(Token![=]) { - let eq_token: Token![=] = input.parse()?; - let discriminant: Expr = input.parse()?; - Some((eq_token, discriminant)) - } else { - None - }; - Ok(Variant { - attrs, - ident, - fields, - discriminant, - }) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for FieldsNamed { - fn parse(input: ParseStream) -> Result { - let content; - Ok(FieldsNamed { - brace_token: braced!(content in input), - named: content.parse_terminated(Field::parse_named)?, - }) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for FieldsUnnamed { - fn parse(input: ParseStream) -> Result { - let content; - Ok(FieldsUnnamed { - paren_token: parenthesized!(content in input), - unnamed: content.parse_terminated(Field::parse_unnamed)?, - }) - } - } - - impl Field { - /// Parses a named (braced struct) field. - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_named(input: ParseStream) -> Result { - Ok(Field { - attrs: input.call(Attribute::parse_outer)?, - vis: input.parse()?, - ident: Some(if input.peek(Token![_]) { - input.call(Ident::parse_any) - } else { - input.parse() - }?), - colon_token: Some(input.parse()?), - ty: input.parse()?, - }) - } - - /// Parses an unnamed (tuple struct) field. - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - pub fn parse_unnamed(input: ParseStream) -> Result { - Ok(Field { - attrs: input.call(Attribute::parse_outer)?, - vis: input.parse()?, - ident: None, - colon_token: None, - ty: input.parse()?, - }) - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for Visibility { - fn parse(input: ParseStream) -> Result { - // Recognize an empty None-delimited group, as produced by a $:vis - // matcher that matched no tokens. - if input.peek(token::Group) { - let ahead = input.fork(); - let group = crate::group::parse_group(&ahead)?; - if group.content.is_empty() { - input.advance_to(&ahead); - return Ok(Visibility::Inherited); - } - } - - if input.peek(Token![pub]) { - Self::parse_pub(input) - } else if input.peek(Token![crate]) { - Self::parse_crate(input) - } else { - Ok(Visibility::Inherited) - } - } - } - - impl Visibility { - fn parse_pub(input: ParseStream) -> Result { - let pub_token = input.parse::()?; - - if input.peek(token::Paren) { - let ahead = input.fork(); - - let content; - let paren_token = parenthesized!(content in ahead); - if content.peek(Token![crate]) - || content.peek(Token![self]) - || content.peek(Token![super]) - { - let path = content.call(Ident::parse_any)?; - - // Ensure there are no additional tokens within `content`. - // Without explicitly checking, we may misinterpret a tuple - // field as a restricted visibility, causing a parse error. - // e.g. `pub (crate::A, crate::B)` (Issue #720). - if content.is_empty() { - input.advance_to(&ahead); - return Ok(Visibility::Restricted(VisRestricted { - pub_token, - paren_token, - in_token: None, - path: Box::new(Path::from(path)), - })); - } - } else if content.peek(Token![in]) { - let in_token: Token![in] = content.parse()?; - let path = content.call(Path::parse_mod_style)?; - - input.advance_to(&ahead); - return Ok(Visibility::Restricted(VisRestricted { - pub_token, - paren_token, - in_token: Some(in_token), - path: Box::new(path), - })); - } - } - - Ok(Visibility::Public(VisPublic { pub_token })) - } - - fn parse_crate(input: ParseStream) -> Result { - if input.peek2(Token![::]) { - Ok(Visibility::Inherited) - } else { - Ok(Visibility::Crate(VisCrate { - crate_token: input.parse()?, - })) - } - } - - #[cfg(feature = "full")] - pub(crate) fn is_some(&self) -> bool { - match self { - Visibility::Inherited => false, - _ => true, - } - } - } -} - -#[cfg(feature = "printing")] -mod printing { - use super::*; - use crate::print::TokensOrDefault; - use proc_macro2::TokenStream; - use quote::{ToTokens, TokenStreamExt}; - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for Variant { - fn to_tokens(&self, tokens: &mut TokenStream) { - tokens.append_all(&self.attrs); - self.ident.to_tokens(tokens); - self.fields.to_tokens(tokens); - if let Some((eq_token, disc)) = &self.discriminant { - eq_token.to_tokens(tokens); - disc.to_tokens(tokens); - } - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for FieldsNamed { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.brace_token.surround(tokens, |tokens| { - self.named.to_tokens(tokens); - }); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for FieldsUnnamed { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.paren_token.surround(tokens, |tokens| { - self.unnamed.to_tokens(tokens); - }); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for Field { - fn to_tokens(&self, tokens: &mut TokenStream) { - tokens.append_all(&self.attrs); - self.vis.to_tokens(tokens); - if let Some(ident) = &self.ident { - ident.to_tokens(tokens); - TokensOrDefault(&self.colon_token).to_tokens(tokens); - } - self.ty.to_tokens(tokens); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for VisPublic { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.pub_token.to_tokens(tokens); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for VisCrate { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.crate_token.to_tokens(tokens); - } - } - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for VisRestricted { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.pub_token.to_tokens(tokens); - self.paren_token.surround(tokens, |tokens| { - // TODO: If we have a path which is not "self" or "super" or - // "crate", automatically add the "in" token. - self.in_token.to_tokens(tokens); - self.path.to_tokens(tokens); - }); - } - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/derive.rs b/.cargo-vendor/syn-1.0.109/src/derive.rs deleted file mode 100644 index af9bb91b7a..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/derive.rs +++ /dev/null @@ -1,274 +0,0 @@ -use super::*; -use crate::punctuated::Punctuated; - -ast_struct! { - /// Data structure sent to a `proc_macro_derive` macro. - /// - /// *This type is available only if Syn is built with the `"derive"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] - pub struct DeriveInput { - /// Attributes tagged on the whole struct or enum. - pub attrs: Vec, - - /// Visibility of the struct or enum. - pub vis: Visibility, - - /// Name of the struct or enum. - pub ident: Ident, - - /// Generics required to complete the definition. - pub generics: Generics, - - /// Data within the struct or enum. - pub data: Data, - } -} - -ast_enum_of_structs! { - /// The storage of a struct, enum or union data structure. - /// - /// *This type is available only if Syn is built with the `"derive"` feature.* - /// - /// # Syntax tree enum - /// - /// This type is a [syntax tree enum]. - /// - /// [syntax tree enum]: Expr#syntax-tree-enums - #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] - pub enum Data { - /// A struct input to a `proc_macro_derive` macro. - Struct(DataStruct), - - /// An enum input to a `proc_macro_derive` macro. - Enum(DataEnum), - - /// An untagged union input to a `proc_macro_derive` macro. - Union(DataUnion), - } - - do_not_generate_to_tokens -} - -ast_struct! { - /// A struct input to a `proc_macro_derive` macro. - /// - /// *This type is available only if Syn is built with the `"derive"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] - pub struct DataStruct { - pub struct_token: Token![struct], - pub fields: Fields, - pub semi_token: Option, - } -} - -ast_struct! { - /// An enum input to a `proc_macro_derive` macro. - /// - /// *This type is available only if Syn is built with the `"derive"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] - pub struct DataEnum { - pub enum_token: Token![enum], - pub brace_token: token::Brace, - pub variants: Punctuated, - } -} - -ast_struct! { - /// An untagged union input to a `proc_macro_derive` macro. - /// - /// *This type is available only if Syn is built with the `"derive"` - /// feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "derive")))] - pub struct DataUnion { - pub union_token: Token![union], - pub fields: FieldsNamed, - } -} - -#[cfg(feature = "parsing")] -pub mod parsing { - use super::*; - use crate::parse::{Parse, ParseStream, Result}; - - #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] - impl Parse for DeriveInput { - fn parse(input: ParseStream) -> Result { - let attrs = input.call(Attribute::parse_outer)?; - let vis = input.parse::()?; - - let lookahead = input.lookahead1(); - if lookahead.peek(Token![struct]) { - let struct_token = input.parse::()?; - let ident = input.parse::()?; - let generics = input.parse::()?; - let (where_clause, fields, semi) = data_struct(input)?; - Ok(DeriveInput { - attrs, - vis, - ident, - generics: Generics { - where_clause, - ..generics - }, - data: Data::Struct(DataStruct { - struct_token, - fields, - semi_token: semi, - }), - }) - } else if lookahead.peek(Token![enum]) { - let enum_token = input.parse::()?; - let ident = input.parse::()?; - let generics = input.parse::()?; - let (where_clause, brace, variants) = data_enum(input)?; - Ok(DeriveInput { - attrs, - vis, - ident, - generics: Generics { - where_clause, - ..generics - }, - data: Data::Enum(DataEnum { - enum_token, - brace_token: brace, - variants, - }), - }) - } else if lookahead.peek(Token![union]) { - let union_token = input.parse::()?; - let ident = input.parse::()?; - let generics = input.parse::()?; - let (where_clause, fields) = data_union(input)?; - Ok(DeriveInput { - attrs, - vis, - ident, - generics: Generics { - where_clause, - ..generics - }, - data: Data::Union(DataUnion { - union_token, - fields, - }), - }) - } else { - Err(lookahead.error()) - } - } - } - - pub fn data_struct( - input: ParseStream, - ) -> Result<(Option, Fields, Option)> { - let mut lookahead = input.lookahead1(); - let mut where_clause = None; - if lookahead.peek(Token![where]) { - where_clause = Some(input.parse()?); - lookahead = input.lookahead1(); - } - - if where_clause.is_none() && lookahead.peek(token::Paren) { - let fields = input.parse()?; - - lookahead = input.lookahead1(); - if lookahead.peek(Token![where]) { - where_clause = Some(input.parse()?); - lookahead = input.lookahead1(); - } - - if lookahead.peek(Token![;]) { - let semi = input.parse()?; - Ok((where_clause, Fields::Unnamed(fields), Some(semi))) - } else { - Err(lookahead.error()) - } - } else if lookahead.peek(token::Brace) { - let fields = input.parse()?; - Ok((where_clause, Fields::Named(fields), None)) - } else if lookahead.peek(Token![;]) { - let semi = input.parse()?; - Ok((where_clause, Fields::Unit, Some(semi))) - } else { - Err(lookahead.error()) - } - } - - pub fn data_enum( - input: ParseStream, - ) -> Result<( - Option, - token::Brace, - Punctuated, - )> { - let where_clause = input.parse()?; - - let content; - let brace = braced!(content in input); - let variants = content.parse_terminated(Variant::parse)?; - - Ok((where_clause, brace, variants)) - } - - pub fn data_union(input: ParseStream) -> Result<(Option, FieldsNamed)> { - let where_clause = input.parse()?; - let fields = input.parse()?; - Ok((where_clause, fields)) - } -} - -#[cfg(feature = "printing")] -mod printing { - use super::*; - use crate::attr::FilterAttrs; - use crate::print::TokensOrDefault; - use proc_macro2::TokenStream; - use quote::ToTokens; - - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for DeriveInput { - fn to_tokens(&self, tokens: &mut TokenStream) { - for attr in self.attrs.outer() { - attr.to_tokens(tokens); - } - self.vis.to_tokens(tokens); - match &self.data { - Data::Struct(d) => d.struct_token.to_tokens(tokens), - Data::Enum(d) => d.enum_token.to_tokens(tokens), - Data::Union(d) => d.union_token.to_tokens(tokens), - } - self.ident.to_tokens(tokens); - self.generics.to_tokens(tokens); - match &self.data { - Data::Struct(data) => match &data.fields { - Fields::Named(fields) => { - self.generics.where_clause.to_tokens(tokens); - fields.to_tokens(tokens); - } - Fields::Unnamed(fields) => { - fields.to_tokens(tokens); - self.generics.where_clause.to_tokens(tokens); - TokensOrDefault(&data.semi_token).to_tokens(tokens); - } - Fields::Unit => { - self.generics.where_clause.to_tokens(tokens); - TokensOrDefault(&data.semi_token).to_tokens(tokens); - } - }, - Data::Enum(data) => { - self.generics.where_clause.to_tokens(tokens); - data.brace_token.surround(tokens, |tokens| { - data.variants.to_tokens(tokens); - }); - } - Data::Union(data) => { - self.generics.where_clause.to_tokens(tokens); - data.fields.to_tokens(tokens); - } - } - } - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/discouraged.rs b/.cargo-vendor/syn-1.0.109/src/discouraged.rs deleted file mode 100644 index a46129b6a1..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/discouraged.rs +++ /dev/null @@ -1,194 +0,0 @@ -//! Extensions to the parsing API with niche applicability. - -use super::*; - -/// Extensions to the `ParseStream` API to support speculative parsing. -pub trait Speculative { - /// Advance this parse stream to the position of a forked parse stream. - /// - /// This is the opposite operation to [`ParseStream::fork`]. You can fork a - /// parse stream, perform some speculative parsing, then join the original - /// stream to the fork to "commit" the parsing from the fork to the main - /// stream. - /// - /// If you can avoid doing this, you should, as it limits the ability to - /// generate useful errors. That said, it is often the only way to parse - /// syntax of the form `A* B*` for arbitrary syntax `A` and `B`. The problem - /// is that when the fork fails to parse an `A`, it's impossible to tell - /// whether that was because of a syntax error and the user meant to provide - /// an `A`, or that the `A`s are finished and it's time to start parsing - /// `B`s. Use with care. - /// - /// Also note that if `A` is a subset of `B`, `A* B*` can be parsed by - /// parsing `B*` and removing the leading members of `A` from the - /// repetition, bypassing the need to involve the downsides associated with - /// speculative parsing. - /// - /// [`ParseStream::fork`]: ParseBuffer::fork - /// - /// # Example - /// - /// There has been chatter about the possibility of making the colons in the - /// turbofish syntax like `path::to::` no longer required by accepting - /// `path::to` in expression position. Specifically, according to [RFC - /// 2544], [`PathSegment`] parsing should always try to consume a following - /// `<` token as the start of generic arguments, and reset to the `<` if - /// that fails (e.g. the token is acting as a less-than operator). - /// - /// This is the exact kind of parsing behavior which requires the "fork, - /// try, commit" behavior that [`ParseStream::fork`] discourages. With - /// `advance_to`, we can avoid having to parse the speculatively parsed - /// content a second time. - /// - /// This change in behavior can be implemented in syn by replacing just the - /// `Parse` implementation for `PathSegment`: - /// - /// ``` - /// # use syn::ext::IdentExt; - /// use syn::parse::discouraged::Speculative; - /// # use syn::parse::{Parse, ParseStream}; - /// # use syn::{Ident, PathArguments, Result, Token}; - /// - /// pub struct PathSegment { - /// pub ident: Ident, - /// pub arguments: PathArguments, - /// } - /// # - /// # impl From for PathSegment - /// # where - /// # T: Into, - /// # { - /// # fn from(ident: T) -> Self { - /// # PathSegment { - /// # ident: ident.into(), - /// # arguments: PathArguments::None, - /// # } - /// # } - /// # } - /// - /// impl Parse for PathSegment { - /// fn parse(input: ParseStream) -> Result { - /// if input.peek(Token![super]) - /// || input.peek(Token![self]) - /// || input.peek(Token![Self]) - /// || input.peek(Token![crate]) - /// { - /// let ident = input.call(Ident::parse_any)?; - /// return Ok(PathSegment::from(ident)); - /// } - /// - /// let ident = input.parse()?; - /// if input.peek(Token![::]) && input.peek3(Token![<]) { - /// return Ok(PathSegment { - /// ident, - /// arguments: PathArguments::AngleBracketed(input.parse()?), - /// }); - /// } - /// if input.peek(Token![<]) && !input.peek(Token![<=]) { - /// let fork = input.fork(); - /// if let Ok(arguments) = fork.parse() { - /// input.advance_to(&fork); - /// return Ok(PathSegment { - /// ident, - /// arguments: PathArguments::AngleBracketed(arguments), - /// }); - /// } - /// } - /// Ok(PathSegment::from(ident)) - /// } - /// } - /// - /// # syn::parse_str::("a").unwrap(); - /// ``` - /// - /// # Drawbacks - /// - /// The main drawback of this style of speculative parsing is in error - /// presentation. Even if the lookahead is the "correct" parse, the error - /// that is shown is that of the "fallback" parse. To use the same example - /// as the turbofish above, take the following unfinished "turbofish": - /// - /// ```text - /// let _ = f<&'a fn(), for<'a> serde::>(); - /// ``` - /// - /// If this is parsed as generic arguments, we can provide the error message - /// - /// ```text - /// error: expected identifier - /// --> src.rs:L:C - /// | - /// L | let _ = f<&'a fn(), for<'a> serde::>(); - /// | ^ - /// ``` - /// - /// but if parsed using the above speculative parsing, it falls back to - /// assuming that the `<` is a less-than when it fails to parse the generic - /// arguments, and tries to interpret the `&'a` as the start of a labelled - /// loop, resulting in the much less helpful error - /// - /// ```text - /// error: expected `:` - /// --> src.rs:L:C - /// | - /// L | let _ = f<&'a fn(), for<'a> serde::>(); - /// | ^^ - /// ``` - /// - /// This can be mitigated with various heuristics (two examples: show both - /// forks' parse errors, or show the one that consumed more tokens), but - /// when you can control the grammar, sticking to something that can be - /// parsed LL(3) and without the LL(*) speculative parsing this makes - /// possible, displaying reasonable errors becomes much more simple. - /// - /// [RFC 2544]: https://github.com/rust-lang/rfcs/pull/2544 - /// [`PathSegment`]: crate::PathSegment - /// - /// # Performance - /// - /// This method performs a cheap fixed amount of work that does not depend - /// on how far apart the two streams are positioned. - /// - /// # Panics - /// - /// The forked stream in the argument of `advance_to` must have been - /// obtained by forking `self`. Attempting to advance to any other stream - /// will cause a panic. - fn advance_to(&self, fork: &Self); -} - -impl<'a> Speculative for ParseBuffer<'a> { - fn advance_to(&self, fork: &Self) { - if !crate::buffer::same_scope(self.cursor(), fork.cursor()) { - panic!("Fork was not derived from the advancing parse stream"); - } - - let (self_unexp, self_sp) = inner_unexpected(self); - let (fork_unexp, fork_sp) = inner_unexpected(fork); - if !Rc::ptr_eq(&self_unexp, &fork_unexp) { - match (fork_sp, self_sp) { - // Unexpected set on the fork, but not on `self`, copy it over. - (Some(span), None) => { - self_unexp.set(Unexpected::Some(span)); - } - // Unexpected unset. Use chain to propagate errors from fork. - (None, None) => { - fork_unexp.set(Unexpected::Chain(self_unexp)); - - // Ensure toplevel 'unexpected' tokens from the fork don't - // bubble up the chain by replacing the root `unexpected` - // pointer, only 'unexpected' tokens from existing group - // parsers should bubble. - fork.unexpected - .set(Some(Rc::new(Cell::new(Unexpected::None)))); - } - // Unexpected has been set on `self`. No changes needed. - (_, Some(_)) => {} - } - } - - // See comment on `cell` in the struct definition. - self.cell - .set(unsafe { mem::transmute::>(fork.cursor()) }); - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/drops.rs b/.cargo-vendor/syn-1.0.109/src/drops.rs deleted file mode 100644 index 89b42d82ef..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/drops.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::iter; -use std::mem::ManuallyDrop; -use std::ops::{Deref, DerefMut}; -use std::option; -use std::slice; - -#[repr(transparent)] -pub(crate) struct NoDrop(ManuallyDrop); - -impl NoDrop { - pub(crate) fn new(value: T) -> Self - where - T: TrivialDrop, - { - NoDrop(ManuallyDrop::new(value)) - } -} - -impl Deref for NoDrop { - type Target = T; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for NoDrop { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -pub(crate) trait TrivialDrop {} - -impl TrivialDrop for iter::Empty {} -impl<'a, T> TrivialDrop for slice::Iter<'a, T> {} -impl<'a, T> TrivialDrop for slice::IterMut<'a, T> {} -impl<'a, T> TrivialDrop for option::IntoIter<&'a T> {} -impl<'a, T> TrivialDrop for option::IntoIter<&'a mut T> {} - -#[test] -fn test_needs_drop() { - use std::mem::needs_drop; - - struct NeedsDrop; - - impl Drop for NeedsDrop { - fn drop(&mut self) {} - } - - assert!(needs_drop::()); - - // Test each of the types with a handwritten TrivialDrop impl above. - assert!(!needs_drop::>()); - assert!(!needs_drop::>()); - assert!(!needs_drop::>()); - assert!(!needs_drop::>()); - assert!(!needs_drop::>()); -} diff --git a/.cargo-vendor/syn-1.0.109/src/error.rs b/.cargo-vendor/syn-1.0.109/src/error.rs deleted file mode 100644 index e301367d5e..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/error.rs +++ /dev/null @@ -1,428 +0,0 @@ -#[cfg(feature = "parsing")] -use crate::buffer::Cursor; -use crate::thread::ThreadBound; -use proc_macro2::{ - Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree, -}; -#[cfg(feature = "printing")] -use quote::ToTokens; -use std::fmt::{self, Debug, Display}; -use std::iter::FromIterator; -use std::slice; -use std::vec; - -/// The result of a Syn parser. -pub type Result = std::result::Result; - -/// Error returned when a Syn parser cannot parse the input tokens. -/// -/// # Error reporting in proc macros -/// -/// The correct way to report errors back to the compiler from a procedural -/// macro is by emitting an appropriately spanned invocation of -/// [`compile_error!`] in the generated code. This produces a better diagnostic -/// message than simply panicking the macro. -/// -/// [`compile_error!`]: std::compile_error! -/// -/// When parsing macro input, the [`parse_macro_input!`] macro handles the -/// conversion to `compile_error!` automatically. -/// -/// [`parse_macro_input!`]: crate::parse_macro_input! -/// -/// ``` -/// # extern crate proc_macro; -/// # -/// use proc_macro::TokenStream; -/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; -/// -/// # const IGNORE: &str = stringify! { -/// #[proc_macro_attribute] -/// # }; -/// pub fn my_attr(args: TokenStream, input: TokenStream) -> TokenStream { -/// let args = parse_macro_input!(args as AttributeArgs); -/// let input = parse_macro_input!(input as ItemFn); -/// -/// /* ... */ -/// # TokenStream::new() -/// } -/// ``` -/// -/// For errors that arise later than the initial parsing stage, the -/// [`.to_compile_error()`] or [`.into_compile_error()`] methods can be used to -/// perform an explicit conversion to `compile_error!`. -/// -/// [`.to_compile_error()`]: Error::to_compile_error -/// [`.into_compile_error()`]: Error::into_compile_error -/// -/// ``` -/// # extern crate proc_macro; -/// # -/// # use proc_macro::TokenStream; -/// # use syn::{parse_macro_input, DeriveInput}; -/// # -/// # const IGNORE: &str = stringify! { -/// #[proc_macro_derive(MyDerive)] -/// # }; -/// pub fn my_derive(input: TokenStream) -> TokenStream { -/// let input = parse_macro_input!(input as DeriveInput); -/// -/// // fn(DeriveInput) -> syn::Result -/// expand::my_derive(input) -/// .unwrap_or_else(syn::Error::into_compile_error) -/// .into() -/// } -/// # -/// # mod expand { -/// # use proc_macro2::TokenStream; -/// # use syn::{DeriveInput, Result}; -/// # -/// # pub fn my_derive(input: DeriveInput) -> Result { -/// # unimplemented!() -/// # } -/// # } -/// ``` -pub struct Error { - messages: Vec, -} - -struct ErrorMessage { - // Span is implemented as an index into a thread-local interner to keep the - // size small. It is not safe to access from a different thread. We want - // errors to be Send and Sync to play nicely with the Failure crate, so pin - // the span we're given to its original thread and assume it is - // Span::call_site if accessed from any other thread. - start_span: ThreadBound, - end_span: ThreadBound, - message: String, -} - -#[cfg(test)] -struct _Test -where - Error: Send + Sync; - -impl Error { - /// Usually the [`ParseStream::error`] method will be used instead, which - /// automatically uses the correct span from the current position of the - /// parse stream. - /// - /// Use `Error::new` when the error needs to be triggered on some span other - /// than where the parse stream is currently positioned. - /// - /// [`ParseStream::error`]: crate::parse::ParseBuffer::error - /// - /// # Example - /// - /// ``` - /// use syn::{Error, Ident, LitStr, Result, Token}; - /// use syn::parse::ParseStream; - /// - /// // Parses input that looks like `name = "string"` where the key must be - /// // the identifier `name` and the value may be any string literal. - /// // Returns the string literal. - /// fn parse_name(input: ParseStream) -> Result { - /// let name_token: Ident = input.parse()?; - /// if name_token != "name" { - /// // Trigger an error not on the current position of the stream, - /// // but on the position of the unexpected identifier. - /// return Err(Error::new(name_token.span(), "expected `name`")); - /// } - /// input.parse::()?; - /// let s: LitStr = input.parse()?; - /// Ok(s) - /// } - /// ``` - pub fn new(span: Span, message: T) -> Self { - return new(span, message.to_string()); - - fn new(span: Span, message: String) -> Error { - Error { - messages: vec![ErrorMessage { - start_span: ThreadBound::new(span), - end_span: ThreadBound::new(span), - message, - }], - } - } - } - - /// Creates an error with the specified message spanning the given syntax - /// tree node. - /// - /// Unlike the `Error::new` constructor, this constructor takes an argument - /// `tokens` which is a syntax tree node. This allows the resulting `Error` - /// to attempt to span all tokens inside of `tokens`. While you would - /// typically be able to use the `Spanned` trait with the above `Error::new` - /// constructor, implementation limitations today mean that - /// `Error::new_spanned` may provide a higher-quality error message on - /// stable Rust. - /// - /// When in doubt it's recommended to stick to `Error::new` (or - /// `ParseStream::error`)! - #[cfg(feature = "printing")] - pub fn new_spanned(tokens: T, message: U) -> Self { - return new_spanned(tokens.into_token_stream(), message.to_string()); - - fn new_spanned(tokens: TokenStream, message: String) -> Error { - let mut iter = tokens.into_iter(); - let start = iter.next().map_or_else(Span::call_site, |t| t.span()); - let end = iter.last().map_or(start, |t| t.span()); - Error { - messages: vec![ErrorMessage { - start_span: ThreadBound::new(start), - end_span: ThreadBound::new(end), - message, - }], - } - } - } - - /// The source location of the error. - /// - /// Spans are not thread-safe so this function returns `Span::call_site()` - /// if called from a different thread than the one on which the `Error` was - /// originally created. - pub fn span(&self) -> Span { - let start = match self.messages[0].start_span.get() { - Some(span) => *span, - None => return Span::call_site(), - }; - let end = match self.messages[0].end_span.get() { - Some(span) => *span, - None => return Span::call_site(), - }; - start.join(end).unwrap_or(start) - } - - /// Render the error as an invocation of [`compile_error!`]. - /// - /// The [`parse_macro_input!`] macro provides a convenient way to invoke - /// this method correctly in a procedural macro. - /// - /// [`compile_error!`]: std::compile_error! - /// [`parse_macro_input!`]: crate::parse_macro_input! - pub fn to_compile_error(&self) -> TokenStream { - self.messages - .iter() - .map(ErrorMessage::to_compile_error) - .collect() - } - - /// Render the error as an invocation of [`compile_error!`]. - /// - /// [`compile_error!`]: std::compile_error! - /// - /// # Example - /// - /// ``` - /// # extern crate proc_macro; - /// # - /// use proc_macro::TokenStream; - /// use syn::{parse_macro_input, DeriveInput, Error}; - /// - /// # const _: &str = stringify! { - /// #[proc_macro_derive(MyTrait)] - /// # }; - /// pub fn derive_my_trait(input: TokenStream) -> TokenStream { - /// let input = parse_macro_input!(input as DeriveInput); - /// my_trait::expand(input) - /// .unwrap_or_else(Error::into_compile_error) - /// .into() - /// } - /// - /// mod my_trait { - /// use proc_macro2::TokenStream; - /// use syn::{DeriveInput, Result}; - /// - /// pub(crate) fn expand(input: DeriveInput) -> Result { - /// /* ... */ - /// # unimplemented!() - /// } - /// } - /// ``` - pub fn into_compile_error(self) -> TokenStream { - self.to_compile_error() - } - - /// Add another error message to self such that when `to_compile_error()` is - /// called, both errors will be emitted together. - pub fn combine(&mut self, another: Error) { - self.messages.extend(another.messages); - } -} - -impl ErrorMessage { - fn to_compile_error(&self) -> TokenStream { - let start = self - .start_span - .get() - .cloned() - .unwrap_or_else(Span::call_site); - let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); - - // compile_error!($message) - TokenStream::from_iter(vec![ - TokenTree::Ident(Ident::new("compile_error", start)), - TokenTree::Punct({ - let mut punct = Punct::new('!', Spacing::Alone); - punct.set_span(start); - punct - }), - TokenTree::Group({ - let mut group = Group::new(Delimiter::Brace, { - TokenStream::from_iter(vec![TokenTree::Literal({ - let mut string = Literal::string(&self.message); - string.set_span(end); - string - })]) - }); - group.set_span(end); - group - }), - ]) - } -} - -#[cfg(feature = "parsing")] -pub fn new_at(scope: Span, cursor: Cursor, message: T) -> Error { - if cursor.eof() { - Error::new(scope, format!("unexpected end of input, {}", message)) - } else { - let span = crate::buffer::open_span_of_group(cursor); - Error::new(span, message) - } -} - -#[cfg(all(feature = "parsing", any(feature = "full", feature = "derive")))] -pub fn new2(start: Span, end: Span, message: T) -> Error { - return new2(start, end, message.to_string()); - - fn new2(start: Span, end: Span, message: String) -> Error { - Error { - messages: vec![ErrorMessage { - start_span: ThreadBound::new(start), - end_span: ThreadBound::new(end), - message, - }], - } - } -} - -impl Debug for Error { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - if self.messages.len() == 1 { - formatter - .debug_tuple("Error") - .field(&self.messages[0]) - .finish() - } else { - formatter - .debug_tuple("Error") - .field(&self.messages) - .finish() - } - } -} - -impl Debug for ErrorMessage { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - Debug::fmt(&self.message, formatter) - } -} - -impl Display for Error { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str(&self.messages[0].message) - } -} - -impl Clone for Error { - fn clone(&self) -> Self { - Error { - messages: self.messages.clone(), - } - } -} - -impl Clone for ErrorMessage { - fn clone(&self) -> Self { - let start = self - .start_span - .get() - .cloned() - .unwrap_or_else(Span::call_site); - let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); - ErrorMessage { - start_span: ThreadBound::new(start), - end_span: ThreadBound::new(end), - message: self.message.clone(), - } - } -} - -impl std::error::Error for Error {} - -impl From for Error { - fn from(err: LexError) -> Self { - Error::new(err.span(), "lex error") - } -} - -impl IntoIterator for Error { - type Item = Error; - type IntoIter = IntoIter; - - fn into_iter(self) -> Self::IntoIter { - IntoIter { - messages: self.messages.into_iter(), - } - } -} - -pub struct IntoIter { - messages: vec::IntoIter, -} - -impl Iterator for IntoIter { - type Item = Error; - - fn next(&mut self) -> Option { - Some(Error { - messages: vec![self.messages.next()?], - }) - } -} - -impl<'a> IntoIterator for &'a Error { - type Item = Error; - type IntoIter = Iter<'a>; - - fn into_iter(self) -> Self::IntoIter { - Iter { - messages: self.messages.iter(), - } - } -} - -pub struct Iter<'a> { - messages: slice::Iter<'a, ErrorMessage>, -} - -impl<'a> Iterator for Iter<'a> { - type Item = Error; - - fn next(&mut self) -> Option { - Some(Error { - messages: vec![self.messages.next()?.clone()], - }) - } -} - -impl Extend for Error { - fn extend>(&mut self, iter: T) { - for err in iter { - self.combine(err); - } - } -} diff --git a/.cargo-vendor/syn-1.0.109/src/export.rs b/.cargo-vendor/syn-1.0.109/src/export.rs deleted file mode 100644 index f478d091ea..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/export.rs +++ /dev/null @@ -1,39 +0,0 @@ -pub use std::clone::Clone; -pub use std::cmp::{Eq, PartialEq}; -pub use std::default::Default; -pub use std::fmt::{self, Debug, Formatter}; -pub use std::hash::{Hash, Hasher}; -pub use std::marker::Copy; -pub use std::option::Option::{None, Some}; -pub use std::result::Result::{Err, Ok}; - -#[cfg(feature = "printing")] -pub extern crate quote; - -pub use proc_macro2::{Span, TokenStream as TokenStream2}; - -#[cfg(feature = "parsing")] -pub use crate::group::{parse_braces, parse_brackets, parse_parens}; - -pub use crate::span::IntoSpans; - -#[cfg(all( - not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), - feature = "proc-macro" -))] -pub use proc_macro::TokenStream; - -#[cfg(feature = "printing")] -pub use quote::{ToTokens, TokenStreamExt}; - -#[allow(non_camel_case_types)] -pub type bool = help::Bool; -#[allow(non_camel_case_types)] -pub type str = help::Str; - -mod help { - pub type Bool = bool; - pub type Str = str; -} - -pub struct private(pub(crate) ()); diff --git a/.cargo-vendor/syn-1.0.109/src/expr.rs b/.cargo-vendor/syn-1.0.109/src/expr.rs deleted file mode 100644 index 93a59b0e20..0000000000 --- a/.cargo-vendor/syn-1.0.109/src/expr.rs +++ /dev/null @@ -1,3558 +0,0 @@ -use super::*; -use crate::punctuated::Punctuated; -#[cfg(feature = "full")] -use crate::reserved::Reserved; -use proc_macro2::{Span, TokenStream}; -#[cfg(feature = "printing")] -use quote::IdentFragment; -#[cfg(feature = "printing")] -use std::fmt::{self, Display}; -use std::hash::{Hash, Hasher}; -#[cfg(feature = "parsing")] -use std::mem; - -ast_enum_of_structs! { - /// A Rust expression. - /// - /// *This type is available only if Syn is built with the `"derive"` or `"full"` - /// feature, but most of the variants are not available unless "full" is enabled.* - /// - /// # Syntax tree enums - /// - /// This type is a syntax tree enum. In Syn this and other syntax tree enums - /// are designed to be traversed using the following rebinding idiom. - /// - /// ``` - /// # use syn::Expr; - /// # - /// # fn example(expr: Expr) { - /// # const IGNORE: &str = stringify! { - /// let expr: Expr = /* ... */; - /// # }; - /// match expr { - /// Expr::MethodCall(expr) => { - /// /* ... */ - /// } - /// Expr::Cast(expr) => { - /// /* ... */ - /// } - /// Expr::If(expr) => { - /// /* ... */ - /// } - /// - /// /* ... */ - /// # _ => {} - /// # } - /// # } - /// ``` - /// - /// We begin with a variable `expr` of type `Expr` that has no fields - /// (because it is an enum), and by matching on it and rebinding a variable - /// with the same name `expr` we effectively imbue our variable with all of - /// the data fields provided by the variant that it turned out to be. So for - /// example above if we ended up in the `MethodCall` case then we get to use - /// `expr.receiver`, `expr.args` etc; if we ended up in the `If` case we get - /// to use `expr.cond`, `expr.then_branch`, `expr.else_branch`. - /// - /// This approach avoids repeating the variant names twice on every line. - /// - /// ``` - /// # use syn::{Expr, ExprMethodCall}; - /// # - /// # fn example(expr: Expr) { - /// // Repetitive; recommend not doing this. - /// match expr { - /// Expr::MethodCall(ExprMethodCall { method, args, .. }) => { - /// # } - /// # _ => {} - /// # } - /// # } - /// ``` - /// - /// In general, the name to which a syntax tree enum variant is bound should - /// be a suitable name for the complete syntax tree enum type. - /// - /// ``` - /// # use syn::{Expr, ExprField}; - /// # - /// # fn example(discriminant: ExprField) { - /// // Binding is called `base` which is the name I would use if I were - /// // assigning `*discriminant.base` without an `if let`. - /// if let Expr::Tuple(base) = *discriminant.base { - /// # } - /// # } - /// ``` - /// - /// A sign that you may not be choosing the right variable names is if you - /// see names getting repeated in your code, like accessing - /// `receiver.receiver` or `pat.pat` or `cond.cond`. - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - #[cfg_attr(not(syn_no_non_exhaustive), non_exhaustive)] - pub enum Expr { - /// A slice literal expression: `[a, b, c, d]`. - Array(ExprArray), - - /// An assignment expression: `a = compute()`. - Assign(ExprAssign), - - /// A compound assignment expression: `counter += 1`. - AssignOp(ExprAssignOp), - - /// An async block: `async { ... }`. - Async(ExprAsync), - - /// An await expression: `fut.await`. - Await(ExprAwait), - - /// A binary operation: `a + b`, `a * b`. - Binary(ExprBinary), - - /// A blocked scope: `{ ... }`. - Block(ExprBlock), - - /// A box expression: `box f`. - Box(ExprBox), - - /// A `break`, with an optional label to break and an optional - /// expression. - Break(ExprBreak), - - /// A function call expression: `invoke(a, b)`. - Call(ExprCall), - - /// A cast expression: `foo as f64`. - Cast(ExprCast), - - /// A closure expression: `|a, b| a + b`. - Closure(ExprClosure), - - /// A `continue`, with an optional label. - Continue(ExprContinue), - - /// Access of a named struct field (`obj.k`) or unnamed tuple struct - /// field (`obj.0`). - Field(ExprField), - - /// A for loop: `for pat in expr { ... }`. - ForLoop(ExprForLoop), - - /// An expression contained within invisible delimiters. - /// - /// This variant is important for faithfully representing the precedence - /// of expressions and is related to `None`-delimited spans in a - /// `TokenStream`. - Group(ExprGroup), - - /// An `if` expression with an optional `else` block: `if expr { ... } - /// else { ... }`. - /// - /// The `else` branch expression may only be an `If` or `Block` - /// expression, not any of the other types of expression. - If(ExprIf), - - /// A square bracketed indexing expression: `vector[2]`. - Index(ExprIndex), - - /// A `let` guard: `let Some(x) = opt`. - Let(ExprLet), - - /// A literal in place of an expression: `1`, `"foo"`. - Lit(ExprLit), - - /// Conditionless loop: `loop { ... }`. - Loop(ExprLoop), - - /// A macro invocation expression: `format!("{}", q)`. - Macro(ExprMacro), - - /// A `match` expression: `match n { Some(n) => {}, None => {} }`. - Match(ExprMatch), - - /// A method call expression: `x.foo::(a, b)`. - MethodCall(ExprMethodCall), - - /// A parenthesized expression: `(a + b)`. - Paren(ExprParen), - - /// A path like `std::mem::replace` possibly containing generic - /// parameters and a qualified self-type. - /// - /// A plain identifier like `x` is a path of length 1. - Path(ExprPath), - - /// A range expression: `1..2`, `1..`, `..2`, `1..=2`, `..=2`. - Range(ExprRange), - - /// A referencing operation: `&a` or `&mut a`. - Reference(ExprReference), - - /// An array literal constructed from one repeated element: `[0u8; N]`. - Repeat(ExprRepeat), - - /// A `return`, with an optional value to be returned. - Return(ExprReturn), - - /// A struct literal expression: `Point { x: 1, y: 1 }`. - /// - /// The `rest` provides the value of the remaining fields as in `S { a: - /// 1, b: 1, ..rest }`. - Struct(ExprStruct), - - /// A try-expression: `expr?`. - Try(ExprTry), - - /// A try block: `try { ... }`. - TryBlock(ExprTryBlock), - - /// A tuple expression: `(a, b, c, d)`. - Tuple(ExprTuple), - - /// A type ascription expression: `foo: f64`. - Type(ExprType), - - /// A unary operation: `!x`, `*x`. - Unary(ExprUnary), - - /// An unsafe block: `unsafe { ... }`. - Unsafe(ExprUnsafe), - - /// Tokens in expression position not interpreted by Syn. - Verbatim(TokenStream), - - /// A while loop: `while expr { ... }`. - While(ExprWhile), - - /// A yield expression: `yield expr`. - Yield(ExprYield), - - // Not public API. - // - // For testing exhaustiveness in downstream code, use the following idiom: - // - // match expr { - // Expr::Array(expr) => {...} - // Expr::Assign(expr) => {...} - // ... - // Expr::Yield(expr) => {...} - // - // #[cfg_attr(test, deny(non_exhaustive_omitted_patterns))] - // _ => { /* some sane fallback */ } - // } - // - // This way we fail your tests but don't break your library when adding - // a variant. You will be notified by a test failure when a variant is - // added, so that you can add code to handle it, but your library will - // continue to compile and work for downstream users in the interim. - #[cfg(syn_no_non_exhaustive)] - #[doc(hidden)] - __NonExhaustive, - } -} - -ast_struct! { - /// A slice literal expression: `[a, b, c, d]`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprArray #full { - pub attrs: Vec, - pub bracket_token: token::Bracket, - pub elems: Punctuated, - } -} - -ast_struct! { - /// An assignment expression: `a = compute()`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprAssign #full { - pub attrs: Vec, - pub left: Box, - pub eq_token: Token![=], - pub right: Box, - } -} - -ast_struct! { - /// A compound assignment expression: `counter += 1`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprAssignOp #full { - pub attrs: Vec, - pub left: Box, - pub op: BinOp, - pub right: Box, - } -} - -ast_struct! { - /// An async block: `async { ... }`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprAsync #full { - pub attrs: Vec, - pub async_token: Token![async], - pub capture: Option, - pub block: Block, - } -} - -ast_struct! { - /// An await expression: `fut.await`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprAwait #full { - pub attrs: Vec, - pub base: Box, - pub dot_token: Token![.], - pub await_token: token::Await, - } -} - -ast_struct! { - /// A binary operation: `a + b`, `a * b`. - /// - /// *This type is available only if Syn is built with the `"derive"` or - /// `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct ExprBinary { - pub attrs: Vec, - pub left: Box, - pub op: BinOp, - pub right: Box, - } -} - -ast_struct! { - /// A blocked scope: `{ ... }`. - /// - /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(doc_cfg, doc(cfg(feature = "full")))] - pub struct ExprBlock #full { - pub attrs: Vec, - pub label: Option