Merge pull request #20705 from hvitved/rust/type-inference-unit

Rust: Infer more `()` types
This commit is contained in:
Tom Hvitved
2025-10-31 13:43:10 +01:00
committed by GitHub
22 changed files with 2577 additions and 1421 deletions

View File

@@ -135,7 +135,7 @@ lib/codeql/rust/elements/RefPat.qll fe076bdccb454111b38f360837d180274ba8a003b4cf
lib/codeql/rust/elements/RefTypeRepr.qll 563d2edc097aa1896b3dea5a3918e6225f23dda91b3fb46e2f4c32feb813d56c af3bd746239130e3e94dd41ab682473b29b8b900b05c557beb8a2eba6508ebd9 lib/codeql/rust/elements/RefTypeRepr.qll 563d2edc097aa1896b3dea5a3918e6225f23dda91b3fb46e2f4c32feb813d56c af3bd746239130e3e94dd41ab682473b29b8b900b05c557beb8a2eba6508ebd9
lib/codeql/rust/elements/Rename.qll 5cb0ebad580d9842cfe65033059d4d373a1386f047f3a78f402a93e060e2c13e 642c6f37d94442575df12b2e998572a725d094ac5ae76147a56057e75138d72b lib/codeql/rust/elements/Rename.qll 5cb0ebad580d9842cfe65033059d4d373a1386f047f3a78f402a93e060e2c13e 642c6f37d94442575df12b2e998572a725d094ac5ae76147a56057e75138d72b
lib/codeql/rust/elements/RestPat.qll 5fedfac18080b068f597c9bbb84de672834f72cc22295d6312e111f151f8e3c7 c0e1f77bfcdd40e8ab06ad8c138e6098d79940247758adf9de03a05b00c23de3 lib/codeql/rust/elements/RestPat.qll 5fedfac18080b068f597c9bbb84de672834f72cc22295d6312e111f151f8e3c7 c0e1f77bfcdd40e8ab06ad8c138e6098d79940247758adf9de03a05b00c23de3
lib/codeql/rust/elements/RetTypeRepr.qll a603393d373f38831dded00878c3299d61fdb977723d3e1038692f7a46bfebc5 583c626f7ae7fb4ec9a9f93f072330c16560ab52c8dfec566c46af40fb9f39f8 lib/codeql/rust/elements/RetTypeRepr.qll d68b7c6c2eda13821fcfe085ac3d63010d89a206be09d23deaf531cac405ba96 6db787a96d95265ca20a17ce00603a678b39ac8c7c1d0e1ad6ed119dcf9858fa
lib/codeql/rust/elements/ReturnExpr.qll b87187cff55bc33c8c18558c9b88617179183d1341b322c1cab35ba07167bbdb 892f3a9df2187e745c869e67f33c228ee42754bc9e4f8f4c1718472eb8f8c80f lib/codeql/rust/elements/ReturnExpr.qll b87187cff55bc33c8c18558c9b88617179183d1341b322c1cab35ba07167bbdb 892f3a9df2187e745c869e67f33c228ee42754bc9e4f8f4c1718472eb8f8c80f
lib/codeql/rust/elements/ReturnTypeSyntax.qll f30b779f79bc2f0329d5585a462511e1aaa9da63182cb45231873a9bd9644d19 5ba004dae2bca323ced27bb4b2f54f725ae974421ab11b176eac4888c642b3fa lib/codeql/rust/elements/ReturnTypeSyntax.qll f30b779f79bc2f0329d5585a462511e1aaa9da63182cb45231873a9bd9644d19 5ba004dae2bca323ced27bb4b2f54f725ae974421ab11b176eac4888c642b3fa
lib/codeql/rust/elements/SelfParam.qll e36b54cdc57529935910b321c336783e9e2662c762f3cd6af492d819373ff188 7a4735dbf532fc0c33ebdb0b5c1dfc4e5267e79ceff4ca8977065eb0ce54aaf5 lib/codeql/rust/elements/SelfParam.qll e36b54cdc57529935910b321c336783e9e2662c762f3cd6af492d819373ff188 7a4735dbf532fc0c33ebdb0b5c1dfc4e5267e79ceff4ca8977065eb0ce54aaf5
@@ -177,7 +177,7 @@ lib/codeql/rust/elements/Unimplemented.qll bf624d28163e5c99accda16c0c99f938bec4a
lib/codeql/rust/elements/Union.qll 13f7f62e98b117d18e79db5f6e6535447bc069ebb08f7cdb390b012678b7e085 bd8c37bc0ff09926753bc250e1848ed25923f224829d0136afc27b749eaddd1f lib/codeql/rust/elements/Union.qll 13f7f62e98b117d18e79db5f6e6535447bc069ebb08f7cdb390b012678b7e085 bd8c37bc0ff09926753bc250e1848ed25923f224829d0136afc27b749eaddd1f
lib/codeql/rust/elements/Use.qll fdcf70574403c2f219353211b6930f2f9bc79f41c2594e07548de5a8c6cbb24d e41f2b689fcbeb7b84c7ba8d09592f7561626559318642b73574bbac83f74546 lib/codeql/rust/elements/Use.qll fdcf70574403c2f219353211b6930f2f9bc79f41c2594e07548de5a8c6cbb24d e41f2b689fcbeb7b84c7ba8d09592f7561626559318642b73574bbac83f74546
lib/codeql/rust/elements/UseBoundGenericArg.qll f16903f8fff676d3700eaad5490804624391141472ecc3166ccb1f70c794c120 5efda98088d096b42f53ceccae78c05f15c6953525b514d849681cb2cf65b147 lib/codeql/rust/elements/UseBoundGenericArg.qll f16903f8fff676d3700eaad5490804624391141472ecc3166ccb1f70c794c120 5efda98088d096b42f53ceccae78c05f15c6953525b514d849681cb2cf65b147
lib/codeql/rust/elements/UseBoundGenericArgs.qll d9821a82a1d57e609fdc5e79d65e9a88b0088f51d03927e09f41b6931d3484ab 181483a95e22622c7cee07cce87e9476053f824a82e67e2bdecabf5a39f672ad lib/codeql/rust/elements/UseBoundGenericArgs.qll 841913cfbb84de14aab1820a5433eae978bbadbb8e6d413b8ba70780c7328335 c9ec9d086cff91d15c3aea64f1080b22b41cdaf64e3c8b192aaaec17604a5d10
lib/codeql/rust/elements/UseTree.qll e67c148f63668319c37914a46ff600692de477242a0129fa1bb9839754c0f830 de9b39d3d078d51ec9130db6579bff13e6297e60556a7214a5c51cbf89d92791 lib/codeql/rust/elements/UseTree.qll e67c148f63668319c37914a46ff600692de477242a0129fa1bb9839754c0f830 de9b39d3d078d51ec9130db6579bff13e6297e60556a7214a5c51cbf89d92791
lib/codeql/rust/elements/UseTreeList.qll 92ebfee4392a485b38fb3265fdede7c8f2ed1dbe2ab860aa61b1497c33874d25 a4e677455d20838e422e430eebd73d0a488e34e8c960f375fef7b99e79d4c911 lib/codeql/rust/elements/UseTreeList.qll 92ebfee4392a485b38fb3265fdede7c8f2ed1dbe2ab860aa61b1497c33874d25 a4e677455d20838e422e430eebd73d0a488e34e8c960f375fef7b99e79d4c911
lib/codeql/rust/elements/Variant.qll 7895461fa728f6c3a7293799c5e6b965b413b679566dcbd40bbe2609db8b6cde b0413547365a301bd9fbb6b266757f956394abad0a77f0e424446e23ec7d83e9 lib/codeql/rust/elements/Variant.qll 7895461fa728f6c3a7293799c5e6b965b413b679566dcbd40bbe2609db8b6cde b0413547365a301bd9fbb6b266757f956394abad0a77f0e424446e23ec7d83e9
@@ -369,7 +369,7 @@ lib/codeql/rust/elements/internal/RenameConstructor.qll 65fa2e938978d154701e6cac
lib/codeql/rust/elements/internal/RenameImpl.qll 61c681055f1f86402af0772539f702e9e19a123f8cfcfca225535c3a1a4cb1d7 1aa1c78616c4b54a31c8af74de141aef9e5ada53f3859df631ecb4238faabdbf lib/codeql/rust/elements/internal/RenameImpl.qll 61c681055f1f86402af0772539f702e9e19a123f8cfcfca225535c3a1a4cb1d7 1aa1c78616c4b54a31c8af74de141aef9e5ada53f3859df631ecb4238faabdbf
lib/codeql/rust/elements/internal/RestPatConstructor.qll 45430925ddf08fba70ede44c7f413ddb41b3113c149b7efc276e0c2bf72507b4 25c678898d72446e7a975bb8b7f2fde51e55b59dbd42f2cca997c833b1a995f1 lib/codeql/rust/elements/internal/RestPatConstructor.qll 45430925ddf08fba70ede44c7f413ddb41b3113c149b7efc276e0c2bf72507b4 25c678898d72446e7a975bb8b7f2fde51e55b59dbd42f2cca997c833b1a995f1
lib/codeql/rust/elements/internal/RetTypeReprConstructor.qll 6dcb56c92a13f5ca2c9a8344bc05638cc611543896c578cd6ca185054f155537 3fe34953ba397dc31533bd28b48df76693e86b51c4a89c26ad4dfdbd816a0874 lib/codeql/rust/elements/internal/RetTypeReprConstructor.qll 6dcb56c92a13f5ca2c9a8344bc05638cc611543896c578cd6ca185054f155537 3fe34953ba397dc31533bd28b48df76693e86b51c4a89c26ad4dfdbd816a0874
lib/codeql/rust/elements/internal/RetTypeReprImpl.qll 799e55ffcf27bf6f010419e1d61ebbbf3448e37b903b0f13984d0b44d6b7a999 be774bb09d121c35f40c75d5bee08918e7a6b5fccb4fd573fc55a650466b46e0 lib/codeql/rust/elements/internal/RetTypeReprImpl.qll 321355a9b39193e09ef7c38b807d7f3c221dce06b0cafd2e0ceccdfbb81712e4 02ea0fb17416889b400e0706eeacc0afc6b489b76158e8c26b9b77102df6bd60
lib/codeql/rust/elements/internal/ReturnExprConstructor.qll 57be5afbe20aa8db6e63c1f2871914c19c186730ad7dccaa424038c6305730d5 4d3c4f2e9b38a4b54ff26a0032455cdcca3d35fec201b6c932072a9e31fbb4fe lib/codeql/rust/elements/internal/ReturnExprConstructor.qll 57be5afbe20aa8db6e63c1f2871914c19c186730ad7dccaa424038c6305730d5 4d3c4f2e9b38a4b54ff26a0032455cdcca3d35fec201b6c932072a9e31fbb4fe
lib/codeql/rust/elements/internal/ReturnTypeSyntaxConstructor.qll 8994672e504d1674e5773157d0ad8a0dc3aad3d64ef295e7722e647e78e36c11 abe7df754721f4ff7f3e3bb22d275976b2e9a1ef51436a461fe52ebd2d29cff1 lib/codeql/rust/elements/internal/ReturnTypeSyntaxConstructor.qll 8994672e504d1674e5773157d0ad8a0dc3aad3d64ef295e7722e647e78e36c11 abe7df754721f4ff7f3e3bb22d275976b2e9a1ef51436a461fe52ebd2d29cff1
lib/codeql/rust/elements/internal/ReturnTypeSyntaxImpl.qll 554af21b52fedfc356cb873e25c2429e6660ae62ea01be708de4342960cf4048 cdc497a3693bb162a7528b75e902c4743b0a974c6c44152f822a16107a83bee4 lib/codeql/rust/elements/internal/ReturnTypeSyntaxImpl.qll 554af21b52fedfc356cb873e25c2429e6660ae62ea01be708de4342960cf4048 cdc497a3693bb162a7528b75e902c4743b0a974c6c44152f822a16107a83bee4
@@ -428,7 +428,7 @@ lib/codeql/rust/elements/internal/UnimplementedImpl.qll 06771abc088e0a8fc24032c9
lib/codeql/rust/elements/internal/UnionConstructor.qll d650551a1b3ef29c5a770bdad626269cf539ed0c675af954bc847d2c6111f3f6 aca9064ad653a126ab4f03703e96b274587c852dc5e7ff3fea0fec4d45993f10 lib/codeql/rust/elements/internal/UnionConstructor.qll d650551a1b3ef29c5a770bdad626269cf539ed0c675af954bc847d2c6111f3f6 aca9064ad653a126ab4f03703e96b274587c852dc5e7ff3fea0fec4d45993f10
lib/codeql/rust/elements/internal/UseBoundGenericArgImpl.qll 2f90bfd5e43113da1155445bef0334ab84acddef102bd62dfa2ef908717a5d09 dd2fa3c6081d79e1d96360dbdb339128cd944e7b7dc26c449c04f970ee1d7848 lib/codeql/rust/elements/internal/UseBoundGenericArgImpl.qll 2f90bfd5e43113da1155445bef0334ab84acddef102bd62dfa2ef908717a5d09 dd2fa3c6081d79e1d96360dbdb339128cd944e7b7dc26c449c04f970ee1d7848
lib/codeql/rust/elements/internal/UseBoundGenericArgsConstructor.qll 84d4a959d098fcd1713cb169e15b4945d846121701d2c5709b11e19202c21f2b 93113c92be9bc9f0b8530c308fe482dfeddc7dc827fc44049cecb3eab28df731 lib/codeql/rust/elements/internal/UseBoundGenericArgsConstructor.qll 84d4a959d098fcd1713cb169e15b4945d846121701d2c5709b11e19202c21f2b 93113c92be9bc9f0b8530c308fe482dfeddc7dc827fc44049cecb3eab28df731
lib/codeql/rust/elements/internal/UseBoundGenericArgsImpl.qll f5c082fc8f7d9acc3783da18e61ad2c9831b46c1855e1bde9b7af95adc289ad9 eb83520c5333b199788638ccd70ee8e96fc3f05306072f51a76fd0a643f8930f lib/codeql/rust/elements/internal/UseBoundGenericArgsImpl.qll 0f98d47c1e09c46dd3da66a4770181a0caae0512b362faaec997af22bb5f4ce7 1919235e50b9d2fee9bd5d407a0bc023a02dbb04b2662349fad5a8d6cfa98069
lib/codeql/rust/elements/internal/UseConstructor.qll a4f790795e18abc29a50d6fbaa0db64cba781e3259a42cbf0468c24ac66b63e7 2fa288f073ac094a838c11f091def2c790b347b6a1b79407c11b10c73d6bff57 lib/codeql/rust/elements/internal/UseConstructor.qll a4f790795e18abc29a50d6fbaa0db64cba781e3259a42cbf0468c24ac66b63e7 2fa288f073ac094a838c11f091def2c790b347b6a1b79407c11b10c73d6bff57
lib/codeql/rust/elements/internal/UseTreeConstructor.qll 3e6e834100fcc7249f8a20f8bd9debe09b705fcf5a0e655537e71ac1c6f7956b cdbc84b8f1b009be1e4a7aaba7f5237823cea62c86b38f1794aad97e3dfcf64b lib/codeql/rust/elements/internal/UseTreeConstructor.qll 3e6e834100fcc7249f8a20f8bd9debe09b705fcf5a0e655537e71ac1c6f7956b cdbc84b8f1b009be1e4a7aaba7f5237823cea62c86b38f1794aad97e3dfcf64b
lib/codeql/rust/elements/internal/UseTreeListConstructor.qll 973577da5d7b58eb245f108bd1ae2fecc5645f2795421dedf7687b067a233003 f41e5e3ffcb2a387e5c37f56c0b271e8dc20428b6ff4c63e1ee42fcfa4e67d0a lib/codeql/rust/elements/internal/UseTreeListConstructor.qll 973577da5d7b58eb245f108bd1ae2fecc5645f2795421dedf7687b067a233003 f41e5e3ffcb2a387e5c37f56c0b271e8dc20428b6ff4c63e1ee42fcfa4e67d0a
@@ -584,13 +584,13 @@ lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 8d0ea4f6c7f8203340bf
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9 lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9 lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9
lib/codeql/rust/elements/internal/generated/Raw.qll 3f86deef2f54093e3b4bd24237ba0d80fa94856fdcf2ba6a9812033bec6c0021 30cd773ce7a390afbdabd8a078f5f1408671eaca6fa7e213bed6196dfa872447 lib/codeql/rust/elements/internal/generated/Raw.qll f50925f4925848cef73003adf01420566ca3efa16f491eadac62a30972ee9204 17d62252413618e1fa162c6c0b303ccfcac5f7f70cc170d739b20cc95f57035b
lib/codeql/rust/elements/internal/generated/RefExpr.qll 7d995884e3dc1c25fc719f5d7253179344d63650e217e9ff6530285fe7a57f64 f2c3c12551deea4964b66553fb9b6423ee16fec53bd63db4796191aa60dc6c66 lib/codeql/rust/elements/internal/generated/RefExpr.qll 7d995884e3dc1c25fc719f5d7253179344d63650e217e9ff6530285fe7a57f64 f2c3c12551deea4964b66553fb9b6423ee16fec53bd63db4796191aa60dc6c66
lib/codeql/rust/elements/internal/generated/RefPat.qll 456ede39837463ee22a630ec7ab6c8630d3664a8ea206fcc6e4f199e92fa564c 5622062765f32930465ba6b170e986706f159f6070f48adee3c20e24e8df4e05 lib/codeql/rust/elements/internal/generated/RefPat.qll 456ede39837463ee22a630ec7ab6c8630d3664a8ea206fcc6e4f199e92fa564c 5622062765f32930465ba6b170e986706f159f6070f48adee3c20e24e8df4e05
lib/codeql/rust/elements/internal/generated/RefTypeRepr.qll 5b0663a6d234572fb3e467e276d019415caa95ef006438cc59b7af4e1783161e 0e27c8a8f0e323c0e4d6db01fca821bf07c0864d293cdf96fa891b10820c1e4b lib/codeql/rust/elements/internal/generated/RefTypeRepr.qll 5b0663a6d234572fb3e467e276d019415caa95ef006438cc59b7af4e1783161e 0e27c8a8f0e323c0e4d6db01fca821bf07c0864d293cdf96fa891b10820c1e4b
lib/codeql/rust/elements/internal/generated/Rename.qll 53dd50d35aa38cb6eb4174c94e8e23042b42bdc4f38df009489ebf707380483b db14fbce0d95b4dae3d7512f9bdee92e0dc2dffde5ba5d7458f2f5dd632876b0 lib/codeql/rust/elements/internal/generated/Rename.qll 53dd50d35aa38cb6eb4174c94e8e23042b42bdc4f38df009489ebf707380483b db14fbce0d95b4dae3d7512f9bdee92e0dc2dffde5ba5d7458f2f5dd632876b0
lib/codeql/rust/elements/internal/generated/RestPat.qll 369f5828bb78f2856d528679a9869f81859b375c2f831ff72f4507daaee976e3 17f24ce8aa6a27359c10a654667b7877ca7a1509509e2ab246ed26fe15ef66b4 lib/codeql/rust/elements/internal/generated/RestPat.qll 369f5828bb78f2856d528679a9869f81859b375c2f831ff72f4507daaee976e3 17f24ce8aa6a27359c10a654667b7877ca7a1509509e2ab246ed26fe15ef66b4
lib/codeql/rust/elements/internal/generated/RetTypeRepr.qll 7e782d6ca346fd4057e95a6eefe796e3fba7eef62144a0df78e2d115a7ae9ba9 d5da144e06d180673fa7ce274c5e7e2ca2db12b064df1155bc56f2f9378b58b4 lib/codeql/rust/elements/internal/generated/RetTypeRepr.qll 853b7fd6c1f3678d0f9315ac23a99a0828a6e54148de24016a265039c7b1941c f1e140d2b113c494601143b735482869ee817c8a7d92026f6a511bc5c1420552
lib/codeql/rust/elements/internal/generated/ReturnExpr.qll c9c05400d326cd8e0da11c3bfa524daa08b2579ecaee80e468076e5dd7911d56 e7694926727220f46a7617b6ca336767450e359c6fa3782e82b1e21d85d37268 lib/codeql/rust/elements/internal/generated/ReturnExpr.qll c9c05400d326cd8e0da11c3bfa524daa08b2579ecaee80e468076e5dd7911d56 e7694926727220f46a7617b6ca336767450e359c6fa3782e82b1e21d85d37268
lib/codeql/rust/elements/internal/generated/ReturnTypeSyntax.qll 7b7692ca9fbe627afa0759050a740f0f42a8083446c1c3196084f5698fc570c3 96a735d60a3919c7c994f7b67930c9e51a3713940678d04a5fee54557d733c24 lib/codeql/rust/elements/internal/generated/ReturnTypeSyntax.qll 7b7692ca9fbe627afa0759050a740f0f42a8083446c1c3196084f5698fc570c3 96a735d60a3919c7c994f7b67930c9e51a3713940678d04a5fee54557d733c24
lib/codeql/rust/elements/internal/generated/SelfParam.qll 076c583f7f34e29aaaf3319e9d64565a34c64caa5a6dfca240c0cc7800e9a14c 375afed1772d193b71980d3825c4ac438e90b295cba0baf58319d29a3a8463a0 lib/codeql/rust/elements/internal/generated/SelfParam.qll 076c583f7f34e29aaaf3319e9d64565a34c64caa5a6dfca240c0cc7800e9a14c 375afed1772d193b71980d3825c4ac438e90b295cba0baf58319d29a3a8463a0
@@ -634,7 +634,7 @@ lib/codeql/rust/elements/internal/generated/Unimplemented.qll a3eb304781991bff12
lib/codeql/rust/elements/internal/generated/Union.qll 456504e6a32991ba17ca65f97636f4dfb86c758c7f8509aaca1b0d0432231dfe c96068edfec3e0755a7726426a10996455ee9f0f2d678af258719f1943a3063e lib/codeql/rust/elements/internal/generated/Union.qll 456504e6a32991ba17ca65f97636f4dfb86c758c7f8509aaca1b0d0432231dfe c96068edfec3e0755a7726426a10996455ee9f0f2d678af258719f1943a3063e
lib/codeql/rust/elements/internal/generated/Use.qll cf95b5c4756b25bee74113207786e37464ffbc0fb5f776a04c651300afc53753 1fe26b3904db510184cb688cb0eeb0a8dbac7ac15e27a3b572d839743c738393 lib/codeql/rust/elements/internal/generated/Use.qll cf95b5c4756b25bee74113207786e37464ffbc0fb5f776a04c651300afc53753 1fe26b3904db510184cb688cb0eeb0a8dbac7ac15e27a3b572d839743c738393
lib/codeql/rust/elements/internal/generated/UseBoundGenericArg.qll 69162794e871291545ea04f61259b2d000671a96f7ca129f7dd9ed6e984067c4 31de9ebc0634b38e2347e0608b4ea888892f1f2732a2892464078cd8a07b4ee8 lib/codeql/rust/elements/internal/generated/UseBoundGenericArg.qll 69162794e871291545ea04f61259b2d000671a96f7ca129f7dd9ed6e984067c4 31de9ebc0634b38e2347e0608b4ea888892f1f2732a2892464078cd8a07b4ee8
lib/codeql/rust/elements/internal/generated/UseBoundGenericArgs.qll 2cc8ab0068b7bf44ca17a62b32a8dd1d89cd743532c8a96b262b164fd81b0c36 347e7709a0f5ace197beb6827f6cf04a31ff68ff2dff3707914c6b910658d00a lib/codeql/rust/elements/internal/generated/UseBoundGenericArgs.qll cedde7ccf689e3a2a246113be94544c206c56fb1c01b83b074e1f6edd3acfced f022ea4c653d1b5f311917efde8e59be27394ce7f6abf2561bb1e42f93f74adf
lib/codeql/rust/elements/internal/generated/UseTree.qll 3d7cbcc8ae76068b8f660c7d5b81b05595026043015cd6b4d42a60ed4c165811 b9f0bcf82feb31f31406e787670fee93e1aa0966bcc0e4cc285c342e88793e4e lib/codeql/rust/elements/internal/generated/UseTree.qll 3d7cbcc8ae76068b8f660c7d5b81b05595026043015cd6b4d42a60ed4c165811 b9f0bcf82feb31f31406e787670fee93e1aa0966bcc0e4cc285c342e88793e4e
lib/codeql/rust/elements/internal/generated/UseTreeList.qll 38efaa569b76ca79be047703279388e8f64583a126b98078fbbb6586e0c6eb56 1623a50fd2d3b1e4b85323ad73dd655172f7cbc658d3506aaa6b409e9ebe576e lib/codeql/rust/elements/internal/generated/UseTreeList.qll 38efaa569b76ca79be047703279388e8f64583a126b98078fbbb6586e0c6eb56 1623a50fd2d3b1e4b85323ad73dd655172f7cbc658d3506aaa6b409e9ebe576e
lib/codeql/rust/elements/internal/generated/Variant.qll fa6909715133049b3dba4622e6262fa30c4a9478b6219ec4fd12e07c58750709 71fc2ddac97fc4c4e6b92a13ee217cccc81dffc7c12295b6bc97c56ad25a92cc lib/codeql/rust/elements/internal/generated/Variant.qll fa6909715133049b3dba4622e6262fa30c4a9478b6219ec4fd12e07c58750709 71fc2ddac97fc4c4e6b92a13ee217cccc81dffc7c12295b6bc97c56ad25a92cc

