diff --git a/Cargo.lock b/Cargo.lock index 447a789e318c..77f8032fc7b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5996,9 +5996,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.86" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index fddc3b4af509..7fa5aff180ac 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -613,8 +613,8 @@ user-login = "mbrubeck" user-name = "Matt Brubeck" [[publisher.syn]] -version = "2.0.86" -when = "2024-10-31" +version = "2.0.87" +when = "2024-11-02" user-id = 3618 user-login = "dtolnay" user-name = "David Tolnay" diff --git a/third_party/rust/syn/.cargo-checksum.json b/third_party/rust/syn/.cargo-checksum.json index fea062b5d628..848fdeaceedc 100644 --- a/third_party/rust/syn/.cargo-checksum.json +++ b/third_party/rust/syn/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"13aa64ee73da5f5b5fb8008b65f1d979f6e6e53f225576ef8d2c5602d68c7f18","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"ae6deb98ea51df4829c0327139a555cc115c6bcf6fb459db0ef0d6a96c4566ec","benches/file.rs":"e3593aa456d7ad50a118150e262ce2beb2092ed5c9391e93a055700d228cafb2","benches/rust.rs":"f40e33d0affc2d2081dc4522419382bf9a7b767eada7ac0063a1e6128929359f","src/attr.rs":"d890e2f0866758aec4a21729e2ea76b51485e43170f78b5a130499edad8a069d","src/bigint.rs":"0299829b2f7a1a798fe2f7bc1680e4a10f9b6f4a852d09af4da2deab466c4242","src/buffer.rs":"00f28570908d311f3f568f3b116dc4f6aa3da556eb0bd5af8d6771f3301ab060","src/classify.rs":"fa71d85602981cabf8f283d58748116a0d614a6af07d9e0025f459d71004fd14","src/custom_keyword.rs":"322114e36ae43a2f8605506fb4568efdbc2986853e2fee74bd10a4ca0fb60c69","src/custom_punctuation.rs":"2ae2339c29b1aff3ab16157d51a3a07bfca594aa38586981534fe07a62cdd9d1","src/data.rs":"6f20b5ebbac7c3e9389cb0b5b0637f34d3ab721b6d6707b0eed274024ac78675","src/derive.rs":"f54f8cf9386a2d45186ff3c86ade5dae59e0e337b0198532449190ae8520cff8","src/discouraged.rs":"88b38a75d074d3f0b4186f2b4988844e8284a0c9d279d784327c6b595b9e33ea","src/drops.rs":"e98da4aaafb5afc75919f9e2914326ad09bf16094a9407c60a05515a2e01dd00","src/error.rs":"3b03fd75eee8b0bb646eaf20f7e287345bdc7515ad5286024a2dd1e53c1e7bf2","src/export.rs":"b260cc49da1da3489e7755832bc8015cfad79e84f6c74e237f65ae25a2385e56","src/expr.rs":"485328117485729e3bcf435f881893a700c22e68fa954e5301cd75f9fcf4fcdc","src/ext.rs":"ed143b029af286e62ceb4310286a4ce894792dd588465face042b4199b39d329","src/file.rs":"378839f4e6a9f30d524a6a9213cc513711ddeb14e04d98b0c67644d81788919d","src/fixup.rs":"b312a6a527f81df17a94cb9f08def820584ca76cbef07893bbed492f2f0506af","src/gen/clone.rs":"7af00b0a240453d7aac178be1b6cdf9df3b33f1281da35e02f66ba7ba55d060c","src/gen/debug.rs":"59bc259fa9dc0c7ffe094df7ad8afc9c4e79b6d73a8f0fae8a2e435905866e7a","src/gen/eq.rs":"d7428672d82c1931fdefb8bda0425a25ebbe20e5e2736b18cfd1752b64e99f78","src/gen/fold.rs":"99e8d2a7a7ca3e57c9358e6ea364f68145351f0c81677930e6c3597d15fab527","src/gen/hash.rs":"6808bb0e47e7346a14fbec5f55430906efa172f46417c83c2f7c76ce8c9ceab6","src/gen/token.css":"3a5882d0b3aefbf56ca5d08c28c117e25ac2327eadf7242202d906b2ddb2232e","src/gen/visit.rs":"10ce13d77cec3b3babc8f332902b0bddd712bb5fd5de1f4b3d7761e67cc13947","src/gen/visit_mut.rs":"53672f7c2568b1a9ad0ab33009c61ca19a3ebf18f5d1da57910e4e92fd6075e3","src/generics.rs":"972d7f6c7d33183b5c5338fdbc9e3e67681fd193d945c433b145e348836cbc1c","src/group.rs":"ddbff97e41315bdf9dfce215a8c00bb4d532827cf794246afde7308b39dc09ca","src/ident.rs":"d6061030fadae9c7dc847e1ee46178d9657d782aad108c7197e8cafe765b3eaa","src/item.rs":"2c1547f87927aee8443bebfcc7c924d128f2c78cebd4e23afd81bdd1b0298ee8","src/lib.rs":"7fd3364dbe4fadfb342abb13033280a2fdfa0611b3a5a75cea208754c0cb0c71","src/lifetime.rs":"5787d5a5dc7e5332b03283a25ae0a9e826464242ca2d149b1a19e7cae9cee34d","src/lit.rs":"8fa6fa2d752bd1bf5a94cd5cbf9becbcba37d491876614ce62dba0f8fc745a3d","src/lookahead.rs":"6c8071c172620969b4b708981c7424d672985038be7dfde95ddc433604111773","src/mac.rs":"fdce8291f71adef3f69975f229156dca2309ca232ed943061afaf96220908ab8","src/macros.rs":"2a6e895dfe1c3a9a7237b5e23358ca5d8967e2beae6d094dda68d3659f9a5c84","src/meta.rs":"969d8ccbdbc6ea2e4928a21831b791c57447b231e1373149e4c63b46f3951801","src/op.rs":"a61757370f802e44efa3c4a1057ae2cd26e64e273f7d76c06d5ffb49602319e2","src/parse.rs":"2fa82a15f12a3ff0b7fdd36dd8c215f99120ec316769187bea5c0a6cc730289f","src/parse_macro_input.rs":"e4e22b63d0496d06a4ca17742a22467ed93f08a739081324773828bad63175ee","src/parse_quote.rs":"1679f4621b2702f6ad8ede2fd2a50d4c6f2c07fc5b18e6a389076f37d1e7cc19","src/pat.rs":"1455a882df5defbf6b774a80f37fe24cf96d5ad1e5584c5204c0c9723883566b","src/path.rs":"0e1f132bcb8586b0e93d377da96d48a6c8e63b2c3ea2b83c23698da5ec8039d5","src/precedence.rs":"b745555d0b743bf0d72b56c46ae722b768194ecf9bfbe0fe6c97edcec8c7fd50","src/print.rs":"22910bf0521ab868ebd7c62601c55912d12cfb400c65723e08e5cfa3a2d111c0","src/punctuated.rs":"6e4a63b736f371bbb4cba83bb674e29aa25f9f214bc10e9acf785673a39d3fc5","src/restriction.rs":"a7152ec5a4ee4f55446019aa2b4d84f2238776f0e6ffc0c22adf3374b517fe56","src/sealed.rs":"6ece3b3dcb30f6bb98b93d83759ca7712ee8592bef9c0511141039c38765db0e","src/span.rs":"0a48e375e5c9768f6f64174a91ba6a255f4b021e2fb3548d8494e617f142601b","src/spanned.rs":"4b9bd65f60ab81922adfd0be8f03b6d50e98da3a5f525f242f9639aec4beac79","src/stmt.rs":"9d68b914eac9569de71b3b76fdec2a729796c7350b6eb03d2255662233b12195","src/thread.rs":"1f1deb1272525ab2af9a36aac4bce8f65b0e315adb1656641fd7075662f49222","src/token.rs":"aa7f0e20c3f84e88810ef3ff30f71722973fdeed5cf31ce617f18a5459c758f0","src/tt.rs":"a58303a95d08d6bf3f3e09715b9b70a57b91b54774cfc1f00f2848034d2ff5c7","src/ty.rs":"b0e29da2f6d11e7766ef76d54a5af65eb7eaa00f3cf2db95276528057f77a37c","src/verbatim.rs":"87cbe82a90f48efb57ffd09141042698b3e011a21d0d5412154d80324b0a5ef0","src/whitespace.rs":"9cdcbfe9045b259046329a795bc1105ab5a871471a6d3f7318d275ee53f7a825","tests/common/eq.rs":"b3b055518f7405ed3b782ad4a3f4a916cb635ad66cb506517c4eda7c217ed4d0","tests/common/mod.rs":"1f43ce65b273172c87640e87ee0775ecb6f19280fbf8f792570d019b61f9a32d","tests/common/parse.rs":"c173bd515ba1d53b3b676161849fa8df0ae3d5592445843cee65b6628b71ac32","tests/debug/gen.rs":"3843ce1b6ea5a8e72bd24dfd52760d9326c30e05a3cfe5b28f8f0ac6d76318cf","tests/debug/mod.rs":"1259df940bbcaa968a837e402d6853f2efa38d2260e306d42f17f9e8ef74fae5","tests/macros/mod.rs":"c246b05fcca55d3880278754f36c802a8a006bb0a17d0c787989dd6716e76f37","tests/regression.rs":"e9565ea0efecb4136f099164ffcfa26e1996b0a27fb9c6659e90ad9bdd42e7b6","tests/regression/issue1108.rs":"f32db35244a674e22ff824ca9e5bbec2184e287b59f022db68c418b5878a2edc","tests/regression/issue1235.rs":"a2266b10c3f7c7af5734817ab0a3e8b309b51e7d177b63f26e67e6b744d280b0","tests/repo/mod.rs":"3ff3657c5201809456307dd4f3f3a2eef5170e29f4c3df3a7d43ae0415124471","tests/repo/progress.rs":"c08d0314a7f3ecf760d471f27da3cd2a500aeb9f1c8331bffb2aa648f9fabf3f","tests/test_asyncness.rs":"aca499c3c120f35f56033493aa732079af9a85463cc39297ed46ad2397be1c6d","tests/test_attribute.rs":"48078187c20a257422e02042c47acea8bb9b3644696e5d6a1eb0962864b81691","tests/test_derive_input.rs":"e062007ef389c0b8490d9145f9cc5dec59acbf34927c92355a43f2a847070ac2","tests/test_expr.rs":"f33918ab66c64605890d835fd72d96ea7c9e8ec645518030b4c2f8c8fd569d85","tests/test_generics.rs":"73ed0bb52b75720911fb03977b8ec33b873c2eaab735114d7a5fb45531b0b3c4","tests/test_grouping.rs":"28084b1b922884b54dfa6dc573ffc19a58138e5b08e0b6e0a82120572983c81d","tests/test_ident.rs":"d5850e817720e774cd397a46dbc5298c57933823c18e20805e84503fc9387e8f","tests/test_item.rs":"7191698ea9ed6e94ac57dbcfc4b484623d0c31cf89b005d5935083431be725f3","tests/test_iterators.rs":"f1ab7d5504dc06dc79cc3ba09c0364b045d2da86deb06e60412e6b80208b7439","tests/test_lit.rs":"8ec75a817036f0ff918b350370e90b2fb3fdef0ed32587b0015ebc09f9456c10","tests/test_meta.rs":"fee43f1219dd23523766feded7609d7c7fc3a156ecd55e309b2c5b40f11e045a","tests/test_parse_buffer.rs":"0de6af13ba0345986b18d495063f9b75a1018e8569c34b277f9522c63a6c0941","tests/test_parse_quote.rs":"28c11ab23b374327f56b29cc5f424f4a22a5974b92f9077a8dd0b8dca08c8d5c","tests/test_parse_stream.rs":"b6b533432173123d6d01d8d2cb33714bc50b30b16ffbb6116f93937221ad4594","tests/test_pat.rs":"d70d701ab2b9bd4f632e926af44c829ac273cf6fdacbdc52df4ec7cefcc9e09c","tests/test_path.rs":"9529c461c38ac1ecca1c6b798392aba791e7d371228b7670cde4c9b34c8e9d68","tests/test_precedence.rs":"c9286e45cbf15355715be07d877e9d0aeb3500fa65ec19fc72cdaaca44f5fb4c","tests/test_receiver.rs":"d34a1c5cac8f78ff0ff41df3bd9631b02edacab4d50059e8a2ed3d13fe6ba4c5","tests/test_round_trip.rs":"9c00a071a98cad7ce730d9e78e75ac63852924d6c1eaa6b6e29d06f02d276560","tests/test_shebang.rs":"98f7ec66e2240391c8f48fe9a330737930740b6275fef22486555ebef113acad","tests/test_size.rs":"03efaf829b80b7db1f831474c1d3ce268914fc499d0e2a7eea03cad04a482974","tests/test_stmt.rs":"3cf4463864039483c1ee329e3796d690b47c18bc8255c407451d31b239440ffe","tests/test_token_trees.rs":"f0a57f4d46b5dd4dbdf601450f6eb4db5fb5622dce3e9d17d2f021021b37fd9d","tests/test_ty.rs":"57622225e442427b79a68ff86a3fb2ebf2b81cc2ae1d2d00be601e8402bb1197","tests/test_unparenthesize.rs":"3e1eaf1025849db95d086a06735c6c564b30db87ee7abb3e4bb82f533e58c638","tests/test_visibility.rs":"f0ef86f7a89b8b78b841cad25d98420e96f59309d3d42f6930c6defad183edc7","tests/zzz_stable.rs":"2a862e59cb446235ed99aec0e6ada8e16d3ecc30229b29d825b7c0bbc2602989"},"package":"e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c"} \ No newline at end of file +{"files":{"Cargo.toml":"efa510558fc95d6629092691db4752f63049127862359f0617f675c2c31dea70","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"ae6deb98ea51df4829c0327139a555cc115c6bcf6fb459db0ef0d6a96c4566ec","benches/file.rs":"e3593aa456d7ad50a118150e262ce2beb2092ed5c9391e93a055700d228cafb2","benches/rust.rs":"f40e33d0affc2d2081dc4522419382bf9a7b767eada7ac0063a1e6128929359f","src/attr.rs":"d890e2f0866758aec4a21729e2ea76b51485e43170f78b5a130499edad8a069d","src/bigint.rs":"0299829b2f7a1a798fe2f7bc1680e4a10f9b6f4a852d09af4da2deab466c4242","src/buffer.rs":"c2b99c6b4268205050fa93e6695f0f6d5990c4b2a7b24e234fd8d81c265f309a","src/classify.rs":"fa71d85602981cabf8f283d58748116a0d614a6af07d9e0025f459d71004fd14","src/custom_keyword.rs":"322114e36ae43a2f8605506fb4568efdbc2986853e2fee74bd10a4ca0fb60c69","src/custom_punctuation.rs":"2ae2339c29b1aff3ab16157d51a3a07bfca594aa38586981534fe07a62cdd9d1","src/data.rs":"5bb05d41eb93f5c895f05f31a2aa468f3332265a6d5e7a89968c5daa273937dc","src/derive.rs":"f54f8cf9386a2d45186ff3c86ade5dae59e0e337b0198532449190ae8520cff8","src/discouraged.rs":"88b38a75d074d3f0b4186f2b4988844e8284a0c9d279d784327c6b595b9e33ea","src/drops.rs":"e98da4aaafb5afc75919f9e2914326ad09bf16094a9407c60a05515a2e01dd00","src/error.rs":"3b03fd75eee8b0bb646eaf20f7e287345bdc7515ad5286024a2dd1e53c1e7bf2","src/export.rs":"b260cc49da1da3489e7755832bc8015cfad79e84f6c74e237f65ae25a2385e56","src/expr.rs":"1d33206bc7ef18bc280f1e79101cad01b24f1796c8d9701cb12f6908f63aa973","src/ext.rs":"ed143b029af286e62ceb4310286a4ce894792dd588465face042b4199b39d329","src/file.rs":"378839f4e6a9f30d524a6a9213cc513711ddeb14e04d98b0c67644d81788919d","src/fixup.rs":"b312a6a527f81df17a94cb9f08def820584ca76cbef07893bbed492f2f0506af","src/gen/clone.rs":"7af00b0a240453d7aac178be1b6cdf9df3b33f1281da35e02f66ba7ba55d060c","src/gen/debug.rs":"59bc259fa9dc0c7ffe094df7ad8afc9c4e79b6d73a8f0fae8a2e435905866e7a","src/gen/eq.rs":"d7428672d82c1931fdefb8bda0425a25ebbe20e5e2736b18cfd1752b64e99f78","src/gen/fold.rs":"99e8d2a7a7ca3e57c9358e6ea364f68145351f0c81677930e6c3597d15fab527","src/gen/hash.rs":"6808bb0e47e7346a14fbec5f55430906efa172f46417c83c2f7c76ce8c9ceab6","src/gen/token.css":"3a5882d0b3aefbf56ca5d08c28c117e25ac2327eadf7242202d906b2ddb2232e","src/gen/visit.rs":"10ce13d77cec3b3babc8f332902b0bddd712bb5fd5de1f4b3d7761e67cc13947","src/gen/visit_mut.rs":"53672f7c2568b1a9ad0ab33009c61ca19a3ebf18f5d1da57910e4e92fd6075e3","src/generics.rs":"972d7f6c7d33183b5c5338fdbc9e3e67681fd193d945c433b145e348836cbc1c","src/group.rs":"ddbff97e41315bdf9dfce215a8c00bb4d532827cf794246afde7308b39dc09ca","src/ident.rs":"d6061030fadae9c7dc847e1ee46178d9657d782aad108c7197e8cafe765b3eaa","src/item.rs":"2c1547f87927aee8443bebfcc7c924d128f2c78cebd4e23afd81bdd1b0298ee8","src/lib.rs":"1e4fbde852722294acff9f47056ffde222d6f3f3029e5a1fadb6090e5f2e68fe","src/lifetime.rs":"5787d5a5dc7e5332b03283a25ae0a9e826464242ca2d149b1a19e7cae9cee34d","src/lit.rs":"8fa6fa2d752bd1bf5a94cd5cbf9becbcba37d491876614ce62dba0f8fc745a3d","src/lookahead.rs":"6c8071c172620969b4b708981c7424d672985038be7dfde95ddc433604111773","src/mac.rs":"fdce8291f71adef3f69975f229156dca2309ca232ed943061afaf96220908ab8","src/macros.rs":"2a6e895dfe1c3a9a7237b5e23358ca5d8967e2beae6d094dda68d3659f9a5c84","src/meta.rs":"969d8ccbdbc6ea2e4928a21831b791c57447b231e1373149e4c63b46f3951801","src/op.rs":"a61757370f802e44efa3c4a1057ae2cd26e64e273f7d76c06d5ffb49602319e2","src/parse.rs":"2fa82a15f12a3ff0b7fdd36dd8c215f99120ec316769187bea5c0a6cc730289f","src/parse_macro_input.rs":"e4e22b63d0496d06a4ca17742a22467ed93f08a739081324773828bad63175ee","src/parse_quote.rs":"1679f4621b2702f6ad8ede2fd2a50d4c6f2c07fc5b18e6a389076f37d1e7cc19","src/pat.rs":"1455a882df5defbf6b774a80f37fe24cf96d5ad1e5584c5204c0c9723883566b","src/path.rs":"0e1f132bcb8586b0e93d377da96d48a6c8e63b2c3ea2b83c23698da5ec8039d5","src/precedence.rs":"b745555d0b743bf0d72b56c46ae722b768194ecf9bfbe0fe6c97edcec8c7fd50","src/print.rs":"22910bf0521ab868ebd7c62601c55912d12cfb400c65723e08e5cfa3a2d111c0","src/punctuated.rs":"6e4a63b736f371bbb4cba83bb674e29aa25f9f214bc10e9acf785673a39d3fc5","src/restriction.rs":"a7152ec5a4ee4f55446019aa2b4d84f2238776f0e6ffc0c22adf3374b517fe56","src/scan_expr.rs":"d46ae7a3eaaa6476553db3164676ec71aa82bcd8a2e4cad59deb07893c79f1c8","src/sealed.rs":"6ece3b3dcb30f6bb98b93d83759ca7712ee8592bef9c0511141039c38765db0e","src/span.rs":"0a48e375e5c9768f6f64174a91ba6a255f4b021e2fb3548d8494e617f142601b","src/spanned.rs":"4b9bd65f60ab81922adfd0be8f03b6d50e98da3a5f525f242f9639aec4beac79","src/stmt.rs":"9d68b914eac9569de71b3b76fdec2a729796c7350b6eb03d2255662233b12195","src/thread.rs":"1f1deb1272525ab2af9a36aac4bce8f65b0e315adb1656641fd7075662f49222","src/token.rs":"aa7f0e20c3f84e88810ef3ff30f71722973fdeed5cf31ce617f18a5459c758f0","src/tt.rs":"a58303a95d08d6bf3f3e09715b9b70a57b91b54774cfc1f00f2848034d2ff5c7","src/ty.rs":"b0e29da2f6d11e7766ef76d54a5af65eb7eaa00f3cf2db95276528057f77a37c","src/verbatim.rs":"87cbe82a90f48efb57ffd09141042698b3e011a21d0d5412154d80324b0a5ef0","src/whitespace.rs":"9cdcbfe9045b259046329a795bc1105ab5a871471a6d3f7318d275ee53f7a825","tests/common/eq.rs":"fd76c9ee5324d0b36efe9d5bb649ea545015f6402965b5dabaf109ce19f55155","tests/common/mod.rs":"1f43ce65b273172c87640e87ee0775ecb6f19280fbf8f792570d019b61f9a32d","tests/common/parse.rs":"c173bd515ba1d53b3b676161849fa8df0ae3d5592445843cee65b6628b71ac32","tests/debug/gen.rs":"3843ce1b6ea5a8e72bd24dfd52760d9326c30e05a3cfe5b28f8f0ac6d76318cf","tests/debug/mod.rs":"1259df940bbcaa968a837e402d6853f2efa38d2260e306d42f17f9e8ef74fae5","tests/macros/mod.rs":"c246b05fcca55d3880278754f36c802a8a006bb0a17d0c787989dd6716e76f37","tests/regression.rs":"e9565ea0efecb4136f099164ffcfa26e1996b0a27fb9c6659e90ad9bdd42e7b6","tests/regression/issue1108.rs":"f32db35244a674e22ff824ca9e5bbec2184e287b59f022db68c418b5878a2edc","tests/regression/issue1235.rs":"a2266b10c3f7c7af5734817ab0a3e8b309b51e7d177b63f26e67e6b744d280b0","tests/repo/mod.rs":"3ff3657c5201809456307dd4f3f3a2eef5170e29f4c3df3a7d43ae0415124471","tests/repo/progress.rs":"c08d0314a7f3ecf760d471f27da3cd2a500aeb9f1c8331bffb2aa648f9fabf3f","tests/test_asyncness.rs":"aca499c3c120f35f56033493aa732079af9a85463cc39297ed46ad2397be1c6d","tests/test_attribute.rs":"48078187c20a257422e02042c47acea8bb9b3644696e5d6a1eb0962864b81691","tests/test_derive_input.rs":"e062007ef389c0b8490d9145f9cc5dec59acbf34927c92355a43f2a847070ac2","tests/test_expr.rs":"f33918ab66c64605890d835fd72d96ea7c9e8ec645518030b4c2f8c8fd569d85","tests/test_generics.rs":"73ed0bb52b75720911fb03977b8ec33b873c2eaab735114d7a5fb45531b0b3c4","tests/test_grouping.rs":"28084b1b922884b54dfa6dc573ffc19a58138e5b08e0b6e0a82120572983c81d","tests/test_ident.rs":"d5850e817720e774cd397a46dbc5298c57933823c18e20805e84503fc9387e8f","tests/test_item.rs":"7191698ea9ed6e94ac57dbcfc4b484623d0c31cf89b005d5935083431be725f3","tests/test_iterators.rs":"f1ab7d5504dc06dc79cc3ba09c0364b045d2da86deb06e60412e6b80208b7439","tests/test_lit.rs":"8ec75a817036f0ff918b350370e90b2fb3fdef0ed32587b0015ebc09f9456c10","tests/test_meta.rs":"fee43f1219dd23523766feded7609d7c7fc3a156ecd55e309b2c5b40f11e045a","tests/test_parse_buffer.rs":"0de6af13ba0345986b18d495063f9b75a1018e8569c34b277f9522c63a6c0941","tests/test_parse_quote.rs":"28c11ab23b374327f56b29cc5f424f4a22a5974b92f9077a8dd0b8dca08c8d5c","tests/test_parse_stream.rs":"b6b533432173123d6d01d8d2cb33714bc50b30b16ffbb6116f93937221ad4594","tests/test_pat.rs":"d70d701ab2b9bd4f632e926af44c829ac273cf6fdacbdc52df4ec7cefcc9e09c","tests/test_path.rs":"9529c461c38ac1ecca1c6b798392aba791e7d371228b7670cde4c9b34c8e9d68","tests/test_precedence.rs":"a9cc731e65e5491c3e7d77e0f66ec875583cded36391b2fe02beac58fd95ce9e","tests/test_receiver.rs":"d34a1c5cac8f78ff0ff41df3bd9631b02edacab4d50059e8a2ed3d13fe6ba4c5","tests/test_round_trip.rs":"9c00a071a98cad7ce730d9e78e75ac63852924d6c1eaa6b6e29d06f02d276560","tests/test_shebang.rs":"98f7ec66e2240391c8f48fe9a330737930740b6275fef22486555ebef113acad","tests/test_size.rs":"03efaf829b80b7db1f831474c1d3ce268914fc499d0e2a7eea03cad04a482974","tests/test_stmt.rs":"3cf4463864039483c1ee329e3796d690b47c18bc8255c407451d31b239440ffe","tests/test_token_trees.rs":"f0a57f4d46b5dd4dbdf601450f6eb4db5fb5622dce3e9d17d2f021021b37fd9d","tests/test_ty.rs":"57622225e442427b79a68ff86a3fb2ebf2b81cc2ae1d2d00be601e8402bb1197","tests/test_unparenthesize.rs":"3e1eaf1025849db95d086a06735c6c564b30db87ee7abb3e4bb82f533e58c638","tests/test_visibility.rs":"f0ef86f7a89b8b78b841cad25d98420e96f59309d3d42f6930c6defad183edc7","tests/zzz_stable.rs":"2a862e59cb446235ed99aec0e6ada8e16d3ecc30229b29d825b7c0bbc2602989"},"package":"25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"} \ No newline at end of file diff --git a/third_party/rust/syn/Cargo.toml b/third_party/rust/syn/Cargo.toml index d1b787fbe149..9e91ac2f1209 100644 --- a/third_party/rust/syn/Cargo.toml +++ b/third_party/rust/syn/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.61" name = "syn" -version = "2.0.86" +version = "2.0.87" authors = ["David Tolnay "] build = false include = [ diff --git a/third_party/rust/syn/src/buffer.rs b/third_party/rust/syn/src/buffer.rs index c28440a29b8c..b4d198072556 100644 --- a/third_party/rust/syn/src/buffer.rs +++ b/third_party/rust/syn/src/buffer.rs @@ -183,52 +183,6 @@ impl<'a> Cursor<'a> { 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>, DelimSpan, 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 span = group.delim_span(); - 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, span, after_group)); - } - } - - None - } - - pub(crate) fn any_group(self) -> Option<(Cursor<'a>, Delimiter, DelimSpan, Cursor<'a>)> { - if let Entry::Group(group, end_offset) = self.entry() { - let delimiter = group.delimiter(); - let span = group.delim_span(); - 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, delimiter, span, after_group)); - } - - None - } - - pub(crate) fn any_group_token(self) -> Option<(Group, Cursor<'a>)> { - if let Entry::Group(group, end_offset) = self.entry() { - let end_of_group = unsafe { self.ptr.add(*end_offset) }; - let after_group = unsafe { Cursor::create(end_of_group, self.scope) }; - return Some((group.clone(), 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>)> { @@ -279,6 +233,54 @@ impl<'a> Cursor<'a> { } } + /// 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>, DelimSpan, 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 span = group.delim_span(); + 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, span, after_group)); + } + } + + None + } + + /// If the cursor is pointing at a `Group`, returns a cursor into the group + /// and one pointing to the next `TokenTree`. + pub fn any_group(self) -> Option<(Cursor<'a>, Delimiter, DelimSpan, Cursor<'a>)> { + if let Entry::Group(group, end_offset) = self.entry() { + let delimiter = group.delimiter(); + let span = group.delim_span(); + 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, delimiter, span, after_group)); + } + + None + } + + pub(crate) fn any_group_token(self) -> Option<(Group, Cursor<'a>)> { + if let Entry::Group(group, end_offset) = self.entry() { + let end_of_group = unsafe { self.ptr.add(*end_offset) }; + let after_group = unsafe { Cursor::create(end_of_group, self.scope) }; + return Some((group.clone(), after_group)); + } + + None + } + /// Copies all remaining tokens visible from this cursor into a /// `TokenStream`. pub fn token_stream(self) -> TokenStream { diff --git a/third_party/rust/syn/src/data.rs b/third_party/rust/syn/src/data.rs index 9e73f02d3cb4..96db2a0b7c6f 100644 --- a/third_party/rust/syn/src/data.rs +++ b/third_party/rust/syn/src/data.rs @@ -248,6 +248,8 @@ pub(crate) mod parsing { use crate::parse::discouraged::Speculative as _; use crate::parse::{Parse, ParseStream}; use crate::restriction::{FieldMutability, Visibility}; + #[cfg(not(feature = "full"))] + use crate::scan_expr::scan_expr; use crate::token; use crate::ty::Type; use crate::verbatim; @@ -276,7 +278,7 @@ pub(crate) mod parsing { let mut discriminant: Result = ahead.parse(); if discriminant.is_ok() { input.advance_to(&ahead); - } else if scan_lenient_discriminant(input).is_ok() { + } else if scan_expr(input).is_ok() { discriminant = Ok(Expr::Verbatim(verbatim::between(&begin, input))); } discriminant? @@ -294,85 +296,6 @@ pub(crate) mod parsing { } } - #[cfg(not(feature = "full"))] - pub(crate) fn scan_lenient_discriminant(input: ParseStream) -> Result<()> { - use crate::expr::Member; - use crate::lifetime::Lifetime; - use crate::lit::Lit; - use crate::lit::LitFloat; - use crate::op::{BinOp, UnOp}; - use crate::path::{self, AngleBracketedGenericArguments}; - use proc_macro2::Delimiter::{self, Brace, Bracket, Parenthesis}; - - let consume = |delimiter: Delimiter| { - Result::unwrap(input.step(|cursor| match cursor.group(delimiter) { - Some((_inside, _span, rest)) => Ok((true, rest)), - None => Ok((false, *cursor)), - })) - }; - - macro_rules! consume { - [$token:tt] => { - input.parse::>().unwrap().is_some() - }; - } - - let mut initial = true; - let mut depth = 0usize; - loop { - if initial { - if consume![&] { - input.parse::>()?; - } else if consume![if] || consume![match] || consume![while] { - depth += 1; - } else if input.parse::>()?.is_some() - || (consume(Brace) || consume(Bracket) || consume(Parenthesis)) - || (consume![async] || consume![const] || consume![loop] || consume![unsafe]) - && (consume(Brace) || break) - { - initial = false; - } else if consume![let] { - while !consume![=] { - if !((consume![|] || consume![ref] || consume![mut] || consume![@]) - || (consume![!] || input.parse::>()?.is_some()) - || (consume![..=] || consume![..] || consume![&] || consume![_]) - || (consume(Brace) || consume(Bracket) || consume(Parenthesis))) - { - path::parsing::qpath(input, true)?; - } - } - } else if input.parse::>()?.is_some() && !consume![:] { - break; - } else if input.parse::().is_err() { - path::parsing::qpath(input, true)?; - initial = consume![!] || depth == 0 && input.peek(token::Brace); - } - } else if input.is_empty() || input.peek(Token![,]) { - return Ok(()); - } else if depth > 0 && consume(Brace) { - if consume![else] && !consume(Brace) { - initial = consume![if] || break; - } else { - depth -= 1; - } - } else if input.parse::().is_ok() || (consume![..] | consume![=]) { - initial = true; - } else if consume![.] { - if input.parse::>()?.is_none() - && (input.parse::()?.is_named() && consume![::]) - { - AngleBracketedGenericArguments::do_parse(None, input)?; - } - } else if consume![as] { - input.parse::()?; - } else if !(consume(Brace) || consume(Bracket) || consume(Parenthesis)) { - break; - } - } - - Err(input.error("unsupported expression")) - } - #[cfg_attr(docsrs, doc(cfg(feature = "parsing")))] impl Parse for FieldsNamed { fn parse(input: ParseStream) -> Result { diff --git a/third_party/rust/syn/src/expr.rs b/third_party/rust/syn/src/expr.rs index dc18cd1aa3d8..f68f6322fecd 100644 --- a/third_party/rust/syn/src/expr.rs +++ b/third_party/rust/syn/src/expr.rs @@ -1,15 +1,17 @@ use crate::attr::Attribute; #[cfg(all(feature = "parsing", feature = "full"))] use crate::error::Result; +#[cfg(feature = "parsing")] +use crate::ext::IdentExt as _; #[cfg(feature = "full")] use crate::generics::BoundLifetimes; use crate::ident::Ident; -#[cfg(feature = "full")] +#[cfg(any(feature = "parsing", feature = "full"))] use crate::lifetime::Lifetime; use crate::lit::Lit; use crate::mac::Macro; use crate::op::{BinOp, UnOp}; -#[cfg(all(feature = "parsing", feature = "full"))] +#[cfg(feature = "parsing")] use crate::parse::ParseStream; #[cfg(feature = "full")] use crate::pat::Pat; @@ -889,6 +891,36 @@ impl Expr { parsing::parse_with_earlier_boundary_rule(input) } + /// Returns whether the next token in the parse stream is one that might + /// possibly form the beginning of an expr. + /// + /// This classification is a load-bearing part of the grammar of some Rust + /// expressions, notably `return` and `break`. For example `return < …` will + /// never parse `<` as a binary operator regardless of what comes after, + /// because `<` is a legal starting token for an expression and so it's + /// required to be continued as a return value, such as `return ::CONST`. Meanwhile `return > …` treats the `>` as a binary + /// operator because it cannot be a starting token for any Rust expression. + #[cfg(feature = "parsing")] + #[cfg_attr(docsrs, doc(cfg(feature = "parsing")))] + pub fn peek(input: ParseStream) -> bool { + input.peek(Ident::peek_any) // value name or keyword + || input.peek(token::Paren) // tuple + || input.peek(token::Bracket) // array + || input.peek(token::Brace) // block + || input.peek(Lit) // literal + || input.peek(Token![!]) && !input.peek(Token![!=]) // operator not + || input.peek(Token![-]) && !input.peek(Token![-=]) && !input.peek(Token![->]) // unary minus + || input.peek(Token![*]) && !input.peek(Token![*=]) // dereference + || input.peek(Token![|]) && !input.peek(Token![|=]) // closure + || input.peek(Token![&]) && !input.peek(Token![&=]) // reference + || input.peek(Token![..]) // range + || input.peek(Token![<]) && !input.peek(Token![<=]) && !input.peek(Token![<<=]) // associated path + || input.peek(Token![::]) // absolute path + || input.peek(Lifetime) // labeled loop + || input.peek(Token![#]) // expression attributes + } + #[cfg(all(feature = "parsing", feature = "full"))] pub(crate) fn replace_attrs(&mut self, new: Vec) -> Vec { match self { @@ -1147,8 +1179,6 @@ pub(crate) mod parsing { FieldValue, Index, Member, }; #[cfg(feature = "full")] - use crate::ext::IdentExt as _; - #[cfg(feature = "full")] use crate::generics::BoundLifetimes; use crate::ident::Ident; #[cfg(feature = "full")] @@ -1266,25 +1296,6 @@ pub(crate) mod parsing { } } - #[cfg(feature = "full")] - fn can_begin_expr(input: ParseStream) -> bool { - input.peek(Ident::peek_any) // value name or keyword - || input.peek(token::Paren) // tuple - || input.peek(token::Bracket) // array - || input.peek(token::Brace) // block - || input.peek(Lit) // literal - || input.peek(Token![!]) && !input.peek(Token![!=]) // operator not - || input.peek(Token![-]) && !input.peek(Token![-=]) && !input.peek(Token![->]) // unary minus - || input.peek(Token![*]) && !input.peek(Token![*=]) // dereference - || input.peek(Token![|]) && !input.peek(Token![|=]) // closure - || input.peek(Token![&]) && !input.peek(Token![&=]) // reference - || input.peek(Token![..]) // range notation - || input.peek(Token![<]) && !input.peek(Token![<=]) && !input.peek(Token![<<=]) // associated path - || input.peek(Token![::]) // global path - || input.peek(Lifetime) // labeled loop - || input.peek(Token![#]) // expression attributes - } - #[cfg(feature = "full")] fn parse_expr( input: ParseStream, @@ -2439,7 +2450,7 @@ pub(crate) mod parsing { attrs: Vec::new(), return_token: input.parse()?, expr: { - if can_begin_expr(input) { + if Expr::peek(input) { Some(input.parse()?) } else { None @@ -2477,7 +2488,7 @@ pub(crate) mod parsing { attrs: Vec::new(), yield_token: input.parse()?, expr: { - if can_begin_expr(input) { + if Expr::peek(input) { Some(input.parse()?) } else { None @@ -2690,7 +2701,7 @@ pub(crate) mod parsing { } input.advance_to(&ahead); - let expr = if can_begin_expr(input) && (allow_struct.0 || !input.peek(token::Brace)) { + let expr = if Expr::peek(input) && (allow_struct.0 || !input.peek(token::Brace)) { Some(input.parse()?) } else { None diff --git a/third_party/rust/syn/src/lib.rs b/third_party/rust/syn/src/lib.rs index 2eb370ad9242..19736acf92a5 100644 --- a/third_party/rust/syn/src/lib.rs +++ b/third_party/rust/syn/src/lib.rs @@ -249,7 +249,7 @@ //! dynamic library libproc_macro from rustc toolchain. // Syn types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/syn/2.0.86")] +#![doc(html_root_url = "https://docs.rs/syn/2.0.87")] #![cfg_attr(docsrs, feature(doc_cfg))] #![deny(unsafe_op_in_unsafe_fn)] #![allow(non_camel_case_types)] @@ -264,6 +264,7 @@ clippy::derivable_impls, clippy::diverging_sub_expression, clippy::doc_markdown, + clippy::enum_glob_use, clippy::expl_impl_clone_on_copy, clippy::explicit_auto_deref, clippy::if_not_else, @@ -307,6 +308,8 @@ clippy::wildcard_imports, )] +extern crate self as syn; + #[cfg(feature = "proc-macro")] extern crate proc_macro; @@ -509,6 +512,9 @@ pub use crate::restriction::{FieldMutability, VisRestricted, Visibility}; mod sealed; +#[cfg(all(feature = "parsing", feature = "derive", not(feature = "full")))] +mod scan_expr; + mod span; #[cfg(all(feature = "parsing", feature = "printing"))] diff --git a/third_party/rust/syn/src/scan_expr.rs b/third_party/rust/syn/src/scan_expr.rs new file mode 100644 index 000000000000..155b5b63bf02 --- /dev/null +++ b/third_party/rust/syn/src/scan_expr.rs @@ -0,0 +1,264 @@ +use self::{Action::*, Input::*}; +use proc_macro2::{Delimiter, Ident, Spacing, TokenTree}; +use syn::parse::{ParseStream, Result}; +use syn::{AngleBracketedGenericArguments, BinOp, Expr, ExprPath, Lifetime, Lit, Token, Type}; + +enum Input { + Keyword(&'static str), + Punct(&'static str), + ConsumeAny, + ConsumeBinOp, + ConsumeBrace, + ConsumeDelimiter, + ConsumeIdent, + ConsumeLifetime, + ConsumeLiteral, + ConsumeNestedBrace, + ExpectPath, + ExpectTurbofish, + ExpectType, + CanBeginExpr, + Otherwise, + Empty, +} + +enum Action { + SetState(&'static [(Input, Action)]), + IncDepth, + DecDepth, + Finish, +} + +static INIT: [(Input, Action); 28] = [ + (ConsumeDelimiter, SetState(&POSTFIX)), + (Keyword("async"), SetState(&ASYNC)), + (Keyword("break"), SetState(&BREAK_LABEL)), + (Keyword("const"), SetState(&CONST)), + (Keyword("continue"), SetState(&CONTINUE)), + (Keyword("for"), SetState(&FOR)), + (Keyword("if"), IncDepth), + (Keyword("let"), SetState(&PATTERN)), + (Keyword("loop"), SetState(&BLOCK)), + (Keyword("match"), IncDepth), + (Keyword("move"), SetState(&CLOSURE)), + (Keyword("return"), SetState(&RETURN)), + (Keyword("static"), SetState(&CLOSURE)), + (Keyword("unsafe"), SetState(&BLOCK)), + (Keyword("while"), IncDepth), + (Keyword("yield"), SetState(&RETURN)), + (Keyword("_"), SetState(&POSTFIX)), + (Punct("!"), SetState(&INIT)), + (Punct("#"), SetState(&[(ConsumeDelimiter, SetState(&INIT))])), + (Punct("&"), SetState(&REFERENCE)), + (Punct("*"), SetState(&INIT)), + (Punct("-"), SetState(&INIT)), + (Punct("..="), SetState(&INIT)), + (Punct(".."), SetState(&RANGE)), + (Punct("|"), SetState(&CLOSURE_ARGS)), + (ConsumeLifetime, SetState(&[(Punct(":"), SetState(&INIT))])), + (ConsumeLiteral, SetState(&POSTFIX)), + (ExpectPath, SetState(&PATH)), +]; + +static POSTFIX: [(Input, Action); 10] = [ + (Keyword("as"), SetState(&[(ExpectType, SetState(&POSTFIX))])), + (Punct("..="), SetState(&INIT)), + (Punct(".."), SetState(&RANGE)), + (Punct("."), SetState(&DOT)), + (Punct("?"), SetState(&POSTFIX)), + (ConsumeBinOp, SetState(&INIT)), + (Punct("="), SetState(&INIT)), + (ConsumeNestedBrace, SetState(&IF_THEN)), + (ConsumeDelimiter, SetState(&POSTFIX)), + (Empty, Finish), +]; + +static ASYNC: [(Input, Action); 3] = [ + (Keyword("move"), SetState(&ASYNC)), + (Punct("|"), SetState(&CLOSURE_ARGS)), + (ConsumeBrace, SetState(&POSTFIX)), +]; + +static BLOCK: [(Input, Action); 1] = [(ConsumeBrace, SetState(&POSTFIX))]; + +static BREAK_LABEL: [(Input, Action); 2] = [ + (ConsumeLifetime, SetState(&BREAK_VALUE)), + (Otherwise, SetState(&BREAK_VALUE)), +]; + +static BREAK_VALUE: [(Input, Action); 3] = [ + (ConsumeNestedBrace, SetState(&IF_THEN)), + (CanBeginExpr, SetState(&INIT)), + (Otherwise, SetState(&POSTFIX)), +]; + +static CLOSURE: [(Input, Action); 6] = [ + (Keyword("async"), SetState(&CLOSURE)), + (Keyword("move"), SetState(&CLOSURE)), + (Punct(","), SetState(&CLOSURE)), + (Punct(">"), SetState(&CLOSURE)), + (Punct("|"), SetState(&CLOSURE_ARGS)), + (ConsumeLifetime, SetState(&CLOSURE)), +]; + +static CLOSURE_ARGS: [(Input, Action); 2] = [ + (Punct("|"), SetState(&CLOSURE_RET)), + (ConsumeAny, SetState(&CLOSURE_ARGS)), +]; + +static CLOSURE_RET: [(Input, Action); 2] = [ + (Punct("->"), SetState(&[(ExpectType, SetState(&BLOCK))])), + (Otherwise, SetState(&INIT)), +]; + +static CONST: [(Input, Action); 2] = [ + (Punct("|"), SetState(&CLOSURE_ARGS)), + (ConsumeBrace, SetState(&POSTFIX)), +]; + +static CONTINUE: [(Input, Action); 2] = [ + (ConsumeLifetime, SetState(&POSTFIX)), + (Otherwise, SetState(&POSTFIX)), +]; + +static DOT: [(Input, Action); 3] = [ + (Keyword("await"), SetState(&POSTFIX)), + (ConsumeIdent, SetState(&METHOD)), + (ConsumeLiteral, SetState(&POSTFIX)), +]; + +static FOR: [(Input, Action); 2] = [ + (Punct("<"), SetState(&CLOSURE)), + (Otherwise, SetState(&PATTERN)), +]; + +static IF_ELSE: [(Input, Action); 2] = [(Keyword("if"), SetState(&INIT)), (ConsumeBrace, DecDepth)]; +static IF_THEN: [(Input, Action); 2] = + [(Keyword("else"), SetState(&IF_ELSE)), (Otherwise, DecDepth)]; + +static METHOD: [(Input, Action); 1] = [(ExpectTurbofish, SetState(&POSTFIX))]; + +static PATH: [(Input, Action); 4] = [ + (Punct("!="), SetState(&INIT)), + (Punct("!"), SetState(&INIT)), + (ConsumeNestedBrace, SetState(&IF_THEN)), + (Otherwise, SetState(&POSTFIX)), +]; + +static PATTERN: [(Input, Action); 15] = [ + (ConsumeDelimiter, SetState(&PATTERN)), + (Keyword("box"), SetState(&PATTERN)), + (Keyword("in"), IncDepth), + (Keyword("mut"), SetState(&PATTERN)), + (Keyword("ref"), SetState(&PATTERN)), + (Keyword("_"), SetState(&PATTERN)), + (Punct("!"), SetState(&PATTERN)), + (Punct("&"), SetState(&PATTERN)), + (Punct("..="), SetState(&PATTERN)), + (Punct(".."), SetState(&PATTERN)), + (Punct("="), SetState(&INIT)), + (Punct("@"), SetState(&PATTERN)), + (Punct("|"), SetState(&PATTERN)), + (ConsumeLiteral, SetState(&PATTERN)), + (ExpectPath, SetState(&PATTERN)), +]; + +static RANGE: [(Input, Action); 6] = [ + (Punct("..="), SetState(&INIT)), + (Punct(".."), SetState(&RANGE)), + (Punct("."), SetState(&DOT)), + (ConsumeNestedBrace, SetState(&IF_THEN)), + (Empty, Finish), + (Otherwise, SetState(&INIT)), +]; + +static RAW: [(Input, Action); 3] = [ + (Keyword("const"), SetState(&INIT)), + (Keyword("mut"), SetState(&INIT)), + (Otherwise, SetState(&POSTFIX)), +]; + +static REFERENCE: [(Input, Action); 3] = [ + (Keyword("mut"), SetState(&INIT)), + (Keyword("raw"), SetState(&RAW)), + (Otherwise, SetState(&INIT)), +]; + +static RETURN: [(Input, Action); 2] = [ + (CanBeginExpr, SetState(&INIT)), + (Otherwise, SetState(&POSTFIX)), +]; + +pub(crate) fn scan_expr(input: ParseStream) -> Result<()> { + let mut state = INIT.as_slice(); + let mut depth = 0usize; + 'table: loop { + for rule in state { + if match rule.0 { + Input::Keyword(expected) => input.step(|cursor| match cursor.ident() { + Some((ident, rest)) if ident == expected => Ok((true, rest)), + _ => Ok((false, *cursor)), + })?, + Input::Punct(expected) => input.step(|cursor| { + let begin = *cursor; + let mut cursor = begin; + for (i, ch) in expected.chars().enumerate() { + match cursor.punct() { + Some((punct, _)) if punct.as_char() != ch => break, + Some((_, rest)) if i == expected.len() - 1 => { + return Ok((true, rest)); + } + Some((punct, rest)) if punct.spacing() == Spacing::Joint => { + cursor = rest; + } + _ => break, + } + } + Ok((false, begin)) + })?, + Input::ConsumeAny => input.parse::>()?.is_some(), + Input::ConsumeBinOp => input.parse::().is_ok(), + Input::ConsumeBrace | Input::ConsumeNestedBrace => { + (matches!(rule.0, Input::ConsumeBrace) || depth > 0) + && input.step(|cursor| match cursor.group(Delimiter::Brace) { + Some((_inside, _span, rest)) => Ok((true, rest)), + None => Ok((false, *cursor)), + })? + } + Input::ConsumeDelimiter => input.step(|cursor| match cursor.any_group() { + Some((_inside, _delimiter, _span, rest)) => Ok((true, rest)), + None => Ok((false, *cursor)), + })?, + Input::ConsumeIdent => input.parse::>()?.is_some(), + Input::ConsumeLifetime => input.parse::>()?.is_some(), + Input::ConsumeLiteral => input.parse::>()?.is_some(), + Input::ExpectPath => { + input.parse::()?; + true + } + Input::ExpectTurbofish => { + if input.peek(Token![::]) { + input.parse::()?; + } + true + } + Input::ExpectType => { + Type::without_plus(input)?; + true + } + Input::CanBeginExpr => Expr::peek(input), + Input::Otherwise => true, + Input::Empty => input.is_empty() || input.peek(Token![,]), + } { + state = match rule.1 { + Action::SetState(next) => next, + Action::IncDepth => (depth += 1, &INIT).1, + Action::DecDepth => (depth -= 1, &POSTFIX).1, + Action::Finish => return if depth == 0 { Ok(()) } else { break }, + }; + continue 'table; + } + } + return Err(input.error("unsupported expression")); + } +} diff --git a/third_party/rust/syn/tests/common/eq.rs b/third_party/rust/syn/tests/common/eq.rs index bf09494b4d6e..119df2b73ec6 100644 --- a/third_party/rust/syn/tests/common/eq.rs +++ b/third_party/rust/syn/tests/common/eq.rs @@ -498,7 +498,7 @@ spanless_eq_struct!(Fn; defaultness generics sig body); spanless_eq_struct!(FnDecl; inputs output); spanless_eq_struct!(FnHeader; constness coroutine_kind safety ext); spanless_eq_struct!(FnSig; header decl span); -spanless_eq_struct!(ForeignMod; safety abi items); +spanless_eq_struct!(ForeignMod; extern_span safety abi items); spanless_eq_struct!(FormatArgPosition; index kind span); spanless_eq_struct!(FormatArgs; span template arguments); spanless_eq_struct!(FormatArgument; kind expr); diff --git a/third_party/rust/syn/tests/test_precedence.rs b/third_party/rust/syn/tests/test_precedence.rs index 7231bd6409db..1fa64b320504 100644 --- a/third_party/rust/syn/tests/test_precedence.rs +++ b/third_party/rust/syn/tests/test_precedence.rs @@ -49,6 +49,7 @@ use std::fs; use std::path::Path; use std::process; use std::sync::atomic::{AtomicUsize, Ordering}; +use syn::parse::Parser as _; #[macro_use] mod macros; @@ -56,6 +57,9 @@ mod macros; mod common; mod repo; +#[path = "../src/scan_expr.rs"] +mod scan_expr; + #[test] fn test_rustc_precedence() { repo::rayon_init(); @@ -115,7 +119,8 @@ fn test_expressions(path: &Path, edition: Edition, exprs: Vec) -> (us rustc_span::create_session_if_not_set_then(edition, |_| { for expr in exprs { - let source_code = expr.to_token_stream().to_string(); + let expr_tokens = expr.to_token_stream(); + let source_code = expr_tokens.to_string(); let librustc_ast = if let Some(e) = librustc_parse_and_rewrite(&source_code) { e } else { @@ -173,6 +178,16 @@ fn test_expressions(path: &Path, edition: Edition, exprs: Vec) -> (us continue; } + if scan_expr::scan_expr.parse2(expr_tokens).is_err() { + failed += 1; + errorf!( + "\nFAIL {} - failed to scan expr\n{}\n", + path.display(), + source_code, + ); + continue; + } + passed += 1; } });