From 7d4e34d0bcf06b357fd09a059a02687acf335132 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 21 Jun 2023 01:17:50 +0100 Subject: gentoo auto-resync : 21:06:2023 - 01:17:50 --- dev-lang/Manifest.gz | Bin 19501 -> 19502 bytes dev-lang/python/Manifest | 12 +- dev-lang/python/python-3.10.12.ebuild | 2 +- dev-lang/python/python-3.11.4.ebuild | 2 +- dev-lang/python/python-3.12.0_beta3.ebuild | 522 +++++++++ dev-lang/python/python-3.8.17.ebuild | 2 +- dev-lang/python/python-3.9.17.ebuild | 2 +- dev-lang/rust-bin/Manifest | 6 +- dev-lang/rust-bin/rust-bin-1.67.1-r2.ebuild | 6 +- dev-lang/rust-bin/rust-bin-1.68.2-r1.ebuild | 6 +- dev-lang/rust/Manifest | 3 +- dev-lang/rust/files/1.67.1-rustc_expand.patch | 1427 +++++++++++++++++++++++++ dev-lang/rust/rust-1.67.1-r1.ebuild | 743 +++++++++++++ dev-lang/rust/rust-1.67.1.ebuild | 742 ------------- 14 files changed, 2716 insertions(+), 759 deletions(-) create mode 100644 dev-lang/python/python-3.12.0_beta3.ebuild create mode 100644 dev-lang/rust/files/1.67.1-rustc_expand.patch create mode 100644 dev-lang/rust/rust-1.67.1-r1.ebuild delete mode 100644 dev-lang/rust/rust-1.67.1.ebuild (limited to 'dev-lang') diff --git a/dev-lang/Manifest.gz b/dev-lang/Manifest.gz index 15ff93e379ca..636cbe43a562 100644 Binary files a/dev-lang/Manifest.gz and b/dev-lang/Manifest.gz differ diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 25fa2ad820b9..a02e9f2163c7 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -14,6 +14,8 @@ DIST Python-3.12.0b1.tar.xz 20053428 BLAKE2B b5b0df040de6cff181689f7c53e09407ef3 DIST Python-3.12.0b1.tar.xz.asc 963 BLAKE2B e80cbc9cf93756b6efbce3037dfcd4fec310ce17a3db36f33ac617dae63a8c2abc8efb3cfd5ec42299b9e4c2bdd06a3405c50b5550869564ae5f6a6d79d596c9 SHA512 cea449f05ae66c28aeb4ffd99b5748ba4c09bfb2a6889a771744ea81ca2afc2420648d4ca92592d32ddb26660804e73912e6fb8d906674e9e1895ba613904b26 DIST Python-3.12.0b2.tar.xz 20215500 BLAKE2B e38c9b77fd80510cccfad7b141164c9cae142f89ca112acd3e7c46256c5539688455c66ba60bb52cd57186766a8f2d61cf92f67944a5b9ffb0991ab88f3fd38b SHA512 9bfac70f2ccc1f6798bc63a55d92f0b162e3a9077624a2e37448002ea310cb7b1da64ad2aceda795b45de91f60eb4d95dde85984900e54906d814625b42143b5 DIST Python-3.12.0b2.tar.xz.asc 963 BLAKE2B d491a8ff123f35c6dfc77f466b67fbba13ec3496ea2dd95f0cb8375b755778e10ba4802618787b71006f8433175144ae1dc640171068c583bbd23831b2d78cca SHA512 22a1f2c3335bc428cfee0ce2e081aeed24474d3cd877fac1cc4cf92b4a2bee70f85aed0068a71600cddef9c8b46bbde257a92c57bd494ad820c0686ab7c8c0f0 +DIST Python-3.12.0b3.tar.xz 20220780 BLAKE2B 78deb1efe3642bd11265fdb810d8e40d6d816ebadd55872bfa7de313956865d4370631449a7f0db7ca95f38643598753aaf94c9a02d44f9a2707f45bba41f77f SHA512 2d83285ea09445da25204285937366b20793b12223f5a0979276633213773d14de6dbb6a311629b755962804d8521b30cf9fe032f447608b6df7af721a18ba0c +DIST Python-3.12.0b3.tar.xz.asc 963 BLAKE2B fad39386d4f8a6a1103e0cef431ba171fd5e6af75b097684717f68046683bf967981d1aee0e17f7dc7f97578e686565f817e39de11b309c4e8d64949fff396aa SHA512 ab0d91f3c2fc001fe924f71182526d543a3c9e65238954bb954c58d03171a6cb3640a15570d2d7b889c6251fd876790121cd36bcc29a901f53d17f5f4f8f6f4e DIST Python-3.8.16.tar.xz 19046724 BLAKE2B cbdeec7961d39cb9ab4960760b5d4c7ae71675c174156aa9f6fca55ee92a93a937ef39defe86e423237a25e0e24703233ce4b91dc97005b6ffc1f342ddd9e22c SHA512 d206e80806409410c00ef8acd8c3d90e3cc9553f996d0a57faa63802f2415e9d7591542b2e84b5e8e79245f40f6478790b5ba2acf1da98ebbc9495999183f7fd DIST Python-3.8.16.tar.xz.asc 833 BLAKE2B 678dabc558d013b104bf9e65d4319076c4730a67093a66fefc073b429c640d4facb31a0d6b7238deb08b265586a0cfb2c345051fe4df7bf5001d7317e6c06c9b SHA512 e93c394c0c5afcaaab625a3bd540dcc8e0ab946803d212343b8d1d6d5e6b89b09b6a20607bab0d858b30389a03305d57e14548605a65277d053c7817f32f4546 DIST Python-3.8.17.tar.xz 20696584 BLAKE2B 07be197f7d753775b039ca200864e6d40cbb0115538604d0b214a5404beecd38e3ef416c1941f7871e2e92913d09faba48745bb9df141cf8e5ca77c7de6f0a24 SHA512 bc7e02acfebba86e4394f02195993500fac9347a52c7b49727eb0cdda38786ae917234272872d75effaddb042810d9682ef5627b0cc199f8aa0d5d3e315ddc0e @@ -32,22 +34,24 @@ DIST python-gentoo-patches-3.12.0b1_p1.tar.xz 73068 BLAKE2B 6728a4dcc102cc73e0e3 DIST python-gentoo-patches-3.12.0b1_p3.tar.xz 127756 BLAKE2B b2e0d60cedaf2cfd798387a06e0ea16285b880526639f5050ce285482008bd034c4ee3463f396c96d7b7d6834d4e5f79a4bf441e92b0fe257369c9519d904bf5 SHA512 8e5da370301104f6520c364696b41ce9d1d2561abca096dfb626118d87ac14f8a15fb7a195903aa4aaf6a91189f3dbb9e3833c389fcabb1c9b19720c68228874 DIST python-gentoo-patches-3.12.0b1_p4.tar.xz 127836 BLAKE2B 188fac1b90925b6f80666fd102832909490d82452bb1655c91657d6bf716fca6b4185c34e774387559234a68713ac14d0b5de21a4110ffb3fef200ba8b5379e0 SHA512 07d9dff9e8f53a8b6e79603f2a6b61f5448cf3eb83cdcd184b3131611a7f8bcb975a0ad41bd194256617696df138cff79fbf7626b29f2407435fb0f55175cc72 DIST python-gentoo-patches-3.12.0b2.tar.xz 4652 BLAKE2B 401c9406c9f2f9acf403c73fe75dec65ceb61b4c36b2be0c8c2f3b0b8f02ef727e7f7a913a758931d582e8f10d0003df2adecfef883971157ab60193b00f8305 SHA512 1370b7399eccf6580f0b80303ab2b75bd3c37a4a6503348f3f7ac90dedcb95d00bb0a8b728d59d38e61b4aca237bbbe027eac478edf6ae983810e8c537281b74 +DIST python-gentoo-patches-3.12.0b3.tar.xz 4656 BLAKE2B b7ae4023c1aea6f3fe9f98bc1a974cfd79769dae104fb1dd88cf778f89b6a7d30f68093abc5211e746548e46ed06044beb7458b2ed3b0d67b5a48f00bc960683 SHA512 8d7fbb6ecf65770c6900dccff34c668a79efa3a86d55be50edaa3f583b50be9b4a7e628a41fa9efc92ad61ed9be8e04f1b324e68240fcfdaaad67b7a077ef928 DIST python-gentoo-patches-3.8.16_p4.tar.xz 32436 BLAKE2B 76984bbc04e5cf32d70853891967a33366dd28ca2cd47f3538ed1e9f4d39008d04c90f616d92112f5ec3468c42119089d195ee4d936536f8da4a772164aae221 SHA512 ad6d653fec3cce1f73db4b192f7e95b35ae2cf70aa8782d7b69f9d48eee240ef1cc32257a42bbb57f3952720df68b9976164a0b2748e36600332fba488383016 DIST python-gentoo-patches-3.8.17.tar.xz 32424 BLAKE2B d992f6b1c971583000086175d07198d367e4504dea8829b35742a3daf2279ba1fbade8c37f00018bda97fa9080d1d40087c236486bbcd369c2d1c850de47a976 SHA512 d309da6805a72742cf8d1bb170a777edd7b7aa936d6e9967e96bed4427285180cd9935f202f899f3aa54632a31a5a94c5b7c20a343b1a714d8aa5fc6f8e9f371 DIST python-gentoo-patches-3.9.16_p3.tar.xz 27160 BLAKE2B 5a41a6ff135c3aca02b19cf9a61f554ca224173854274b872ce85e8c71f25c678604e50b87bae40d4b5ac082731c143338fcc6ef47acebad2b59ce0b1d600f5d SHA512 1ace0a9e929769c29082fdec6845a476c07c13fbbff8726a7a592fda09da8b50c996638b4e4e40acccb15630a796074329adbcc9a004c4305952fa5b0dc4146c DIST python-gentoo-patches-3.9.17.tar.xz 25048 BLAKE2B da19105dfa2fda7b422ac368f85c97d7541be74a6f9b9170a19ceac901e026ab39baef83c610172ecba1f70cce6e2832e956c2e4c87387b0e21c79c2c633b116 SHA512 ce9d3c62c675bceccaac21fd467c54322a55a1c8af9be3a6dcfd7a892c03b39b38dc35ba570e3dd9fc984a5f3eeabb3cc564ba2d7f935dbf6df829264cb32b2f EBUILD python-2.7.18_p16-r1.ebuild 8612 BLAKE2B f6c315dcdc3df5d88b456823a2f18cc5fb9e63d8e7b3686a25a814e6222a0787a0b0e1a9373297b14eea9706aa68b6fa36c49a3a4ecf42d3967bf09ca4ca872a SHA512 8234c63e15aa33327bf9cf86f08621b319ba0d7e0826c1159a53b030eab02cf64cd13f1ddce4c250c291eca7a853e0cc420bb549085fd2d11a4dabc0a9d61543 EBUILD python-3.10.11.ebuild 14096 BLAKE2B 56239d09fe6e89a66f2d369fc351d048a0702e6628ba7a5742b85f45207fd4f62808fa6c66ec1a3a7b1bf3b30a94e1962162f6bb94a5b5c0dcb5f78973d31060 SHA512 1fad970178dc06873b54b349c3faef4f8593772c7e533f9a9b664f921eb57065f275bc28d03a9d1aed20576e048b8fed9ce9cf15ad5eea5876d9467c2038be0e -EBUILD python-3.10.12.ebuild 14099 BLAKE2B 1fe15553d67b1b110b2f49ad1e197e453155c034f9d7f985dbfee088277f6799162791d665bce1e59b0de9b84464fc9e4e147c894ec0b59ca3d97e0402b2fb70 SHA512 35432cdfb741ce47eec040bac825ee2cbac14957e012775b01f3de4f2abebd454833a91267e9d1785b470c8713bc55fea49f8fe80880c7dbba2faca06b0ffaae +EBUILD python-3.10.12.ebuild 14096 BLAKE2B 56239d09fe6e89a66f2d369fc351d048a0702e6628ba7a5742b85f45207fd4f62808fa6c66ec1a3a7b1bf3b30a94e1962162f6bb94a5b5c0dcb5f78973d31060 SHA512 1fad970178dc06873b54b349c3faef4f8593772c7e533f9a9b664f921eb57065f275bc28d03a9d1aed20576e048b8fed9ce9cf15ad5eea5876d9467c2038be0e EBUILD python-3.11.3.ebuild 14995 BLAKE2B 30607787937eeb3df47816b0f7ae3c60aa25bc18fa741e4c97d7c6b07ce3648cff5f7ccde5055c793b302455622c836dfbfd9d6238eab8628585acdc1166e834 SHA512 85be8dcdd4988572ff9378663977ada69577bcdaaf99a02f0f352088b6895e1e69a864ca5df67c70a39cfa2942894e09b2f2fd2b36ad2e229b05ce87ded63c67 -EBUILD python-3.11.4.ebuild 15000 BLAKE2B 2f12d05c7bc2d4b9e7ce595a0f5c1a25d4d5aa783e02b5d021eb920c0bc507f71639a89924b3bf2aaac7cd172233965b59f0bf4380edeeb4e7294b6bb72492d9 SHA512 78d6178445ff078a6c55cc552e9e50599896ea267fcf6446ed779a49e0bc57b524abd53e6510f5df65888a06e28190a948f2e99f006bccb807620f43b47ca1b6 +EBUILD python-3.11.4.ebuild 14997 BLAKE2B 853d077e7e56cd093cc9bd78eadacd9f145721ebbfb4ea237c8a4180218fae82c380cf1d739a2f7a434ffcd6e8f72f14e9e1959b05cb57f68e250c1aa2fc7d75 SHA512 188d4364d49955b71021258174d027efd6a7ea9afdf85651bc5f4a512670f1a6dae49d496d096d763e9ca3d70594cf627b4c8175e467b77a230fc45e99df9324 EBUILD python-3.12.0_beta1.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 EBUILD python-3.12.0_beta1_p1.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 EBUILD python-3.12.0_beta1_p3.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 EBUILD python-3.12.0_beta1_p4.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 EBUILD python-3.12.0_beta2.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 +EBUILD python-3.12.0_beta3.ebuild 14804 BLAKE2B 312121a0d299e5f6c446d3315ea363120f91ea065ee173117d71284533cf53a738b10564b0199c1725d58e55c12f5e99d2f5d9d9459f8491b4e51c785e29299c SHA512 e209833e6745fe7c8c13e90bfe56258f54225448671699e5e8abb3de4b16952fa422ac6d1ab2abccad48bf7aba486a8d5bae64aba7eef5fd30923252dd48d413 EBUILD python-3.8.16_p4.ebuild 12195 BLAKE2B 7dcc6fb88eb5a36747eeca7bffb25ca8924969e1c024704f18159d9bb02e24a8ba95caa9a0e001c1e01f3953ffcf6f5414ee86d3f9e8666ccb317c26c045f150 SHA512 884acc58a6b77594ac0aa11d79d0d09c8dfbd317834f11ca1b2041eea5a4c1d0a5cc7710e6902b8e83ec3cba858beed5f7a82563eba5af6243fcf1583c6cac7f -EBUILD python-3.8.17.ebuild 12199 BLAKE2B 2fb9f37a4f07e4271f6c705aab69ef57730bcb642604486fca78e3ef4a692dfdd189129aef9269386d690ced8f6e28f0144d355241327d01ab560a1cec029293 SHA512 536e576faf3e9a83994ef7bcd75712124f16d1a1e7720e79de7b6140015f18a058155967365d741fef0290701fdb6d9c90de660b63c2300f7c04d23fa8769568 +EBUILD python-3.8.17.ebuild 12195 BLAKE2B 7dcc6fb88eb5a36747eeca7bffb25ca8924969e1c024704f18159d9bb02e24a8ba95caa9a0e001c1e01f3953ffcf6f5414ee86d3f9e8666ccb317c26c045f150 SHA512 884acc58a6b77594ac0aa11d79d0d09c8dfbd317834f11ca1b2041eea5a4c1d0a5cc7710e6902b8e83ec3cba858beed5f7a82563eba5af6243fcf1583c6cac7f EBUILD python-3.9.16_p3-r1.ebuild 13696 BLAKE2B b4ed34e15ef72dd0daa606eb558ae73747fda1a9d445cd6d12b28ee2b16a8a0be9ce3b4af059b2a75f493648a5b9da05046fff8264831dede27df072e6c3ebec SHA512 58fe67c0a629571f6969eb6a9743cbc9b59aeb14cff4a4c8a42b273f3afeb676208b1d0007dab0d0887939e107a57ea262c8e5d1cb05ef83b1999ede005e83bb -EBUILD python-3.9.17.ebuild 13701 BLAKE2B a452142a2c753d886062d5b8065d4fe73acb7c11f6a2843a8f9ccce3d96df16660f2aebfeca66bd571754ba45b1142b483ef416c377109d5b226470a36276031 SHA512 1eb191ebdf44747063bb84a126ec10595e96343c737f5b57035e8f46c7bd859383614e26ae8202a363a1e9e07ac57612892199cee609b408c63b7a7adb09868e +EBUILD python-3.9.17.ebuild 13696 BLAKE2B b4ed34e15ef72dd0daa606eb558ae73747fda1a9d445cd6d12b28ee2b16a8a0be9ce3b4af059b2a75f493648a5b9da05046fff8264831dede27df072e6c3ebec SHA512 58fe67c0a629571f6969eb6a9743cbc9b59aeb14cff4a4c8a42b273f3afeb676208b1d0007dab0d0887939e107a57ea262c8e5d1cb05ef83b1999ede005e83bb MISC metadata.xml 1436 BLAKE2B fd5ebcef153bc74aae02f8930dba67736ce44b1dd23418448e7d5bd22391845f5edf0ba8cdf3f43af9254c68734b95fbac9ee891f09c4584c9272ac4233eede6 SHA512 124a1e743cef7236f7936aa843d3aae739a420b1b6173f02c2ef787745616891142724446320d887aeecb95fac09e3620a9666e8e3e32085d79019fe71ff7da5 diff --git a/dev-lang/python/python-3.10.12.ebuild b/dev-lang/python/python-3.10.12.ebuild index 184b5ace1359..5b06497f4210 100644 --- a/dev-lang/python/python-3.10.12.ebuild +++ b/dev-lang/python/python-3.10.12.ebuild @@ -28,7 +28,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~alpha ~amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" IUSE=" bluetooth build debug +ensurepip examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk valgrind +xml diff --git a/dev-lang/python/python-3.11.4.ebuild b/dev-lang/python/python-3.11.4.ebuild index dea412c1830f..ec017f3c8aaa 100644 --- a/dev-lang/python/python-3.11.4.ebuild +++ b/dev-lang/python/python-3.11.4.ebuild @@ -28,7 +28,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~alpha ~amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc ~x86" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86" IUSE=" bluetooth build debug +ensurepip examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk valgrind diff --git a/dev-lang/python/python-3.12.0_beta3.ebuild b/dev-lang/python/python-3.12.0_beta3.ebuild new file mode 100644 index 000000000000..2f7f75bf906e --- /dev/null +++ b/dev-lang/python/python-3.12.0_beta3.ebuild @@ -0,0 +1,522 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils +inherit python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_beta/b} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE=" + bluetooth build debug +ensurepip examples gdbm hardened libedit lto + +ncurses pgo +readline +sqlite +ssl test tk valgrind +" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + app-crypt/libb2 + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-wheels ) + gdbm? ( sys-libs/gdbm:=[berkdb] ) + kernel_linux? ( sys-apps/util-linux:= ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( + !libedit? ( >=sys-libs/readline-4.1:= ) + libedit? ( dev-libs/libedit:= ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + !! /dev/null || die + # We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating + # libdir correctly for cross. + PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \ + ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" + + # Avoid as many dependencies as possible for the cross build. + cat >> Makefile <<-EOF || die + MODULE_NIS_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__GDBM_STATE=disabled + MODULE__DBM_STATE=disabled + MODULE__SQLITE3_STATE=disabled + MODULE__HASHLIB_STATE=disabled + MODULE__SSL_STATE=disabled + MODULE__CURSES_STATE=disabled + MODULE__CURSES_PANEL_STATE=disabled + MODULE_READLINE_STATE=disabled + MODULE__TKINTER_STATE=disabled + MODULE_PYEXPAT_STATE=disabled + MODULE_ZLIB_STATE=disabled + EOF + + # Unfortunately, we do have to build this immediately, and + # not in src_compile, because CHOST configure for Python + # will check the existence of the --with-build-python value + # immediately. + PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake + popd &> /dev/null || die + fi + + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS} + local -x LDFLAGS_NODIST=${LDFLAGS} + local -x CFLAGS= LDFLAGS= + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + if use ncurses; then + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + fi + + econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi + + # force-disable modules we don't want built + local disable_modules=( NIS ) + use gdbm || disable_modules+=( _GDBM _DBM ) + use sqlite || disable_modules+=( _SQLITE3 ) + use ssl || disable_modules+=( _HASHLIB _SSL ) + use ncurses || disable_modules+=( _CURSES _CURSES_PANEL ) + use readline || disable_modules+=( READLINE ) + use tk || disable_modules+=( _TKINTER ) + + local mod + for mod in "${disable_modules[@]}"; do + echo "MODULE_${mod}_STATE=disabled" + done >> Makefile || die + + # install epython.py as part of stdlib + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + export PYTHONSTRICTEXTENSIONBUILD=1 + + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't + # end up writing bytecode & violating sandbox. + # bug #831897 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict "/usr/lib/python${PYVER}/site-packages" + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # this just happens to skip test_support.test_freeze that is broken + # without bundled expat + # TODO: get a proper skip for it upstream + local -x LOGNAME=buildbot + + local test_opts=( + -u-network + -j "$(makeopts_jobs)" + + # fails + -x test_gdb + ) + + if use sparc ; then + # bug #788022 + test_opts+=( + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + ) + fi + + # workaround docutils breaking tests + cat > Lib/docutils.py <<-EOF || die + raise ImportError("Thou shalt not import!") + EOF + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite "/usr/lib/python${PYVER}/site-packages" + + nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local ret=${?} + + rm Lib/docutils.py || die + + [[ ${ret} -eq 0 ]] || die "emake test failed" +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + # the Makefile rules are broken + # https://github.com/python/cpython/issues/100221 + mkdir -p "${libdir}"/lib-dynload || die + + # -j1 hack for now for bug #843458 + emake -j1 DESTDIR="${D}" altinstall + + # Fix collisions between different slots of Python. + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + rm -r "${libdir}"/ensurepip/_bundled || die + if ! use ensurepip; then + rm -r "${libdir}"/ensurepip || die + fi + if ! use sqlite; then + rm -r "${libdir}/"sqlite3 || die + fi + if ! use tk; then + rm -r "${ED}/usr/bin/idle${PYVER}" || die + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + fi + + ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$( + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | + emake --no-print-directory -s -f - 2>/dev/null + ) + newins Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local EPYTHON=python${PYVER} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die + fi +} + +pkg_postinst() { + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3.11.0_beta4-r2; then + ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files" + ewarn "installed previously are no longer valid and will be regenerated" + ewarn "(or ignored) on the next import. This may cause sandbox failures" + ewarn "when installing some packages and checksum mismatches when removing" + ewarn "old versions. To actively prevent this, rebuild all packages" + ewarn "installing Python 3.11 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.11/site-packages" + fi + done +} diff --git a/dev-lang/python/python-3.8.17.ebuild b/dev-lang/python/python-3.8.17.ebuild index aaa7e49caa41..67ca3cbba43e 100644 --- a/dev-lang/python/python-3.8.17.ebuild +++ b/dev-lang/python/python-3.8.17.ebuild @@ -28,7 +28,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~alpha ~amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" IUSE=" bluetooth build debug +ensurepip examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk valgrind wininst +xml diff --git a/dev-lang/python/python-3.9.17.ebuild b/dev-lang/python/python-3.9.17.ebuild index 449a5f90b94d..592e2685f905 100644 --- a/dev-lang/python/python-3.9.17.ebuild +++ b/dev-lang/python/python-3.9.17.ebuild @@ -28,7 +28,7 @@ S="${WORKDIR}/${MY_P}" LICENSE="PSF-2" SLOT="${PYVER}" -KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc ~x86" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" IUSE=" bluetooth build debug +ensurepip examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk valgrind +xml diff --git a/dev-lang/rust-bin/Manifest b/dev-lang/rust-bin/Manifest index fe4efbd70c00..5d84741614f6 100644 --- a/dev-lang/rust-bin/Manifest +++ b/dev-lang/rust-bin/Manifest @@ -92,6 +92,7 @@ DIST rust-1.67.1-riscv64gc-unknown-linux-gnu.tar.xz 199552128 BLAKE2B acfeb341ff DIST rust-1.67.1-riscv64gc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 246adaf9b5980413ac32af57d2e089e765336e085bb45799aaeb80311a7a5d73545779c8b2e810b763520d9d5a5d475f764675191c12a2d4b2b313c11230d311 SHA512 bf447737b414839b126fe258bb5dd6d34bb9d47d57fdb68a4cd0b9296fda2c47aa267cc9722f7821bab365b95ee4a2c93631786f89c7cb5197c283897c413016 DIST rust-1.67.1-s390x-unknown-linux-gnu.tar.xz 235970856 BLAKE2B efbe49525e880b07de613be0d22bb87065e0d64f7006ae07c9deb020b65bcbb6dd20cdc250e740763480426baf9c64adfd06e005b616543f2ef9451e99b7d411 SHA512 308aa7bc5e32c50a0b5c2fdb5e9bae60d8c8ea32fcab72205aea9832f24df35d9331c63503e092ecfee18c1eedcb5a50138837e29bb50d74f526aafbad9e71aa DIST rust-1.67.1-s390x-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 875b4168bf1458376ba31aa8b27d7bb331cb3bcfaf2645e65d0a2167cf55e6a6a2a0bf5f66438e7cca7c73f1cc02fddeea3be570e37ca80f5cc14fc5e0349423 SHA512 97a0e05fabc4755ffaf23ada6d77dde78b410ef530437a8700673ee986c1fc5015665948fb4c63f2e0716bc022ef7d6f061fee0a1516995a6a4d7ea100d234d2 +DIST rust-1.67.1-sparc64-unknown-linux-gnu.tar.xz 64593768 BLAKE2B 17de4478cac7be3e30b2e6d5e9a5b9803d063186d9425a886832f6116883578bea300001d4f85c925edf9be8e8bab829106b15696e1eba7d6b9993c4f38f5eba SHA512 2d6a89ed15a96b5a8bc8f83bf84708fa37b627aaa0834f90f5442c807135c7e37a0680bebdb253f41efa45fb20b49b4304ddd9fea742fa4547da226a1b9ff9e1 DIST rust-1.67.1-x86_64-unknown-linux-gnu.tar.xz 186714164 BLAKE2B 648efbb30233335e31c9a90aed4958325258365cd4aef5e01312005606f23ea42cb6788eb82a11e61fb5111c4d32e052ed815e455c32ed3f6fcb18d963589669 SHA512 1a65ce569fb3262dfb805d0fa2c5c9f987c2c69e547fce366d9d371c8b19a90de279099a942919690aa6d58e2462cfd7bf54240f7ef51dc22ce12e292c46038d DIST rust-1.67.1-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 669b7c4b0d5382a7d1d0fe49405f2798f67a9e745711dc2c8e7548ea6fdc8f0fefdab37d0594aec14b2745ce45e7c469e79c0cb1d86077ad9c7b6aafc2656827 SHA512 067681cb4140a29adfa5f4b141e2f3450dad34b95a1e549a6bc8d759e57da5d2ae69cc165efcdef9d83e2eee06edb6acd587d38c9b2f3d000d7a3f79daccc671 DIST rust-1.67.1-x86_64-unknown-linux-musl.tar.xz 269831452 BLAKE2B a36498528454f1bf0e1812eba005f27e3e281e4e2c117477785f5e48468c3fe316947b7e4360f573f0f4cd6f117e4102db8aeaa616be5bef09fb7518fd230b23 SHA512 9a3eb67239a88b875fe55846a2fffbbb1f2a4cc8eed18b5558f0f989d544a8ddfe0861d5b2b860a779833a1660ee622b30320ec9ef83e841724f7a32f08fda06 @@ -124,6 +125,7 @@ DIST rust-1.68.2-riscv64gc-unknown-linux-gnu.tar.xz 207916672 BLAKE2B 81c09e028d DIST rust-1.68.2-riscv64gc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 31bb980aa2a6b45e7a51cba0f14ed86674617f2cf8ee0583765d01502bf754f59a0cd960ad50a1e21ea8f6898e83e307d39be1eecc2b3344f5681c1908cfb436 SHA512 66c8a3efd1c579784321f24edcb4113c184516912ad490c9088d2141ac527af85acc64b6c67454661d1a991a710758cbebbfaaac7ae086b463fbdae7d1c89bb0 DIST rust-1.68.2-s390x-unknown-linux-gnu.tar.xz 234071260 BLAKE2B dbcd38a0503d3e131a7786e11874cf0e3dbca13c5ae7c9b605caec529aae5c498722d2685557be43387e2d2b855892720b6e84021765bebdfeea4a2dbe7502f1 SHA512 00614d53a4d34b4714febfc7c4eb2f92446ba928e8bfde0de537de51474704525456b628b60634f0220278c5d403da55c793a30d744362b181cacb1a9d8fac1b DIST rust-1.68.2-s390x-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 9eb99100e0e61ffa6f031b9f04fbcedccfbecd897e3232c8e192e52b3d5c103f8558de5e23e7eb19487eec890c0fef2c9be952edfdcd2f1a05b5b09d3a0fa82e SHA512 4d36bab880a386e6e70d23682435e1a960be3c88387ffcd955a55ce451acd3d49085b0db05230f874519aef12192eebbbbc26627807a6fa7021c89ff5d82f814 +DIST rust-1.68.2-sparc64-unknown-linux-gnu.tar.xz 65355904 BLAKE2B e0318420255e1342f256988ccf9ba463424be3bdb4c35aa497292f02f9e9c3c7d2d2124ba8924341b05c455dd094255a9a51bf0d7e6f2bee2e067d9ba18f29fb SHA512 da54b8aa143dfbc3ff9c030a7ca7f08047bcf09904f245ed0d594e63bc052ad9d9ce3cc22e7184520b06dc4635bedf8b3e7ece3cc9d6cc27d97a9cf7cc182733 DIST rust-1.68.2-x86_64-unknown-linux-gnu.tar.xz 185953856 BLAKE2B 11fc1f284c77261d69b2ba582843cbd15f3bde832cfa038764e68711de73c9a86f9e36f69a81606b4d5dcb0f9c0f413c88cb400e17511b980671a246ff63aa2a SHA512 7f3344591be014b86e55c21fab27587b00756aa46a366cde2149fafa36b5dfae29e126f70511b40bfad131a1d4d27c8cf82add3474b69e2c498c7380961a23e5 DIST rust-1.68.2-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 06f3d90126dfe5dcfb8147c8529f333bf635c5c669cc0b5d45156fed85e87aaaa67d8d9c4b250f77e1f0998e77e5635d3f3056447a032eac07bf847fc532a383 SHA512 1d826f0f8ed896d54139b4ae78205aee5cee3ce6f5449d94b8edb8fc19ab589bde6720eb1644502fc45fe0bd452e2e5209de83c99f7c4285a896cfaacbfdad36 DIST rust-1.68.2-x86_64-unknown-linux-musl.tar.xz 270073164 BLAKE2B 7d69a578e1d4a8fa75cfea6e630265f1c73cca08ed86ddc7858e7770755431dbf13ddaadcf8035fc2b7d2d7b7144a08b3e3a9fa20afcb5cfed7a31d82098fe5e SHA512 b0294141f1e51176664ae841ea55991826ccd15d0d36b03471831baa202ecb97434bf96479e167772bd62f05b80b49878f89a065a91e00026f0aabe7c02fe552 @@ -200,8 +202,8 @@ DIST rust-src-1.69.0.tar.xz 2405440 BLAKE2B 685ae443aab2a1ccf3c4024be9a96f476ba5 DIST rust-src-1.70.0.tar.xz 2422004 BLAKE2B 2f6b22d767ca93ed5d02d432deb743e10d73fa3f767facaf958b43281cdf6786d399f83a00a7154e3935e4ec65137c15162009d20b0b97a00f9c14ff90cae007 SHA512 0ec5ecacbf46f503aa6492d518fb747496cb09f37ae377e12849c2c9f8e5c3fb5a09385a2e5912f492f4fe4b76d7e74872ca9ced18ad46d8e11671721ec03b5d EBUILD rust-bin-1.65.0-r1.ebuild 6793 BLAKE2B d0a58b6ef31ddb223cccdc65998038e9ff0cb4455614619de7adecc0907cca47fe4fb7d7db9d315fec00b0779530a60ad03935fca88df7c840b409c0c37e480b SHA512 7e6908661f31c2a1ea77ad3f1cc1fd729a9ebf4093296e69f39184ed95b3ee4b715de00899736d409f0aa7362b9c5b904d150e47e255cf32244fdfea28e69edf EBUILD rust-bin-1.66.1-r1.ebuild 6798 BLAKE2B 6c814eb21abe2a4f3e3511d609e7ccc9196f49dd2d3ac060e3c8727c84258206f80173cbe6ca544f27b4fd1a32346cf6c9ba308f4d3e2abaabbdefe3051169e7 SHA512 71c77d41dd56c309b7e9103a0cd87ff54b5a9fb7ec51ea62d871041a0cb18bcc44cd98d431507339d03bcedcadc1804bb2c86637e4e5c6ba707f95b0d3b98a35 -EBUILD rust-bin-1.67.1-r2.ebuild 6815 BLAKE2B 2de4c538189f9a2aad2b4d89c3dda55fa66f8dc9db229f3aef19191d6b1185e304e4a4041f52bd14513af7a02b950ea61697302d50432fabba346bf42dca8108 SHA512 610825359ada60e639220f0f9c48ef751b3e74c3a50723028605916e1391abecbc2748949a26105e25da2c8a95387109039d8db576fdec630a4fc86e57a02d01 -EBUILD rust-bin-1.68.2-r1.ebuild 6770 BLAKE2B 7b40eeaeecce67b8a1c2b4705805d966644db051701f9e9c367bd6dfaf1ff8b12933c4f8b82759db1e26ec64ad9f765cf1aff5f7f108538588002bd16a1cd2cd SHA512 c30549581c8acd13453fffb9cca41c33dc2155279de6c58522dd6710c6bada519aaea7fd781284e652c15ff53915af4e31ef06121e9816fd4bf2876e8ceb63f4 +EBUILD rust-bin-1.67.1-r2.ebuild 6827 BLAKE2B 015f8ad560c32b0ab76c01d46ae53fb4212797ebc60767f5f99e890daa2d505e68c091d43796eb7be7b46da44b9c6b7809101042dd508f51cbd4225d1a1e4339 SHA512 049643f3b2f950663c289d820da8eb18c04a0dc5cdad0bb34ae73c7a47fac7fbf77ae92cd93a54b53ff42684b17efa3a450dca79efeaa5bc6081183826abe74b +EBUILD rust-bin-1.68.2-r1.ebuild 6782 BLAKE2B 08d3bb6c7f6d19bd98789c9a9ac6a8fca57c8719a52b543f34cff7d9b47a89162d74f6cef31328e7577df704671e582e438781d187eb8441b58bec6f52d02694 SHA512 694a8262d709800337777fc7a60066724394910217b897746821f4541aa7aeb45f0756d24aeac883d2ba304714b9140d7ecb44bf3732996d181190393e2c1ae4 EBUILD rust-bin-1.69.0.ebuild 6765 BLAKE2B c14b16db80f636d064a54bf256df9a4d8fe308e9821422dc9b46ce5e272200f32d463a4f6fa36b7a80b0c12972d00ff5c155183db4f788858cce6760d6b5a785 SHA512 c345e3f23dad76998bf86f893e75212b10a9c5621fd551546eaf3580cc418985255d3cc7e53f67855a42902d1d3116d3b78708fecc5073cfa71ec43c05ab1679 EBUILD rust-bin-1.70.0-r2.ebuild 6889 BLAKE2B 2bad9cb9724360157a1ca1eab776b2d86f6453399e9d298baa1d9aa6d38e2865c32e99940bafd9f4864a6067fd4d8c05fa73e971b6b3f9fe9b7e3c7182732de0 SHA512 83a7b4f7a1af11d8d9aa09a4894a722f6773f08904b7470cbc7e1009d045fa03c958543122a7c8c11aa9b4f7bf2bce3153a770ad28783cad794253333d1ef4c1 MISC metadata.xml 602 BLAKE2B 8e74f441d22eeb8b276d77ed0a9c5bde01540a3f34d6053185b2be77dd9188b80c01c536f8bb18c4c60214bd0bf366a504c1f3627110a213332120b533f7ddd2 SHA512 5f120deec600c7453d503b6acb9460d1c765a567954c79749654365721b1b6fa2dd48d60d5f3fc86191e79d5f7f78d7aa1e9634e6127f333f81e546f9b0f74ac diff --git a/dev-lang/rust-bin/rust-bin-1.67.1-r2.ebuild b/dev-lang/rust-bin/rust-bin-1.67.1-r2.ebuild index c8ce92fc1251..8cba54455119 100644 --- a/dev-lang/rust-bin/rust-bin-1.67.1-r2.ebuild +++ b/dev-lang/rust-bin/rust-bin-1.67.1-r2.ebuild @@ -8,7 +8,7 @@ inherit multilib prefix rust-toolchain toolchain-funcs verify-sig multilib-minim MY_P="rust-${PV}" # curl -L static.rust-lang.org/dist/channel-rust-${PV}.toml 2>/dev/null | grep "xz_url.*rust-src" MY_SRC_URI="${RUST_TOOLCHAIN_BASEURL%/}/2023-02-09/rust-src-${PV}.tar.xz" -GENTOO_BIN_BASEURI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}" # omit leading slash +GENTOO_BIN_BASEURI="https://dev.gentoo.org/~gyakovlev/distfiles/${CATEGORY}/${PN}" # omit leading slash DESCRIPTION="Systems programming language from Mozilla" HOMEPAGE="https://www.rust-lang.org/" @@ -16,11 +16,11 @@ SRC_URI="$(rust_all_arch_uris ${MY_P}) rust-src? ( ${MY_SRC_URI} ) " # Keep this separate to allow easy commenting out if not yet built -#SRC_URI+=" sparc? ( ${GENTOO_BIN_BASEURI}/${MY_P}-sparc64-unknown-linux-gnu.tar.xz ) " +SRC_URI+=" sparc? ( ${GENTOO_BIN_BASEURI}/${MY_P}-sparc64-unknown-linux-gnu.tar.xz ) " LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4 UoI-NCSA" SLOT="stable" -KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86" +KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" IUSE="clippy cpu_flags_x86_sse2 doc prefix rust-analyzer rust-src rustfmt" DEPEND="" diff --git a/dev-lang/rust-bin/rust-bin-1.68.2-r1.ebuild b/dev-lang/rust-bin/rust-bin-1.68.2-r1.ebuild index efd643da0fd7..bbf4146808a7 100644 --- a/dev-lang/rust-bin/rust-bin-1.68.2-r1.ebuild +++ b/dev-lang/rust-bin/rust-bin-1.68.2-r1.ebuild @@ -8,7 +8,7 @@ inherit multilib prefix rust-toolchain toolchain-funcs verify-sig multilib-minim MY_P="rust-${PV}" # curl -L static.rust-lang.org/dist/channel-rust-${PV}.toml 2>/dev/null | grep "xz_url.*rust-src" MY_SRC_URI="${RUST_TOOLCHAIN_BASEURL%/}/2023-03-28/rust-src-${PV}.tar.xz" -GENTOO_BIN_BASEURI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}" # omit leading slash +GENTOO_BIN_BASEURI="https://dev.gentoo.org/~gyakovlev/distfiles/${CATEGORY}/${PN}" # omit leading slash DESCRIPTION="Systems programming language from Mozilla" HOMEPAGE="https://www.rust-lang.org/" @@ -16,11 +16,11 @@ SRC_URI="$(rust_all_arch_uris ${MY_P}) rust-src? ( ${MY_SRC_URI} ) " # Keep this separate to allow easy commenting out if not yet built -#SRC_URI+=" sparc? ( ${GENTOO_BIN_BASEURI}/${MY_P}-sparc64-unknown-linux-gnu.tar.xz ) " +SRC_URI+=" sparc? ( ${GENTOO_BIN_BASEURI}/${MY_P}-sparc64-unknown-linux-gnu.tar.xz ) " LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4 UoI-NCSA" SLOT="stable" -KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86" +KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" IUSE="clippy cpu_flags_x86_sse2 doc prefix rust-analyzer rust-src rustfmt" DEPEND="" diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest index 55a4954faea6..58b8b1a00875 100644 --- a/dev-lang/rust/Manifest +++ b/dev-lang/rust/Manifest @@ -2,6 +2,7 @@ AUX 1.62.1-musl-dynamic-linking.patch 898 BLAKE2B 09321e356d5c945f72e75e668bfee2 AUX 1.64.0-vendor-rustix-sparc-has-no-SIGSTKFLT.patch 2744 BLAKE2B 4eb03df7c21087a5833f031b85c999f95e8055492c61184bbe137407b4cdddb76d25f95d6beb5a1c6f82f42800f914f0fde60192c807a9548ee27ba226b10f65 SHA512 d489d0841ad297f8835b7adb1e5777865080f3f83a991da55a266da38396993c7b50f8ec98285ed7b174c879053670acedf9116b586c493338daac8f67741fb6 AUX 1.65.0-ignore-broken-and-non-applicable-tests.patch 1504 BLAKE2B 6318227c4a11ef0b849a85f164fc446ba34ffc3e4314b3f18248aa6605f08aa9a1adfaa2d9b2154c9e29fcab203d3c322fcf67e770778cc788f37bfb86ef353d SHA512 54a05e43c7d01129d8590495d2d651d677ebec06b5302355fec87d3c9bfdaab96bae192d17fafe115039d74a0d56fffa653a03ff0a8528a88582d64f1bbe663d AUX 1.67.0-doc-wasm.patch 1359 BLAKE2B 59293c5b61de7ca283629d7f65b965388a42527811fc8355cdf5320fee03d10560f34e9c9a25dbe91e5758c37484485581a5e524a497711f1e108e5ffde6c53c SHA512 f3bafc2d0d2569f0d6891e14aa307cd2425d6624832b27381ae9d6f7ced488eff6d5fa0cdcd77a98d1f92a10a9d832f3aa3c481d1abbb42a0882862bbb189346 +AUX 1.67.1-rustc_expand.patch 53069 BLAKE2B f78a79ebe926aa5acaf40069dfaad8618656ed4b15f7d0eeeee741ed3af9671185b31285979ef06535f67238923e458d90baa182a718685c661518912f0046ec SHA512 33681f1d2192bef129bdcb6ec2a38eb4a03d4430b54386e8c142820209eafa7b8446cc951527b15f189e0ed06ebc486cab592de9881d8f5f5f9be106ba2b4182 AUX 1.68.0-ignore-broken-and-non-applicable-tests.patch 1472 BLAKE2B e91233c812ca413ae8b09ff13ddf6d27773c1fce95aa6f637a6dba6ee8115b0913aeec6e045ae01f49c14a9e7537b6506a3a1f9a20c9bd7afa3bc9d9200a9bd6 SHA512 cafc3765cb4e10f17dd2b15e24466d630d8b24b4fbef72571dd7c38d9535cb7661f64c88792254ef52bedac5c6bec15001aafb047543657047bb9ec986b5959a AUX 1.70.0-ignore-broken-and-non-applicable-tests.patch 1029 BLAKE2B 42a634c423c57f23bf709294f79024fde03a529c9de6e15554102bfb0a777571e388a8a122d8e01fa8b1889b873083e7802ee30bc9de3c3ebd758a6c7628f295 SHA512 3b0f22370f002934f5237849f2a018989a700e6b4ed5ffe308d5a0acda54c85b67919db88a94eb991568056030899802ceb2bf102ce8eef9745efee40e8f738c DIST rust-1.64.0-aarch64-unknown-linux-gnu.tar.xz 245636524 BLAKE2B 90e405bc6e7f47aec091924bcd7a35017d591936b2697f2b0ddc5271e65fa431cc193a2b392489b6636896fa2d4f3d8f5096d197cfed36e812ea7f3986130c85 SHA512 c163b19a56148646ebbdb10b5b20459a206b4a1c45a2de9ce69f2e45dc5527cc69920f81007ee6fb75080782d534a2a39f7580d0c8cfdcf36ebed971b2513b63 @@ -210,7 +211,7 @@ DIST rustc-1.70.0-src.tar.xz 140736896 BLAKE2B f07a800e35dca074df0c76fa91f512ae3 DIST rustc-1.70.0-src.tar.xz.asc 801 BLAKE2B 172744ff679c4554a6992b08a6bdcd65bd133f3db2d7f2eb1fa3659683aeb65228f9c57d101d9d050256217bb4fbbc0ccaf892bfcd8ef69ac742e12e75548c68 SHA512 0b26b176bf957ea5c2465a8da05992907165f11dccfb8f3a8a2c851b20fc9083e8bca80fefee2534d3326e721f41d19ef75b7f49692a342ab7ef5cdb2e8c52a4 EBUILD rust-1.65.0.ebuild 23827 BLAKE2B 6a520838a379281dbb992e03957bd39820009d9d69fe3163ebbaba9a5259475c359aefd8a9232e7c12a012c66ec8d0e4e3a9e2822cb441ddc47c2c6e0e1dfe4b SHA512 76311be1a575192386a01b96ae7fca7bcb80333000dca88495043678ce04c27f1002f6319a85d6caceea126d8f57cfeb8a838d1ac1c3620cd2711d00273789cb EBUILD rust-1.66.1.ebuild 23722 BLAKE2B fabdd9cfd2b8bdd812934548db81b4499b0e7ac485688c1457233b509f9f0c5f68b5a16c35422e2fdc2ec186c0c5109bc54f0748601ada8a11b95982cc0fd3ae SHA512 751c6f08f7676810867f6dabc6da17774a7a42fac93534ffdf6ebf433d6919ecbcf26da048764166797a2a622f2d33c7525e0f2e331659763890e567dd8e079d -EBUILD rust-1.67.1.ebuild 23148 BLAKE2B bc292a444801553efb9a8556834d9d8e117fe9e5c30bb7a8d99a3d0bcff62b839162f4f21161d7bede51236ac7c0d277aff93e97b308232fae4ddd3ee41958ec SHA512 ceafa53fcc725110b3b1d2cbb3bc198f558b3bb6fc17760a502232f85de114ec253dfe7275bbd0f8778ab936d20ba8f54b9035adde89c2c5e7713e2663527513 +EBUILD rust-1.67.1-r1.ebuild 23189 BLAKE2B ad3dba96cc9c76736ccd9e8661da392c79ae975b0c3797959412b88adb932d6536d7e919e1f1ba644d6ed311fcee9b4d281fa7bf69ae2db87248d18db63cb4e9 SHA512 846fbd2ffc9d16378c67820ef22c30f2b559dc28d765c7694e7079b069acb078aaf35debd8f9f2de1e1016da63eaaddd38662b017ade3fa17fedb65fcc5388b5 EBUILD rust-1.68.2.ebuild 23148 BLAKE2B 190d2a4c9fd075d9cb6a848224bc6c66f8d33502a9950bcd3aa6bef33e20fd9bd74ba53567b48afc923a6c0444cf9683e7423a6b1b79f9f7a5050fbc560da99e SHA512 fdf734a54c00fa9c12b87c2f097a6c2c4f864d0e8885f925e4a14b7fdf01afc1a2830cd40df8a184b5776039ca9398e3c50485c5d65fc439e230ea73bc9d3569 EBUILD rust-1.69.0-r1.ebuild 23207 BLAKE2B 9d17cdbbd5dd85e8591fba437462ee0677912a11d715e4483061fee22efcc5f1ac8b7eee2a404bb9c3c252551797c82163504e35ade99a29e22d111a3a8091ae SHA512 b1d0f50bbb9557aeb83a264d2dccdbc2ef879e44fd901cb2f6ac91c67e15a9aace3f4307c9d84228914e4317728fca91ee5fce1c3df1624bd6b3dfbba347988d EBUILD rust-1.70.0.ebuild 23321 BLAKE2B 50e5163e777315d2ded4193c27ac81570c4d8430aad5e4325e002941abacf8c414bb17c7aefb2a88b5a97aa685e58ca2a54514b66bbff87ca7e8874a054cf03a SHA512 1ac78a71aa54ee6e77fca5df409b698f9acd668dfb1aa63ca8ba67ed5e7eb0a0267fb6373a8e8b735aa1e69309e8fc3087e8386ec79a15fce1c6669178fb4714 diff --git a/dev-lang/rust/files/1.67.1-rustc_expand.patch b/dev-lang/rust/files/1.67.1-rustc_expand.patch new file mode 100644 index 000000000000..af778d45c76f --- /dev/null +++ b/dev-lang/rust/files/1.67.1-rustc_expand.patch @@ -0,0 +1,1427 @@ +From 2f9f097cb8b6c27a7e0d7a916e6911fc1f5ecd81 Mon Sep 17 00:00:00 2001 +From: nils <48135649+Nilstrieb@users.noreply.github.com> +Date: Tue, 15 Nov 2022 14:24:33 +0100 +Subject: [PATCH] Migrate parts of `rustc_expand` to session diagnostics + +This migrates everything but the `mbe` and `proc_macro` modules. It also +contains a few cleanups and drive-by/accidental diagnostic improvements +which can be seen in the diff for the UI tests. +--- + compiler/rustc_builtin_macros/src/concat.rs | 2 +- + .../rustc_builtin_macros/src/concat_bytes.rs | 2 +- + compiler/rustc_builtin_macros/src/env.rs | 2 +- + .../locales/en-US/expand.ftl | 107 ++++++ + compiler/rustc_errors/src/diagnostic_impls.rs | 6 + + compiler/rustc_expand/src/base.rs | 90 +++-- + compiler/rustc_expand/src/config.rs | 106 +++--- + compiler/rustc_expand/src/errors.rs | 326 +++++++++++++++++- + compiler/rustc_expand/src/expand.rs | 86 ++--- + compiler/rustc_expand/src/lib.rs | 6 + + compiler/rustc_expand/src/module.rs | 80 ++--- + compiler/rustc_expand/src/tests.rs | 1 + + src/test/rustdoc-ui/doc-cfg.stderr | 4 +- + .../cfg-attr-syntax-validation.stderr | 2 +- + .../macros/macro-in-expression-context.stderr | 8 +- + .../ui/proc-macro/attr-invalid-exprs.stderr | 16 +- + src/test/ui/proc-macro/attribute.rs | 8 +- + src/test/ui/proc-macro/attribute.stderr | 8 +- + src/test/ui/proc-macro/expand-expr.stderr | 16 +- + 19 files changed, 640 insertions(+), 236 deletions(-) + +diff --git a/compiler/rustc_builtin_macros/src/concat.rs b/compiler/rustc_builtin_macros/src/concat.rs +index e2d71825d556f..9ae65c641fd62 100644 +--- a/compiler/rustc_builtin_macros/src/concat.rs ++++ b/compiler/rustc_builtin_macros/src/concat.rs +@@ -11,7 +11,7 @@ pub fn expand_concat( + sp: rustc_span::Span, + tts: TokenStream, + ) -> Box { +- let Some(es) = base::get_exprs_from_tts(cx, sp, tts) else { ++ let Some(es) = base::get_exprs_from_tts(cx, tts) else { + return DummyResult::any(sp); + }; + let mut accumulator = String::new(); +diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs +index d1124145dcbbb..70ce5a6c41929 100644 +--- a/compiler/rustc_builtin_macros/src/concat_bytes.rs ++++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs +@@ -137,7 +137,7 @@ pub fn expand_concat_bytes( + sp: rustc_span::Span, + tts: TokenStream, + ) -> Box { +- let Some(es) = base::get_exprs_from_tts(cx, sp, tts) else { ++ let Some(es) = base::get_exprs_from_tts(cx, tts) else { + return DummyResult::any(sp); + }; + let mut accumulator = Vec::new(); +diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs +index 0b4e545f7a3d0..a7283ea601b19 100644 +--- a/compiler/rustc_builtin_macros/src/env.rs ++++ b/compiler/rustc_builtin_macros/src/env.rs +@@ -52,7 +52,7 @@ pub fn expand_env<'cx>( + sp: Span, + tts: TokenStream, + ) -> Box { +- let mut exprs = match get_exprs_from_tts(cx, sp, tts) { ++ let mut exprs = match get_exprs_from_tts(cx, tts) { + Some(exprs) if exprs.is_empty() => { + cx.span_err(sp, "env! takes 1 or 2 arguments"); + return DummyResult::any(sp); +diff --git a/compiler/rustc_error_messages/locales/en-US/expand.ftl b/compiler/rustc_error_messages/locales/en-US/expand.ftl +index 5720591154f99..df0e8ae5dd8f5 100644 +--- a/compiler/rustc_error_messages/locales/en-US/expand.ftl ++++ b/compiler/rustc_error_messages/locales/en-US/expand.ftl +@@ -20,3 +20,110 @@ expand_var_still_repeating = + variable '{$ident}' is still repeating at this depth + + expand_meta_var_dif_seq_matchers = {$msg} ++ ++expand_macro_const_stability = ++ macros cannot have const stability attributes ++ .label = invalid const stability attribute ++ .label2 = const stability attribute affects this macro ++ ++expand_macro_body_stability = ++ macros cannot have body stability attributes ++ .label = invalid body stability attribute ++ .label2 = body stability attribute affects this macro ++ ++expand_resolve_relative_path = ++ cannot resolve relative path in non-file source `{$path}` ++ ++expand_attr_no_arguments = ++ attribute must have either one or two arguments ++ ++expand_not_a_meta_item = ++ not a meta item ++ ++expand_only_one_word = ++ must only be one word ++ ++expand_cannot_be_name_of_macro = ++ `{$trait_ident}` cannot be a name of {$macro_type} macro ++ ++expand_arg_not_attributes = ++ second argument must be `attributes` ++ ++expand_attributes_wrong_form = ++ attribute must be of form: `attributes(foo, bar)` ++ ++expand_attribute_meta_item = ++ attribute must be a meta item, not a literal ++ ++expand_attribute_single_word = ++ attribute must only be a single word ++ ++expand_helper_attribute_name_invalid = ++ `{$name}` cannot be a name of derive helper attribute ++ ++expand_expected_comma_in_list = ++ expected token: `,` ++ ++expand_only_one_argument = ++ {$name} takes 1 argument ++ ++expand_takes_no_arguments = ++ {$name} takes no arguments ++ ++expand_feature_included_in_edition = ++ the feature `{$feature}` is included in the Rust {$edition} edition ++ ++expand_feature_removed = ++ feature has been removed ++ .label = feature has been removed ++ .reason = {$reason} ++ ++expand_feature_not_allowed = ++ the feature `{$name}` is not in the list of allowed features ++ ++expand_recursion_limit_reached = ++ recursion limit reached while expanding `{$descr}` ++ .help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`) ++ ++expand_malformed_feature_attribute = ++ malformed `feature` attribute input ++ .expected = expected just one word ++ ++expand_remove_expr_not_supported = ++ removing an expression is not supported in this position ++ ++expand_invalid_cfg_no_parens = `cfg` is not followed by parentheses ++expand_invalid_cfg_no_predicate = `cfg` predicate is not specified ++expand_invalid_cfg_multiple_predicates = multiple `cfg` predicates are specified ++expand_invalid_cfg_predicate_literal = `cfg` predicate key cannot be a literal ++expand_invalid_cfg_expected_syntax = expected syntax is ++ ++expand_wrong_fragment_kind = ++ non-{$kind} macro in {$kind} position: {$name} ++ ++expand_unsupported_key_value = ++ key-value macro attributes are not supported ++ ++expand_incomplete_parse = ++ macro expansion ignores token `{$token}` and any following ++ .label = caused by the macro expansion here ++ .note = the usage of `{$macro_path}!` is likely invalid in {$kind_name} context ++ .suggestion_add_semi = you might be missing a semicolon here ++ ++expand_remove_node_not_supported = ++ removing {$descr} is not supported in this position ++ ++expand_module_circular = ++ circular modules: {$modules} ++ ++expand_module_in_block = ++ cannot declare a non-inline module inside a block unless it has a path attribute ++ .note = maybe `use` the module `{$name}` instead of redeclaring it ++ ++expand_module_file_not_found = ++ file not found for module `{$name}` ++ .help = to create the module `{$name}`, create file "{$default_path}" or "{$secondary_path}" ++ ++expand_module_multiple_candidates = ++ file for module `{$name}` found at both "{$default_path}" and "{$secondary_path}" ++ .help = delete or rename one of them to remove the ambiguity +diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs +index 7155db32e53b7..cb39e997436e0 100644 +--- a/compiler/rustc_errors/src/diagnostic_impls.rs ++++ b/compiler/rustc_errors/src/diagnostic_impls.rs +@@ -152,6 +152,12 @@ impl IntoDiagnosticArg for ast::Path { + } + } + ++impl IntoDiagnosticArg for &ast::Path { ++ fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { ++ DiagnosticArgValue::Str(Cow::Owned(pprust::path_to_string(self))) ++ } ++} ++ + impl IntoDiagnosticArg for ast::token::Token { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + DiagnosticArgValue::Str(pprust::token_to_string(&self)) +diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs +index 9d6a4f9a1fd7d..6f159663e80cf 100644 +--- a/compiler/rustc_expand/src/base.rs ++++ b/compiler/rustc_expand/src/base.rs +@@ -1,3 +1,11 @@ ++#![deny(rustc::untranslatable_diagnostic)] ++ ++use crate::errors::{ ++ ArgumentNotAttributes, AttrNoArguments, AttributeMetaItem, AttributeSingleWord, ++ AttributesWrongForm, CannotBeNameOfMacro, ExpectedCommaInList, HelperAttributeNameInvalid, ++ MacroBodyStability, MacroConstStability, NotAMetaItem, OnlyOneArgument, OnlyOneWord, ++ ResolveRelativePath, TakesNoArguments, ++}; + use crate::expand::{self, AstFragment, Invocation}; + use crate::module::DirOwnership; + +@@ -789,26 +797,16 @@ impl SyntaxExtension { + .unwrap_or_else(|| (None, helper_attrs)); + let (stability, const_stability, body_stability) = attr::find_stability(&sess, attrs, span); + if let Some((_, sp)) = const_stability { +- sess.parse_sess +- .span_diagnostic +- .struct_span_err(sp, "macros cannot have const stability attributes") +- .span_label(sp, "invalid const stability attribute") +- .span_label( +- sess.source_map().guess_head_span(span), +- "const stability attribute affects this macro", +- ) +- .emit(); ++ sess.emit_err(MacroConstStability { ++ span: sp, ++ head_span: sess.source_map().guess_head_span(span), ++ }); + } + if let Some((_, sp)) = body_stability { +- sess.parse_sess +- .span_diagnostic +- .struct_span_err(sp, "macros cannot have body stability attributes") +- .span_label(sp, "invalid body stability attribute") +- .span_label( +- sess.source_map().guess_head_span(span), +- "body stability attribute affects this macro", +- ) +- .emit(); ++ sess.emit_err(MacroBodyStability { ++ span: sp, ++ head_span: sess.source_map().guess_head_span(span), ++ }); + } + + SyntaxExtension { +@@ -1200,13 +1198,11 @@ pub fn resolve_path( + .expect("attempting to resolve a file path in an external file"), + FileName::DocTest(path, _) => path, + other => { +- return Err(parse_sess.span_diagnostic.struct_span_err( ++ return Err(ResolveRelativePath { + span, +- &format!( +- "cannot resolve relative path in non-file source `{}`", +- parse_sess.source_map().filename_for_diagnostics(&other) +- ), +- )); ++ path: parse_sess.source_map().filename_for_diagnostics(&other).to_string(), ++ } ++ .into_diagnostic(&parse_sess.span_diagnostic)); + } + }; + result.pop(); +@@ -1222,6 +1218,8 @@ pub fn resolve_path( + /// The returned bool indicates whether an applicable suggestion has already been + /// added to the diagnostic to avoid emitting multiple suggestions. `Err(None)` + /// indicates that an ast error was encountered. ++// FIXME(Nilstrieb) Make this function setup translatable ++#[allow(rustc::untranslatable_diagnostic)] + pub fn expr_to_spanned_string<'a>( + cx: &'a mut ExtCtxt<'_>, + expr: P, +@@ -1280,9 +1278,9 @@ pub fn expr_to_string( + /// compilation should call + /// `cx.parse_sess.span_diagnostic.abort_if_errors()` (this should be + /// done as rarely as possible). +-pub fn check_zero_tts(cx: &ExtCtxt<'_>, sp: Span, tts: TokenStream, name: &str) { ++pub fn check_zero_tts(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream, name: &str) { + if !tts.is_empty() { +- cx.span_err(sp, &format!("{} takes no arguments", name)); ++ cx.emit_err(TakesNoArguments { span, name }); + } + } + +@@ -1304,31 +1302,27 @@ pub fn parse_expr(p: &mut parser::Parser<'_>) -> Option> { + /// expect exactly one string literal, or emit an error and return `None`. + pub fn get_single_str_from_tts( + cx: &mut ExtCtxt<'_>, +- sp: Span, ++ span: Span, + tts: TokenStream, + name: &str, + ) -> Option { + let mut p = cx.new_parser_from_tts(tts); + if p.token == token::Eof { +- cx.span_err(sp, &format!("{} takes 1 argument", name)); ++ cx.emit_err(OnlyOneArgument { span, name }); + return None; + } + let ret = parse_expr(&mut p)?; + let _ = p.eat(&token::Comma); + + if p.token != token::Eof { +- cx.span_err(sp, &format!("{} takes 1 argument", name)); ++ cx.emit_err(OnlyOneArgument { span, name }); + } + expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| s) + } + + /// Extracts comma-separated expressions from `tts`. + /// On error, emit it, and return `None`. +-pub fn get_exprs_from_tts( +- cx: &mut ExtCtxt<'_>, +- sp: Span, +- tts: TokenStream, +-) -> Option>> { ++pub fn get_exprs_from_tts(cx: &mut ExtCtxt<'_>, tts: TokenStream) -> Option>> { + let mut p = cx.new_parser_from_tts(tts); + let mut es = Vec::new(); + while p.token != token::Eof { +@@ -1343,7 +1337,7 @@ pub fn get_exprs_from_tts( + continue; + } + if p.token != token::Eof { +- cx.span_err(sp, "expected token: `,`"); ++ cx.emit_err(ExpectedCommaInList { span: p.token.span }); + return None; + } + } +@@ -1353,64 +1347,58 @@ pub fn get_exprs_from_tts( + pub fn parse_macro_name_and_helper_attrs( + diag: &rustc_errors::Handler, + attr: &Attribute, +- descr: &str, ++ macro_type: &str, + ) -> Option<(Symbol, Vec)> { + // Once we've located the `#[proc_macro_derive]` attribute, verify + // that it's of the form `#[proc_macro_derive(Foo)]` or + // `#[proc_macro_derive(Foo, attributes(A, ..))]` + let list = attr.meta_item_list()?; + if list.len() != 1 && list.len() != 2 { +- diag.span_err(attr.span, "attribute must have either one or two arguments"); ++ diag.emit_err(AttrNoArguments { span: attr.span }); + return None; + } + let Some(trait_attr) = list[0].meta_item() else { +- diag.span_err(list[0].span(), "not a meta item"); ++ diag.emit_err(NotAMetaItem {span: list[0].span()}); + return None; + }; + let trait_ident = match trait_attr.ident() { + Some(trait_ident) if trait_attr.is_word() => trait_ident, + _ => { +- diag.span_err(trait_attr.span, "must only be one word"); ++ diag.emit_err(OnlyOneWord { span: trait_attr.span }); + return None; + } + }; + + if !trait_ident.name.can_be_raw() { +- diag.span_err( +- trait_attr.span, +- &format!("`{}` cannot be a name of {} macro", trait_ident, descr), +- ); ++ diag.emit_err(CannotBeNameOfMacro { span: trait_attr.span, trait_ident, macro_type }); + } + + let attributes_attr = list.get(1); + let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr { + if !attr.has_name(sym::attributes) { +- diag.span_err(attr.span(), "second argument must be `attributes`"); ++ diag.emit_err(ArgumentNotAttributes { span: attr.span() }); + } + attr.meta_item_list() + .unwrap_or_else(|| { +- diag.span_err(attr.span(), "attribute must be of form: `attributes(foo, bar)`"); ++ diag.emit_err(AttributesWrongForm { span: attr.span() }); + &[] + }) + .iter() + .filter_map(|attr| { + let Some(attr) = attr.meta_item() else { +- diag.span_err(attr.span(), "not a meta item"); ++ diag.emit_err(AttributeMetaItem { span: attr.span() }); + return None; + }; + + let ident = match attr.ident() { + Some(ident) if attr.is_word() => ident, + _ => { +- diag.span_err(attr.span, "must only be one word"); ++ diag.emit_err(AttributeSingleWord { span: attr.span }); + return None; + } + }; + if !ident.name.can_be_raw() { +- diag.span_err( +- attr.span, +- &format!("`{}` cannot be a name of derive helper attribute", ident), +- ); ++ diag.emit_err(HelperAttributeNameInvalid { span: attr.span, name: ident }); + } + + Some(ident.name) +diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs +index 2510795c2e3ed..f4c6f3386ade2 100644 +--- a/compiler/rustc_expand/src/config.rs ++++ b/compiler/rustc_expand/src/config.rs +@@ -1,5 +1,9 @@ + //! Conditional compilation stripping. + ++use crate::errors::{ ++ FeatureIncludedInEdition, FeatureNotAllowed, FeatureRemoved, FeatureRemovedReason, InvalidCfg, ++ MalformedFeatureAttribute, MalformedFeatureAttributeHelp, RemoveExprNotSupported, ++}; + use rustc_ast::ptr::P; + use rustc_ast::token::{Delimiter, Token, TokenKind}; + use rustc_ast::tokenstream::{AttrTokenStream, AttrTokenTree}; +@@ -10,7 +14,6 @@ use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem + use rustc_attr as attr; + use rustc_data_structures::fx::FxHashMap; + use rustc_data_structures::map_in_place::MapInPlace; +-use rustc_errors::{error_code, struct_span_err, Applicability, Handler}; + use rustc_feature::{Feature, Features, State as FeatureState}; + use rustc_feature::{ + ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES, +@@ -33,18 +36,12 @@ pub struct StripUnconfigured<'a> { + pub lint_node_id: NodeId, + } + +-fn get_features( +- sess: &Session, +- span_handler: &Handler, +- krate_attrs: &[ast::Attribute], +-) -> Features { +- fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { +- let mut err = struct_span_err!(span_handler, span, E0557, "feature has been removed"); +- err.span_label(span, "feature has been removed"); +- if let Some(reason) = reason { +- err.note(reason); +- } +- err.emit(); ++fn get_features(sess: &Session, krate_attrs: &[ast::Attribute]) -> Features { ++ fn feature_removed(sess: &Session, span: Span, reason: Option<&str>) { ++ sess.emit_err(FeatureRemoved { ++ span, ++ reason: reason.map(|reason| FeatureRemovedReason { reason }), ++ }); + } + + fn active_features_up_to(edition: Edition) -> impl Iterator { +@@ -117,34 +114,34 @@ fn get_features( + continue; + }; + +- let bad_input = |span| { +- struct_span_err!(span_handler, span, E0556, "malformed `feature` attribute input") +- }; +- + for mi in list { + let name = match mi.ident() { + Some(ident) if mi.is_word() => ident.name, + Some(ident) => { +- bad_input(mi.span()) +- .span_suggestion( +- mi.span(), +- "expected just one word", +- ident.name, +- Applicability::MaybeIncorrect, +- ) +- .emit(); ++ sess.emit_err(MalformedFeatureAttribute { ++ span: mi.span(), ++ help: MalformedFeatureAttributeHelp::Suggestion { ++ span: mi.span(), ++ suggestion: ident.name, ++ }, ++ }); + continue; + } + None => { +- bad_input(mi.span()).span_label(mi.span(), "expected just one word").emit(); ++ sess.emit_err(MalformedFeatureAttribute { ++ span: mi.span(), ++ help: MalformedFeatureAttributeHelp::Label { span: mi.span() }, ++ }); + continue; + } + }; + +- if let Some(edition) = edition_enabled_features.get(&name) { +- let msg = +- &format!("the feature `{}` is included in the Rust {} edition", name, edition); +- span_handler.struct_span_warn_with_code(mi.span(), msg, error_code!(E0705)).emit(); ++ if let Some(&edition) = edition_enabled_features.get(&name) { ++ sess.emit_warning(FeatureIncludedInEdition { ++ span: mi.span(), ++ feature: name, ++ edition, ++ }); + continue; + } + +@@ -159,7 +156,7 @@ fn get_features( + if let FeatureState::Removed { reason } | FeatureState::Stabilized { reason } = + state + { +- feature_removed(span_handler, mi.span(), *reason); ++ feature_removed(sess, mi.span(), *reason); + continue; + } + } +@@ -173,14 +170,7 @@ fn get_features( + + if let Some(allowed) = sess.opts.unstable_opts.allow_features.as_ref() { + if allowed.iter().all(|f| name.as_str() != f) { +- struct_span_err!( +- span_handler, +- mi.span(), +- E0725, +- "the feature `{}` is not in the list of allowed features", +- name +- ) +- .emit(); ++ sess.emit_err(FeatureNotAllowed { span: mi.span(), name }); + continue; + } + } +@@ -221,7 +211,7 @@ pub fn features( + } + Some(attrs) => { + krate.attrs = attrs; +- let features = get_features(sess, diag, &krate.attrs); ++ let features = get_features(sess, &krate.attrs); + if err_count == diag.err_count() { + // Avoid reconfiguring malformed `cfg_attr`s. + strip_unconfigured.features = Some(&features); +@@ -503,8 +493,7 @@ impl<'a> StripUnconfigured<'a> { + // N.B., this is intentionally not part of the visit_expr() function + // in order for filter_map_expr() to be able to avoid this check + if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(*a)) { +- let msg = "removing an expression is not supported in this position"; +- self.sess.parse_sess.span_diagnostic.span_err(attr.span, msg); ++ self.sess.emit_err(RemoveExprNotSupported { span: attr.span }); + } + + self.process_cfg_attrs(expr); +@@ -513,27 +502,26 @@ impl<'a> StripUnconfigured<'a> { + } + + pub fn parse_cfg<'a>(meta_item: &'a MetaItem, sess: &Session) -> Option<&'a MetaItem> { +- let error = |span, msg, suggestion: &str| { +- let mut err = sess.parse_sess.span_diagnostic.struct_span_err(span, msg); +- if !suggestion.is_empty() { +- err.span_suggestion( +- span, +- "expected syntax is", +- suggestion, +- Applicability::HasPlaceholders, +- ); +- } +- err.emit(); +- None +- }; + let span = meta_item.span; + match meta_item.meta_item_list() { +- None => error(span, "`cfg` is not followed by parentheses", "cfg(/* predicate */)"), +- Some([]) => error(span, "`cfg` predicate is not specified", ""), +- Some([_, .., l]) => error(l.span(), "multiple `cfg` predicates are specified", ""), ++ None => { ++ sess.emit_err(InvalidCfg::NotFollowedByParens { span }); ++ None ++ } ++ Some([]) => { ++ sess.emit_err(InvalidCfg::NoPredicate { span }); ++ None ++ } ++ Some([_, .., l]) => { ++ sess.emit_err(InvalidCfg::MultiplePredicates { span: l.span() }); ++ None ++ } + Some([single]) => match single.meta_item() { + Some(meta_item) => Some(meta_item), +- None => error(single.span(), "`cfg` predicate key cannot be a literal", ""), ++ None => { ++ sess.emit_err(InvalidCfg::PredicateLiteral { span: single.span() }); ++ None ++ } + }, + } + } +diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs +index d383f4832f699..afe5169d3f5c0 100644 +--- a/compiler/rustc_expand/src/errors.rs ++++ b/compiler/rustc_expand/src/errors.rs +@@ -1,6 +1,10 @@ ++use rustc_ast::ast; + use rustc_macros::Diagnostic; +-use rustc_span::symbol::MacroRulesNormalizedIdent; +-use rustc_span::Span; ++use rustc_session::Limit; ++use rustc_span::edition::Edition; ++use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent}; ++use rustc_span::{Span, Symbol}; ++use std::borrow::Cow; + + #[derive(Diagnostic)] + #[diag(expand_expr_repeat_no_syntax_vars)] +@@ -46,3 +50,321 @@ pub(crate) struct MetaVarsDifSeqMatchers { + pub span: Span, + pub msg: String, + } ++ ++#[derive(Diagnostic)] ++#[diag(expand_resolve_relative_path)] ++pub(crate) struct ResolveRelativePath { ++ #[primary_span] ++ pub span: Span, ++ pub path: String, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_macro_const_stability)] ++pub(crate) struct MacroConstStability { ++ #[primary_span] ++ #[label] ++ pub span: Span, ++ #[label(label2)] ++ pub head_span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_macro_body_stability)] ++pub(crate) struct MacroBodyStability { ++ #[primary_span] ++ #[label] ++ pub span: Span, ++ #[label(label2)] ++ pub head_span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_attr_no_arguments)] ++pub(crate) struct AttrNoArguments { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_not_a_meta_item)] ++pub(crate) struct NotAMetaItem { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_only_one_word)] ++pub(crate) struct OnlyOneWord { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_cannot_be_name_of_macro)] ++pub(crate) struct CannotBeNameOfMacro<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub trait_ident: Ident, ++ pub macro_type: &'a str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_arg_not_attributes)] ++pub(crate) struct ArgumentNotAttributes { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_attributes_wrong_form)] ++pub(crate) struct AttributesWrongForm { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_attribute_meta_item)] ++pub(crate) struct AttributeMetaItem { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_attribute_single_word)] ++pub(crate) struct AttributeSingleWord { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_helper_attribute_name_invalid)] ++pub(crate) struct HelperAttributeNameInvalid { ++ #[primary_span] ++ pub span: Span, ++ pub name: Ident, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_expected_comma_in_list)] ++pub(crate) struct ExpectedCommaInList { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_only_one_argument)] ++pub(crate) struct OnlyOneArgument<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub name: &'a str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_takes_no_arguments)] ++pub(crate) struct TakesNoArguments<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub name: &'a str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_feature_included_in_edition, code = "E0705")] ++pub(crate) struct FeatureIncludedInEdition { ++ #[primary_span] ++ pub span: Span, ++ pub feature: Symbol, ++ pub edition: Edition, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_feature_removed, code = "E0557")] ++pub(crate) struct FeatureRemoved<'a> { ++ #[primary_span] ++ #[label] ++ pub span: Span, ++ #[subdiagnostic] ++ pub reason: Option>, ++} ++ ++#[derive(Subdiagnostic)] ++#[note(reason)] ++pub(crate) struct FeatureRemovedReason<'a> { ++ pub reason: &'a str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_feature_not_allowed, code = "E0725")] ++pub(crate) struct FeatureNotAllowed { ++ #[primary_span] ++ pub span: Span, ++ pub name: Symbol, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_recursion_limit_reached)] ++#[help] ++pub(crate) struct RecursionLimitReached<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub descr: String, ++ pub suggested_limit: Limit, ++ pub crate_name: &'a str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_malformed_feature_attribute, code = "E0556")] ++pub(crate) struct MalformedFeatureAttribute { ++ #[primary_span] ++ pub span: Span, ++ #[subdiagnostic] ++ pub help: MalformedFeatureAttributeHelp, ++} ++ ++#[derive(Subdiagnostic)] ++pub(crate) enum MalformedFeatureAttributeHelp { ++ #[label(expected)] ++ Label { ++ #[primary_span] ++ span: Span, ++ }, ++ #[suggestion(expected, code = "{suggestion}", applicability = "maybe-incorrect")] ++ Suggestion { ++ #[primary_span] ++ span: Span, ++ suggestion: Symbol, ++ }, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_remove_expr_not_supported)] ++pub(crate) struct RemoveExprNotSupported { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++pub(crate) enum InvalidCfg { ++ #[diag(expand_invalid_cfg_no_parens)] ++ NotFollowedByParens { ++ #[primary_span] ++ #[suggestion( ++ expand_invalid_cfg_expected_syntax, ++ code = "cfg(/* predicate */)", ++ applicability = "has-placeholders" ++ )] ++ span: Span, ++ }, ++ #[diag(expand_invalid_cfg_no_predicate)] ++ NoPredicate { ++ #[primary_span] ++ #[suggestion( ++ expand_invalid_cfg_expected_syntax, ++ code = "cfg(/* predicate */)", ++ applicability = "has-placeholders" ++ )] ++ span: Span, ++ }, ++ #[diag(expand_invalid_cfg_multiple_predicates)] ++ MultiplePredicates { ++ #[primary_span] ++ span: Span, ++ }, ++ #[diag(expand_invalid_cfg_predicate_literal)] ++ PredicateLiteral { ++ #[primary_span] ++ span: Span, ++ }, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_wrong_fragment_kind)] ++pub(crate) struct WrongFragmentKind<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub kind: &'a str, ++ pub name: &'a ast::Path, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_unsupported_key_value)] ++pub(crate) struct UnsupportedKeyValue { ++ #[primary_span] ++ pub span: Span, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_incomplete_parse)] ++#[note] ++pub(crate) struct IncompleteParse<'a> { ++ #[primary_span] ++ pub span: Span, ++ pub token: Cow<'a, str>, ++ #[label] ++ pub label_span: Span, ++ pub macro_path: &'a ast::Path, ++ pub kind_name: &'a str, ++ ++ #[suggestion( ++ suggestion_add_semi, ++ style = "verbose", ++ code = ";", ++ applicability = "maybe-incorrect" ++ )] ++ pub add_semicolon: Option, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_remove_node_not_supported)] ++pub(crate) struct RemoveNodeNotSupported { ++ #[primary_span] ++ pub span: Span, ++ pub descr: &'static str, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_module_circular)] ++pub(crate) struct ModuleCircular { ++ #[primary_span] ++ pub span: Span, ++ pub modules: String, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_module_in_block)] ++pub(crate) struct ModuleInBlock { ++ #[primary_span] ++ pub span: Span, ++ #[subdiagnostic] ++ pub name: Option, ++} ++ ++#[derive(Subdiagnostic)] ++#[note(note)] ++pub(crate) struct ModuleInBlockName { ++ #[primary_span] ++ pub span: Span, ++ pub name: Ident, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_module_file_not_found, code = "E0583")] ++#[help] ++pub(crate) struct ModuleFileNotFound { ++ #[primary_span] ++ pub span: Span, ++ pub name: Ident, ++ pub default_path: String, ++ pub secondary_path: String, ++} ++ ++#[derive(Diagnostic)] ++#[diag(expand_module_multiple_candidates, code = "E0761")] ++#[help] ++pub(crate) struct ModuleMultipleCandidates { ++ #[primary_span] ++ pub span: Span, ++ pub name: Ident, ++ pub default_path: String, ++ pub secondary_path: String, ++} +diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs +index 1014ec2209c61..e26c16dcd7ee7 100644 +--- a/compiler/rustc_expand/src/expand.rs ++++ b/compiler/rustc_expand/src/expand.rs +@@ -1,5 +1,9 @@ + use crate::base::*; + use crate::config::StripUnconfigured; ++use crate::errors::{ ++ IncompleteParse, RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, ++ UnsupportedKeyValue, WrongFragmentKind, ++}; + use crate::hygiene::SyntaxContext; + use crate::mbe::diagnostics::annotate_err_with_kind; + use crate::module::{mod_dir_path, parse_external_mod, DirOwnership, ParsedExternalMod}; +@@ -18,7 +22,7 @@ use rustc_ast::{NestedMetaItem, NodeId, PatKind, StmtKind, TyKind}; + use rustc_ast_pretty::pprust; + use rustc_data_structures::map_in_place::MapInPlace; + use rustc_data_structures::sync::Lrc; +-use rustc_errors::{Applicability, PResult}; ++use rustc_errors::PResult; + use rustc_feature::Features; + use rustc_parse::parser::{ + AttemptLocalParseRecovery, CommaRecoveryMode, ForceCollect, Parser, RecoverColon, RecoverComma, +@@ -606,29 +610,22 @@ impl<'a, 'b> MacroExpander<'a, 'b> { + Limit(0) => Limit(2), + limit => limit * 2, + }; +- self.cx +- .struct_span_err( +- expn_data.call_site, +- &format!("recursion limit reached while expanding `{}`", expn_data.kind.descr()), +- ) +- .help(&format!( +- "consider increasing the recursion limit by adding a \ +- `#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)", +- suggested_limit, self.cx.ecfg.crate_name, +- )) +- .emit(); ++ ++ self.cx.emit_err(RecursionLimitReached { ++ span: expn_data.call_site, ++ descr: expn_data.kind.descr(), ++ suggested_limit, ++ crate_name: &self.cx.ecfg.crate_name, ++ }); ++ + self.cx.trace_macros_diag(); + } + + /// A macro's expansion does not fit in this fragment kind. + /// For example, a non-type macro in a type position. + fn error_wrong_fragment_kind(&mut self, kind: AstFragmentKind, mac: &ast::MacCall, span: Span) { +- let msg = format!( +- "non-{kind} macro in {kind} position: {path}", +- kind = kind.name(), +- path = pprust::path_to_string(&mac.path), +- ); +- self.cx.span_err(span, &msg); ++ self.cx.emit_err(WrongFragmentKind { span, kind: kind.name(), name: &mac.path }); ++ + self.cx.trace_macros_diag(); + } + +@@ -707,7 +704,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { + }; + let attr_item = attr.unwrap_normal_item(); + if let AttrArgs::Eq(..) = attr_item.args { +- self.cx.span_err(span, "key-value macro attributes are not supported"); ++ self.cx.emit_err(UnsupportedKeyValue { span }); + } + let inner_tokens = attr_item.args.inner_tokens(); + let Ok(tok_result) = expander.expand(self.cx, span, inner_tokens, tokens) else { +@@ -729,9 +726,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { + } + }; + if fragment_kind == AstFragmentKind::Expr && items.is_empty() { +- let msg = +- "removing an expression is not supported in this position"; +- self.cx.span_err(span, msg); ++ self.cx.emit_err(RemoveExprNotSupported { span }); + fragment_kind.dummy(span) + } else { + fragment_kind.expect_from_annotatables(items) +@@ -939,38 +934,32 @@ pub fn parse_ast_fragment<'a>( + } + + pub fn ensure_complete_parse<'a>( +- this: &mut Parser<'a>, ++ parser: &mut Parser<'a>, + macro_path: &ast::Path, + kind_name: &str, + span: Span, + ) { +- if this.token != token::Eof { +- let token = pprust::token_to_string(&this.token); +- let msg = format!("macro expansion ignores token `{}` and any following", token); ++ if parser.token != token::Eof { ++ let token = pprust::token_to_string(&parser.token); + // Avoid emitting backtrace info twice. +- let def_site_span = this.token.span.with_ctxt(SyntaxContext::root()); +- let mut err = this.struct_span_err(def_site_span, &msg); +- err.span_label(span, "caused by the macro expansion here"); +- let msg = format!( +- "the usage of `{}!` is likely invalid in {} context", +- pprust::path_to_string(macro_path), +- kind_name, +- ); +- err.note(&msg); ++ let def_site_span = parser.token.span.with_ctxt(SyntaxContext::root()); + +- let semi_span = this.sess.source_map().next_point(span); +- match this.sess.source_map().span_to_snippet(semi_span) { ++ let semi_span = parser.sess.source_map().next_point(span); ++ let add_semicolon = match parser.sess.source_map().span_to_snippet(semi_span) { + Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => { +- err.span_suggestion( +- span.shrink_to_hi(), +- "you might be missing a semicolon here", +- ";", +- Applicability::MaybeIncorrect, +- ); ++ Some(span.shrink_to_hi()) + } +- _ => {} +- } +- err.emit(); ++ _ => None, ++ }; ++ ++ parser.sess.emit_err(IncompleteParse { ++ span: def_site_span, ++ token, ++ label_span: span, ++ macro_path, ++ kind_name, ++ add_semicolon, ++ }); + } + } + +@@ -1766,9 +1755,8 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { + if self.expand_cfg_true(node, attr, pos) { + continue; + } +- let msg = +- format!("removing {} is not supported in this position", Node::descr()); +- self.cx.span_err(span, &msg); ++ ++ self.cx.emit_err(RemoveNodeNotSupported { span, descr: Node::descr() }); + continue; + } + sym::cfg_attr => { +diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs +index b34de94fb7db4..897268566358a 100644 +--- a/compiler/rustc_expand/src/lib.rs ++++ b/compiler/rustc_expand/src/lib.rs +@@ -10,6 +10,7 @@ + #![feature(rustc_attrs)] + #![feature(try_blocks)] + #![recursion_limit = "256"] ++#![deny(rustc::untranslatable_diagnostic)] + + #[macro_use] + extern crate rustc_macros; +@@ -31,8 +32,13 @@ pub mod config; + pub mod errors; + pub mod expand; + pub mod module; ++ ++// FIXME(Nilstrieb) Translate proc_macro diagnostics ++#[allow(rustc::untranslatable_diagnostic)] + pub mod proc_macro; + ++// FIXME(Nilstrieb) Translate macro_rules diagnostics ++#[allow(rustc::untranslatable_diagnostic)] + pub(crate) mod mbe; + + // HACK(Centril, #64197): These shouldn't really be here. +diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs +index 9002a24e42f9d..07f47a9c3a4f2 100644 +--- a/compiler/rustc_expand/src/module.rs ++++ b/compiler/rustc_expand/src/module.rs +@@ -1,13 +1,17 @@ + use crate::base::ModuleData; ++use crate::errors::{ ++ ModuleCircular, ModuleFileNotFound, ModuleInBlock, ModuleInBlockName, ModuleMultipleCandidates, ++}; + use rustc_ast::ptr::P; + use rustc_ast::{token, AttrVec, Attribute, Inline, Item, ModSpans}; +-use rustc_errors::{struct_span_err, DiagnosticBuilder, ErrorGuaranteed}; ++use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed}; + use rustc_parse::new_parser_from_file; + use rustc_parse::validate_attr; + use rustc_session::parse::ParseSess; + use rustc_session::Session; + use rustc_span::symbol::{sym, Ident}; + use rustc_span::Span; ++use std::iter::once; + + use std::path::{self, Path, PathBuf}; + +@@ -242,57 +246,41 @@ pub fn default_submod_path<'a>( + + impl ModError<'_> { + fn report(self, sess: &Session, span: Span) -> ErrorGuaranteed { +- let diag = &sess.parse_sess.span_diagnostic; + match self { + ModError::CircularInclusion(file_paths) => { +- let mut msg = String::from("circular modules: "); +- for file_path in &file_paths { +- msg.push_str(&file_path.display().to_string()); +- msg.push_str(" -> "); +- } +- msg.push_str(&file_paths[0].display().to_string()); +- diag.struct_span_err(span, &msg) +- } +- ModError::ModInBlock(ident) => { +- let msg = "cannot declare a non-inline module inside a block unless it has a path attribute"; +- let mut err = diag.struct_span_err(span, msg); +- if let Some(ident) = ident { +- let note = +- format!("maybe `use` the module `{}` instead of redeclaring it", ident); +- err.span_note(span, ¬e); +- } +- err ++ let path_to_string = |path: &PathBuf| path.display().to_string(); ++ ++ let paths = file_paths ++ .iter() ++ .map(path_to_string) ++ .chain(once(path_to_string(&file_paths[0]))) ++ .collect::>(); ++ ++ let modules = paths.join(" -> "); ++ ++ sess.emit_err(ModuleCircular { span, modules }) + } +- ModError::FileNotFound(ident, default_path, secondary_path) => { +- let mut err = struct_span_err!( +- diag, ++ ModError::ModInBlock(ident) => sess.emit_err(ModuleInBlock { ++ span, ++ name: ident.map(|name| ModuleInBlockName { span, name }), ++ }), ++ ModError::FileNotFound(name, default_path, secondary_path) => { ++ sess.emit_err(ModuleFileNotFound { + span, +- E0583, +- "file not found for module `{}`", +- ident, +- ); +- err.help(&format!( +- "to create the module `{}`, create file \"{}\" or \"{}\"", +- ident, +- default_path.display(), +- secondary_path.display(), +- )); +- err ++ name, ++ default_path: default_path.display().to_string(), ++ secondary_path: secondary_path.display().to_string(), ++ }) + } +- ModError::MultipleCandidates(ident, default_path, secondary_path) => { +- let mut err = struct_span_err!( +- diag, ++ ModError::MultipleCandidates(name, default_path, secondary_path) => { ++ sess.emit_err(ModuleMultipleCandidates { + span, +- E0761, +- "file for module `{}` found at both \"{}\" and \"{}\"", +- ident, +- default_path.display(), +- secondary_path.display(), +- ); +- err.help("delete or rename one of them to remove the ambiguity"); +- err ++ name, ++ default_path: default_path.display().to_string(), ++ secondary_path: secondary_path.display().to_string(), ++ }) + } +- ModError::ParserError(err) => err, +- }.emit() ++ ModError::ParserError(mut err) => err.emit(), ++ } + } + } +diff --git a/compiler/rustc_expand/src/tests.rs b/compiler/rustc_expand/src/tests.rs +index 539b04535a0d0..8f3bea29ffd28 100644 +--- a/compiler/rustc_expand/src/tests.rs ++++ b/compiler/rustc_expand/src/tests.rs +@@ -154,6 +154,7 @@ fn test_harness(file_text: &str, span_labels: Vec, expected_output: & + false, + ); + let handler = Handler::with_emitter(true, None, Box::new(emitter)); ++ #[allow(rustc::untranslatable_diagnostic)] + handler.span_err(msp, "foo"); + + assert!( +diff --git a/src/test/rustdoc-ui/doc-cfg.stderr b/src/test/rustdoc-ui/doc-cfg.stderr +index b379f6febe29f..14b7b17e04d3a 100644 +--- a/src/test/rustdoc-ui/doc-cfg.stderr ++++ b/src/test/rustdoc-ui/doc-cfg.stderr +@@ -2,7 +2,7 @@ error: `cfg` predicate is not specified + --> $DIR/doc-cfg.rs:3:7 + | + LL | #[doc(cfg(), cfg(foo, bar))] +- | ^^^^^ ++ | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` + + error: multiple `cfg` predicates are specified + --> $DIR/doc-cfg.rs:3:23 +@@ -14,7 +14,7 @@ error: `cfg` predicate is not specified + --> $DIR/doc-cfg.rs:7:7 + | + LL | #[doc(cfg())] +- | ^^^^^ ++ | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` + + error: multiple `cfg` predicates are specified + --> $DIR/doc-cfg.rs:8:16 +diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +index d4bd673b84e1b..d5b4349c00f6f 100644 +--- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr ++++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +@@ -14,7 +14,7 @@ error: `cfg` predicate is not specified + --> $DIR/cfg-attr-syntax-validation.rs:7:1 + | + LL | #[cfg()] +- | ^^^^^^^^ ++ | ^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + + error: multiple `cfg` predicates are specified + --> $DIR/cfg-attr-syntax-validation.rs:10:10 +diff --git a/src/test/ui/macros/macro-in-expression-context.stderr b/src/test/ui/macros/macro-in-expression-context.stderr +index 1023189eaa30f..36aba8aa08a0b 100644 +--- a/src/test/ui/macros/macro-in-expression-context.stderr ++++ b/src/test/ui/macros/macro-in-expression-context.stderr +@@ -5,11 +5,13 @@ LL | assert_eq!("B", "B"); + | ^^^^^^^^^ + ... + LL | foo!() +- | ------- help: you might be missing a semicolon here: `;` +- | | +- | caused by the macro expansion here ++ | ------ caused by the macro expansion here + | + = note: the usage of `foo!` is likely invalid in expression context ++help: you might be missing a semicolon here ++ | ++LL | foo!(); ++ | + + + warning: trailing semicolon in macro used in expression position + --> $DIR/macro-in-expression-context.rs:5:29 +diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.stderr b/src/test/ui/proc-macro/attr-invalid-exprs.stderr +index bcb54df0ecac7..f96939bb6efce 100644 +--- a/src/test/ui/proc-macro/attr-invalid-exprs.stderr ++++ b/src/test/ui/proc-macro/attr-invalid-exprs.stderr +@@ -8,21 +8,25 @@ error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:15:13 + | + LL | let _ = #[duplicate] "Hello, world!"; +- | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` +- | | +- | caused by the macro expansion here ++ | ^^^^^^^^^^^^ caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context ++help: you might be missing a semicolon here ++ | ++LL | let _ = #[duplicate]; "Hello, world!"; ++ | + + + error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:24:9 + | + LL | #[duplicate] +- | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` +- | | +- | caused by the macro expansion here ++ | ^^^^^^^^^^^^ caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context ++help: you might be missing a semicolon here ++ | ++LL | #[duplicate]; ++ | + + + error: aborting due to 3 previous errors + +diff --git a/src/test/ui/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs +index 5531b32362125..9e40e4d9ba63e 100644 +--- a/src/test/ui/proc-macro/attribute.rs ++++ b/src/test/ui/proc-macro/attribute.rs +@@ -53,19 +53,19 @@ pub fn foo11(input: TokenStream) -> TokenStream { input } + pub fn foo12(input: TokenStream) -> TokenStream { input } + + #[proc_macro_derive(d13, attributes("a"))] +-//~^ ERROR: not a meta item ++//~^ ERROR: attribute must be a meta item, not a literal + pub fn foo13(input: TokenStream) -> TokenStream { input } + + #[proc_macro_derive(d14, attributes(a = ""))] +-//~^ ERROR: must only be one word ++//~^ ERROR: attribute must only be a single word + pub fn foo14(input: TokenStream) -> TokenStream { input } + + #[proc_macro_derive(d15, attributes(m::a))] +-//~^ ERROR: must only be one word ++//~^ ERROR: attribute must only be a single word + pub fn foo15(input: TokenStream) -> TokenStream { input } + + #[proc_macro_derive(d16, attributes(a(b)))] +-//~^ ERROR: must only be one word ++//~^ ERROR: attribute must only be a single word + pub fn foo16(input: TokenStream) -> TokenStream { input } + + #[proc_macro_derive(d17, attributes(self))] +diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr +index 021e7cad09b69..3269aaf7f917e 100644 +--- a/src/test/ui/proc-macro/attribute.stderr ++++ b/src/test/ui/proc-macro/attribute.stderr +@@ -70,25 +70,25 @@ error: attribute must be of form: `attributes(foo, bar)` + LL | #[proc_macro_derive(d12, attributes)] + | ^^^^^^^^^^ + +-error: not a meta item ++error: attribute must be a meta item, not a literal + --> $DIR/attribute.rs:55:37 + | + LL | #[proc_macro_derive(d13, attributes("a"))] + | ^^^ + +-error: must only be one word ++error: attribute must only be a single word + --> $DIR/attribute.rs:59:37 + | + LL | #[proc_macro_derive(d14, attributes(a = ""))] + | ^^^^^^ + +-error: must only be one word ++error: attribute must only be a single word + --> $DIR/attribute.rs:63:37 + | + LL | #[proc_macro_derive(d15, attributes(m::a))] + | ^^^^ + +-error: must only be one word ++error: attribute must only be a single word + --> $DIR/attribute.rs:67:37 + | + LL | #[proc_macro_derive(d16, attributes(a(b)))] +diff --git a/src/test/ui/proc-macro/expand-expr.stderr b/src/test/ui/proc-macro/expand-expr.stderr +index c6c4695fd9c43..0004f2fe17f01 100644 +--- a/src/test/ui/proc-macro/expand-expr.stderr ++++ b/src/test/ui/proc-macro/expand-expr.stderr +@@ -26,21 +26,25 @@ error: macro expansion ignores token `hello` and any following + --> $DIR/expand-expr.rs:115:47 + | + LL | expand_expr_is!("string", echo_tts!("string"; hello)); +- | --------------------^^^^^-- help: you might be missing a semicolon here: `;` +- | | +- | caused by the macro expansion here ++ | --------------------^^^^^- caused by the macro expansion here + | + = note: the usage of `echo_tts!` is likely invalid in expression context ++help: you might be missing a semicolon here ++ | ++LL | expand_expr_is!("string", echo_tts!("string"; hello);); ++ | + + + error: macro expansion ignores token `;` and any following + --> $DIR/expand-expr.rs:116:44 + | + LL | expand_expr_is!("string", echo_pm!("string"; hello)); +- | -----------------^-------- help: you might be missing a semicolon here: `;` +- | | +- | caused by the macro expansion here ++ | -----------------^------- caused by the macro expansion here + | + = note: the usage of `echo_pm!` is likely invalid in expression context ++help: you might be missing a semicolon here ++ | ++LL | expand_expr_is!("string", echo_pm!("string"; hello);); ++ | + + + error: recursion limit reached while expanding `recursive_expand!` + --> $DIR/expand-expr.rs:124:16 diff --git a/dev-lang/rust/rust-1.67.1-r1.ebuild b/dev-lang/rust/rust-1.67.1-r1.ebuild new file mode 100644 index 000000000000..663f1323a4ef --- /dev/null +++ b/dev-lang/rust/rust-1.67.1-r1.ebuild @@ -0,0 +1,743 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..11} ) + +inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \ + multilib multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig + +if [[ ${PV} = *beta* ]]; then + betaver=${PV//*beta} + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" + MY_P="rustc-beta" + SLOT="beta/${PV}" + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" +else + ABI_VER="$(ver_cut 1-2)" + SLOT="stable/${ABI_VER}" + MY_P="rustc-${PV}" + SRC="${MY_P}-src.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1" + +DESCRIPTION="Systems programming language from Mozilla" +HOMEPAGE="https://www.rust-lang.org/" + +SRC_URI=" + https://static.rust-lang.org/dist/${SRC} + verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc ) + !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) +" + +# keep in sync with llvm ebuild of the same version as bundled one. +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?} + +LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4 UoI-NCSA" + +IUSE="clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind miri nightly parallel-compiler profiler rustfmt rust-analyzer rust-src system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" + +# Please keep the LLVM dependency block separate. Since LLVM is slotted, +# we need to *really* make sure we're not pulling more than one slot +# simultaneously. + +# How to use it: +# List all the working slots in LLVM_VALID_SLOTS, newest first. +LLVM_VALID_SLOTS=( 15 ) +LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}" + +# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation +# (-) usedep needed because we may build with older llvm without that target +LLVM_DEPEND="|| ( " +for _s in ${LLVM_VALID_SLOTS[@]}; do + LLVM_DEPEND+=" ( " + for _x in ${ALL_LLVM_TARGETS[@]}; do + LLVM_DEPEND+=" + ${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] ) + wasm? ( sys-devel/lld:${_s} )" + done + LLVM_DEPEND+=" )" +done +unset _s _x +LLVM_DEPEND+=" ) + /dev/null) ) + rustc_version=${rustc_version[0]#rust-bin-} + rustc_version=${rustc_version#rust-} + + [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" + + if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then + eerror "Rust >=${rustc_wanted} is required" + eerror "please run 'eselect rust' and set correct rust version" + die "selected rust version is too old" + elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then + eerror "Rust <${rustc_toonew} is required" + eerror "please run 'eselect rust' and set correct rust version" + die "selected rust version is too new" + else + einfo "Using rust ${rustc_version} to build" + fi +} + +pre_build_checks() { + local M=8192 + # multiply requirements by 1.3 if we are doing x86-multilib + if use amd64; then + M=$(( $(usex abi_x86_32 13 10) * ${M} / 10 )) + fi + M=$(( $(usex clippy 128 0) + ${M} )) + M=$(( $(usex miri 128 0) + ${M} )) + M=$(( $(usex rustfmt 256 0) + ${M} )) + # add 2G if we compile llvm and 256M per llvm_target + if ! use system-llvm; then + M=$(( 2048 + ${M} )) + local ltarget + for ltarget in ${ALL_LLVM_TARGETS[@]}; do + M=$(( $(usex ${ltarget} 256 0) + ${M} )) + done + fi + M=$(( $(usex wasm 256 0) + ${M} )) + M=$(( $(usex debug 2 1) * ${M} )) + eshopts_push -s extglob + if is-flagq '-g?(gdb)?([1-9])'; then + M=$(( 15 * ${M} / 10 )) + fi + eshopts_pop + M=$(( $(usex system-bootstrap 0 1024) + ${M} )) + M=$(( $(usex doc 256 0) + ${M} )) + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} +} + +llvm_check_deps() { + has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]" +} + +# Is LLVM being linked against libc++? +is_libcxx_linked() { + local code='#include +#if defined(_LIBCPP_VERSION) + HAVE_LIBCXX +#endif +' + local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 + [[ ${out} == *HAVE_LIBCXX* ]] +} + +pkg_pretend() { + pre_build_checks +} + +pkg_setup() { + pre_build_checks + python-any-r1_pkg_setup + + export LIBGIT2_NO_PKG_CONFIG=1 #749381 + + use system-bootstrap && bootstrap_rust_version_check + + if use system-llvm; then + llvm_pkg_setup + + local llvm_config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + export LLVM_LINK_SHARED=1 + export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" + fi +} + +esetup_unwind_hack() { + # https://bugs.gentoo.org/870280 + # this is a hack needed to bootstrap with libgcc_s linked tarball on llvm-libunwind system. + # it should trigger for internal bootstrap or system-bootstrap with rust-bin. + # the whole idea is for stage0 to bootstrap with fake libgcc_s. + # final stage will receive -L${T}/lib but not -lgcc_s args, producing clean compiler. + local fakelib="${T}/fakelib" + mkdir -p "${fakelib}" || die + # we need both symlinks, one for cargo runtime, other for linker. + ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so.1" || die + ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so" || die + export LD_LIBRARY_PATH="${fakelib}" + export RUSTFLAGS+=" -L${fakelib}" + # this is a literally magic variable that gets through cargo cache, without it some + # crates ignore RUSTFLAGS. + # this variable can not contain leading space. + export MAGIC_EXTRA_RUSTFLAGS+="${MAGIC_EXTRA_RUSTFLAGS:+ }-L${fakelib}" +} + +src_prepare() { + if ! use system-bootstrap; then + has_version sys-devel/gcc || esetup_unwind_hack + local rust_stage0_root="${WORKDIR}"/rust-stage0 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" + + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ + --without=rust-docs-json-preview,rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die + fi + + default +} + +src_configure() { + filter-flags '-flto*' # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231 + + local rust_target="" rust_targets="" arch_cflags + + # Collect rust target names to compile standard libs for all ABIs. + for v in $(multilib_get_enabled_abi_pairs); do + rust_targets+=",\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" + done + if use wasm; then + rust_targets+=",\"wasm32-unknown-unknown\"" + if use system-llvm; then + # un-hardcode rust-lld linker for this target + # https://bugs.gentoo.org/715348 + sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die + fi + fi + rust_targets="${rust_targets#,}" + + local tools='"cargo"' + use clippy && tools+=',"clippy"' + use miri && tools+=',"miri"' + use profiler && tools+=',"rust-demangler"' + use rustfmt && tools+=',"rustfmt"' + use rust-analyzer && tools+=',"rust-analyzer","analysis"' + use rust-src && tools+=',"src"' + + local rust_stage0_root + if use system-bootstrap; then + local printsysroot + printsysroot="$(rustc --print sysroot || die "Can't determine rust's sysroot")" + rust_stage0_root="${printsysroot}" + else + rust_stage0_root="${WORKDIR}"/rust-stage0 + fi + # in case of prefix it will be already prefixed, as --print sysroot returns full path + [[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory" + + rust_target="$(rust_abi)" + + local cm_btype="$(usex debug DEBUG RELEASE)" + cat <<- _EOF_ > "${S}"/config.toml + changelog-seen = 2 + [llvm] + download-ci-llvm = false + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + ninja = true + targets = "${LLVM_TARGETS// /;}" + experimental-targets = "" + link-shared = $(toml_usex system-llvm) + $(if is_libcxx_linked; then + # https://bugs.gentoo.org/732632 + echo "use-libcxx = true" + echo "static-libstdcpp = false" + fi) + $(case "${rust_target}" in + i586-*-linux-*) + # https://github.com/rust-lang/rust/issues/93059 + echo 'cflags = "-fcf-protection=none"' + echo 'cxxflags = "-fcf-protection=none"' + echo 'ldflags = "-fcf-protection=none"' + ;; + *) + ;; + esac) + [llvm.build-config] + CMAKE_VERBOSE_MAKEFILE = "ON" + CMAKE_C_FLAGS_${cm_btype} = "${CFLAGS}" + CMAKE_CXX_FLAGS_${cm_btype} = "${CXXFLAGS}" + CMAKE_EXE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" + CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" + CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" + CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = "${ARFLAGS}" + [build] + build-stage = 2 + test-stage = 2 + build = "${rust_target}" + host = ["${rust_target}"] + target = [${rust_targets}] + cargo = "${rust_stage0_root}/bin/cargo" + rustc = "${rust_stage0_root}/bin/rustc" + rustfmt = "${rust_stage0_root}/bin/rustfmt" + docs = $(toml_usex doc) + compiler-docs = false + submodules = false + python = "${EPYTHON}" + locked-deps = true + vendor = true + extended = true + tools = [${tools}] + verbose = 2 + sanitizers = false + profiler = $(toml_usex profiler) + cargo-native-static = false + [install] + prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" + sysconfdir = "etc" + docdir = "share/doc/rust" + bindir = "bin" + libdir = "lib" + mandir = "share/man" + [rust] + # https://github.com/rust-lang/rust/issues/54872 + codegen-units-std = 1 + optimize = true + debug = $(toml_usex debug) + debug-assertions = $(toml_usex debug) + debug-assertions-std = $(toml_usex debug) + debuginfo-level = $(usex debug 2 0) + debuginfo-level-rustc = $(usex debug 2 0) + debuginfo-level-std = $(usex debug 2 0) + debuginfo-level-tools = $(usex debug 2 0) + debuginfo-level-tests = 0 + backtrace = true + incremental = false + default-linker = "$(tc-getCC)" + parallel-compiler = $(toml_usex parallel-compiler) + channel = "$(usex nightly nightly stable)" + description = "gentoo" + rpath = false + verbose-tests = true + optimize-tests = $(toml_usex !debug) + codegen-tests = true + dist-src = false + remap-debuginfo = true + lld = $(usex system-llvm false $(toml_usex wasm)) + # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it + # https://github.com/rust-lang/rust/issues/74976 + # https://github.com/rust-lang/rust/issues/76526 + deny-warnings = $(usex wasm $(usex doc false true) true) + backtrace-on-ice = true + jemalloc = false + [dist] + src-tarball = false + compression-formats = ["xz"] + _EOF_ + + for v in $(multilib_get_enabled_abi_pairs); do + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) + arch_cflags="$(get_abi_CFLAGS ${v##*.})" + + export CFLAGS_${rust_target//-/_}="${arch_cflags}" + + cat <<- _EOF_ >> "${S}"/config.toml + [target.${rust_target}] + ar = "$(tc-getAR)" + cc = "$(tc-getCC)" + cxx = "$(tc-getCXX)" + linker = "$(tc-getCC)" + ranlib = "$(tc-getRANLIB)" + llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)" + _EOF_ + if use system-llvm; then + cat <<- _EOF_ >> "${S}"/config.toml + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + _EOF_ + fi + # by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; + # but we patch it and set to false here as well + if use elibc_musl; then + cat <<- _EOF_ >> "${S}"/config.toml + crt-static = false + _EOF_ + fi + done + if use wasm; then + cat <<- _EOF_ >> "${S}"/config.toml + [target.wasm32-unknown-unknown] + linker = "$(usex system-llvm lld rust-lld)" + # wasm target does not have profiler_builtins https://bugs.gentoo.org/848483 + profiler = false + _EOF_ + fi + + if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below + # experimental cross support + # discussion: https://bugs.gentoo.org/679878 + # TODO: c*flags, clang, system-llvm, cargo.eclass target support + # it would be much better if we could split out stdlib + # complilation to separate ebuild and abuse CATEGORY to + # just install to /usr/lib/rustlib/ + + # extra targets defined as a bash array + # spec format: :: + # best place would be /etc/portage/env/dev-lang/rust + # Example: + # RUST_CROSS_TARGETS=( + # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" + # ) + # no extra hand holding is done, no target transformations, all + # values are passed as-is with just basic checks, so it's up to user to supply correct values + # valid rust targets can be obtained with + # rustc --print target-list + # matching cross toolchain has to be installed + # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) + # only gcc toolchains installed with crossdev are checked for now. + + # BUG: we can't pass host flags to cross compiler, so just filter for now + # BUG: this should be more fine-grained. + filter-flags '-mcpu=*' '-march=*' '-mtune=*' + + local cross_target_spec + for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do + # extracts first element form :: + local cross_llvm_target="${cross_target_spec%%:*}" + # extracts toolchain triples, : + local cross_triples="${cross_target_spec#*:}" + # extracts first element after before : separator + local cross_rust_target="${cross_triples%%:*}" + # extracts last element after : separator + local cross_toolchain="${cross_triples##*:}" + use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" + command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" + + cat <<- _EOF_ >> "${S}"/config.toml + [target.${cross_rust_target}] + ar = "${cross_toolchain}-ar" + cc = "${cross_toolchain}-gcc" + cxx = "${cross_toolchain}-g++" + linker = "${cross_toolchain}-gcc" + ranlib = "${cross_toolchain}-ranlib" + _EOF_ + if use system-llvm; then + cat <<- _EOF_ >> "${S}"/config.toml + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + _EOF_ + fi + if [[ "${cross_toolchain}" == *-musl* ]]; then + cat <<- _EOF_ >> "${S}"/config.toml + musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" + _EOF_ + fi + + # append cross target to "normal" target list + # example 'target = ["powerpc64le-unknown-linux-gnu"]' + # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' + + rust_targets="${rust_targets},\"${cross_rust_target}\"" + sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die + + ewarn + ewarn "Enabled ${cross_rust_target} rust target" + ewarn "Using ${cross_toolchain} cross toolchain" + ewarn + if ! has_version -b 'sys-devel/binutils[multitarget]' ; then + ewarn "'sys-devel/binutils[multitarget]' is not installed" + ewarn "'strip' will be unable to strip cross libraries" + ewarn "cross targets will be installed with full debug information" + ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" + ewarn + ewarn "Alternatively llvm-strip can be used, it supports stripping any target" + ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" + ewarn + fi + done + fi # I_KNOW_WHAT_I_AM_DOING_CROSS + + einfo "Rust configured with the following flags:" + echo + echo RUSTFLAGS="\"${RUSTFLAGS}\"" + echo RUSTFLAGS_BOOTSTRAP="\"${RUSTFLAGS_BOOTSTRAP}\"" + echo RUSTFLAGS_NOT_BOOTSTRAP="\"${RUSTFLAGS_NOT_BOOTSTRAP}\"" + echo MAGIC_EXTRA_RUSTFLAGS="\"${MAGIC_EXTRA_RUSTFLAGS}\"" + env | grep "CARGO_TARGET_.*_RUSTFLAGS=" + env | grep "CFLAGS_.*" + echo + einfo "config.toml contents:" + cat "${S}"/config.toml || die + echo +} + +src_compile() { + RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die +} + +src_test() { + # https://rustc-dev-guide.rust-lang.org/tests/intro.html + + # those are basic and codegen tests. + local tests=( + codegen + codegen-units + compile-fail + incremental + mir-opt + pretty + run-make + ) + + # fails if llvm is not built with ALL targets. + # and known to fail with system llvm sometimes. + use system-llvm || tests+=( assembly ) + + # fragile/expensive/less important tests + # or tests that require extra builds + # TODO: instead of skipping, just make some nonfatal. + if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then + tests+=( + rustdoc + rustdoc-js + rustdoc-js-std + rustdoc-ui + run-make-fulldeps + ui + ui-fulldeps + ) + fi + + local i failed=() + einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" + for i in "${tests[@]}"; do + local t="src/test/${i}" + einfo "rust_src_test: running ${t}" + if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ + -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" + then + failed+=( "${t}" ) + eerror "rust_src_test: ${t} failed" + fi + done + + if [[ ${#failed[@]} -ne 0 ]]; then + eerror "rust_src_test: failure summary: ${failed[@]}" + die "aborting due to test failures" + fi +} + +src_install() { + DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die + + # bug #689562, #689160 + rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die + rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die + newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo + + local symlinks=( + cargo + rustc + rustdoc + rust-gdb + rust-gdbgui + rust-lldb + ) + + use clippy && symlinks+=( clippy-driver cargo-clippy ) + use miri && symlinks+=( miri cargo-miri ) + use profiler && symlinks+=( rust-demangler ) + use rustfmt && symlinks+=( rustfmt cargo-fmt ) + use rust-analyzer && symlinks+=( rust-analyzer ) + + einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" + local i + for i in "${symlinks[@]}"; do + # we need realpath on /usr/bin/* symlink return version-appended binary path. + # so /usr/bin/rustc should point to /usr/lib/rust//bin/rustc- + # need to fix eselect-rust to remove this hack. + local ver_i="${i}-${PV}" + if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then + einfo "Installing ${i} symlink" + ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die + else + ewarn "${i} symlink requested, but source file not found" + ewarn "please report this" + fi + dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" + done + + # symlinks to switch components to active rust in eselect + dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" + dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}" + dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" + dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" + dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" + + newenvd - "50${P}" <<-_EOF_ + LDPATH="${EPREFIX}/usr/lib/rust/lib" + MANPATH="${EPREFIX}/usr/lib/rust/man" + _EOF_ + + rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die + rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die + + # note: eselect-rust adds EROOT to all paths below + cat <<-_EOF_ > "${T}/provider-${P}" + /usr/bin/cargo + /usr/bin/rustdoc + /usr/bin/rust-gdb + /usr/bin/rust-gdbgui + /usr/bin/rust-lldb + /usr/lib/rustlib + /usr/lib/rust/lib + /usr/lib/rust/libexec + /usr/lib/rust/man + /usr/share/doc/rust + _EOF_ + + if use clippy; then + echo /usr/bin/clippy-driver >> "${T}/provider-${P}" + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" + fi + if use miri; then + echo /usr/bin/miri >> "${T}/provider-${P}" + echo /usr/bin/cargo-miri >> "${T}/provider-${P}" + fi + if use profiler; then + echo /usr/bin/rust-demangler >> "${T}/provider-${P}" + fi + if use rustfmt; then + echo /usr/bin/rustfmt >> "${T}/provider-${P}" + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" + fi + if use rust-analyzer; then + echo /usr/bin/rust-analyzer >> "${T}/provider-${P}" + fi + + insinto /etc/env.d/rust + doins "${T}/provider-${P}" + + if use dist; then + insinto "/usr/lib/${PN}/${PV}/dist" + doins -r "${S}/build/dist/." + fi +} + +pkg_postinst() { + eselect rust update + + if has_version sys-devel/gdb || has_version dev-util/lldb; then + elog "Rust installs a helper script for calling GDB and LLDB," + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." + fi + + if has_version app-editors/emacs; then + elog "install app-emacs/rust-mode to get emacs support for rust." + fi + + if has_version app-editors/gvim || has_version app-editors/vim; then + elog "install app-vim/rust-vim to get vim support for rust." + fi +} + +pkg_postrm() { + eselect rust cleanup +} diff --git a/dev-lang/rust/rust-1.67.1.ebuild b/dev-lang/rust/rust-1.67.1.ebuild deleted file mode 100644 index 4c66b8e3b4c4..000000000000 --- a/dev-lang/rust/rust-1.67.1.ebuild +++ /dev/null @@ -1,742 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{9..11} ) - -inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \ - multilib multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig - -if [[ ${PV} = *beta* ]]; then - betaver=${PV//*beta} - BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" - MY_P="rustc-beta" - SLOT="beta/${PV}" - SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" -else - ABI_VER="$(ver_cut 1-2)" - SLOT="stable/${ABI_VER}" - MY_P="rustc-${PV}" - SRC="${MY_P}-src.tar.xz" - KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" -fi - -RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1" - -DESCRIPTION="Systems programming language from Mozilla" -HOMEPAGE="https://www.rust-lang.org/" - -SRC_URI=" - https://static.rust-lang.org/dist/${SRC} - verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc ) - !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) -" - -# keep in sync with llvm ebuild of the same version as bundled one. -ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 - NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) -ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) -LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?} - -LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4 UoI-NCSA" - -IUSE="clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind miri nightly parallel-compiler profiler rustfmt rust-analyzer rust-src system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" - -# Please keep the LLVM dependency block separate. Since LLVM is slotted, -# we need to *really* make sure we're not pulling more than one slot -# simultaneously. - -# How to use it: -# List all the working slots in LLVM_VALID_SLOTS, newest first. -LLVM_VALID_SLOTS=( 15 ) -LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}" - -# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation -# (-) usedep needed because we may build with older llvm without that target -LLVM_DEPEND="|| ( " -for _s in ${LLVM_VALID_SLOTS[@]}; do - LLVM_DEPEND+=" ( " - for _x in ${ALL_LLVM_TARGETS[@]}; do - LLVM_DEPEND+=" - ${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] ) - wasm? ( sys-devel/lld:${_s} )" - done - LLVM_DEPEND+=" )" -done -unset _s _x -LLVM_DEPEND+=" ) - /dev/null) ) - rustc_version=${rustc_version[0]#rust-bin-} - rustc_version=${rustc_version#rust-} - - [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" - - if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then - eerror "Rust >=${rustc_wanted} is required" - eerror "please run 'eselect rust' and set correct rust version" - die "selected rust version is too old" - elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then - eerror "Rust <${rustc_toonew} is required" - eerror "please run 'eselect rust' and set correct rust version" - die "selected rust version is too new" - else - einfo "Using rust ${rustc_version} to build" - fi -} - -pre_build_checks() { - local M=8192 - # multiply requirements by 1.3 if we are doing x86-multilib - if use amd64; then - M=$(( $(usex abi_x86_32 13 10) * ${M} / 10 )) - fi - M=$(( $(usex clippy 128 0) + ${M} )) - M=$(( $(usex miri 128 0) + ${M} )) - M=$(( $(usex rustfmt 256 0) + ${M} )) - # add 2G if we compile llvm and 256M per llvm_target - if ! use system-llvm; then - M=$(( 2048 + ${M} )) - local ltarget - for ltarget in ${ALL_LLVM_TARGETS[@]}; do - M=$(( $(usex ${ltarget} 256 0) + ${M} )) - done - fi - M=$(( $(usex wasm 256 0) + ${M} )) - M=$(( $(usex debug 2 1) * ${M} )) - eshopts_push -s extglob - if is-flagq '-g?(gdb)?([1-9])'; then - M=$(( 15 * ${M} / 10 )) - fi - eshopts_pop - M=$(( $(usex system-bootstrap 0 1024) + ${M} )) - M=$(( $(usex doc 256 0) + ${M} )) - CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} -} - -llvm_check_deps() { - has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]" -} - -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - [[ ${out} == *HAVE_LIBCXX* ]] -} - -pkg_pretend() { - pre_build_checks -} - -pkg_setup() { - pre_build_checks - python-any-r1_pkg_setup - - export LIBGIT2_NO_PKG_CONFIG=1 #749381 - - use system-bootstrap && bootstrap_rust_version_check - - if use system-llvm; then - llvm_pkg_setup - - local llvm_config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" - export LLVM_LINK_SHARED=1 - export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" - fi -} - -esetup_unwind_hack() { - # https://bugs.gentoo.org/870280 - # this is a hack needed to bootstrap with libgcc_s linked tarball on llvm-libunwind system. - # it should trigger for internal bootstrap or system-bootstrap with rust-bin. - # the whole idea is for stage0 to bootstrap with fake libgcc_s. - # final stage will receive -L${T}/lib but not -lgcc_s args, producing clean compiler. - local fakelib="${T}/fakelib" - mkdir -p "${fakelib}" || die - # we need both symlinks, one for cargo runtime, other for linker. - ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so.1" || die - ln -s "${ESYSROOT}/usr/lib/libunwind.so" "${fakelib}/libgcc_s.so" || die - export LD_LIBRARY_PATH="${fakelib}" - export RUSTFLAGS+=" -L${fakelib}" - # this is a literally magic variable that gets through cargo cache, without it some - # crates ignore RUSTFLAGS. - # this variable can not contain leading space. - export MAGIC_EXTRA_RUSTFLAGS+="${MAGIC_EXTRA_RUSTFLAGS:+ }-L${fakelib}" -} - -src_prepare() { - if ! use system-bootstrap; then - has_version sys-devel/gcc || esetup_unwind_hack - local rust_stage0_root="${WORKDIR}"/rust-stage0 - local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" - - "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ - --without=rust-docs-json-preview,rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die - fi - - default -} - -src_configure() { - filter-flags '-flto*' # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231 - - local rust_target="" rust_targets="" arch_cflags - - # Collect rust target names to compile standard libs for all ABIs. - for v in $(multilib_get_enabled_abi_pairs); do - rust_targets+=",\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" - done - if use wasm; then - rust_targets+=",\"wasm32-unknown-unknown\"" - if use system-llvm; then - # un-hardcode rust-lld linker for this target - # https://bugs.gentoo.org/715348 - sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die - fi - fi - rust_targets="${rust_targets#,}" - - local tools='"cargo"' - use clippy && tools+=',"clippy"' - use miri && tools+=',"miri"' - use profiler && tools+=',"rust-demangler"' - use rustfmt && tools+=',"rustfmt"' - use rust-analyzer && tools+=',"rust-analyzer","analysis"' - use rust-src && tools+=',"src"' - - local rust_stage0_root - if use system-bootstrap; then - local printsysroot - printsysroot="$(rustc --print sysroot || die "Can't determine rust's sysroot")" - rust_stage0_root="${printsysroot}" - else - rust_stage0_root="${WORKDIR}"/rust-stage0 - fi - # in case of prefix it will be already prefixed, as --print sysroot returns full path - [[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory" - - rust_target="$(rust_abi)" - - local cm_btype="$(usex debug DEBUG RELEASE)" - cat <<- _EOF_ > "${S}"/config.toml - changelog-seen = 2 - [llvm] - download-ci-llvm = false - optimize = $(toml_usex !debug) - release-debuginfo = $(toml_usex debug) - assertions = $(toml_usex debug) - ninja = true - targets = "${LLVM_TARGETS// /;}" - experimental-targets = "" - link-shared = $(toml_usex system-llvm) - $(if is_libcxx_linked; then - # https://bugs.gentoo.org/732632 - echo "use-libcxx = true" - echo "static-libstdcpp = false" - fi) - $(case "${rust_target}" in - i586-*-linux-*) - # https://github.com/rust-lang/rust/issues/93059 - echo 'cflags = "-fcf-protection=none"' - echo 'cxxflags = "-fcf-protection=none"' - echo 'ldflags = "-fcf-protection=none"' - ;; - *) - ;; - esac) - [llvm.build-config] - CMAKE_VERBOSE_MAKEFILE = "ON" - CMAKE_C_FLAGS_${cm_btype} = "${CFLAGS}" - CMAKE_CXX_FLAGS_${cm_btype} = "${CXXFLAGS}" - CMAKE_EXE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" - CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" - CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}" - CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = "${ARFLAGS}" - [build] - build-stage = 2 - test-stage = 2 - build = "${rust_target}" - host = ["${rust_target}"] - target = [${rust_targets}] - cargo = "${rust_stage0_root}/bin/cargo" - rustc = "${rust_stage0_root}/bin/rustc" - rustfmt = "${rust_stage0_root}/bin/rustfmt" - docs = $(toml_usex doc) - compiler-docs = false - submodules = false - python = "${EPYTHON}" - locked-deps = true - vendor = true - extended = true - tools = [${tools}] - verbose = 2 - sanitizers = false - profiler = $(toml_usex profiler) - cargo-native-static = false - [install] - prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" - sysconfdir = "etc" - docdir = "share/doc/rust" - bindir = "bin" - libdir = "lib" - mandir = "share/man" - [rust] - # https://github.com/rust-lang/rust/issues/54872 - codegen-units-std = 1 - optimize = true - debug = $(toml_usex debug) - debug-assertions = $(toml_usex debug) - debug-assertions-std = $(toml_usex debug) - debuginfo-level = $(usex debug 2 0) - debuginfo-level-rustc = $(usex debug 2 0) - debuginfo-level-std = $(usex debug 2 0) - debuginfo-level-tools = $(usex debug 2 0) - debuginfo-level-tests = 0 - backtrace = true - incremental = false - default-linker = "$(tc-getCC)" - parallel-compiler = $(toml_usex parallel-compiler) - channel = "$(usex nightly nightly stable)" - description = "gentoo" - rpath = false - verbose-tests = true - optimize-tests = $(toml_usex !debug) - codegen-tests = true - dist-src = false - remap-debuginfo = true - lld = $(usex system-llvm false $(toml_usex wasm)) - # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it - # https://github.com/rust-lang/rust/issues/74976 - # https://github.com/rust-lang/rust/issues/76526 - deny-warnings = $(usex wasm $(usex doc false true) true) - backtrace-on-ice = true - jemalloc = false - [dist] - src-tarball = false - compression-formats = ["xz"] - _EOF_ - - for v in $(multilib_get_enabled_abi_pairs); do - rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) - arch_cflags="$(get_abi_CFLAGS ${v##*.})" - - export CFLAGS_${rust_target//-/_}="${arch_cflags}" - - cat <<- _EOF_ >> "${S}"/config.toml - [target.${rust_target}] - ar = "$(tc-getAR)" - cc = "$(tc-getCC)" - cxx = "$(tc-getCXX)" - linker = "$(tc-getCC)" - ranlib = "$(tc-getRANLIB)" - llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)" - _EOF_ - if use system-llvm; then - cat <<- _EOF_ >> "${S}"/config.toml - llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" - _EOF_ - fi - # by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; - # but we patch it and set to false here as well - if use elibc_musl; then - cat <<- _EOF_ >> "${S}"/config.toml - crt-static = false - _EOF_ - fi - done - if use wasm; then - cat <<- _EOF_ >> "${S}"/config.toml - [target.wasm32-unknown-unknown] - linker = "$(usex system-llvm lld rust-lld)" - # wasm target does not have profiler_builtins https://bugs.gentoo.org/848483 - profiler = false - _EOF_ - fi - - if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below - # experimental cross support - # discussion: https://bugs.gentoo.org/679878 - # TODO: c*flags, clang, system-llvm, cargo.eclass target support - # it would be much better if we could split out stdlib - # complilation to separate ebuild and abuse CATEGORY to - # just install to /usr/lib/rustlib/ - - # extra targets defined as a bash array - # spec format: :: - # best place would be /etc/portage/env/dev-lang/rust - # Example: - # RUST_CROSS_TARGETS=( - # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" - # ) - # no extra hand holding is done, no target transformations, all - # values are passed as-is with just basic checks, so it's up to user to supply correct values - # valid rust targets can be obtained with - # rustc --print target-list - # matching cross toolchain has to be installed - # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) - # only gcc toolchains installed with crossdev are checked for now. - - # BUG: we can't pass host flags to cross compiler, so just filter for now - # BUG: this should be more fine-grained. - filter-flags '-mcpu=*' '-march=*' '-mtune=*' - - local cross_target_spec - for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do - # extracts first element form :: - local cross_llvm_target="${cross_target_spec%%:*}" - # extracts toolchain triples, : - local cross_triples="${cross_target_spec#*:}" - # extracts first element after before : separator - local cross_rust_target="${cross_triples%%:*}" - # extracts last element after : separator - local cross_toolchain="${cross_triples##*:}" - use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" - command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" - - cat <<- _EOF_ >> "${S}"/config.toml - [target.${cross_rust_target}] - ar = "${cross_toolchain}-ar" - cc = "${cross_toolchain}-gcc" - cxx = "${cross_toolchain}-g++" - linker = "${cross_toolchain}-gcc" - ranlib = "${cross_toolchain}-ranlib" - _EOF_ - if use system-llvm; then - cat <<- _EOF_ >> "${S}"/config.toml - llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" - _EOF_ - fi - if [[ "${cross_toolchain}" == *-musl* ]]; then - cat <<- _EOF_ >> "${S}"/config.toml - musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" - _EOF_ - fi - - # append cross target to "normal" target list - # example 'target = ["powerpc64le-unknown-linux-gnu"]' - # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' - - rust_targets="${rust_targets},\"${cross_rust_target}\"" - sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die - - ewarn - ewarn "Enabled ${cross_rust_target} rust target" - ewarn "Using ${cross_toolchain} cross toolchain" - ewarn - if ! has_version -b 'sys-devel/binutils[multitarget]' ; then - ewarn "'sys-devel/binutils[multitarget]' is not installed" - ewarn "'strip' will be unable to strip cross libraries" - ewarn "cross targets will be installed with full debug information" - ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" - ewarn - ewarn "Alternatively llvm-strip can be used, it supports stripping any target" - ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" - ewarn - fi - done - fi # I_KNOW_WHAT_I_AM_DOING_CROSS - - einfo "Rust configured with the following flags:" - echo - echo RUSTFLAGS="\"${RUSTFLAGS}\"" - echo RUSTFLAGS_BOOTSTRAP="\"${RUSTFLAGS_BOOTSTRAP}\"" - echo RUSTFLAGS_NOT_BOOTSTRAP="\"${RUSTFLAGS_NOT_BOOTSTRAP}\"" - echo MAGIC_EXTRA_RUSTFLAGS="\"${MAGIC_EXTRA_RUSTFLAGS}\"" - env | grep "CARGO_TARGET_.*_RUSTFLAGS=" - env | grep "CFLAGS_.*" - echo - einfo "config.toml contents:" - cat "${S}"/config.toml || die - echo -} - -src_compile() { - RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die -} - -src_test() { - # https://rustc-dev-guide.rust-lang.org/tests/intro.html - - # those are basic and codegen tests. - local tests=( - codegen - codegen-units - compile-fail - incremental - mir-opt - pretty - run-make - ) - - # fails if llvm is not built with ALL targets. - # and known to fail with system llvm sometimes. - use system-llvm || tests+=( assembly ) - - # fragile/expensive/less important tests - # or tests that require extra builds - # TODO: instead of skipping, just make some nonfatal. - if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then - tests+=( - rustdoc - rustdoc-js - rustdoc-js-std - rustdoc-ui - run-make-fulldeps - ui - ui-fulldeps - ) - fi - - local i failed=() - einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" - for i in "${tests[@]}"; do - local t="src/test/${i}" - einfo "rust_src_test: running ${t}" - if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ - -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" - then - failed+=( "${t}" ) - eerror "rust_src_test: ${t} failed" - fi - done - - if [[ ${#failed[@]} -ne 0 ]]; then - eerror "rust_src_test: failure summary: ${failed[@]}" - die "aborting due to test failures" - fi -} - -src_install() { - DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die - - # bug #689562, #689160 - rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die - rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die - newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo - - local symlinks=( - cargo - rustc - rustdoc - rust-gdb - rust-gdbgui - rust-lldb - ) - - use clippy && symlinks+=( clippy-driver cargo-clippy ) - use miri && symlinks+=( miri cargo-miri ) - use profiler && symlinks+=( rust-demangler ) - use rustfmt && symlinks+=( rustfmt cargo-fmt ) - use rust-analyzer && symlinks+=( rust-analyzer ) - - einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" - local i - for i in "${symlinks[@]}"; do - # we need realpath on /usr/bin/* symlink return version-appended binary path. - # so /usr/bin/rustc should point to /usr/lib/rust//bin/rustc- - # need to fix eselect-rust to remove this hack. - local ver_i="${i}-${PV}" - if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then - einfo "Installing ${i} symlink" - ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die - else - ewarn "${i} symlink requested, but source file not found" - ewarn "please report this" - fi - dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" - done - - # symlinks to switch components to active rust in eselect - dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" - dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}" - dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" - dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" - dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" - - newenvd - "50${P}" <<-_EOF_ - LDPATH="${EPREFIX}/usr/lib/rust/lib" - MANPATH="${EPREFIX}/usr/lib/rust/man" - _EOF_ - - rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die - rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die - - # note: eselect-rust adds EROOT to all paths below - cat <<-_EOF_ > "${T}/provider-${P}" - /usr/bin/cargo - /usr/bin/rustdoc - /usr/bin/rust-gdb - /usr/bin/rust-gdbgui - /usr/bin/rust-lldb - /usr/lib/rustlib - /usr/lib/rust/lib - /usr/lib/rust/libexec - /usr/lib/rust/man - /usr/share/doc/rust - _EOF_ - - if use clippy; then - echo /usr/bin/clippy-driver >> "${T}/provider-${P}" - echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" - fi - if use miri; then - echo /usr/bin/miri >> "${T}/provider-${P}" - echo /usr/bin/cargo-miri >> "${T}/provider-${P}" - fi - if use profiler; then - echo /usr/bin/rust-demangler >> "${T}/provider-${P}" - fi - if use rustfmt; then - echo /usr/bin/rustfmt >> "${T}/provider-${P}" - echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" - fi - if use rust-analyzer; then - echo /usr/bin/rust-analyzer >> "${T}/provider-${P}" - fi - - insinto /etc/env.d/rust - doins "${T}/provider-${P}" - - if use dist; then - insinto "/usr/lib/${PN}/${PV}/dist" - doins -r "${S}/build/dist/." - fi -} - -pkg_postinst() { - eselect rust update - - if has_version sys-devel/gdb || has_version dev-util/lldb; then - elog "Rust installs a helper script for calling GDB and LLDB," - elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." - fi - - if has_version app-editors/emacs; then - elog "install app-emacs/rust-mode to get emacs support for rust." - fi - - if has_version app-editors/gvim || has_version app-editors/vim; then - elog "install app-vim/rust-vim to get vim support for rust." - fi -} - -pkg_postrm() { - eselect rust cleanup -} -- cgit v1.2.3