Auto merge of #2738 - RalfJung:rustup, r=RalfJung

Rustup
This commit is contained in:
bors 2022-12-24 09:41:11 +00:00
commit d23554fae8
758 changed files with 11422 additions and 3693 deletions

View File

@ -41,16 +41,24 @@ jobs:
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
CACHE_DOMAIN: ci-caches.rust-lang.org
if: "github.event_name == 'pull_request'"
continue-on-error: "${{ matrix.tidy }}"
strategy:
matrix:
include:
- name: mingw-check
tidy: false
os: ubuntu-20.04-xl
env: {}
- name: mingw-check-tidy
tidy: true
os: ubuntu-20.04-xl
env: {}
- name: x86_64-gnu-llvm-13
tidy: false
os: ubuntu-20.04-xl
env: {}
- name: x86_64-gnu-tools
tidy: false
env:
CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
os: ubuntu-20.04-xl
@ -301,7 +309,7 @@ jobs:
- name: dist-x86_64-apple
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin"
RUST_CONFIGURE_ARGS: "--enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
RUST_CONFIGURE_ARGS: "--enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin"
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
SELECT_XCODE: /Applications/Xcode_13.4.1.app

View File

@ -30,7 +30,7 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.8",
"once_cell",
"version_check",
]
@ -77,6 +77,15 @@ dependencies = [
"yansi-term",
]
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
@ -181,7 +190,7 @@ checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7"
dependencies = [
"addr2line",
"cc",
"cfg-if 1.0.0",
"cfg-if",
"libc",
"miniz_oxide",
"object",
@ -294,7 +303,7 @@ dependencies = [
[[package]]
name = "cargo"
version = "0.68.0"
version = "0.69.0"
dependencies = [
"anyhow",
"bytesize",
@ -394,7 +403,7 @@ dependencies = [
"directories",
"rustc-build-sysroot",
"rustc-workspace-hack",
"rustc_tools_util",
"rustc_tools_util 0.2.1",
"rustc_version",
"serde",
"serde_json",
@ -502,12 +511,6 @@ dependencies = [
"jobserver",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -658,7 +661,7 @@ dependencies = [
[[package]]
name = "clippy"
version = "0.1.67"
version = "0.1.68"
dependencies = [
"clippy_lints",
"clippy_utils",
@ -673,7 +676,7 @@ dependencies = [
"regex",
"rustc-semver",
"rustc-workspace-hack",
"rustc_tools_util",
"rustc_tools_util 0.3.0",
"semver",
"serde",
"syn",
@ -700,14 +703,14 @@ dependencies = [
[[package]]
name = "clippy_lints"
version = "0.1.67"
version = "0.1.68"
dependencies = [
"cargo_metadata 0.14.0",
"clippy_utils",
"declare_clippy_lint",
"if_chain",
"itertools",
"pulldown-cmark",
"pulldown-cmark 0.9.2",
"quine-mc_cluskey",
"regex-syntax",
"rustc-semver",
@ -723,7 +726,7 @@ dependencies = [
[[package]]
name = "clippy_utils"
version = "0.1.67"
version = "0.1.68"
dependencies = [
"arrayvec",
"if_chain",
@ -951,7 +954,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
]
[[package]]
@ -960,42 +963,41 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.6"
version = "0.9.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762"
checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"
dependencies = [
"cfg-if 1.0.0",
"autocfg",
"cfg-if",
"crossbeam-utils",
"lazy_static",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.8"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
dependencies = [
"cfg-if 1.0.0",
"lazy_static",
"cfg-if",
]
[[package]]
@ -1029,6 +1031,16 @@ dependencies = [
"quote",
]
[[package]]
name = "ctor"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "curl"
version = "0.4.44"
@ -1068,7 +1080,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
[[package]]
name = "declare_clippy_lint"
version = "0.1.67"
version = "0.1.68"
dependencies = [
"itertools",
"quote",
@ -1105,6 +1117,12 @@ version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "difference"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
[[package]]
name = "digest"
version = "0.10.2"
@ -1139,7 +1157,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"dirs-sys-next",
]
@ -1342,7 +1360,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"libc",
"redox_syscall",
"winapi",
@ -1360,7 +1378,7 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"crc32fast",
"libc",
"libz-sys",
@ -1599,20 +1617,20 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.0"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if 0.1.10",
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
"wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
@ -1684,6 +1702,21 @@ dependencies = [
"serde",
]
[[package]]
name = "handlebars"
version = "3.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3"
dependencies = [
"log",
"pest",
"pest_derive",
"quick-error 2.0.1",
"serde",
"serde_json",
"walkdir",
]
[[package]]
name = "handlebars"
version = "4.3.3"
@ -1795,7 +1828,7 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
"quick-error 1.2.3",
]
[[package]]
@ -1967,7 +2000,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
]
[[package]]
@ -1991,9 +2024,9 @@ dependencies = [
[[package]]
name = "io-lifetimes"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
@ -2001,9 +2034,9 @@ dependencies = [
[[package]]
name = "is-terminal"
version = "0.4.0"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi 0.2.6",
"io-lifetimes",
@ -2151,7 +2184,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"winapi",
]
@ -2222,9 +2255,9 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "litemap"
@ -2252,7 +2285,7 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
]
[[package]]
@ -2329,12 +2362,12 @@ dependencies = [
"clap_complete",
"elasticlunr-rs",
"env_logger 0.9.0",
"handlebars",
"handlebars 4.3.3",
"lazy_static",
"log",
"memchr",
"opener",
"pulldown-cmark",
"pulldown-cmark 0.9.2",
"regex",
"serde",
"serde_json",
@ -2344,6 +2377,19 @@ dependencies = [
"topological-sort",
]
[[package]]
name = "mdman"
version = "0.1.0"
dependencies = [
"anyhow",
"handlebars 3.5.5",
"pretty_assertions",
"pulldown-cmark 0.7.2",
"same-file",
"serde_json",
"url",
]
[[package]]
name = "measureme"
version = "10.1.0"
@ -2379,9 +2425,9 @@ dependencies = [
[[package]]
name = "memoffset"
version = "0.6.5"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
@ -2434,7 +2480,7 @@ version = "0.1.0"
dependencies = [
"colored",
"env_logger 0.9.0",
"getrandom 0.2.0",
"getrandom 0.2.8",
"lazy_static",
"libc",
"libffi",
@ -2530,7 +2576,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a518809ac14b25b569624d0268eba1e88498f71615893dca57982bed7621abb"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
]
[[package]]
@ -2556,7 +2602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
@ -2618,6 +2664,15 @@ version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
[[package]]
name = "output_vt100"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi",
]
[[package]]
name = "owo-colors"
version = "3.4.0"
@ -2626,11 +2681,11 @@ checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b"
[[package]]
name = "packed_simd_2"
version = "0.3.4"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3278e0492f961fd4ae70909f56b2723a7e8d01a228427294e19cdfdebda89a17"
checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282"
dependencies = [
"cfg-if 0.1.10",
"cfg-if",
"libm",
]
@ -2639,7 +2694,7 @@ name = "panic_abort"
version = "0.0.0"
dependencies = [
"alloc",
"cfg-if 1.0.0",
"cfg-if",
"compiler_builtins",
"core",
"libc",
@ -2650,7 +2705,7 @@ name = "panic_unwind"
version = "0.0.0"
dependencies = [
"alloc",
"cfg-if 1.0.0",
"cfg-if",
"compiler_builtins",
"core",
"libc",
@ -2684,7 +2739,7 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"instant",
"libc",
"redox_syscall",
@ -2698,7 +2753,7 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
@ -2859,6 +2914,18 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "pretty_assertions"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
dependencies = [
"ansi_term 0.11.0",
"ctor",
"difference",
"output_vt100",
]
[[package]]
name = "pretty_env_logger"
version = "0.4.0"
@ -2934,6 +3001,17 @@ dependencies = [
"cc",
]
[[package]]
name = "pulldown-cmark"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca36dea94d187597e104a5c8e4b07576a8a45aa5db48a65e12940d3eb7461f55"
dependencies = [
"bitflags",
"memchr",
"unicase",
]
[[package]]
name = "pulldown-cmark"
version = "0.9.2"
@ -2957,6 +3035,12 @@ version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quick-error"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]]
name = "quine-mc_cluskey"
version = "0.2.4"
@ -3031,7 +3115,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.8",
]
[[package]]
@ -3100,7 +3184,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.8",
"redox_syscall",
]
@ -3591,7 +3675,7 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"bitflags",
"cfg-if 0.1.10",
"cfg-if",
"ena",
"indexmap",
"jobserver",
@ -4039,6 +4123,7 @@ dependencies = [
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
"rustc_error_messages",
"rustc_errors",
"rustc_feature",
"rustc_graphviz",
@ -4070,6 +4155,7 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
@ -4374,7 +4460,7 @@ dependencies = [
name = "rustc_span"
version = "0.0.0"
dependencies = [
"cfg-if 0.1.10",
"cfg-if",
"md-5",
"rustc_arena",
"rustc_data_structures",
@ -4429,6 +4515,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598f48ce2a421542b3e64828aa742b687cc1b91d2f96591cfdb7ac5988cd6366"
[[package]]
name = "rustc_tools_util"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"
[[package]]
name = "rustc_trait_selection"
version = "0.0.0"
@ -4539,7 +4631,7 @@ dependencies = [
"itertools",
"minifier",
"once_cell",
"pulldown-cmark",
"pulldown-cmark 0.9.2",
"rayon",
"regex",
"rustdoc-json-types",
@ -4777,7 +4869,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"cpufeatures",
"digest",
]
@ -4788,7 +4880,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99c3bd8169c58782adad9290a9af5939994036b76187f7b4f0e6de91dbbfc0ec"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"cpufeatures",
"digest",
]
@ -4930,7 +5022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce"
dependencies = [
"cc",
"cfg-if 1.0.0",
"cfg-if",
"libc",
"psm",
"winapi",
@ -4948,7 +5040,7 @@ version = "0.0.0"
dependencies = [
"addr2line",
"alloc",
"cfg-if 1.0.0",
"cfg-if",
"compiler_builtins",
"core",
"dlmalloc",
@ -4972,7 +5064,7 @@ dependencies = [
name = "std_detect"
version = "0.1.5"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"compiler_builtins",
"libc",
"rustc-std-workspace-alloc",
@ -5079,7 +5171,7 @@ version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"fastrand",
"libc",
"redox_syscall",
@ -5132,7 +5224,7 @@ dependencies = [
name = "test"
version = "0.0.0"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"core",
"getopts",
"libc",
@ -5148,7 +5240,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"getopts",
"libc",
"num_cpus",
@ -5315,7 +5407,7 @@ version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
@ -5369,7 +5461,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3"
dependencies = [
"ansi_term",
"ansi_term 0.12.1",
"lazy_static",
"matchers",
"parking_lot 0.11.2",
@ -5388,7 +5480,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ce989c9962c7f61fe084dd4a230eec784649dfc2392467c790007c3a6e134e7"
dependencies = [
"ansi_term",
"ansi_term 0.12.1",
"atty",
"tracing-core",
"tracing-log",
@ -5401,7 +5493,7 @@ version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"rand 0.8.5",
"static_assertions",
]
@ -5648,7 +5740,7 @@ name = "unwind"
version = "0.0.0"
dependencies = [
"cc",
"cfg-if 1.0.0",
"cfg-if",
"compiler_builtins",
"core",
"libc",
@ -5685,7 +5777,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
"getrandom 0.2.0",
"getrandom 0.2.8",
]
[[package]]

View File

@ -25,6 +25,8 @@ members = [
"src/tools/cargo/crates/credential/cargo-credential-1password",
"src/tools/cargo/crates/credential/cargo-credential-macos-keychain",
"src/tools/cargo/crates/credential/cargo-credential-wincred",
"src/tools/cargo/crates/mdman",
# "src/tools/cargo/crates/resolver-tests",
"src/tools/rustdoc",
"src/tools/rls",
"src/tools/rustfmt",

View File

@ -774,6 +774,18 @@ pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAndPrefAlign {
}
}
/// Returns the largest signed value that can be represented by this Integer.
#[inline]
pub fn signed_max(self) -> i128 {
match self {
I8 => i8::MAX as i128,
I16 => i16::MAX as i128,
I32 => i32::MAX as i128,
I64 => i64::MAX as i128,
I128 => i128::MAX,
}
}
/// Finds the smallest Integer type which can represent the signed value.
#[inline]
pub fn fit_signed(x: i128) -> Integer {

View File

@ -2554,10 +2554,9 @@ pub enum AttrStyle {
}
rustc_index::newtype_index! {
pub struct AttrId {
ENCODABLE = custom
DEBUG_FORMAT = "AttrId({})"
}
#[custom_encodable]
#[debug_format = "AttrId({})]"]
pub struct AttrId {}
}
impl<S: Encoder> Encodable<S> for AttrId {

View File

@ -8,9 +8,8 @@
/// This is later turned into [`DefId`] and `HirId` for the HIR.
///
/// [`DefId`]: rustc_span::def_id::DefId
pub struct NodeId {
DEBUG_FORMAT = "NodeId({})"
}
#[debug_format = "NodeId({})"]
pub struct NodeId {}
}
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId);

View File

@ -51,7 +51,7 @@ fn get_vertical_trim(lines: &[&str]) -> Option<(usize, usize)> {
if i != 0 || j != lines.len() { Some((i, j)) } else { None }
}
fn get_horizontal_trim<'a>(lines: &'a [&str], kind: CommentKind) -> Option<String> {
fn get_horizontal_trim(lines: &[&str], kind: CommentKind) -> Option<String> {
let mut i = usize::MAX;
let mut first = true;

View File

@ -16,7 +16,7 @@
use rustc_hir::definitions::DefPathData;
use rustc_session::errors::report_lit_error;
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::symbol::{sym, Ident};
use rustc_span::DUMMY_SP;
use thin_vec::thin_vec;
@ -596,38 +596,14 @@ pub(super) fn make_async_expr(
) -> hir::ExprKind<'hir> {
let output = ret_ty.unwrap_or_else(|| hir::FnRetTy::DefaultReturn(self.lower_span(span)));
// Resume argument type, which should be `&mut Context<'_>`.
// NOTE: Using the `'static` lifetime here is technically cheating.
// The `Future::poll` argument really is `&'a mut Context<'b>`, but we cannot
// express the fact that we are not storing it across yield-points yet,
// and we would thus run into lifetime errors.
// See <https://github.com/rust-lang/rust/issues/68923>.
// Our lowering makes sure we are not mis-using the `_task_context` input type
// in the sense that we are indeed not using it across yield points. We
// get a fresh `&mut Context` for each resume / call of `Future::poll`.
// This "cheating" was previously done with a `ResumeTy` that contained a raw
// pointer, and a `get_context` accessor that pulled the `Context` lifetimes
// out of thin air.
let context_lifetime_ident = Ident::with_dummy_span(kw::StaticLifetime);
let context_lifetime = self.arena.alloc(hir::Lifetime {
hir_id: self.next_id(),
ident: context_lifetime_ident,
res: hir::LifetimeName::Static,
});
let context_path =
hir::QPath::LangItem(hir::LangItem::Context, self.lower_span(span), None);
let context_ty = hir::MutTy {
ty: self.arena.alloc(hir::Ty {
hir_id: self.next_id(),
kind: hir::TyKind::Path(context_path),
span: self.lower_span(span),
}),
mutbl: hir::Mutability::Mut,
};
// Resume argument type: `ResumeTy`
let unstable_span =
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
let resume_ty = hir::QPath::LangItem(hir::LangItem::ResumeTy, unstable_span, None);
let input_ty = hir::Ty {
hir_id: self.next_id(),
kind: hir::TyKind::Rptr(context_lifetime, context_ty),
span: self.lower_span(span),
kind: hir::TyKind::Path(resume_ty),
span: unstable_span,
};
// The closure/generator `FnDecl` takes a single (resume) argument of type `input_ty`.
@ -680,15 +656,14 @@ pub(super) fn make_async_expr(
hir::ExprKind::Closure(c)
};
let track_caller = self
.attrs
.get(&outer_hir_id.local_id)
.map_or(false, |attrs| attrs.into_iter().any(|attr| attr.has_name(sym::track_caller)));
let hir_id = self.lower_node_id(closure_node_id);
let unstable_span =
self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
if track_caller {
if self.tcx.features().closure_track_caller
&& let Some(attrs) = self.attrs.get(&outer_hir_id.local_id)
&& attrs.into_iter().any(|attr| attr.has_name(sym::track_caller))
{
self.lower_attrs(
hir_id,
&[Attribute {
@ -731,7 +706,7 @@ pub(super) fn make_async_expr(
/// mut __awaitee => loop {
/// match unsafe { ::std::future::Future::poll(
/// <::std::pin::Pin>::new_unchecked(&mut __awaitee),
/// task_context,
/// ::std::future::get_context(task_context),
/// ) } {
/// ::std::task::Poll::Ready(result) => break result,
/// ::std::task::Poll::Pending => {}
@ -772,7 +747,7 @@ fn lower_expr_await(&mut self, dot_await_span: Span, expr: &Expr) -> hir::ExprKi
// unsafe {
// ::std::future::Future::poll(
// ::std::pin::Pin::new_unchecked(&mut __awaitee),
// task_context,
// ::std::future::get_context(task_context),
// )
// }
let poll_expr = {
@ -790,10 +765,16 @@ fn lower_expr_await(&mut self, dot_await_span: Span, expr: &Expr) -> hir::ExprKi
arena_vec![self; ref_mut_awaitee],
Some(expr_hir_id),
);
let get_context = self.expr_call_lang_item_fn_mut(
gen_future_span,
hir::LangItem::GetContext,
arena_vec![self; task_context],
Some(expr_hir_id),
);
let call = self.expr_call_lang_item_fn(
span,
hir::LangItem::FuturePoll,
arena_vec![self; new_unchecked, task_context],
arena_vec![self; new_unchecked, get_context],
Some(expr_hir_id),
);
self.arena.alloc(self.expr_unsafe(call))

View File

@ -1,6 +1,6 @@
use super::errors::{InvalidAbi, InvalidAbiSuggestion, MisplacedRelaxTraitBound};
use super::ResolverAstLoweringExt;
use super::{Arena, AstOwner, ImplTraitContext, ImplTraitPosition};
use super::{AstOwner, ImplTraitContext, ImplTraitPosition};
use super::{FnDeclKind, LoweringContext, ParamMode};
use rustc_ast::ptr::P;
@ -24,7 +24,6 @@
pub(super) struct ItemLowerer<'a, 'hir> {
pub(super) tcx: TyCtxt<'hir>,
pub(super) resolver: &'a mut ResolverAstLowering,
pub(super) ast_arena: &'a Arena<'static>,
pub(super) ast_index: &'a IndexVec<LocalDefId, AstOwner<'a>>,
pub(super) owners: &'a mut IndexVec<LocalDefId, hir::MaybeOwner<&'hir hir::OwnerInfo<'hir>>>,
}
@ -60,7 +59,6 @@ fn with_lctx(
tcx: self.tcx,
resolver: self.resolver,
arena: self.tcx.hir_arena,
ast_arena: self.ast_arena,
// HirId handling.
bodies: Vec::new(),

View File

@ -42,7 +42,6 @@
use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait, TraitFnAsync};
use rustc_arena::declare_arena;
use rustc_ast::ptr::P;
use rustc_ast::visit;
use rustc_ast::{self as ast, *};
@ -94,13 +93,6 @@ struct LoweringContext<'a, 'hir> {
/// Used to allocate HIR nodes.
arena: &'hir hir::Arena<'hir>,
/// Used to allocate temporary AST nodes for use during lowering.
/// This allows us to create "fake" AST -- these nodes can sometimes
/// be allocated on the stack, but other times we need them to live longer
/// than the current stack frame, so they can be collected into vectors
/// and things like that.
ast_arena: &'a Arena<'static>,
/// Bodies inside the owner being lowered.
bodies: Vec<(hir::ItemLocalId, &'hir hir::Body<'hir>)>,
/// Attributes inside the owner being lowered.
@ -146,15 +138,6 @@ struct LoweringContext<'a, 'hir> {
generics_def_id_map: Vec<FxHashMap<LocalDefId, LocalDefId>>,
}
declare_arena!([
[] tys: rustc_ast::Ty,
[] aba: rustc_ast::AngleBracketedArgs,
[] ptr: rustc_ast::PolyTraitRef,
// This _marker field is needed because `declare_arena` creates `Arena<'tcx>` and we need to
// use `'tcx`. If we don't have this we get a compile error.
[] _marker: std::marker::PhantomData<&'tcx ()>,
]);
trait ResolverAstLoweringExt {
fn legacy_const_generic_args(&self, expr: &Expr) -> Option<Vec<usize>>;
fn get_partial_res(&self, id: NodeId) -> Option<PartialRes>;
@ -431,7 +414,7 @@ fn compute_hir_hash(
})
}
pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
let sess = tcx.sess;
let krate = tcx.untracked_crate.steal();
let mut resolver = tcx.resolver_for_lowering(()).steal();
@ -442,13 +425,10 @@ pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
tcx.definitions_untracked().def_index_count(),
);
let ast_arena = Arena::default();
for def_id in ast_index.indices() {
item::ItemLowerer {
tcx,
resolver: &mut resolver,
ast_arena: &ast_arena,
ast_index: &ast_index,
owners: &mut owners,
}
@ -620,7 +600,7 @@ fn with_hir_id_owner(
self.impl_trait_defs = current_impl_trait_defs;
self.impl_trait_bounds = current_impl_trait_bounds;
debug_assert!(self.children.iter().find(|(id, _)| id == &def_id).is_none());
debug_assert!(!self.children.iter().any(|(id, _)| id == &def_id));
self.children.push((def_id, hir::MaybeOwner::Owner(info)));
}
@ -1001,8 +981,12 @@ fn lower_assoc_ty_constraint(
}
GenericArgs::Parenthesized(data) => {
self.emit_bad_parenthesized_trait_in_assoc_ty(data);
let aba = self.ast_arena.aba.alloc(data.as_angle_bracketed_args());
self.lower_angle_bracketed_parameter_data(aba, ParamMode::Explicit, itctx).0
self.lower_angle_bracketed_parameter_data(
&data.as_angle_bracketed_args(),
ParamMode::Explicit,
itctx,
)
.0
}
};
gen_args_ctor.into_generic_args(self)
@ -1067,13 +1051,15 @@ fn lower_assoc_ty_constraint(
self.with_dyn_type_scope(false, |this| {
let node_id = this.next_node_id();
let ty = this.ast_arena.tys.alloc(Ty {
id: node_id,
kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
span: this.lower_span(constraint.span),
tokens: None,
});
let ty = this.lower_ty(ty, itctx);
let ty = this.lower_ty(
&Ty {
id: node_id,
kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
span: this.lower_span(constraint.span),
tokens: None,
},
itctx,
);
hir::TypeBindingKind::Equality { term: ty.into() }
})
@ -1217,13 +1203,12 @@ fn lower_path_ty(
&& let Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _)) = partial_res.full_res()
{
let (bounds, lifetime_bound) = self.with_dyn_type_scope(true, |this| {
let poly_trait_ref = this.ast_arena.ptr.alloc(PolyTraitRef {
bound_generic_params: vec![],
trait_ref: TraitRef { path: path.clone(), ref_id: t.id },
span: t.span
});
let bound = this.lower_poly_trait_ref(
poly_trait_ref,
&PolyTraitRef {
bound_generic_params: vec![],
trait_ref: TraitRef { path: path.clone(), ref_id: t.id },
span: t.span
},
itctx,
);
let bounds = this.arena.alloc_from_iter([bound]);

View File

@ -42,7 +42,6 @@ enum SelfSemantic {
/// What is the context that prevents using `~const`?
enum DisallowTildeConstContext<'a> {
TraitObject,
ImplTrait,
Fn(FnKind<'a>),
}
@ -187,11 +186,7 @@ fn with_banned_assoc_ty_bound(&mut self, f: impl FnOnce(&mut Self)) {
fn with_impl_trait(&mut self, outer: Option<Span>, f: impl FnOnce(&mut Self)) {
let old = mem::replace(&mut self.outer_impl_trait, outer);
if outer.is_some() {
self.with_banned_tilde_const(DisallowTildeConstContext::ImplTrait, f);
} else {
f(self);
}
f(self);
self.outer_impl_trait = old;
}
@ -1384,7 +1379,6 @@ fn visit_param_bound(&mut self, bound: &'a GenericBound, ctxt: BoundKind) {
let mut err = self.err_handler().struct_span_err(bound.span(), "`~const` is not allowed here");
match reason {
DisallowTildeConstContext::TraitObject => err.note("trait objects cannot have `~const` trait bounds"),
DisallowTildeConstContext::ImplTrait => err.note("`impl Trait`s cannot have `~const` trait bounds"),
DisallowTildeConstContext::Fn(FnKind::Closure(..)) => err.note("closures cannot have `~const` trait bounds"),
DisallowTildeConstContext::Fn(FnKind::Fn(_, ident, ..)) => err.span_note(ident.span, "this function is not `const`, so it cannot have `~const` trait bounds"),
};

View File

@ -148,7 +148,7 @@ fn next(&mut self) -> Option<Self::Item> {
if let Some(p) = self.pointer {
self.pointer = self.graph.next_constraints[p];
Some(self.constraints[p].clone())
Some(self.constraints[p])
} else if let Some(next_static_idx) = self.next_static_idx {
self.next_static_idx = if next_static_idx == (self.graph.first_constraints.len() - 1) {
None

View File

@ -115,13 +115,11 @@ fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
}
rustc_index::newtype_index! {
pub struct OutlivesConstraintIndex {
DEBUG_FORMAT = "OutlivesConstraintIndex({})"
}
#[debug_format = "OutlivesConstraintIndex({})"]
pub struct OutlivesConstraintIndex {}
}
rustc_index::newtype_index! {
pub struct ConstraintSccIndex {
DEBUG_FORMAT = "ConstraintSccIndex({})"
}
#[debug_format = "ConstraintSccIndex({})"]
pub struct ConstraintSccIndex {}
}

View File

@ -28,10 +28,10 @@
/// that shows how to do this at `src/test/run-make/obtain-borrowck/`.
///
/// * Polonius is highly unstable, so expect regular changes in its signature or other details.
pub fn get_body_with_borrowck_facts<'tcx>(
tcx: TyCtxt<'tcx>,
pub fn get_body_with_borrowck_facts(
tcx: TyCtxt<'_>,
def: ty::WithOptConstParam<LocalDefId>,
) -> BodyWithBorrowckFacts<'tcx> {
) -> BodyWithBorrowckFacts<'_> {
let (input_body, promoted) = tcx.mir_promoted(def);
let infcx = tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(def.did)).build();
let input_body: &Body<'_> = &input_body.borrow();

View File

@ -108,9 +108,8 @@ fn reconstruct_terminator_effect(
}
rustc_index::newtype_index! {
pub struct BorrowIndex {
DEBUG_FORMAT = "bw{}"
}
#[debug_format = "bw{}"]
pub struct BorrowIndex {}
}
/// `Borrows` stores the data used in the analyses that track the flow

View File

@ -649,7 +649,7 @@ fn suggest_assign_value(
if !assign_value.is_empty() {
err.span_suggestion_verbose(
sugg_span.shrink_to_hi(),
format!("consider assigning a value"),
"consider assigning a value",
format!(" = {}", assign_value),
Applicability::MaybeIncorrect,
);

View File

@ -270,7 +270,7 @@ pub(crate) fn add_explanation_to_diagnostic(
for extra in extra_info {
match extra {
ExtraConstraintInfo::PlaceholderFromPredicate(span) => {
err.span_note(*span, format!("due to current limitations in the borrow checker, this implies a `'static` lifetime"));
err.span_note(*span, "due to current limitations in the borrow checker, this implies a `'static` lifetime");
}
}
}

View File

@ -9,7 +9,7 @@
/// Find all uses of (including assignments to) a [`Local`].
///
/// Uses `BTreeSet` so output is deterministic.
pub(super) fn find<'tcx>(body: &Body<'tcx>, local: Local) -> BTreeSet<Location> {
pub(super) fn find(body: &Body<'_>, local: Local) -> BTreeSet<Location> {
let mut visitor = AllLocalUsesVisitor { for_local: local, uses: BTreeSet::default() };
visitor.visit_body(body);
visitor.uses

View File

@ -18,11 +18,11 @@
use rustc_middle::hir::place::PlaceBase;
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
use rustc_middle::ty::subst::InternalSubsts;
use rustc_middle::ty::Region;
use rustc_middle::ty::TypeVisitor;
use rustc_middle::ty::{self, RegionVid, Ty};
use rustc_middle::ty::{Region, TyCtxt};
use rustc_span::symbol::{kw, Ident};
use rustc_span::Span;
use rustc_span::{Span, DUMMY_SP};
use crate::borrowck_errors;
use crate::session_diagnostics::{
@ -70,7 +70,25 @@ fn description(&self) -> &'static str {
///
/// Usually we expect this to either be empty or contain a small number of items, so we can avoid
/// allocation most of the time.
pub(crate) type RegionErrors<'tcx> = Vec<RegionErrorKind<'tcx>>;
pub(crate) struct RegionErrors<'tcx>(Vec<RegionErrorKind<'tcx>>, TyCtxt<'tcx>);
impl<'tcx> RegionErrors<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> Self {
Self(vec![], tcx)
}
#[track_caller]
pub fn push(&mut self, val: impl Into<RegionErrorKind<'tcx>>) {
let val = val.into();
self.1.sess.delay_span_bug(DUMMY_SP, "{val:?}");
self.0.push(val);
}
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
pub fn into_iter(self) -> impl Iterator<Item = RegionErrorKind<'tcx>> {
self.0.into_iter()
}
}
#[derive(Clone, Debug)]
pub(crate) enum RegionErrorKind<'tcx> {
@ -472,7 +490,7 @@ pub(crate) fn report_region_error(
for extra in extra_info {
match extra {
ExtraConstraintInfo::PlaceholderFromPredicate(span) => {
diag.span_note(span, format!("due to current limitations in the borrow checker, this implies a `'static` lifetime"));
diag.span_note(span, "due to current limitations in the borrow checker, this implies a `'static` lifetime");
}
}
}

View File

@ -124,10 +124,7 @@ pub fn provide(providers: &mut Providers) {
};
}
fn mir_borrowck<'tcx>(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
) -> &'tcx BorrowCheckResult<'tcx> {
fn mir_borrowck(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &BorrowCheckResult<'_> {
let (input_body, promoted) = tcx.mir_promoted(def);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def.did.to_def_id()));
@ -2059,12 +2056,7 @@ fn is_local_ever_initialized(
) -> Option<InitIndex> {
let mpi = self.move_data.rev_lookup.find_local(local);
let ii = &self.move_data.init_path_map[mpi];
for &index in ii {
if flow_state.ever_inits.contains(index) {
return Some(index);
}
}
None
ii.into_iter().find(|&&index| flow_state.ever_inits.contains(index)).copied()
}
/// Adds the place into the used mutable variables set

View File

@ -20,9 +20,8 @@ pub struct LocationTable {
}
rustc_index::newtype_index! {
pub struct LocationIndex {
DEBUG_FORMAT = "LocationIndex({})"
}
#[debug_format = "LocationIndex({})"]
pub struct LocationIndex {}
}
#[derive(Copy, Clone, Debug)]

View File

@ -55,9 +55,8 @@ pub(crate) struct NllMemberConstraint<'tcx> {
}
rustc_index::newtype_index! {
pub(crate) struct NllMemberConstraintIndex {
DEBUG_FORMAT = "MemberConstraintIndex({})"
}
#[debug_format = "MemberConstraintIndex({})"]
pub(crate) struct NllMemberConstraintIndex {}
}
impl Default for MemberConstraintSet<'_, ty::RegionVid> {

View File

@ -562,7 +562,7 @@ pub(super) fn solve(
let mir_def_id = body.source.def_id();
self.propagate_constraints(body);
let mut errors_buffer = RegionErrors::new();
let mut errors_buffer = RegionErrors::new(infcx.tcx);
// If this is a closure, we can propagate unsatisfied
// `outlives_requirements` to our creator, so create a vector
@ -831,7 +831,6 @@ fn check_type_tests(
if self.eval_verify_bound(
infcx,
param_env,
body,
generic_ty,
type_test.lower_bound,
&type_test.verify_bound,
@ -962,14 +961,7 @@ fn try_promote_type_test(
// where `ur` is a local bound -- we are sometimes in a
// position to prove things that our caller cannot. See
// #53570 for an example.
if self.eval_verify_bound(
infcx,
param_env,
body,
generic_ty,
ur,
&type_test.verify_bound,
) {
if self.eval_verify_bound(infcx, param_env, generic_ty, ur, &type_test.verify_bound) {
continue;
}
@ -1190,7 +1182,6 @@ fn eval_verify_bound(
&self,
infcx: &InferCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
generic_ty: Ty<'tcx>,
lower_bound: RegionVid,
verify_bound: &VerifyBound<'tcx>,
@ -1213,25 +1204,11 @@ fn eval_verify_bound(
}
VerifyBound::AnyBound(verify_bounds) => verify_bounds.iter().any(|verify_bound| {
self.eval_verify_bound(
infcx,
param_env,
body,
generic_ty,
lower_bound,
verify_bound,
)
self.eval_verify_bound(infcx, param_env, generic_ty, lower_bound, verify_bound)
}),
VerifyBound::AllBounds(verify_bounds) => verify_bounds.iter().all(|verify_bound| {
self.eval_verify_bound(
infcx,
param_env,
body,
generic_ty,
lower_bound,
verify_bound,
)
self.eval_verify_bound(infcx, param_env, generic_ty, lower_bound, verify_bound)
}),
}
}
@ -1670,26 +1647,29 @@ fn check_bound_universal_region(
let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
debug!("check_bound_universal_region: longer_fr_scc={:?}", longer_fr_scc,);
// If we have some bound universal region `'a`, then the only
// elements it can contain is itself -- we don't know anything
// else about it!
let Some(error_element) = ({
self.scc_values.elements_contained_in(longer_fr_scc).find(|element| match element {
RegionElement::Location(_) => true,
RegionElement::RootUniversalRegion(_) => true,
RegionElement::PlaceholderRegion(placeholder1) => placeholder != *placeholder1,
})
}) else {
return;
};
debug!("check_bound_universal_region: error_element = {:?}", error_element);
for error_element in self.scc_values.elements_contained_in(longer_fr_scc) {
match error_element {
RegionElement::Location(_) | RegionElement::RootUniversalRegion(_) => {}
// If we have some bound universal region `'a`, then the only
// elements it can contain is itself -- we don't know anything
// else about it!
RegionElement::PlaceholderRegion(placeholder1) => {
if placeholder == placeholder1 {
continue;
}
}
}
// Find the region that introduced this `error_element`.
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
longer_fr,
error_element,
placeholder,
});
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
longer_fr,
error_element,
placeholder,
});
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
break;
}
debug!("check_bound_universal_region: all bounds satisfied");
}
#[instrument(level = "debug", skip(self, infcx, errors_buffer))]

View File

@ -90,12 +90,14 @@ pub(crate) fn point_in_range(&self, index: PointIndex) -> bool {
rustc_index::newtype_index! {
/// A single integer representing a `Location` in the MIR control-flow
/// graph. Constructed efficiently from `RegionValueElements`.
pub struct PointIndex { DEBUG_FORMAT = "PointIndex({})" }
#[debug_format = "PointIndex({})"]
pub struct PointIndex {}
}
rustc_index::newtype_index! {
/// A single integer representing a `ty::Placeholder`.
pub struct PlaceholderIndex { DEBUG_FORMAT = "PlaceholderIndex({})" }
#[debug_format = "PlaceholderIndex({})"]
pub struct PlaceholderIndex {}
}
/// An individual element in a region value -- the value of a

View File

@ -85,7 +85,7 @@ pub(crate) fn postdom_upper_bound(&self, fr1: RegionVid, fr2: RegionVid) -> Regi
/// outlives `fr` and (b) is not local.
///
/// (*) If there are multiple competing choices, we return all of them.
pub(crate) fn non_local_upper_bounds<'a>(&'a self, fr: RegionVid) -> Vec<RegionVid> {
pub(crate) fn non_local_upper_bounds(&self, fr: RegionVid) -> Vec<RegionVid> {
debug!("non_local_upper_bound(fr={:?})", fr);
let res = self.non_local_bounds(&self.inverse_outlives, fr);
assert!(!res.is_empty(), "can't find an upper bound!?");
@ -148,9 +148,9 @@ pub(crate) fn non_local_lower_bound(&self, fr: RegionVid) -> Option<RegionVid> {
/// Helper for `non_local_upper_bounds` and `non_local_lower_bounds`.
/// Repeatedly invokes `postdom_parent` until we find something that is not
/// local. Returns `None` if we never do so.
fn non_local_bounds<'a>(
fn non_local_bounds(
&self,
relation: &'a TransitiveRelation<RegionVid>,
relation: &TransitiveRelation<RegionVid>,
fr0: RegionVid,
) -> Vec<RegionVid> {
// This method assumes that `fr0` is one of the universally

View File

@ -46,7 +46,7 @@ struct Appearance {
}
rustc_index::newtype_index! {
pub struct AppearanceIndex { .. }
pub struct AppearanceIndex {}
}
impl vll::LinkElem for Appearance {

View File

@ -612,7 +612,7 @@ fn sanitize_promoted(&mut self, promoted_body: &'b Body<'tcx>, location: Locatio
let locations = location.to_locations();
for constraint in constraints.outlives().iter() {
let mut constraint = constraint.clone();
let mut constraint = *constraint;
constraint.locations = locations;
if let ConstraintCategory::Return(_)
| ConstraintCategory::UseAsConst
@ -1153,16 +1153,23 @@ fn relate_type_and_user_type(
category: ConstraintCategory<'tcx>,
) -> Fallible<()> {
let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty;
trace!(?annotated_type);
let mut curr_projected_ty = PlaceTy::from_ty(annotated_type);
let tcx = self.infcx.tcx;
for proj in &user_ty.projs {
if let ty::Alias(ty::Opaque, ..) = curr_projected_ty.ty.kind() {
// There is nothing that we can compare here if we go through an opaque type.
// We're always in its defining scope as we can otherwise not project through
// it, so we're constraining it anyways.
return Ok(());
}
let projected_ty = curr_projected_ty.projection_ty_core(
tcx,
self.param_env,
proj,
|this, field, _| {
|this, field, ()| {
let ty = this.field_ty(tcx, field);
self.normalize(ty, locations)
},
@ -1170,10 +1177,7 @@ fn relate_type_and_user_type(
);
curr_projected_ty = projected_ty;
}
debug!(
"user_ty base: {:?} freshened: {:?} projs: {:?} yields: {:?}",
user_ty.base, annotated_type, user_ty.projs, curr_projected_ty
);
trace!(?curr_projected_ty);
let ty = curr_projected_ty.ty;
self.relate_types(ty, v.xform(ty::Variance::Contravariant), a, locations, category)?;

View File

@ -352,7 +352,7 @@ pub fn parse_asm_args<'a>(
///
/// This function must be called immediately after the option token is parsed.
/// Otherwise, the suggestion will be incorrect.
fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
let mut err = p
.sess
.span_diagnostic

View File

@ -35,7 +35,7 @@ pub fn expand(
(item, true, ecx.with_def_site_ctxt(ty.span))
} else {
ecx.sess.parse_sess.span_diagnostic.span_err(item.span(), "allocators must be statics");
return vec![orig_item.clone()]
return vec![orig_item];
};
// Generate a bunch of new items using the AllocFnFactory

View File

@ -262,6 +262,7 @@ fn visit_item(&mut self, item: &'a ast::Item) {
// use proc_macro::bridge::client::ProcMacro;
//
// #[rustc_proc_macro_decls]
// #[used]
// #[allow(deprecated)]
// static DECLS: &[ProcMacro] = &[
// ProcMacro::custom_derive($name_trait1, &[], ::$name1);
@ -364,6 +365,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
)
.map(|mut i| {
i.attrs.push(cx.attr_word(sym::rustc_proc_macro_decls, span));
i.attrs.push(cx.attr_word(sym::used, span));
i.attrs.push(cx.attr_nested_word(sym::allow, sym::deprecated, span));
i
});

View File

@ -239,8 +239,7 @@ pub fn expand_test_or_bench(
cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
// #[rustc_test_marker = "test_case_sort_key"]
cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
]
.into(),
],
// const $ident: test::TestDescAndFn =
ast::ItemKind::Const(
ast::Defaultness::Final,

View File

@ -644,7 +644,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let res = CValue::by_val(res, arg.layout());
ret.write_cvalue(fx, res);
}
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_mem_uninitialized_valid => {
intrinsic_args!(fx, args => (); intrinsic);
let layout = fx.layout_of(substs.type_at(0));
@ -673,7 +673,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
return;
}
if intrinsic == sym::assert_uninit_valid && !fx.tcx.permits_uninit_init(layout) {
if intrinsic == sym::assert_mem_uninitialized_valid
&& !fx.tcx.permits_uninit_init(layout)
{
with_no_trimmed_paths!({
crate::base::codegen_panic(
fx,

View File

@ -52,7 +52,7 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
}
}
pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_128bit_integers: bool) -> (ModuleCodegen<GccContext>, u64) {
pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, supports_128bit_integers: bool) -> (ModuleCodegen<GccContext>, u64) {
let prof_timer = tcx.prof.generic_activity("codegen_module");
let start_time = Instant::now();

View File

@ -44,7 +44,7 @@ pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) ->
context.new_array_constructor(None, typ, &elements)
}
pub fn type_is_pointer<'gcc>(typ: Type<'gcc>) -> bool {
pub fn type_is_pointer(typ: Type<'_>) -> bool {
typ.get_pointee().is_some()
}

View File

@ -161,7 +161,7 @@ fn codegen_allocator<'tcx>(&self, tcx: TyCtxt<'tcx>, module_name: &str, kind: Al
mods
}
fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (ModuleCodegen<Self::Module>, u64) {
fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen<Self::Module>, u64) {
base::compile_codegen_unit(tcx, cgu_name, *self.supports_128bit_integers.lock().expect("lock"))
}

View File

@ -144,7 +144,7 @@ fn codegen_inline_asm(
// We prefer the latter because it matches the behavior of
// Clang.
if late && matches!(reg, InlineAsmRegOrRegClass::Reg(_)) {
constraints.push(format!("{}", reg_to_llvm(reg, Some(&in_value.layout))));
constraints.push(reg_to_llvm(reg, Some(&in_value.layout)).to_string());
} else {
constraints.push(format!("{}", op_idx[&idx]));
}

View File

@ -137,6 +137,14 @@ fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribu
}
}
fn nojumptables_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
if !cx.sess().opts.unstable_opts.no_jump_tables {
return None;
}
Some(llvm::CreateAttrStringValue(cx.llcx, "no-jump-tables", "true"))
}
fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
// Currently stack probes seem somewhat incompatible with the address
// sanitizer and thread sanitizer. With asan we're already protected from
@ -293,6 +301,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
// FIXME: none of these three functions interact with source level attributes.
to_add.extend(frame_pointer_type_attr(cx));
to_add.extend(instrument_function_attr(cx));
to_add.extend(nojumptables_attr(cx));
to_add.extend(probestack_attr(cx));
to_add.extend(stackprotector_attr(cx));

View File

@ -425,7 +425,7 @@ fn thin_lto(
info!("going for that thin, thin LTO");
let green_modules: FxHashMap<_, _> =
cached_modules.iter().map(|&(_, ref wp)| (wp.cgu_name.clone(), wp.clone())).collect();
cached_modules.iter().map(|(_, wp)| (wp.cgu_name.clone(), wp.clone())).collect();
let full_scope_len = modules.len() + serialized_modules.len() + cached_modules.len();
let mut thin_buffers = Vec::with_capacity(modules.len());

View File

@ -233,8 +233,8 @@ fn invoke(
// Set KCFI operand bundle
let is_indirect_call = unsafe { llvm::LLVMIsAFunction(llfn).is_none() };
let kcfi_bundle =
if self.tcx.sess.is_sanitizer_kcfi_enabled() && fn_abi.is_some() && is_indirect_call {
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi.unwrap());
if self.tcx.sess.is_sanitizer_kcfi_enabled() && let Some(fn_abi) = fn_abi && is_indirect_call {
let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi);
Some(llvm::OperandBundleDef::new("kcfi", &[self.const_u32(kcfi_typeid)]))
} else {
None

View File

@ -3,7 +3,6 @@
use crate::callee::get_fn;
use crate::coverageinfo;
use crate::debuginfo;
use crate::errors::BranchProtectionRequiresAArch64;
use crate::llvm;
use crate::llvm_util;
use crate::type_::Type;
@ -281,34 +280,43 @@ pub unsafe fn create_module<'ll>(
}
if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection {
if sess.target.arch != "aarch64" {
sess.emit_err(BranchProtectionRequiresAArch64);
let behavior = if llvm_version >= (15, 0, 0) {
llvm::LLVMModFlagBehavior::Min
} else {
llvm::LLVMModFlagBehavior::Error
};
if sess.target.arch == "aarch64" {
llvm::LLVMRustAddModuleFlag(
llmod,
llvm::LLVMModFlagBehavior::Error,
behavior,
"branch-target-enforcement\0".as_ptr().cast(),
bti.into(),
);
llvm::LLVMRustAddModuleFlag(
llmod,
llvm::LLVMModFlagBehavior::Error,
behavior,
"sign-return-address\0".as_ptr().cast(),
pac_ret.is_some().into(),
);
let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A });
llvm::LLVMRustAddModuleFlag(
llmod,
llvm::LLVMModFlagBehavior::Error,
behavior,
"sign-return-address-all\0".as_ptr().cast(),
pac_opts.leaf.into(),
);
llvm::LLVMRustAddModuleFlag(
llmod,
llvm::LLVMModFlagBehavior::Error,
behavior,
"sign-return-address-with-bkey\0".as_ptr().cast(),
u32::from(pac_opts.key == PAuthKey::B),
);
} else {
bug!(
"branch-protection used on non-AArch64 target; \
this should be checked in rustc_session."
);
}
}

View File

@ -30,7 +30,7 @@
/// implementing this Rust version, and though the format documentation is very explicit and
/// detailed, some undocumented details in Clang's implementation (that may or may not be important)
/// were also replicated for Rust's Coverage Map.
pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
pub fn finalize(cx: &CodegenCx<'_, '_>) {
let tcx = cx.tcx;
// Ensure the installed version of LLVM supports at least Coverage Map
@ -284,7 +284,7 @@ fn save_function_record(
/// "code coverage dead code cgu" during the partitioning process. This prevents us from generating
/// code regions for the same function more than once which can lead to linker errors regarding
/// duplicate symbols.
fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
fn add_unused_functions(cx: &CodegenCx<'_, '_>) {
assert!(cx.codegen_unit.is_code_coverage_dead_code_cgu());
let tcx = cx.tcx;

View File

@ -111,7 +111,7 @@ macro_rules! return_if_di_node_created_in_meantime {
/// Extract size and alignment from a TyAndLayout.
#[inline]
fn size_and_align_of<'tcx>(ty_and_layout: TyAndLayout<'tcx>) -> (Size, Align) {
fn size_and_align_of(ty_and_layout: TyAndLayout<'_>) -> (Size, Align) {
(ty_and_layout.size, ty_and_layout.align.abi)
}

View File

@ -51,10 +51,6 @@ pub(crate) struct SymbolAlreadyDefined<'a> {
pub symbol_name: &'a str,
}
#[derive(Diagnostic)]
#[diag(codegen_llvm_branch_protection_requires_aarch64)]
pub(crate) struct BranchProtectionRequiresAArch64;
#[derive(Diagnostic)]
#[diag(codegen_llvm_invalid_minimum_alignment)]
pub(crate) struct InvalidMinimumAlignment {

View File

@ -567,7 +567,7 @@ fn codegen_msvc_try<'ll>(
// module.
//
// When modifying, make sure that the type_name string exactly matches
// the one used in src/libpanic_unwind/seh.rs.
// the one used in library/panic_unwind/src/seh.rs.
let type_info_vtable = bx.declare_global("??_7type_info@@6B@", bx.type_i8p());
let type_name = bx.const_bytes(b"rust_panic\0");
let type_info =

View File

@ -79,6 +79,7 @@ pub enum LLVMModFlagBehavior {
Append = 5,
AppendUnique = 6,
Max = 7,
Min = 8,
}
// Consts for the LLVM CallConv type, pre-cast to usize.
@ -2389,11 +2390,11 @@ pub fn LLVMRustWriteImportLibrary(
pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
pub fn LLVMRustBuildOperandBundleDef<'a>(
pub fn LLVMRustBuildOperandBundleDef(
Name: *const c_char,
Inputs: *const &'a Value,
Inputs: *const &'_ Value,
NumInputs: c_uint,
) -> &'a mut OperandBundleDef<'a>;
) -> &mut OperandBundleDef<'_>;
pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);

View File

@ -175,6 +175,89 @@ fn emit_aapcs_va_arg<'ll, 'tcx>(
val
}
fn emit_s390x_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
list: OperandRef<'tcx, &'ll Value>,
target_ty: Ty<'tcx>,
) -> &'ll Value {
// Implementation of the s390x ELF ABI calling convention for va_args see
// https://github.com/IBM/s390x-abi (chapter 1.2.4)
let va_list_addr = list.immediate();
let va_list_layout = list.deref(bx.cx).layout;
let va_list_ty = va_list_layout.llvm_type(bx);
let layout = bx.cx.layout_of(target_ty);
let in_reg = bx.append_sibling_block("va_arg.in_reg");
let in_mem = bx.append_sibling_block("va_arg.in_mem");
let end = bx.append_sibling_block("va_arg.end");
// FIXME: vector ABI not yet supported.
let target_ty_size = bx.cx.size_of(target_ty).bytes();
let indirect: bool = target_ty_size > 8 || !target_ty_size.is_power_of_two();
let unpadded_size = if indirect { 8 } else { target_ty_size };
let padded_size = 8;
let padding = padded_size - unpadded_size;
let gpr_type = indirect || !layout.is_single_fp_element(bx.cx);
let (max_regs, reg_count_field, reg_save_index, reg_padding) =
if gpr_type { (5, 0, 2, padding) } else { (4, 1, 16, 0) };
// Check whether the value was passed in a register or in memory.
let reg_count = bx.struct_gep(
va_list_ty,
va_list_addr,
va_list_layout.llvm_field_index(bx.cx, reg_count_field),
);
let reg_count_v = bx.load(bx.type_i64(), reg_count, Align::from_bytes(8).unwrap());
let use_regs = bx.icmp(IntPredicate::IntULT, reg_count_v, bx.const_u64(max_regs));
bx.cond_br(use_regs, in_reg, in_mem);
// Emit code to load the value if it was passed in a register.
bx.switch_to_block(in_reg);
// Work out the address of the value in the register save area.
let reg_ptr =
bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 3));
let reg_ptr_v = bx.load(bx.type_i8p(), reg_ptr, bx.tcx().data_layout.pointer_align.abi);
let scaled_reg_count = bx.mul(reg_count_v, bx.const_u64(8));
let reg_off = bx.add(scaled_reg_count, bx.const_u64(reg_save_index * 8 + reg_padding));
let reg_addr = bx.gep(bx.type_i8(), reg_ptr_v, &[reg_off]);
// Update the register count.
let new_reg_count_v = bx.add(reg_count_v, bx.const_u64(1));
bx.store(new_reg_count_v, reg_count, Align::from_bytes(8).unwrap());
bx.br(end);
// Emit code to load the value if it was passed in memory.
bx.switch_to_block(in_mem);
// Work out the address of the value in the argument overflow area.
let arg_ptr =
bx.struct_gep(va_list_ty, va_list_addr, va_list_layout.llvm_field_index(bx.cx, 2));
let arg_ptr_v = bx.load(bx.type_i8p(), arg_ptr, bx.tcx().data_layout.pointer_align.abi);
let arg_off = bx.const_u64(padding);
let mem_addr = bx.gep(bx.type_i8(), arg_ptr_v, &[arg_off]);
// Update the argument overflow area pointer.
let arg_size = bx.cx().const_u64(padded_size);
let new_arg_ptr_v = bx.inbounds_gep(bx.type_i8(), arg_ptr_v, &[arg_size]);
bx.store(new_arg_ptr_v, arg_ptr, bx.tcx().data_layout.pointer_align.abi);
bx.br(end);
// Return the appropriate result.
bx.switch_to_block(end);
let val_addr = bx.phi(bx.type_i8p(), &[reg_addr, mem_addr], &[in_reg, in_mem]);
let val_type = layout.llvm_type(bx);
let val_addr = if indirect {
let ptr_type = bx.cx.type_ptr_to(val_type);
let ptr_addr = bx.bitcast(val_addr, bx.cx.type_ptr_to(ptr_type));
bx.load(ptr_type, ptr_addr, bx.tcx().data_layout.pointer_align.abi)
} else {
bx.bitcast(val_addr, bx.cx.type_ptr_to(val_type))
};
bx.load(val_type, val_addr, layout.align.abi)
}
pub(super) fn emit_va_arg<'ll, 'tcx>(
bx: &mut Builder<'_, 'll, 'tcx>,
addr: OperandRef<'tcx, &'ll Value>,
@ -200,6 +283,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true)
}
"aarch64" => emit_aapcs_va_arg(bx, addr, target_ty),
"s390x" => emit_s390x_va_arg(bx, addr, target_ty),
// Windows x86_64
"x86_64" if target.is_like_windows => {
let target_ty_size = bx.cx.size_of(target_ty).bytes();

View File

@ -123,7 +123,7 @@ fn try_filter_fat_archs<'a>(
) -> io::Result<Option<(&'a [u8], u64)>> {
let archs = archs.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
let desired = match archs.iter().filter(|a| a.architecture() == target_arch).next() {
let desired = match archs.iter().find(|a| a.architecture() == target_arch) {
Some(a) => a,
None => return Ok(None),
};

View File

@ -253,7 +253,7 @@ pub fn each_linked_rlib(
};
for &cnum in crates {
match fmts.get(cnum.as_usize() - 1) {
Some(&Linkage::NotLinked | &Linkage::IncludedFromDylib) => continue,
Some(&Linkage::NotLinked | &Linkage::Dynamic | &Linkage::IncludedFromDylib) => continue,
Some(_) => {}
None => return Err(errors::LinkRlibError::MissingFormat),
}
@ -607,21 +607,21 @@ struct ThorinSession<Relocations> {
}
impl<Relocations> ThorinSession<Relocations> {
fn alloc_mmap<'arena>(&'arena self, data: Mmap) -> &'arena Mmap {
fn alloc_mmap(&self, data: Mmap) -> &Mmap {
(*self.arena_mmap.alloc(data)).borrow()
}
}
impl<Relocations> thorin::Session<Relocations> for ThorinSession<Relocations> {
fn alloc_data<'arena>(&'arena self, data: Vec<u8>) -> &'arena [u8] {
fn alloc_data(&self, data: Vec<u8>) -> &[u8] {
(*self.arena_data.alloc(data)).borrow()
}
fn alloc_relocation<'arena>(&'arena self, data: Relocations) -> &'arena Relocations {
fn alloc_relocation(&self, data: Relocations) -> &Relocations {
(*self.arena_relocations.alloc(data)).borrow()
}
fn read_input<'arena>(&'arena self, path: &Path) -> std::io::Result<&'arena [u8]> {
fn read_input(&self, path: &Path) -> std::io::Result<&[u8]> {
let file = File::open(&path)?;
let mmap = (unsafe { Mmap::map(file) })?;
Ok(self.alloc_mmap(mmap))
@ -722,7 +722,7 @@ fn link_natively<'a>(
linker::disable_localization(&mut cmd);
for &(ref k, ref v) in sess.target.link_env.as_ref() {
for (k, v) in sess.target.link_env.as_ref() {
cmd.env(k.as_ref(), v.as_ref());
}
for k in sess.target.link_env_remove.as_ref() {

View File

@ -108,7 +108,7 @@ pub fn get_linker<'a>(
if sess.target.is_like_msvc {
if let Some(ref tool) = msvc_tool {
cmd.args(tool.args());
for &(ref k, ref v) in tool.env() {
for (k, v) in tool.env() {
if k == "PATH" {
new_path.extend(env::split_paths(v));
msvc_changed_path = true;

View File

@ -163,10 +163,10 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b
tcx.reachable_non_generics(def_id.krate).contains_key(&def_id)
}
fn exported_symbols_provider_local<'tcx>(
tcx: TyCtxt<'tcx>,
fn exported_symbols_provider_local(
tcx: TyCtxt<'_>,
cnum: CrateNum,
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
) -> &[(ExportedSymbol<'_>, SymbolExportInfo)] {
assert_eq!(cnum, LOCAL_CRATE);
if !tcx.sess.opts.output_types.should_codegen() {

View File

@ -10,7 +10,7 @@
/// NOTE: This is somewhat inconsistent right now: For empty enums and enums with a single
/// fieldless variant, we generate DW_TAG_struct_type, although a
/// DW_TAG_enumeration_type would be a better fit.
pub fn wants_c_like_enum_debuginfo<'tcx>(enum_type_and_layout: TyAndLayout<'tcx>) -> bool {
pub fn wants_c_like_enum_debuginfo(enum_type_and_layout: TyAndLayout<'_>) -> bool {
match enum_type_and_layout.ty.kind() {
ty::Adt(adt_def, _) => {
if !adt_def.is_enum() {

View File

@ -29,6 +29,9 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let align = meth::VirtualIndex::from_index(ty::COMMON_VTABLE_ENTRIES_ALIGN)
.get_usize(bx, vtable);
// Size is always <= isize::MAX.
let size_bound = bx.data_layout().ptr_sized_integer().signed_max() as u128;
bx.range_metadata(size, WrappingRange { start: 0, end: size_bound });
// Alignment is always nonzero.
bx.range_metadata(align, WrappingRange { start: 1, end: !0 });

View File

@ -65,7 +65,7 @@ pub fn get_usize<Bx: BuilderMethods<'a, 'tcx>>(
/// This takes a valid `self` receiver type and extracts the principal trait
/// ref of the type.
fn expect_dyn_trait_in_self<'tcx>(ty: Ty<'tcx>) -> ty::PolyExistentialTraitRef<'tcx> {
fn expect_dyn_trait_in_self(ty: Ty<'_>) -> ty::PolyExistentialTraitRef<'_> {
for arg in ty.peel_refs().walk() {
if let GenericArgKind::Type(ty) = arg.unpack() {
if let ty::Dynamic(data, _, _) = ty.kind() {

View File

@ -663,12 +663,12 @@ fn codegen_panic_intrinsic(
enum AssertIntrinsic {
Inhabited,
ZeroValid,
UninitValid,
MemUninitializedValid,
}
let panic_intrinsic = intrinsic.and_then(|i| match i {
sym::assert_inhabited => Some(AssertIntrinsic::Inhabited),
sym::assert_zero_valid => Some(AssertIntrinsic::ZeroValid),
sym::assert_uninit_valid => Some(AssertIntrinsic::UninitValid),
sym::assert_mem_uninitialized_valid => Some(AssertIntrinsic::MemUninitializedValid),
_ => None,
});
if let Some(intrinsic) = panic_intrinsic {
@ -679,7 +679,7 @@ enum AssertIntrinsic {
let do_panic = match intrinsic {
Inhabited => layout.abi.is_uninhabited(),
ZeroValid => !bx.tcx().permits_zero_init(layout),
UninitValid => !bx.tcx().permits_uninit_init(layout),
MemUninitializedValid => !bx.tcx().permits_uninit_init(layout),
};
Some(if do_panic {
let msg_str = with_no_visible_paths!({

View File

@ -110,10 +110,16 @@ pub fn codegen_intrinsic_call(
_ => bug!(),
};
let value = meth::VirtualIndex::from_index(idx).get_usize(bx, vtable);
if name == sym::vtable_align {
match name {
// Size is always <= isize::MAX.
sym::vtable_size => {
let size_bound = bx.data_layout().ptr_sized_integer().signed_max() as u128;
bx.range_metadata(value, WrappingRange { start: 0, end: size_bound });
},
// Alignment is always nonzero.
bx.range_metadata(value, WrappingRange { start: 1, end: !0 });
};
sym::vtable_align => bx.range_metadata(value, WrappingRange { start: 1, end: !0 }),
_ => {}
}
value
}
sym::pref_align_of

View File

@ -419,7 +419,7 @@ pub fn from_target_feature(
/// Computes the set of target features used in a function for the purposes of
/// inline assembly.
fn asm_target_features<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx FxHashSet<Symbol> {
fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxHashSet<Symbol> {
let mut target_features = tcx.sess.unstable_target_features.clone();
if tcx.def_kind(did).has_codegen_attrs() {
let attrs = tcx.codegen_fn_attrs(did);

View File

@ -332,7 +332,7 @@ fn unsize_into_ptr(
Immediate::new_slice(ptr, length.eval_usize(*self.tcx, self.param_env), self);
self.write_immediate(val, dest)
}
(&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
(ty::Dynamic(data_a, ..), ty::Dynamic(data_b, ..)) => {
let val = self.read_immediate(src)?;
if data_a.principal() == data_b.principal() {
// A NOP cast that doesn't actually change anything, should be allowed even with mismatching vtables.

View File

@ -303,7 +303,7 @@ pub fn emulate_intrinsic(
}
sym::offset => {
let ptr = self.read_pointer(&args[0])?;
let offset_count = self.read_scalar(&args[1])?.to_machine_isize(self)?;
let offset_count = self.read_machine_isize(&args[1])?;
let pointee_ty = substs.type_at(0);
let offset_ptr = self.ptr_offset_inbounds(ptr, pointee_ty, offset_count)?;
@ -311,7 +311,7 @@ pub fn emulate_intrinsic(
}
sym::arith_offset => {
let ptr = self.read_pointer(&args[0])?;
let offset_count = self.read_scalar(&args[1])?.to_machine_isize(self)?;
let offset_count = self.read_machine_isize(&args[1])?;
let pointee_ty = substs.type_at(0);
let pointee_size = i64::try_from(self.layout_of(pointee_ty)?.size.bytes()).unwrap();
@ -428,7 +428,9 @@ pub fn emulate_intrinsic(
sym::transmute => {
self.copy_op(&args[0], dest, /*allow_transmute*/ true)?;
}
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_mem_uninitialized_valid => {
let ty = instance.substs.type_at(0);
let layout = self.layout_of(ty)?;
@ -460,7 +462,7 @@ pub fn emulate_intrinsic(
}
}
if intrinsic_name == sym::assert_uninit_valid {
if intrinsic_name == sym::assert_mem_uninitialized_valid {
let should_panic = !self.tcx.permits_uninit_init(layout);
if should_panic {
@ -668,7 +670,7 @@ pub(crate) fn copy_intrinsic(
count: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>,
nonoverlapping: bool,
) -> InterpResult<'tcx> {
let count = self.read_scalar(&count)?.to_machine_usize(self)?;
let count = self.read_machine_usize(&count)?;
let layout = self.layout_of(src.layout.ty.builtin_deref(true).unwrap().ty)?;
let (size, align) = (layout.size, layout.align.abi);
// `checked_mul` enforces a too small bound (the correct one would probably be machine_isize_max),
@ -696,7 +698,7 @@ pub(crate) fn write_bytes_intrinsic(
let dst = self.read_pointer(&dst)?;
let byte = self.read_scalar(&byte)?.to_u8()?;
let count = self.read_scalar(&count)?.to_machine_usize(self)?;
let count = self.read_machine_usize(&count)?;
// `checked_mul` enforces a too small bound (the correct one would probably be machine_isize_max),
// but no actual allocation can be big enough for the difference to be noticeable.

View File

@ -39,7 +39,7 @@ pub enum Immediate<Prov: Provenance = AllocId> {
impl<Prov: Provenance> From<Scalar<Prov>> for Immediate<Prov> {
#[inline(always)]
fn from(val: Scalar<Prov>) -> Self {
Immediate::Scalar(val.into())
Immediate::Scalar(val)
}
}
@ -53,7 +53,7 @@ pub fn from_maybe_pointer(p: Pointer<Option<Prov>>, cx: &impl HasDataLayout) ->
}
pub fn new_slice(val: Scalar<Prov>, len: u64, cx: &impl HasDataLayout) -> Self {
Immediate::ScalarPair(val.into(), Scalar::from_machine_usize(len, cx).into())
Immediate::ScalarPair(val, Scalar::from_machine_usize(len, cx))
}
pub fn new_dyn_trait(
@ -61,7 +61,7 @@ pub fn new_dyn_trait(
vtable: Pointer<Option<Prov>>,
cx: &impl HasDataLayout,
) -> Self {
Immediate::ScalarPair(val.into(), Scalar::from_maybe_pointer(vtable, cx))
Immediate::ScalarPair(val, Scalar::from_maybe_pointer(vtable, cx))
}
#[inline]
@ -341,10 +341,7 @@ fn read_immediate_from_mplace_raw(
alloc_range(b_offset, b_size),
/*read_provenance*/ b.is_ptr(),
)?;
Some(ImmTy {
imm: Immediate::ScalarPair(a_val.into(), b_val.into()),
layout: mplace.layout,
})
Some(ImmTy { imm: Immediate::ScalarPair(a_val, b_val), layout: mplace.layout })
}
_ => {
// Neither a scalar nor scalar pair.
@ -407,6 +404,9 @@ pub fn read_scalar(
Ok(self.read_immediate(op)?.to_scalar())
}
// Pointer-sized reads are fairly common and need target layout access, so we wrap them in
// convenience functions.
/// Read a pointer from a place.
pub fn read_pointer(
&self,
@ -414,6 +414,14 @@ pub fn read_pointer(
) -> InterpResult<'tcx, Pointer<Option<M::Provenance>>> {
self.read_scalar(op)?.to_pointer(self)
}
/// Read a pointer-sized unsigned integer from a place.
pub fn read_machine_usize(&self, op: &OpTy<'tcx, M::Provenance>) -> InterpResult<'tcx, u64> {
self.read_scalar(op)?.to_machine_usize(self)
}
/// Read a pointer-sized signed integer from a place.
pub fn read_machine_isize(&self, op: &OpTy<'tcx, M::Provenance>) -> InterpResult<'tcx, i64> {
self.read_scalar(op)?.to_machine_isize(self)
}
/// Turn the wide MPlace into a string (must already be dereferenced!)
pub fn read_str(&self, mplace: &MPlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx, &str> {
@ -569,8 +577,10 @@ fn eval_ty_constant(
ty::ConstKind::Unevaluated(uv) => {
let instance = self.resolve(uv.def, uv.substs)?;
let cid = GlobalId { instance, promoted: None };
self.ctfe_query(span, |tcx| tcx.eval_to_valtree(self.param_env.and(cid)))?
.unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}"))
self.ctfe_query(span, |tcx| {
tcx.eval_to_valtree(self.param_env.with_const().and(cid))
})?
.unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}"))
}
ty::ConstKind::Bound(..) | ty::ConstKind::Infer(..) => {
span_bug!(self.cur_span(), "unexpected ConstKind in ctfe: {val:?}")

View File

@ -36,7 +36,7 @@ pub fn binop_with_overflow(
if let Abi::ScalarPair(..) = dest.layout.abi {
// We can use the optimized path and avoid `place_field` (which might do
// `force_allocation`).
let pair = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
let pair = Immediate::ScalarPair(val, Scalar::from_bool(overflowed));
self.write_immediate(pair, dest)?;
} else {
assert!(self.tcx.sess.opts.unstable_opts.randomize_layout);

View File

@ -141,7 +141,7 @@ pub fn to_ref(self, cx: &impl HasDataLayout) -> Immediate<Prov> {
match self.meta {
MemPlaceMeta::None => Immediate::from(Scalar::from_maybe_pointer(self.ptr, cx)),
MemPlaceMeta::Meta(meta) => {
Immediate::ScalarPair(Scalar::from_maybe_pointer(self.ptr, cx).into(), meta.into())
Immediate::ScalarPair(Scalar::from_maybe_pointer(self.ptr, cx), meta)
}
}
}

View File

@ -363,7 +363,7 @@ pub fn place_projection(
Index(local) => {
let layout = self.layout_of(self.tcx.types.usize)?;
let n = self.local_to_op(self.frame(), local, Some(layout))?;
let n = self.read_scalar(&n)?.to_machine_usize(self)?;
let n = self.read_machine_usize(&n)?;
self.place_index(base, n)?
}
ConstantIndex { offset, min_length, from_end } => {
@ -392,7 +392,7 @@ pub fn operand_projection(
Index(local) => {
let layout = self.layout_of(self.tcx.types.usize)?;
let n = self.local_to_op(self.frame(), local, Some(layout))?;
let n = self.read_scalar(&n)?.to_machine_usize(self)?;
let n = self.read_machine_usize(&n)?;
self.operand_index(base, n)?
}
ConstantIndex { offset, min_length, from_end } => {

View File

@ -119,11 +119,20 @@ pub(super) fn eval_terminator(
}
Drop { place, target, unwind } => {
let place = self.eval_place(place)?;
let ty = place.layout.ty;
trace!("TerminatorKind::drop: {:?}, type {}", place, ty);
let frame = self.frame();
let ty = place.ty(&frame.body.local_decls, *self.tcx).ty;
let ty = self.subst_from_frame_and_normalize_erasing_regions(frame, ty)?;
let instance = Instance::resolve_drop_in_place(*self.tcx, ty);
if let ty::InstanceDef::DropGlue(_, None) = instance.def {
// This is the branch we enter if and only if the dropped type has no drop glue
// whatsoever. This can happen as a result of monomorphizing a drop of a
// generic. In order to make sure that generic and non-generic code behaves
// roughly the same (and in keeping with Mir semantics) we do nothing here.
self.go_to_block(target);
return Ok(());
}
let place = self.eval_place(place)?;
trace!("TerminatorKind::drop: {:?}, type {}", place, ty);
self.drop_in_place(&place, instance, target, unwind)?;
}

View File

@ -9,8 +9,8 @@
use rustc_middle::mir::{
traversal, AggregateKind, BasicBlock, BinOp, Body, BorrowKind, CastKind, CopyNonOverlapping,
Local, Location, MirPass, MirPhase, NonDivergingIntrinsic, Operand, Place, PlaceElem, PlaceRef,
ProjectionElem, RuntimePhase, Rvalue, SourceScope, Statement, StatementKind, Terminator,
TerminatorKind, UnOp, START_BLOCK,
ProjectionElem, RetagKind, RuntimePhase, Rvalue, SourceScope, Statement, StatementKind,
Terminator, TerminatorKind, UnOp, START_BLOCK,
};
use rustc_middle::ty::{self, InstanceDef, ParamEnv, Ty, TyCtxt, TypeVisitable};
use rustc_mir_dataflow::impls::MaybeStorageLive;
@ -667,10 +667,13 @@ fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
self.fail(location, "`Deinit`is not allowed until deaggregation");
}
}
StatementKind::Retag(_, _) => {
StatementKind::Retag(kind, _) => {
// FIXME(JakobDegen) The validator should check that `self.mir_phase <
// DropsLowered`. However, this causes ICEs with generation of drop shims, which
// seem to fail to set their `MirPhase` correctly.
if *kind == RetagKind::Raw || *kind == RetagKind::TwoPhase {
self.fail(location, format!("explicit `{:?}` is forbidden", kind));
}
}
StatementKind::StorageLive(..)
| StatementKind::StorageDead(..)

View File

@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
arrayvec = { version = "0.7", default-features = false }
bitflags = "1.2.1"
cfg-if = "0.1.2"
cfg-if = "1.0"
ena = "0.14"
indexmap = { version = "1.9.1" }
jobserver_crate = { version = "0.1.13", package = "jobserver" }
@ -21,7 +21,11 @@ rustc-hash = "1.1.0"
rustc_index = { path = "../rustc_index", package = "rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
smallvec = { version = "1.8.1", features = ["const_generics", "union", "may_dangle"] }
smallvec = { version = "1.8.1", features = [
"const_generics",
"union",
"may_dangle",
] }
stable_deref_trait = "1.0.0"
stacker = "0.1.15"
tempfile = "3.2"

View File

@ -22,7 +22,7 @@ struct PreOrderFrame<Iter> {
}
rustc_index::newtype_index! {
struct PreorderIndex { .. }
struct PreorderIndex {}
}
pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {

View File

@ -205,10 +205,7 @@ fn cold_call<F>(profiler_ref: &SelfProfilerRef, f: F) -> TimingGuard<'_>
/// VerboseTimingGuard returned from this call is dropped. In addition to recording
/// a measureme event, "verbose" generic activities also print a timing entry to
/// stderr if the compiler is invoked with -Ztime-passes.
pub fn verbose_generic_activity<'a>(
&'a self,
event_label: &'static str,
) -> VerboseTimingGuard<'a> {
pub fn verbose_generic_activity(&self, event_label: &'static str) -> VerboseTimingGuard<'_> {
let message =
if self.print_verbose_generic_activities { Some(event_label.to_owned()) } else { None };
@ -216,11 +213,11 @@ pub fn verbose_generic_activity<'a>(
}
/// Like `verbose_generic_activity`, but with an extra arg.
pub fn verbose_generic_activity_with_arg<'a, A>(
&'a self,
pub fn verbose_generic_activity_with_arg<A>(
&self,
event_label: &'static str,
event_arg: A,
) -> VerboseTimingGuard<'a>
) -> VerboseTimingGuard<'_>
where
A: Borrow<str> + Into<String>,
{

View File

@ -199,7 +199,7 @@ pub fn postdom_upper_bound(&self, a: T, b: T) -> Option<T> {
/// Viewing the relation as a graph, computes the "mutual
/// immediate postdominator" of a set of points (if one
/// exists). See `postdom_upper_bound` for details.
pub fn mutual_immediate_postdominator<'a>(&'a self, mut mubs: Vec<T>) -> Option<T> {
pub fn mutual_immediate_postdominator(&self, mut mubs: Vec<T>) -> Option<T> {
loop {
match mubs.len() {
0 => return None,

View File

@ -178,7 +178,7 @@ pub fn contains<Q: ?Sized>(&self, v: &Q) -> bool
}
#[inline]
pub fn items<'a>(&'a self) -> UnordItems<&'a V, impl Iterator<Item = &'a V>> {
pub fn items(&self) -> UnordItems<&V, impl Iterator<Item = &V>> {
UnordItems(self.inner.iter())
}
@ -255,7 +255,7 @@ pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
}
#[inline]
pub fn items<'a>(&'a self) -> UnordItems<(&'a K, &'a V), impl Iterator<Item = (&'a K, &'a V)>> {
pub fn items(&self) -> UnordItems<(&K, &V), impl Iterator<Item = (&K, &V)>> {
UnordItems(self.inner.iter())
}
@ -311,7 +311,7 @@ pub fn push(&mut self, v: V) {
}
#[inline]
pub fn items<'a>(&'a self) -> UnordItems<&'a V, impl Iterator<Item = &'a V>> {
pub fn items(&self) -> UnordItems<&V, impl Iterator<Item = &V>> {
UnordItems(self.inner.iter())
}

View File

@ -1199,10 +1199,13 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
};
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
(*DEFAULT_HOOK)(info);
// Don't do this for `ExplicitBug`, which has an unhelpful message and backtrace.
if !info.payload().is::<rustc_errors::ExplicitBug>() {
(*DEFAULT_HOOK)(info);
// Separate the output with an empty line
eprintln!();
// Separate the output with an empty line
eprintln!();
}
// Print the ICE message
report_ice(info, BUG_REPORT_URL);

View File

@ -163,6 +163,7 @@
E0312: include_str!("./error_codes/E0312.md"),
E0316: include_str!("./error_codes/E0316.md"),
E0317: include_str!("./error_codes/E0317.md"),
E0320: include_str!("./error_codes/E0320.md"),
E0321: include_str!("./error_codes/E0321.md"),
E0322: include_str!("./error_codes/E0322.md"),
E0323: include_str!("./error_codes/E0323.md"),
@ -183,6 +184,7 @@
E0374: include_str!("./error_codes/E0374.md"),
E0375: include_str!("./error_codes/E0375.md"),
E0376: include_str!("./error_codes/E0376.md"),
E0377: include_str!("./error_codes/E0377.md"),
E0378: include_str!("./error_codes/E0378.md"),
E0379: include_str!("./error_codes/E0379.md"),
E0380: include_str!("./error_codes/E0380.md"),
@ -238,13 +240,17 @@
E0453: include_str!("./error_codes/E0453.md"),
E0454: include_str!("./error_codes/E0454.md"),
E0455: include_str!("./error_codes/E0455.md"),
E0457: include_str!("./error_codes/E0457.md"),
E0458: include_str!("./error_codes/E0458.md"),
E0459: include_str!("./error_codes/E0459.md"),
E0460: include_str!("./error_codes/E0460.md"),
E0462: include_str!("./error_codes/E0462.md"),
E0463: include_str!("./error_codes/E0463.md"),
E0464: include_str!("./error_codes/E0464.md"),
E0466: include_str!("./error_codes/E0466.md"),
E0468: include_str!("./error_codes/E0468.md"),
E0469: include_str!("./error_codes/E0469.md"),
E0472: include_str!("./error_codes/E0472.md"),
E0477: include_str!("./error_codes/E0477.md"),
E0478: include_str!("./error_codes/E0478.md"),
E0482: include_str!("./error_codes/E0482.md"),
@ -575,10 +581,7 @@
// E0314, // closure outlives stack frame
// E0315, // cannot invoke closure outside of its lifetime
// E0319, // trait impls for defaulted traits allowed just for structs/enums
E0320, // recursive overflow during dropck
// E0372, // coherence not object safe
E0377, // the trait `CoerceUnsized` may only be implemented for a coercion
// between structures with the same definition
// E0385, // {} in an aliasable location
// E0402, // cannot use an outer type parameter in this context
// E0406, // merged into 420
@ -592,15 +595,11 @@
// E0421, // merged into 531
// E0427, // merged into 530
// E0456, // plugin `..` is not available for triple `..`
E0457, // plugin `..` only found in rlib format, but must be available...
E0460, // found possibly newer version of crate `..`
E0461, // couldn't find crate `..` with expected target triple ..
E0462, // found staticlib `..` instead of rlib or dylib
E0465, // multiple .. candidates for `..` found
// E0467, // removed
// E0470, // removed
// E0471, // constant evaluation error (in pattern)
E0472, // llvm_asm! is unsupported on this target
// E0473, // dereference of reference outside its lifetime
// E0474, // captured variable `..` does not outlive the enclosing closure
// E0475, // index of slice outside its lifetime

View File

@ -1,38 +1,53 @@
An associated const has been referenced in a pattern.
An associated `const`, `const` parameter or `static` has been referenced
in a pattern.
Erroneous code example:
```compile_fail,E0158
enum EFoo { A, B, C, D }
trait Foo {
const X: EFoo;
enum Foo {
One,
Two
}
fn test<A: Foo>(arg: EFoo) {
trait Bar {
const X: Foo;
}
fn test<A: Bar>(arg: Foo) {
match arg {
A::X => { // error!
println!("A::X");
}
A::X => println!("A::X"), // error: E0158: associated consts cannot be
// referenced in patterns
Foo::Two => println!("Two")
}
}
```
`const` and `static` mean different things. A `const` is a compile-time
constant, an alias for a literal value. This property means you can match it
directly within a pattern.
Associated `const`s cannot be referenced in patterns because it is impossible
for the compiler to prove exhaustiveness (that some pattern will always match).
Take the above example, because Rust does type checking in the *generic*
method, not the *monomorphized* specific instance. So because `Bar` could have
theoretically infinite implementations, there's no way to always be sure that
`A::X` is `Foo::One`. So this code must be rejected. Even if code can be
proven exhaustive by a programmer, the compiler cannot currently prove this.
The `static` keyword, on the other hand, guarantees a fixed location in memory.
This does not always mean that the value is constant. For example, a global
mutex can be declared `static` as well.
The same holds true of `const` parameters and `static`s.
If you want to match against a `static`, consider using a guard instead:
If you want to match against an associated `const`, `const` parameter or
`static` consider using a guard instead:
```
static FORTY_TWO: i32 = 42;
trait Trait {
const X: char;
}
match Some(42) {
Some(x) if x == FORTY_TWO => {}
_ => {}
static FOO: char = 'j';
fn test<A: Trait, const Y: char>(arg: char) {
match arg {
c if c == A::X => println!("A::X"),
c if c == Y => println!("Y"),
c if c == FOO => println!("FOO"),
_ => ()
}
}
```

View File

@ -0,0 +1,27 @@
Recursion limit reached while creating drop-check rules.
Example of erroneous code:
```compile_fail,E0320
enum A<T> {
B,
C(T, Box<A<(T, T)>>)
}
fn foo<T>() {
A::<T>::B; // error: overflow while adding drop-check rules for A<T>
}
```
The Rust compiler must be able to reason about how a type is [`Drop`]ped, and
by extension the types of its fields, to be able to generate the glue to
properly drop a value. The code example above shows a type where this inference
is impossible because it is recursive. Note that this is *not* the same as
[E0072](E0072.html), where a type has an infinite size; the type here has a
finite size but any attempt to `Drop` it would recurse infinitely. For more
information, read [the `Drop` docs](../std/ops/trait.Drop.html).
It is not possible to define a type with recursive drop-check rules. All such
recursion must be removed.
[`Drop`]: ../std/ops/trait.Drop.html

View File

@ -0,0 +1,29 @@
The trait `CoerceUnsized` may only be implemented for a coercion between
structures with the same definition.
Example of erroneous code:
```compile_fail,E0377
#![feature(coerce_unsized)]
use std::ops::CoerceUnsized;
pub struct Foo<T: ?Sized> {
field_with_unsized_type: T,
}
pub struct Bar<T: ?Sized> {
field_with_unsized_type: T,
}
// error: the trait `CoerceUnsized` may only be implemented for a coercion
// between structures with the same definition
impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
```
When attempting to implement `CoerceUnsized`, the `impl` signature must look
like: `impl CoerceUnsized<Type<U>> for Type<T> where T: CoerceUnsized<U>`;
the *implementer* and *`CoerceUnsized` type parameter* must be the same
type. In this example, `Bar` and `Foo` (even though structurally identical)
are *not* the same type and are rejected. Learn more about the `CoerceUnsized`
trait and DST coercion in
[the `CoerceUnsized` docs](../std/ops/trait.CoerceUnsized.html).

View File

@ -0,0 +1,36 @@
Plugin `..` only found in rlib format, but must be available in dylib format.
Erroronous code example:
`rlib-plugin.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_type = "rlib"]
#![feature(rustc_private)]
extern crate rustc_middle;
extern crate rustc_driver;
use rustc_driver::plugin::Registry;
#[no_mangle]
fn __rustc_plugin_registrar(_: &mut Registry) {}
```
`main.rs`
```ignore (needs-linkage-with-other-tests)
#![feature(plugin)]
#![plugin(rlib_plugin)] // error: plugin `rlib_plugin` only found in rlib
// format, but must be available in dylib
fn main() {}
```
The compiler exposes a plugin interface to allow altering the compile process
(adding lints, etc). Plugins must be defined in their own crates (similar to
[proc-macro](../reference/procedural-macros.html) isolation) and then compiled
and linked to another crate. Plugin crates *must* be compiled to the
dynamically-linked dylib format, and not the statically-linked rlib format.
Learn more about different output types in
[this section](../reference/linkage.html) of the Rust reference.
This error is easily fixed by recompiling the plugin crate in the dylib format.

View File

@ -0,0 +1,71 @@
Found possibly newer version of crate `..` which `..` depends on.
Consider these erroneous files:
`a1.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "a"]
pub fn foo<T>() {}
```
`a2.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "a"]
pub fn foo<T>() {
println!("foo<T>()");
}
```
`b.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "b"]
extern crate a; // linked with `a1.rs`
pub fn foo() {
a::foo::<isize>();
}
```
`main.rs`
```ignore (needs-linkage-with-other-tests)
extern crate a; // linked with `a2.rs`
extern crate b; // error: found possibly newer version of crate `a` which `b`
// depends on
fn main() {}
```
The dependency graph of this program can be represented as follows:
```text
crate `main`
|
+-------------+
| |
| v
depends: | crate `b`
`a` v1 | |
| | depends:
| | `a` v2
v |
crate `a` <------+
```
Crate `main` depends on crate `a` (version 1) and crate `b` which in turn
depends on crate `a` (version 2); this discrepancy in versions cannot be
reconciled. This difference in versions typically occurs when one crate is
compiled and linked, then updated and linked to another crate. The crate
"version" is a SVH (Strict Version Hash) of the crate in an
implementation-specific way. Note that this error can *only* occur when
directly compiling and linking with `rustc`; [Cargo] automatically resolves
dependencies, without using the compiler's own dependency management that
causes this issue.
This error can be fixed by:
* Using [Cargo], the Rust package manager, automatically fixing this issue.
* Recompiling crate `a` so that both crate `b` and `main` have a uniform
version to depend on.
[Cargo]: ../cargo/index.html

View File

@ -0,0 +1,32 @@
Found `staticlib` `..` instead of `rlib` or `dylib`.
Consider the following two files:
`a.rs`
```ignore (cannot-link-with-other-tests)
#![crate_type = "staticlib"]
fn foo() {}
```
`main.rs`
```ignore (cannot-link-with-other-tests)
extern crate a;
fn main() {
a::foo();
}
```
Crate `a` is compiled as a `staticlib`. A `staticlib` is a system-dependant
library only intended for linking with non-Rust applications (C programs). Note
that `staticlib`s include all upstream dependencies (`core`, `std`, other user
dependencies, etc) which makes them significantly larger than `dylib`s:
prefer `staticlib` for linking with C programs. Learn more about different
`crate_type`s in [this section of the Reference](../reference/linkage.html).
This error can be fixed by:
* Using [Cargo](../cargo/index.html), the Rust package manager, automatically
fixing this issue.
* Recompiling the crate as a `rlib` or `dylib`; formats suitable for Rust
linking.

View File

@ -0,0 +1,31 @@
Inline assembly (`asm!`) is not supported on this target.
Example of erroneous code:
```ignore (cannot-change-target)
// compile-flags: --target sparc64-unknown-linux-gnu
#![no_std]
use core::arch::asm;
fn main() {
unsafe {
asm!(""); // error: inline assembly is not supported on this target
}
}
```
The Rust compiler does not support inline assembly, with the `asm!` macro
(previously `llvm_asm!`), for all targets. All Tier 1 targets do support this
macro but support among Tier 2 and 3 targets is not guaranteed (even when they
have `std` support). Note that this error is related to
`error[E0658]: inline assembly is not stable yet on this architecture`, but
distinct in that with `E0472` support is not planned or in progress.
There is no way to easily fix this issue, however:
* Consider if you really need inline assembly, is there some other way to
achieve your goal (intrinsics, etc)?
* Consider writing your assembly externally, linking with it and calling it
from Rust.
* Consider contributing to <https://github.com/rust-lang/rust> and help
integrate support for your target!

View File

@ -17,9 +17,6 @@ codegen_llvm_instrument_coverage_requires_llvm_12 =
codegen_llvm_symbol_already_defined =
symbol `{$symbol_name}` is already defined
codegen_llvm_branch_protection_requires_aarch64 =
-Zbranch-protection is only supported on aarch64
codegen_llvm_invalid_minimum_alignment =
invalid minimum global alignment: {$err}

View File

@ -350,6 +350,9 @@ lint_builtin_mutable_transmutes =
lint_builtin_unstable_features = unstable feature
lint_ungated_async_fn_track_caller = `#[track_caller]` on async functions is a no-op
.label = this function will not propagate the caller location
lint_builtin_unreachable_pub = unreachable `pub` {$what}
.suggestion = consider restricting its visibility
.help = or consider exporting it for use by other crates

View File

@ -166,12 +166,6 @@ metadata_conflicting_alloc_error_handler =
metadata_global_alloc_required =
no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
metadata_alloc_func_required =
`#[alloc_error_handler]` function required, but not found
metadata_missing_alloc_error_handler =
use `#![feature(default_alloc_error_handler)]` for a default error handler
metadata_no_transitive_needs_dep =
the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`

View File

@ -0,0 +1,301 @@
mir_build_unconditional_recursion = function cannot return without recursing
.label = cannot return without recursing
.help = a `loop` may express intention better if this is on purpose
mir_build_unconditional_recursion_call_site_label = recursive call site
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe =
call to unsafe function `{$function}` is unsafe and requires unsafe block (error E0133)
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless =
call to unsafe function is unsafe and requires unsafe block (error E0133)
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe =
use of inline assembly is unsafe and requires unsafe block (error E0133)
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe
block (error E0133)
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe =
use of mutable static is unsafe and requires unsafe block (error E0133)
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe =
use of extern static is unsafe and requires unsafe block (error E0133)
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe =
dereference of raw pointer is unsafe and requires unsafe block (error E0133)
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe =
access to union field is unsafe and requires unsafe block (error E0133)
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe =
mutation of layout constrained field is unsafe and requires unsafe block (error E0133)
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block (error E0133)
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
.note = can only be called if the required target features are available
.label = call to function with `#[target_feature]`
mir_build_call_to_unsafe_fn_requires_unsafe =
call to unsafe function `{$function}` is unsafe and requires unsafe block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_call_to_unsafe_fn_requires_unsafe_nameless =
call to unsafe function is unsafe and requires unsafe block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
call to unsafe function `{$function}` is unsafe and requires unsafe function or block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_call_to_unsafe_fn_requires_unsafe_nameless_unsafe_op_in_unsafe_fn_allowed =
call to unsafe function is unsafe and requires unsafe function or block
.note = consult the function's documentation for information on how to avoid undefined behavior
.label = call to unsafe function
mir_build_inline_assembly_requires_unsafe =
use of inline assembly is unsafe and requires unsafe block
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of inline assembly is unsafe and requires unsafe function or block
.note = inline assembly is entirely unchecked and can cause undefined behavior
.label = use of inline assembly
mir_build_initializing_type_with_requires_unsafe =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe block
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
mir_build_initializing_type_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
.note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
.label = initializing type with `rustc_layout_scalar_valid_range` attr
mir_build_mutable_static_requires_unsafe =
use of mutable static is unsafe and requires unsafe block
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of mutable static is unsafe and requires unsafe function or block
.note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
.label = use of mutable static
mir_build_extern_static_requires_unsafe =
use of extern static is unsafe and requires unsafe block
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
use of extern static is unsafe and requires unsafe function or block
.note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
.label = use of extern static
mir_build_deref_raw_pointer_requires_unsafe =
dereference of raw pointer is unsafe and requires unsafe block
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
dereference of raw pointer is unsafe and requires unsafe function or block
.note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
.label = dereference of raw pointer
mir_build_union_field_requires_unsafe =
access to union field is unsafe and requires unsafe block
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
access to union field is unsafe and requires unsafe function or block
.note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
.label = access to union field
mir_build_mutation_of_layout_constrained_field_requires_unsafe =
mutation of layout constrained field is unsafe and requires unsafe block
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
mir_build_mutation_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
mutation of layout constrained field is unsafe and requires unsafe function or block
.note = mutating layout constrained fields cannot statically be checked for valid values
.label = mutation of layout constrained field
mir_build_borrow_of_layout_constrained_field_requires_unsafe =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe block
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block
.note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
.label = borrow of layout constrained field with interior mutability
mir_build_call_to_fn_with_requires_unsafe =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block
.note = can only be called if the required target features are available
.label = call to function with `#[target_feature]`
mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe function or block
.note = can only be called if the required target features are available
.label = call to function with `#[target_feature]`
mir_build_unused_unsafe = unnecessary `unsafe` block
.label = unnecessary `unsafe` block
mir_build_unused_unsafe_enclosing_block_label = because it's nested under this `unsafe` block
mir_build_unused_unsafe_enclosing_fn_label = because it's nested under this `unsafe` fn
mir_build_non_exhaustive_patterns_type_not_empty = non-exhaustive patterns: type `{$ty}` is non-empty
.def_note = `{$peeled_ty}` defined here
.type_note = the matched value is of type `{$ty}`
.non_exhaustive_type_note = the matched value is of type `{$ty}`, which is marked as non-exhaustive
.reference_note = references are always considered inhabited
.suggestion = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
.help = ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
mir_build_static_in_pattern = statics cannot be referenced in patterns
mir_build_assoc_const_in_pattern = associated consts cannot be referenced in patterns
mir_build_const_param_in_pattern = const parameters cannot be referenced in patterns
mir_build_non_const_path = runtime values cannot be referenced in patterns
mir_build_unreachable_pattern = unreachable pattern
.label = unreachable pattern
.catchall_label = matches any value
mir_build_const_pattern_depends_on_generic_parameter =
constant pattern depends on a generic parameter
mir_build_could_not_eval_const_pattern = could not evaluate constant pattern
mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper =
lower range bound must be less than or equal to upper
.label = lower bound larger than upper bound
.teach_note = When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
mir_build_lower_range_bound_must_be_less_than_upper = lower range bound must be less than upper
mir_build_leading_irrefutable_let_patterns = leading irrefutable {$count ->
[one] pattern
*[other] patterns
} in let chain
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match
.help = consider moving {$count ->
[one] it
*[other] them
} outside of the construct
mir_build_trailing_irrefutable_let_patterns = trailing irrefutable {$count ->
[one] pattern
*[other] patterns
} in let chain
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match
.help = consider moving {$count ->
[one] it
*[other] them
} into the body
mir_build_bindings_with_variant_name =
pattern binding `{$ident}` is named the same as one of the variants of the type `{$ty_path}`
.suggestion = to match on the variant, qualify the path
mir_build_irrefutable_let_patterns_generic_let = irrefutable `let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `let` is useless
.help = consider removing `let`
mir_build_irrefutable_let_patterns_if_let = irrefutable `if let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `if let` is useless
.help = consider replacing the `if let` with a `let`
mir_build_irrefutable_let_patterns_if_let_guard = irrefutable `if let` guard {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the guard is useless
.help = consider removing the guard and adding a `let` inside the match arm
mir_build_irrefutable_let_patterns_let_else = irrefutable `let...else` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `else` clause is useless
.help = consider removing the `else` clause
mir_build_irrefutable_let_patterns_while_let = irrefutable `while let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the loop will never exit
.help = consider instead using a `loop {"{"} ... {"}"}` with a `let` inside it
mir_build_borrow_of_moved_value = borrow of moved value
.label = value moved into `{$name}` here
.occurs_because_label = move occurs because `{$name}` has type `{$ty}` which does not implement the `Copy` trait
.value_borrowed_label = value borrowed here after move
.suggestion = borrow this binding in the pattern to avoid moving the value
mir_build_multiple_mut_borrows = cannot borrow value as mutable more than once at a time
.label = first mutable borrow, by `{$name}`, occurs here
.mutable_borrow = another mutable borrow, by `{$name_mut}`, occurs here
.immutable_borrow = also borrowed as immutable, by `{$name_immut}`, here
.moved = also moved into `{$name_moved}` here

View File

@ -41,6 +41,8 @@ session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is
session_target_stack_protector_not_supported = `-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored
session_branch_protection_requires_aarch64 = `-Zbranch-protection` is only supported on aarch64
session_split_debuginfo_unstable_platform = `-Csplit-debuginfo={$debuginfo}` is unstable on this platform
session_file_is_not_writeable = output file {$file} is not writeable -- check its permissions

View File

@ -57,6 +57,7 @@
lint => "../locales/en-US/lint.ftl",
metadata => "../locales/en-US/metadata.ftl",
middle => "../locales/en-US/middle.ftl",
mir_build => "../locales/en-US/mir_build.ftl",
mir_dataflow => "../locales/en-US/mir_dataflow.ftl",
monomorphize => "../locales/en-US/monomorphize.ftl",
parse => "../locales/en-US/parse.ftl",
@ -380,7 +381,7 @@ fn from(s: S) -> Self {
}
}
/// A workaround for "good path" ICEs when formatting types in disables lints.
/// A workaround for "good path" ICEs when formatting types in disabled lints.
///
/// Delays formatting until `.into(): DiagnosticMessage` is used.
pub struct DelayDm<F>(pub F);
@ -548,9 +549,7 @@ fn icu_locale_from_unic_langid(lang: LanguageIdentifier) -> Option<icu_locid::Lo
icu_locid::Locale::try_from_bytes(lang.to_string().as_bytes()).ok()
}
pub fn fluent_value_from_str_list_sep_by_and<'source>(
l: Vec<Cow<'source, str>>,
) -> FluentValue<'source> {
pub fn fluent_value_from_str_list_sep_by_and(l: Vec<Cow<'_, str>>) -> FluentValue<'_> {
// Fluent requires 'static value here for its AnyEq usages.
#[derive(Clone, PartialEq, Debug)]
struct FluentStrListSepByAnd(Vec<String>);

View File

@ -468,7 +468,7 @@ fn check_nested_occurrences(
// We check that the meta-variable is correctly used.
check_occurrences(sess, node_id, tt, macros, binders, ops, valid);
}
(NestedMacroState::MacroName, &TokenTree::Delimited(_, ref del))
(NestedMacroState::MacroName, TokenTree::Delimited(_, del))
if del.delim == Delimiter::Parenthesis =>
{
state = NestedMacroState::MacroNameParen;
@ -483,7 +483,7 @@ fn check_nested_occurrences(
valid,
);
}
(NestedMacroState::MacroNameParen, &TokenTree::Delimited(_, ref del))
(NestedMacroState::MacroNameParen, TokenTree::Delimited(_, del))
if del.delim == Delimiter::Brace =>
{
state = NestedMacroState::Empty;

View File

@ -792,7 +792,7 @@ fn first(&self, tts: &'tt [mbe::TokenTree]) -> TokenSet<'tt> {
TokenTree::Sequence(sp, ref seq_rep) => {
let subfirst_owned;
let subfirst = match self.first.get(&sp.entire()) {
Some(&Some(ref subfirst)) => subfirst,
Some(Some(subfirst)) => subfirst,
Some(&None) => {
subfirst_owned = self.first(&seq_rep.tts);
&subfirst_owned

View File

@ -356,7 +356,7 @@ fn parse_sep_and_kleene_op(
// `$$` or a meta-variable is the lhs of a macro but shouldn't.
//
// For example, `macro_rules! foo { ( ${length()} ) => {} }`
fn span_dollar_dollar_or_metavar_in_the_lhs_err<'sess>(sess: &'sess ParseSess, token: &Token) {
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
sess.span_diagnostic
.span_err(token.span, &format!("unexpected token: {}", pprust::token_to_string(token)));
sess.span_diagnostic.span_note_without_error(

View File

@ -126,6 +126,8 @@ macro_rules! declare_features {
(accepted, copy_closures, "1.26.0", Some(44490), None),
/// Allows `crate` in paths.
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
/// Allows rustc to inject a default alloc_error_handler
(accepted, default_alloc_error_handler, "CURRENT_RUSTC_VERSION", Some(66741), None),
/// Allows using assigning a default type to type parameters in algebraic data type definitions.
(accepted, default_type_params, "1.0.0", None, None),
/// Allows `#[deprecated]` attribute.

View File

@ -368,8 +368,6 @@ pub fn set(&self, features: &mut Features, span: Span) {
(active, debugger_visualizer, "1.62.0", Some(95939), None),
/// Allows declarative macros 2.0 (`macro`).
(active, decl_macro, "1.17.0", Some(39412), None),
/// Allows rustc to inject a default alloc_error_handler
(active, default_alloc_error_handler, "1.48.0", Some(66741), None),
/// Allows default type parameters to influence type inference.
(active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait

View File

@ -164,7 +164,7 @@
//! fn node_id(&'a self, n: &Nd) -> dot::Id<'a> {
//! dot::Id::new(format!("N{}", n)).unwrap()
//! }
//! fn node_label<'b>(&'b self, n: &Nd) -> dot::LabelText<'b> {
//! fn node_label(&self, n: &Nd) -> dot::LabelText<'_> {
//! dot::LabelText::LabelStr(self.nodes[*n].into())
//! }
//! fn edge_label<'b>(&'b self, _: &Ed) -> dot::LabelText<'b> {

View File

@ -138,7 +138,7 @@ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
/// an "item-like" to something else can be implemented by a `Vec` instead of a
/// tree or hash map.
#[derive(HashStable_Generic)]
pub struct ItemLocalId { .. }
pub struct ItemLocalId {}
}
impl ItemLocalId {

View File

@ -286,9 +286,10 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
// FIXME(swatinem): the following lang items are used for async lowering and
// should become obsolete eventually.
ResumeTy, sym::ResumeTy, resume_ty, Target::Struct, GenericRequirement::None;
IdentityFuture, sym::identity_future, identity_future_fn, Target::Fn, GenericRequirement::None;
GetContext, sym::get_context, get_context_fn, Target::Fn, GenericRequirement::None;
Context, sym::Context, context, Target::Struct, GenericRequirement::None;
FuturePoll, sym::poll, future_poll_fn, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;
FromFrom, sym::from, from_fn, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::None;

View File

@ -26,11 +26,9 @@
use rustc_hir::{GenericArg, GenericArgs, OpaqueTyOrigin};
use rustc_middle::middle::stability::AllowUnstable;
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, SubstsRef};
use rustc_middle::ty::DynKind;
use rustc_middle::ty::GenericParamDefKind;
use rustc_middle::ty::{
self, Const, DefIdTree, EarlyBinder, IsSuggestable, Ty, TyCtxt, TypeVisitable,
};
use rustc_middle::ty::{self, Const, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeVisitable};
use rustc_middle::ty::{DynKind, EarlyBinder};
use rustc_session::lint::builtin::{AMBIGUOUS_ASSOCIATED_ITEMS, BARE_TRAIT_OBJECTS};
use rustc_span::edition::Edition;
use rustc_span::lev_distance::find_best_match_for_name;
@ -490,7 +488,8 @@ fn inferred_kind(
self.astconv
.normalize_ty(
self.span,
EarlyBinder(tcx.at(self.span).type_of(param.def_id))
tcx.at(self.span)
.bound_type_of(param.def_id)
.subst(tcx, substs),
)
.into()
@ -1255,10 +1254,7 @@ fn ast_path_to_ty(
item_segment: &hir::PathSegment<'_>,
) -> Ty<'tcx> {
let substs = self.ast_path_substs_for_ty(span, did, item_segment);
self.normalize_ty(
span,
EarlyBinder(self.tcx().at(span).type_of(did)).subst(self.tcx(), substs),
)
self.normalize_ty(span, self.tcx().at(span).bound_type_of(did).subst(self.tcx(), substs))
}
fn conv_object_ty_poly_trait_ref(
@ -2240,7 +2236,7 @@ pub fn prohibit_generics<'a>(
),
"s",
),
[only] => (format!("{only}"), ""),
[only] => (only.to_string(), ""),
[] => unreachable!(),
};
let last_span = *arg_spans.last().unwrap();

View File

@ -99,18 +99,17 @@ fn allowed_union_field<'tcx>(
ty: Ty<'tcx>,
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
span: Span,
) -> bool {
// We don't just accept all !needs_drop fields, due to semver concerns.
match ty.kind() {
ty::Ref(..) => true, // references never drop (even mutable refs, which are non-Copy and hence fail the later check)
ty::Tuple(tys) => {
// allow tuples of allowed types
tys.iter().all(|ty| allowed_union_field(ty, tcx, param_env, span))
tys.iter().all(|ty| allowed_union_field(ty, tcx, param_env))
}
ty::Array(elem, _len) => {
// Like `Copy`, we do *not* special-case length 0.
allowed_union_field(*elem, tcx, param_env, span)
allowed_union_field(*elem, tcx, param_env)
}
_ => {
// Fallback case: allow `ManuallyDrop` and things that are `Copy`.
@ -124,7 +123,7 @@ fn allowed_union_field<'tcx>(
for field in &def.non_enum_variant().fields {
let field_ty = field.ty(tcx, substs);
if !allowed_union_field(field_ty, tcx, param_env, span) {
if !allowed_union_field(field_ty, tcx, param_env) {
let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {
// We are currently checking the type this field came from, so it must be local.
Some(Node::Field(field)) => (field.span, field.ty.span),
@ -163,7 +162,7 @@ fn allowed_union_field<'tcx>(
}
/// Check that a `static` is inhabited.
fn check_static_inhabited<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
// Make sure statics are inhabited.
// Other parts of the compiler assume that there are no uninhabited places. In principle it
// would be enough to check this for `extern` statics, as statics with an initializer will
@ -213,7 +212,7 @@ fn check_static_inhabited<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
/// Checks that an opaque type does not contain cycles and does not use `Self` or `T::Foo`
/// projections that would result in "inheriting lifetimes".
fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
fn check_opaque(tcx: TyCtxt<'_>, id: hir::ItemId) {
let item = tcx.hir().item(id);
let hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) = item.kind else {
tcx.sess.delay_span_bug(tcx.hir().span(id.hir_id()), "expected opaque item");
@ -246,8 +245,8 @@ fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
/// Checks that an opaque type does not use `Self` or `T::Foo` projections that would result
/// in "inheriting lifetimes".
#[instrument(level = "debug", skip(tcx, span))]
pub(super) fn check_opaque_for_inheriting_lifetimes<'tcx>(
tcx: TyCtxt<'tcx>,
pub(super) fn check_opaque_for_inheriting_lifetimes(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
span: Span,
) {
@ -497,7 +496,7 @@ fn is_enum_of_nonnullable_ptr<'tcx>(
matches!(field.ty(tcx, substs).kind(), ty::FnPtr(..) | ty::Ref(..))
}
fn check_static_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
if tcx.codegen_fn_attrs(def_id).import_linkage.is_some() {
if match tcx.type_of(def_id).kind() {
ty::RawPtr(_) => false,
@ -509,7 +508,7 @@ fn check_static_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
}
}
fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
debug!(
"check_item_type(it.def_id={:?}, it.name={})",
id.owner_id,
@ -1161,7 +1160,7 @@ fn check_non_exhaustive<'tcx>(
}
#[allow(trivial_numeric_casts)]
fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated

View File

@ -71,8 +71,14 @@ pub(crate) fn compare_impl_method<'tcx>(
return;
}
if let Err(_) = compare_predicate_entailment(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref)
{
if let Err(_) = compare_predicate_entailment(
tcx,
impl_m,
impl_m_span,
trait_m,
impl_trait_ref,
CheckImpliedWfMode::Check,
) {
return;
}
}
@ -150,6 +156,7 @@ fn compare_predicate_entailment<'tcx>(
impl_m_span: Span,
trait_m: &ty::AssocItem,
impl_trait_ref: ty::TraitRef<'tcx>,
check_implied_wf: CheckImpliedWfMode,
) -> Result<(), ErrorGuaranteed> {
let trait_to_impl_substs = impl_trait_ref.substs;
@ -255,15 +262,15 @@ fn compare_predicate_entailment<'tcx>(
let mut wf_tys = FxIndexSet::default();
let impl_sig = infcx.replace_bound_vars_with_fresh_vars(
let unnormalized_impl_sig = infcx.replace_bound_vars_with_fresh_vars(
impl_m_span,
infer::HigherRankedType,
tcx.fn_sig(impl_m.def_id),
);
let unnormalized_impl_fty = tcx.mk_fn_ptr(ty::Binder::dummy(unnormalized_impl_sig));
let norm_cause = ObligationCause::misc(impl_m_span, impl_m_hir_id);
let impl_sig = ocx.normalize(&norm_cause, param_env, impl_sig);
let impl_fty = tcx.mk_fn_ptr(ty::Binder::dummy(impl_sig));
let impl_fty = ocx.normalize(&norm_cause, param_env, unnormalized_impl_fty);
debug!("compare_impl_method: impl_fty={:?}", impl_fty);
let trait_sig = tcx.bound_fn_sig(trait_m.def_id).subst(tcx, trait_to_placeholder_substs);
@ -304,29 +311,108 @@ fn compare_predicate_entailment<'tcx>(
return Err(emitted);
}
if check_implied_wf == CheckImpliedWfMode::Check {
// We need to check that the impl's args are well-formed given
// the hybrid param-env (impl + trait method where-clauses).
ocx.register_obligation(traits::Obligation::new(
infcx.tcx,
ObligationCause::dummy(),
param_env,
ty::Binder::dummy(ty::PredicateKind::WellFormed(unnormalized_impl_fty.into())),
));
}
let emit_implied_wf_lint = || {
infcx.tcx.struct_span_lint_hir(
rustc_session::lint::builtin::IMPLIED_BOUNDS_ENTAILMENT,
impl_m_hir_id,
infcx.tcx.def_span(impl_m.def_id),
"impl method assumes more implied bounds than the corresponding trait method",
|lint| lint,
);
};
// Check that all obligations are satisfied by the implementation's
// version.
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
return Err(reported);
match check_implied_wf {
CheckImpliedWfMode::Check => {
return compare_predicate_entailment(
tcx,
impl_m,
impl_m_span,
trait_m,
impl_trait_ref,
CheckImpliedWfMode::Skip,
)
.map(|()| {
// If the skip-mode was successful, emit a lint.
emit_implied_wf_lint();
});
}
CheckImpliedWfMode::Skip => {
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
return Err(reported);
}
}
}
// Finally, resolve all regions. This catches wily misuses of
// lifetime parameters.
let outlives_environment = OutlivesEnvironment::with_bounds(
let outlives_env = OutlivesEnvironment::with_bounds(
param_env,
Some(infcx),
infcx.implied_bounds_tys(param_env, impl_m_hir_id, wf_tys),
infcx.implied_bounds_tys(param_env, impl_m_hir_id, wf_tys.clone()),
);
infcx.check_region_obligations_and_report_errors(
impl_m.def_id.expect_local(),
&outlives_environment,
infcx.process_registered_region_obligations(
outlives_env.region_bound_pairs(),
outlives_env.param_env,
);
let errors = infcx.resolve_regions(&outlives_env);
if !errors.is_empty() {
// FIXME(compiler-errors): This can be simplified when IMPLIED_BOUNDS_ENTAILMENT
// becomes a hard error (i.e. ideally we'd just call `resolve_regions_and_report_errors`
match check_implied_wf {
CheckImpliedWfMode::Check => {
return compare_predicate_entailment(
tcx,
impl_m,
impl_m_span,
trait_m,
impl_trait_ref,
CheckImpliedWfMode::Skip,
)
.map(|()| {
// If the skip-mode was successful, emit a lint.
emit_implied_wf_lint();
});
}
CheckImpliedWfMode::Skip => {
if infcx.tainted_by_errors().is_none() {
infcx.err_ctxt().report_region_errors(impl_m.def_id.expect_local(), &errors);
}
return Err(tcx
.sess
.delay_span_bug(rustc_span::DUMMY_SP, "error should have been emitted"));
}
}
}
Ok(())
}
#[derive(Debug, PartialEq, Eq)]
enum CheckImpliedWfMode {
/// Checks implied well-formedness of the impl method. If it fails, we will
/// re-check with `Skip`, and emit a lint if it succeeds.
Check,
/// Skips checking implied well-formedness of the impl method, but will emit
/// a lint if the `compare_predicate_entailment` succeeded. This means that
/// the reason that we had failed earlier during `Check` was due to the impl
/// having stronger requirements than the trait.
Skip,
}
fn compare_asyncness<'tcx>(
tcx: TyCtxt<'tcx>,
impl_m: &ty::AssocItem,
@ -405,6 +491,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
tcx.fn_sig(impl_m.def_id),
),
);
impl_sig.error_reported()?;
let impl_return_ty = impl_sig.output();
// Normalize the trait signature with liberated bound vars, passing it through
@ -419,6 +506,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
)
.fold_with(&mut collector);
let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
trait_sig.error_reported()?;
let trait_return_ty = trait_sig.output();
let wf_tys = FxIndexSet::from_iter(
@ -1429,8 +1517,8 @@ fn compare_generic_param_kinds<'tcx>(
}
/// Use `tcx.compare_assoc_const_impl_item_with_trait_item` instead
pub(crate) fn raw_compare_const_impl<'tcx>(
tcx: TyCtxt<'tcx>,
pub(crate) fn raw_compare_const_impl(
tcx: TyCtxt<'_>,
(impl_const_item_def, trait_const_item_def): (LocalDefId, DefId),
) -> Result<(), ErrorGuaranteed> {
let impl_const_item = tcx.associated_item(impl_const_item_def);

View File

@ -75,7 +75,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: DefId) -> hir
sym::abort
| sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_uninit_valid
| sym::assert_mem_uninitialized_valid
| sym::size_of
| sym::min_align_of
| sym::needs_drop
@ -193,9 +193,9 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
}
sym::rustc_peek => (1, vec![param(0)], param(0)),
sym::caller_location => (0, vec![], tcx.caller_location_ty()),
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
(1, Vec::new(), tcx.mk_unit())
}
sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_mem_uninitialized_valid => (1, Vec::new(), tcx.mk_unit()),
sym::forget => (1, vec![param(0)], tcx.mk_unit()),
sym::transmute => (2, vec![param(0)], param(1)),
sym::prefetch_read_data

View File

@ -115,10 +115,10 @@ fn adt_destructor(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::Destructor> {
/// Given a `DefId` for an opaque type in return position, find its parent item's return
/// expressions.
fn get_owner_return_paths<'tcx>(
tcx: TyCtxt<'tcx>,
fn get_owner_return_paths(
tcx: TyCtxt<'_>,
def_id: LocalDefId,
) -> Option<(LocalDefId, ReturnsVisitor<'tcx>)> {
) -> Option<(LocalDefId, ReturnsVisitor<'_>)> {
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let parent_id = tcx.hir().get_parent_item(hir_id).def_id;
tcx.hir().find_by_def_id(parent_id).and_then(|node| node.body_id()).map(|body_id| {

View File

@ -1673,7 +1673,7 @@ fn check_method_receiver<'tcx>(
}
}
fn e0307<'tcx>(tcx: TyCtxt<'tcx>, span: Span, receiver_ty: Ty<'_>) {
fn e0307(tcx: TyCtxt<'_>, span: Span, receiver_ty: Ty<'_>) {
struct_span_err!(
tcx.sess.diagnostic(),
span,

View File

@ -171,7 +171,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
}
}
fn visit_implementation_of_coerce_unsized<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did);
// Just compute this for the side-effects, in particular reporting
@ -181,7 +181,7 @@ fn visit_implementation_of_coerce_unsized<'tcx>(tcx: TyCtxt<'tcx>, impl_did: Loc
tcx.at(span).coerce_unsized_info(impl_did);
}
fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", impl_did);
let impl_hir_id = tcx.hir().local_def_id_to_hir_id(impl_did);

View File

@ -198,10 +198,10 @@ fn check_item(&mut self, id: hir::ItemId) {
// entire graph when there are many connected regions.
rustc_index::newtype_index! {
pub struct RegionId {
ENCODABLE = custom
}
#[custom_encodable]
pub struct RegionId {}
}
struct ConnectedRegion {
idents: SmallVec<[Symbol; 8]>,
impl_blocks: FxHashSet<usize>,

Some files were not shown because too many files have changed in this diff Show More