View File

@@ -12,7 +12,7 @@ import codeql.rust.elements.TypeRepr
* *
* For example: * For example:
* ```rust * ```rust
* fn foo() -> i32 {} * fn foo() -> i32 { 0 }
* // ^^^^^^ * // ^^^^^^
* ``` * ```
*/ */

View File

@@ -12,7 +12,7 @@ import codeql.rust.elements.UseBoundGenericArg
* *
* For example: * For example:
* ```rust * ```rust
* pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} * pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
* // ^^^^^^^^ * // ^^^^^^^^
* ``` * ```
*/ */

View File

@@ -17,7 +17,7 @@ module Impl {
* *
* For example: * For example:
* ```rust * ```rust
* fn foo() -> i32 {} * fn foo() -> i32 { 0 }
* // ^^^^^^ * // ^^^^^^
* ``` * ```
*/ */

View File

@@ -17,7 +17,7 @@ module Impl {
* *
* For example: * For example:
* ```rust * ```rust
* pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} * pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
* // ^^^^^^^^ * // ^^^^^^^^
* ``` * ```
*/ */

View File

@@ -874,7 +874,7 @@ module Raw {
* *
* For example: * For example:
* ```rust * ```rust
* fn foo() -> i32 {} * fn foo() -> i32 { 0 }
* // ^^^^^^ * // ^^^^^^
* ``` * ```
*/ */
@@ -1270,7 +1270,7 @@ module Raw {
* *
* For example: * For example:
* ```rust * ```rust
* pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} * pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
* // ^^^^^^^^ * // ^^^^^^^^
* ``` * ```
*/ */

View File

@@ -19,7 +19,7 @@ module Generated {
* *
* For example: * For example:
* ```rust * ```rust
* fn foo() -> i32 {} * fn foo() -> i32 { 0 }
* // ^^^^^^ * // ^^^^^^
* ``` * ```
* INTERNAL: Do not reference the `Generated::RetTypeRepr` class directly. * INTERNAL: Do not reference the `Generated::RetTypeRepr` class directly.

View File

@@ -19,7 +19,7 @@ module Generated {
* *
* For example: * For example:
* ```rust * ```rust
* pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} * pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
* // ^^^^^^^^ * // ^^^^^^^^
* ``` * ```
* INTERNAL: Do not reference the `Generated::UseBoundGenericArgs` class directly. * INTERNAL: Do not reference the `Generated::UseBoundGenericArgs` class directly.

View File

@@ -232,9 +232,14 @@ import M2
module Consistency { module Consistency {
import M2::Consistency import M2::Consistency
private Type inferCertainTypeAdj(AstNode n, TypePath path) {
result = CertainTypeInference::inferCertainType(n, path) and
not result = TNeverType()
}
predicate nonUniqueCertainType(AstNode n, TypePath path, Type t) { predicate nonUniqueCertainType(AstNode n, TypePath path, Type t) {
strictcount(CertainTypeInference::inferCertainType(n, path)) > 1 and strictcount(inferCertainTypeAdj(n, path)) > 1 and
t = CertainTypeInference::inferCertainType(n, path) and t = inferCertainTypeAdj(n, path) and
// Suppress the inconsistency if `n` is a self parameter and the type // Suppress the inconsistency if `n` is a self parameter and the type
// mention for the self type has multiple types for a path. // mention for the self type has multiple types for a path.
not exists(ImplItemNode impl, TypePath selfTypePath | not exists(ImplItemNode impl, TypePath selfTypePath |
@@ -278,7 +283,7 @@ private TypeMention getTypeAnnotation(AstNode n) {
) )
or or
exists(Function f | exists(Function f |
result = f.getRetType().getTypeRepr() and result = getReturnTypeMention(f) and
n = f.getFunctionBody() n = f.getFunctionBody()
) )
} }
@@ -291,6 +296,17 @@ private Type inferAnnotatedType(AstNode n, TypePath path) {
result = n.(ShorthandSelfParameterMention).resolveTypeAt(path) result = n.(ShorthandSelfParameterMention).resolveTypeAt(path)
} }
/**
* Holds if `me` is a call to the `panic!` macro.
*
* `panic!` needs special treatment, because it expands to a block expression
* that looks like it should have type `()` instead of the correct `!` type.
*/
pragma[nomagic]
private predicate isPanicMacroCall(MacroExpr me) {
me.getMacroCall().resolveMacro().(MacroRules).getName().getText() = "panic"
}
/** Module for inferring certain type information. */ /** Module for inferring certain type information. */
module CertainTypeInference { module CertainTypeInference {
pragma[nomagic] pragma[nomagic]
@@ -436,14 +452,21 @@ module CertainTypeInference {
result = inferTupleRootType(n) and result = inferTupleRootType(n) and
path.isEmpty() path.isEmpty()
or or
result = inferAsyncBlockExprRootType(n) and result = inferBlockExprType(n, path)
path.isEmpty()
or or
result = inferArrayExprType(n) and result = inferArrayExprType(n) and
path.isEmpty() path.isEmpty()
or or
result = inferCastExprType(n, path) result = inferCastExprType(n, path)
or or
exprHasUnitType(n) and
path.isEmpty() and
result instanceof UnitType
or
isPanicMacroCall(n) and
path.isEmpty() and
result instanceof NeverType
or
infersCertainTypeAt(n, path, result.getATypeParameter()) infersCertainTypeAt(n, path, result.getATypeParameter())
} }
@@ -580,7 +603,8 @@ private predicate typeEquality(AstNode n1, TypePath prefix1, AstNode n2, TypePat
n2 = be.getRhs() n2 = be.getRhs()
) )
or or
n1 = n2.(MacroExpr).getMacroCall().getMacroCallExpansion() n1 = n2.(MacroExpr).getMacroCall().getMacroCallExpansion() and
not isPanicMacroCall(n2)
or or
n1 = n2.(MacroPat).getMacroCall().getMacroCallExpansion() n1 = n2.(MacroPat).getMacroCall().getMacroCallExpansion()
or or
@@ -932,14 +956,17 @@ private predicate functionInfoBlanketLike(
*/ */
bindingset[path, type] bindingset[path, type]
private predicate isComplexRootStripped(TypePath path, Type type) { private predicate isComplexRootStripped(TypePath path, Type type) {
path.isEmpty() and (
not validSelfType(type) path.isEmpty() and
or not validSelfType(type)
exists(TypeParameter tp | or
complexSelfRoot(_, tp) and exists(TypeParameter tp |
path = TypePath::singleton(tp) and complexSelfRoot(_, tp) and
exists(type) path = TypePath::singleton(tp) and
) exists(type)
)
) and
type != TNeverType()
} }
/** /**
@@ -1541,7 +1568,8 @@ private module MethodResolution {
MethodCall getMethodCall() { result = mc_ } MethodCall getMethodCall() { result = mc_ }
Type getTypeAt(TypePath path) { Type getTypeAt(TypePath path) {
result = mc_.getACandidateReceiverTypeAtSubstituteLookupTraits(derefChain, borrow, path) result = mc_.getACandidateReceiverTypeAtSubstituteLookupTraits(derefChain, borrow, path) and
not result = TNeverType()
} }
pragma[nomagic] pragma[nomagic]
@@ -1854,7 +1882,7 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
} }
private Type resolveRetType(TypePath path) { private Type resolveRetType(TypePath path) {
result = this.getRetType().getTypeRepr().(TypeMention).resolveTypeAt(path) result = getReturnTypeMention(this).resolveTypeAt(path)
} }
pragma[nomagic] pragma[nomagic]
@@ -2799,10 +2827,37 @@ private AssociatedTypeTypeParameter getFutureOutputTypeParameter() {
} }
pragma[nomagic] pragma[nomagic]
private TraitType inferAsyncBlockExprRootType(AsyncBlockExpr abe) { predicate isUnitBlockExpr(BlockExpr be) {
not be.getStmtList().hasTailExpr() and
not be = any(Callable c).getBody() and
not be.hasLabel()
}
pragma[nomagic]
private Type inferBlockExprType(BlockExpr be, TypePath path) {
// `typeEquality` handles the non-root case // `typeEquality` handles the non-root case
exists(abe) and if be instanceof AsyncBlockExpr
result = getFutureTraitType() then (
path.isEmpty() and
result = getFutureTraitType()
or
isUnitBlockExpr(be) and
path = TypePath::singleton(getFutureOutputTypeParameter()) and
result instanceof UnitType
) else (
isUnitBlockExpr(be) and
path.isEmpty() and
result instanceof UnitType
)
}
pragma[nomagic]
private predicate exprHasUnitType(Expr e) {
e = any(IfExpr ie | not ie.hasElse())
or
e instanceof WhileExpr
or
e instanceof ForExpr
} }
final private class AwaitTarget extends Expr { final private class AwaitTarget extends Expr {

View File

@@ -443,6 +443,34 @@ TypeMention getSelfParamTypeMention(SelfParam self) {
result = self.getTypeRepr() result = self.getTypeRepr()
} }
/**
* An element used to represent the implicit `()` return type of a function.
*
* Since the implicit type does not appear in the AST, we (somewhat arbitrarily)
* choose the name of the function as a type mention. This works because there
* is a one-to-one correspondence between a function and its name.
*/
class ShorthandReturnTypeMention extends TypeMention instanceof Name {
private Function f;
ShorthandReturnTypeMention() {
this = f.getName() and
not f.getRetType().hasTypeRepr()
}
override Type resolveTypeAt(TypePath typePath) {
typePath.isEmpty() and
result instanceof UnitType
}
}
pragma[nomagic]
TypeMention getReturnTypeMention(Function f) {
result.(ShorthandReturnTypeMention) = f.getName()
or
result = f.getRetType().getTypeRepr()
}
class DynTraitTypeReprMention extends TypeMention instanceof DynTraitTypeRepr { class DynTraitTypeReprMention extends TypeMention instanceof DynTraitTypeRepr {
private DynTraitType dynType; private DynTraitType dynType;

View File

@@ -90,7 +90,10 @@ module SatisfiesBlanketConstraint<
Location getLocation() { result = at.getLocation() } Location getLocation() { result = at.getLocation() }
Type getTypeAt(TypePath path) { result = at.getTypeAt(blanketPath.appendInverse(path)) } Type getTypeAt(TypePath path) {
result = at.getTypeAt(blanketPath.appendInverse(path)) and
not result = TNeverType()
}
string toString() { result = at.toString() + " [blanket at " + blanketPath.toString() + "]" } string toString() { result = at.toString() + " [blanket at " + blanketPath.toString() + "]" }
} }

View File

@@ -46,7 +46,7 @@ class FunctionPosition extends TFunctionPosition {
result = f.getParam(this.asPosition()).getTypeRepr() result = f.getParam(this.asPosition()).getTypeRepr()
or or
this.isReturn() and this.isReturn() and
result = f.getRetType().getTypeRepr() result = getReturnTypeMention(f)
} }
string toString() { string toString() {
@@ -227,7 +227,10 @@ module ArgIsInstantiationOf<
final private class ArgFinal = Arg; final private class ArgFinal = Arg;
private class ArgSubst extends ArgFinal { private class ArgSubst extends ArgFinal {
Type getTypeAt(TypePath path) { result = substituteLookupTraits(super.getTypeAt(path)) } Type getTypeAt(TypePath path) {
result = substituteLookupTraits(super.getTypeAt(path)) and
not result = TNeverType()
}
} }
private module IsInstantiationOfInput implements private module IsInstantiationOfInput implements
@@ -332,10 +335,10 @@ module ArgsAreInstantiationsOf<ArgsAreInstantiationsOfInputSig Input> {
CallAndPos cp, Input::Call call, FunctionPosition pos, int rnk, Function f, CallAndPos cp, Input::Call call, FunctionPosition pos, int rnk, Function f,
TypeAbstraction abs, AssocFunctionType constraint TypeAbstraction abs, AssocFunctionType constraint
) { ) {
cp = MkCallAndPos(call, pos) and cp = MkCallAndPos(call, pragma[only_bind_into](pos)) and
call.hasTargetCand(abs, f) and call.hasTargetCand(abs, f) and
toCheckRanked(abs, f, pos, rnk) and toCheckRanked(abs, f, pragma[only_bind_into](pos), rnk) and
Input::toCheck(abs, f, pos, constraint) Input::toCheck(abs, f, pragma[only_bind_into](pos), constraint)
} }
pragma[nomagic] pragma[nomagic]

View File

@@ -75,7 +75,7 @@ MacroItems/gen_macro_items.rs c00f8045d9a7d6562da1d0136b335b685e2ec5dbd708763faa
MacroPat/gen_macro_pat.rs 6bc63338397e6ef322a1824ce7d8fa68629a81c740f6e1d5347642501c83683a 6bc63338397e6ef322a1824ce7d8fa68629a81c740f6e1d5347642501c83683a MacroPat/gen_macro_pat.rs 6bc63338397e6ef322a1824ce7d8fa68629a81c740f6e1d5347642501c83683a 6bc63338397e6ef322a1824ce7d8fa68629a81c740f6e1d5347642501c83683a
MacroRules/gen_macro_rules.rs 5483484783b19a4f4cb7565cf63c517e61a76ce5b5b4bdc9b90f7e235a4c03b7 5483484783b19a4f4cb7565cf63c517e61a76ce5b5b4bdc9b90f7e235a4c03b7 MacroRules/gen_macro_rules.rs 5483484783b19a4f4cb7565cf63c517e61a76ce5b5b4bdc9b90f7e235a4c03b7 5483484783b19a4f4cb7565cf63c517e61a76ce5b5b4bdc9b90f7e235a4c03b7
MacroTypeRepr/gen_macro_type_repr.rs cdb9670dde8b2a71256bc8d4acb1d63bd726cb49ee486ca2dbf1952884fd9c37 cdb9670dde8b2a71256bc8d4acb1d63bd726cb49ee486ca2dbf1952884fd9c37 MacroTypeRepr/gen_macro_type_repr.rs cdb9670dde8b2a71256bc8d4acb1d63bd726cb49ee486ca2dbf1952884fd9c37 cdb9670dde8b2a71256bc8d4acb1d63bd726cb49ee486ca2dbf1952884fd9c37
MatchArm/gen_match_arm.rs ac75b4836a103e2755bd47a1ee1b74af6eb8349adc4ebedaaa27b3ea3ae41aa5 ac75b4836a103e2755bd47a1ee1b74af6eb8349adc4ebedaaa27b3ea3ae41aa5 MatchArm/gen_match_arm.rs 4f4e717930729b2161b9cf9cd5e2b86b8e919204f5f7d4993d2c4e1034858cea 4f4e717930729b2161b9cf9cd5e2b86b8e919204f5f7d4993d2c4e1034858cea
MatchArmList/gen_match_arm_list.rs 6dcb92591c86771d2aeb762e4274d3e61a7d6c1a42da3dbace1cbc545b474080 6dcb92591c86771d2aeb762e4274d3e61a7d6c1a42da3dbace1cbc545b474080 MatchArmList/gen_match_arm_list.rs 6dcb92591c86771d2aeb762e4274d3e61a7d6c1a42da3dbace1cbc545b474080 6dcb92591c86771d2aeb762e4274d3e61a7d6c1a42da3dbace1cbc545b474080
MatchExpr/gen_match_expr.rs 081c5d4c78cb71ccd13fb37a93d7f525267c51b179f44b5a22ca3297897002a0 081c5d4c78cb71ccd13fb37a93d7f525267c51b179f44b5a22ca3297897002a0 MatchExpr/gen_match_expr.rs 081c5d4c78cb71ccd13fb37a93d7f525267c51b179f44b5a22ca3297897002a0 081c5d4c78cb71ccd13fb37a93d7f525267c51b179f44b5a22ca3297897002a0
MatchGuard/gen_match_guard.rs f0e84a1f608c0361983c516a40216cea149620a36e0aed7ff39b0b7d77a9ab8a f0e84a1f608c0361983c516a40216cea149620a36e0aed7ff39b0b7d77a9ab8a MatchGuard/gen_match_guard.rs f0e84a1f608c0361983c516a40216cea149620a36e0aed7ff39b0b7d77a9ab8a f0e84a1f608c0361983c516a40216cea149620a36e0aed7ff39b0b7d77a9ab8a
@@ -106,7 +106,7 @@ RefPat/gen_ref_pat.rs aba7518649d9a37928e59a40d42f76cc0f4735e8daf711a3def6d2f052
RefTypeRepr/gen_ref_type_repr.rs cf7b32d64550cd0b5033869b841089c1de292a1b25d3bd44c63ef9a265b9c8fb cf7b32d64550cd0b5033869b841089c1de292a1b25d3bd44c63ef9a265b9c8fb RefTypeRepr/gen_ref_type_repr.rs cf7b32d64550cd0b5033869b841089c1de292a1b25d3bd44c63ef9a265b9c8fb cf7b32d64550cd0b5033869b841089c1de292a1b25d3bd44c63ef9a265b9c8fb
Rename/gen_rename.rs 05957dd5c7a0971223a485207ef3e98b0408a3e765cfb1fd6237bcc21c89f21a 05957dd5c7a0971223a485207ef3e98b0408a3e765cfb1fd6237bcc21c89f21a Rename/gen_rename.rs 05957dd5c7a0971223a485207ef3e98b0408a3e765cfb1fd6237bcc21c89f21a 05957dd5c7a0971223a485207ef3e98b0408a3e765cfb1fd6237bcc21c89f21a
RestPat/gen_rest_pat.rs e9c977c8d3fce1d931abdfc025444e3e883468927f784ad1791670cace736aa7 e9c977c8d3fce1d931abdfc025444e3e883468927f784ad1791670cace736aa7 RestPat/gen_rest_pat.rs e9c977c8d3fce1d931abdfc025444e3e883468927f784ad1791670cace736aa7 e9c977c8d3fce1d931abdfc025444e3e883468927f784ad1791670cace736aa7
RetTypeRepr/gen_ret_type_repr.rs 9db86003c7a4d91aa13fbc8220559bea6a05221c38c3f3ac0e03c6ac790aebcc 9db86003c7a4d91aa13fbc8220559bea6a05221c38c3f3ac0e03c6ac790aebcc RetTypeRepr/gen_ret_type_repr.rs b5d66327b445e8290be59a4fc4217d8163aa5ab5e49d9335efa1037b7ca5dc6f b5d66327b445e8290be59a4fc4217d8163aa5ab5e49d9335efa1037b7ca5dc6f
ReturnExpr/gen_return_expr.rs 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f ReturnExpr/gen_return_expr.rs 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f 4f6ef29d7b3c60d6d71d1a6034a0721671f517428ba21897361a92b01009d38f
ReturnTypeSyntax/gen_return_type_syntax.rs 648ce343023e7f80c445fada390870c5498add7fdf63dc82a800f6a77b7e7026 648ce343023e7f80c445fada390870c5498add7fdf63dc82a800f6a77b7e7026 ReturnTypeSyntax/gen_return_type_syntax.rs 648ce343023e7f80c445fada390870c5498add7fdf63dc82a800f6a77b7e7026 648ce343023e7f80c445fada390870c5498add7fdf63dc82a800f6a77b7e7026
SelfParam/gen_self_param.rs 15491f86a32020c9ed3ecadc08c945ed01916b63683f95d2f5c1bedb4f3f01f2 15491f86a32020c9ed3ecadc08c945ed01916b63683f95d2f5c1bedb4f3f01f2 SelfParam/gen_self_param.rs 15491f86a32020c9ed3ecadc08c945ed01916b63683f95d2f5c1bedb4f3f01f2 15491f86a32020c9ed3ecadc08c945ed01916b63683f95d2f5c1bedb4f3f01f2
@@ -142,7 +142,7 @@ TypeParam/gen_type_param.rs 00b92ac7042ae83be1e37cd22f6d02098ca3157dc1ef45fbdf3b
UnderscoreExpr/gen_underscore_expr.rs fe34e99d322bf86c0f5509c9b5fd6e1e8abbdf63dbe7e01687344a41e9aabe52 fe34e99d322bf86c0f5509c9b5fd6e1e8abbdf63dbe7e01687344a41e9aabe52 UnderscoreExpr/gen_underscore_expr.rs fe34e99d322bf86c0f5509c9b5fd6e1e8abbdf63dbe7e01687344a41e9aabe52 fe34e99d322bf86c0f5509c9b5fd6e1e8abbdf63dbe7e01687344a41e9aabe52
Union/gen_union.rs 0adc276bf324661137b4de7c4522afd5f7b2776e913c4a6ecc580ce3d753a51d 0adc276bf324661137b4de7c4522afd5f7b2776e913c4a6ecc580ce3d753a51d Union/gen_union.rs 0adc276bf324661137b4de7c4522afd5f7b2776e913c4a6ecc580ce3d753a51d 0adc276bf324661137b4de7c4522afd5f7b2776e913c4a6ecc580ce3d753a51d
Use/gen_use.rs 3a8a426109080ce2a0ed5a68a83cfa195196c9f0a14eff328b7be54d1131eede 3a8a426109080ce2a0ed5a68a83cfa195196c9f0a14eff328b7be54d1131eede Use/gen_use.rs 3a8a426109080ce2a0ed5a68a83cfa195196c9f0a14eff328b7be54d1131eede 3a8a426109080ce2a0ed5a68a83cfa195196c9f0a14eff328b7be54d1131eede
UseBoundGenericArgs/gen_use_bound_generic_args.rs 1da801583b77f5f064d729a1d4313a863f1ad2e1dcc11c963194839cba977367 1da801583b77f5f064d729a1d4313a863f1ad2e1dcc11c963194839cba977367 UseBoundGenericArgs/gen_use_bound_generic_args.rs 7b9542a4fd4025bdef5e3fab0e76a85c533936793d8791b5e4ed93d6d1e503e9 7b9542a4fd4025bdef5e3fab0e76a85c533936793d8791b5e4ed93d6d1e503e9
UseTree/gen_use_tree.rs 90660192ec361e96d0fee9dc03c34fcdf0a102269df33be45856c63ad5d18ff2 90660192ec361e96d0fee9dc03c34fcdf0a102269df33be45856c63ad5d18ff2 UseTree/gen_use_tree.rs 90660192ec361e96d0fee9dc03c34fcdf0a102269df33be45856c63ad5d18ff2 90660192ec361e96d0fee9dc03c34fcdf0a102269df33be45856c63ad5d18ff2
UseTreeList/gen_use_tree_list.rs 2494aadcec03a3f7a6e2ae448ee70ec6774f840e9519c668b2afe8cd968211c9 2494aadcec03a3f7a6e2ae448ee70ec6774f840e9519c668b2afe8cd968211c9 UseTreeList/gen_use_tree_list.rs 2494aadcec03a3f7a6e2ae448ee70ec6774f840e9519c668b2afe8cd968211c9 2494aadcec03a3f7a6e2ae448ee70ec6774f840e9519c668b2afe8cd968211c9
Variant/gen_variant.rs fa3d3a9e3e0c3aa565b965fad9c3dc2ffd5a8d82963e3a55a9acbb0f14b603d6 fa3d3a9e3e0c3aa565b965fad9c3dc2ffd5a8d82963e3a55a9acbb0f14b603d6 Variant/gen_variant.rs fa3d3a9e3e0c3aa565b965fad9c3dc2ffd5a8d82963e3a55a9acbb0f14b603d6 fa3d3a9e3e0c3aa565b965fad9c3dc2ffd5a8d82963e3a55a9acbb0f14b603d6

View File

@@ -1,6 +1,6 @@
// generated by codegen, do not edit // generated by codegen, do not edit
fn test_match_arm(x: i32) -> i32 { fn test_match_arm(x: i32) {
// A match arm. For example: // A match arm. For example:
match x { match x {
Option::Some(y) => y, Option::Some(y) => y,

View File

@@ -4,6 +4,6 @@ fn test_ret_type_repr() -> () {
// A return type in a function signature. // A return type in a function signature.
// //
// For example: // For example:
fn foo() -> i32 {} fn foo() -> i32 { 0 }
// ^^^^^^ // ^^^^^^
} }

View File

@@ -4,6 +4,6 @@ fn test_use_bound_generic_args() -> () {
// A use<..> bound to control which generic parameters are captured by an impl Trait return type. // A use<..> bound to control which generic parameters are captured by an impl Trait return type.
// //
// For example: // For example:
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
// ^^^^^^^^ // ^^^^^^^^
} }

View File

@@ -9,9 +9,9 @@ multipleCallTargets
| main.rs:590:9:590:18 | ...::m(...) | | main.rs:590:9:590:18 | ...::m(...) |
| main.rs:591:9:591:20 | ... .m() | | main.rs:591:9:591:20 | ... .m() |
| main.rs:592:9:592:24 | ...::m(...) | | main.rs:592:9:592:24 | ...::m(...) |
| main.rs:2519:13:2519:31 | ...::from(...) | | main.rs:2524:13:2524:31 | ...::from(...) |
| main.rs:2520:13:2520:31 | ...::from(...) | | main.rs:2525:13:2525:31 | ...::from(...) |
| main.rs:2521:13:2521:31 | ...::from(...) | | main.rs:2526:13:2526:31 | ...::from(...) |
| main.rs:2527:13:2527:31 | ...::from(...) | | main.rs:2532:13:2532:31 | ...::from(...) |
| main.rs:2528:13:2528:31 | ...::from(...) | | main.rs:2533:13:2533:31 | ...::from(...) |
| main.rs:2529:13:2529:31 | ...::from(...) | | main.rs:2534:13:2534:31 | ...::from(...) |

View File

@@ -2122,6 +2122,10 @@ mod async_ {
async { S1 } async { S1 }
} }
fn f3() -> impl Future<Output = ()> {
async {}
}
struct S2; struct S2;
impl Future for S2 { impl Future for S2 {
@@ -2135,14 +2139,15 @@ mod async_ {
} }
} }
fn f3() -> impl Future<Output = S1> { fn f4() -> impl Future<Output = S1> {
S2 S2
} }
pub async fn f() { pub async fn f() {
f1().await.f(); // $ target=S1f target=f1 f1().await.f(); // $ target=S1f target=f1
f2().await.f(); // $ target=S1f target=f2 f2().await.f(); // $ target=S1f target=f2
f3().await.f(); // $ target=S1f target=f3 f3().await; // $ target=f3
f4().await.f(); // $ target=S1f target=f4
S2.await.f(); // $ target=S1f S2.await.f(); // $ target=S1f
let b = async { S1 }; let b = async { S1 };
b.await.f(); // $ target=S1f b.await.f(); // $ target=S1f
@@ -2824,6 +2829,52 @@ mod if_expr {
} }
} }
mod local_function {
pub fn f() -> () {
fn local(x: i32) -> i32 {
x + 1 // $ target=add
}
}
}
mod block_types {
#[rustfmt::skip]
fn f1(cond: bool) -> i32 {
// Block that evaluates to unit
let a = { // $ type=a:()
if cond {
return 12;
}
};
0
}
#[rustfmt::skip]
fn f2() -> i32 {
// Block that does not evaluate to unit
let b = 'label: { // $ MISSING: b:i32
break 'label 12;
};
println!("b: {:?}", b);
0
}
fn f3() -> i32 {
return 0;
} // should only have type `i32`, not `()`
#[rustfmt::skip]
fn f4(cond: bool) -> i32 {
let a = { // $ certainType=a:()
if cond {
return 12;
};
};
println!("a: {:?}", a);
0
}
}
mod blanket_impl; mod blanket_impl;
mod closure; mod closure;
mod dereference; mod dereference;
@@ -2863,4 +2914,5 @@ fn main() {
pattern_matching_experimental::box_patterns(); // $ target=box_patterns pattern_matching_experimental::box_patterns(); // $ target=box_patterns
dyn_type::test(); // $ target=test dyn_type::test(); // $ target=test
if_expr::f(true); // $ target=f if_expr::f(true); // $ target=f
local_function::f(); // $ target=f
} }

View File

@@ -266,7 +266,7 @@ class _:
@annotate(MatchArm) @annotate(MatchArm)
@rust.doc_test_signature("(x: i32) -> i32") @rust.doc_test_signature("(x: i32)")
class _: class _:
""" """
A match arm. For example: A match arm. For example:
@@ -1738,7 +1738,7 @@ class _:
For example: For example:
```rust ```rust
fn foo() -> i32 {} fn foo() -> i32 { 0 }
// ^^^^^^ // ^^^^^^
``` ```
""" """
@@ -2466,7 +2466,7 @@ class _:
For example: For example:
```rust ```rust
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {} pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> { 0 }
// ^^^^^^^^ // ^^^^^^^^
``` ```
""" """