Skip to content

Commit 5a0257f

Browse files
committed
Auto merge of #56408 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 9 pull requests Successful merges: - #55010 (Add template parameter debuginfo to generic types) - #56110 (Consider references and unions potentially inhabited during privacy-respecting inhabitedness checks) - #56305 (update miri) - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs) - #56394 (Deal with EINTR in net timeout tests) - #56395 (Stabilize dbg!(...)) - #56402 (Improve the unstable book example for #56408 [marker] trait) - #56406 (Update RLS and Rustfmt) - #56366 (Stabilize self_in_typedefs feature) Failed merges: r? @ghost
2 parents d311571 + 490a1e9 commit 5a0257f

File tree

55 files changed

+348
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+348
-243
lines changed

Cargo.lock

+30-16
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ version = "0.1.0"
159159

160160
[[package]]
161161
name = "bytecount"
162-
version = "0.3.2"
162+
version = "0.4.0"
163163
source = "registry+https://github.com/rust-lang/crates.io-index"
164164
dependencies = [
165-
"simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
165+
"packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
166166
]
167167

168168
[[package]]
@@ -624,6 +624,15 @@ name = "difference"
624624
version = "2.0.0"
625625
source = "registry+https://github.com/rust-lang/crates.io-index"
626626

627+
[[package]]
628+
name = "directories"
629+
version = "1.0.2"
630+
source = "registry+https://github.com/rust-lang/crates.io-index"
631+
dependencies = [
632+
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
633+
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
634+
]
635+
627636
[[package]]
628637
name = "dlmalloc"
629638
version = "0.0.0"
@@ -1059,7 +1068,7 @@ dependencies = [
10591068

10601069
[[package]]
10611070
name = "languageserver-types"
1062-
version = "0.45.0"
1071+
version = "0.51.1"
10631072
source = "registry+https://github.com/rust-lang/crates.io-index"
10641073
dependencies = [
10651074
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1316,6 +1325,7 @@ dependencies = [
13161325
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
13171326
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
13181327
"compiletest_rs 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
1328+
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
13191329
"env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)",
13201330
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
13211331
"vergen 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1437,6 +1447,14 @@ dependencies = [
14371447
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
14381448
]
14391449

1450+
[[package]]
1451+
name = "packed_simd"
1452+
version = "0.3.1"
1453+
source = "registry+https://github.com/rust-lang/crates.io-index"
1454+
dependencies = [
1455+
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1456+
]
1457+
14401458
[[package]]
14411459
name = "panic_abort"
14421460
version = "0.0.0"
@@ -1820,7 +1838,7 @@ dependencies = [
18201838
"failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
18211839
"itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
18221840
"jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1823-
"languageserver-types 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)",
1841+
"languageserver-types 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)",
18241842
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
18251843
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
18261844
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1829,7 +1847,7 @@ dependencies = [
18291847
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
18301848
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
18311849
"regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1832-
"rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)",
1850+
"rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)",
18331851
"rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
18341852
"rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
18351853
"rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1849,7 +1867,7 @@ dependencies = [
18491867

18501868
[[package]]
18511869
name = "rls-analysis"
1852-
version = "0.16.8"
1870+
version = "0.16.10"
18531871
source = "registry+https://github.com/rust-lang/crates.io-index"
18541872
dependencies = [
18551873
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2565,7 +2583,7 @@ version = "1.0.0"
25652583
dependencies = [
25662584
"assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
25672585
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
2568-
"bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
2586+
"bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
25692587
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
25702588
"derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
25712589
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2695,11 +2713,6 @@ name = "shlex"
26952713
version = "0.1.1"
26962714
source = "registry+https://github.com/rust-lang/crates.io-index"
26972715

2698-
[[package]]
2699-
name = "simd"
2700-
version = "0.2.3"
2701-
source = "registry+https://github.com/rust-lang/crates.io-index"
2702-
27032716
[[package]]
27042717
name = "siphasher"
27052718
version = "0.2.2"
@@ -3251,7 +3264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32513264
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
32523265
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
32533266
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
3254-
"checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8"
3267+
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
32553268
"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9"
32563269
"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010"
32573270
"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2"
@@ -3285,6 +3298,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32853298
"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
32863299
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
32873300
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
3301+
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
32883302
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
32893303
"checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee"
32903304
"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"
@@ -3331,7 +3345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33313345
"checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be"
33323346
"checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c"
33333347
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
3334-
"checksum languageserver-types 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d91d91d1c23db74187096d191967cb49f49bb175ad6d855fa9229d16ef2c982"
3348+
"checksum languageserver-types 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)" = "68de833188ada4e175d04a028f03f244f6370eedbcc75a05604d47d925933f69"
33353349
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
33363350
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
33373351
"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0"
@@ -3372,6 +3386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33723386
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
33733387
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"
33743388
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
3389+
"checksum packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25d36de864f7218ec5633572a800109bbe5a1cc8d9d95a967f3daf93ea7e6ddc"
33753390
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
33763391
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
33773392
"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a"
@@ -3410,7 +3425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
34103425
"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
34113426
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
34123427
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
3413-
"checksum rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)" = "2a1d3a2a8c03e380331aefb8b5e3e06f3065602fbaa6657ba0ac649dc99d8537"
3428+
"checksum rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2de1187cceaf16d7642cc78835a2890b55b35ed9e8a8e3c6348a6297d8dd0fb1"
34143429
"checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411"
34153430
"checksum rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a209ce46bb52813cbe0786a7baadc0c1a3f5543ef93f179eda3b841ed72cf2e"
34163431
"checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0"
@@ -3446,7 +3461,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
34463461
"checksum serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "bb47a3d5c84320222f66d7db21157c4a7407755de41798f9b4c1c40593397b1a"
34473462
"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9"
34483463
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
3449-
"checksum simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0048b17eb9577ac545c61d85c3559b41dfb4cbea41c9bd9ca6a4f73ff05fda84"
34503464
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
34513465
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
34523466
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ rustfmt-nightly = { path = "src/tools/rustfmt" }
6565
# here
6666
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
6767

68-
[patch."https://github.com/rust-lang-nursery/rust-clippy"]
68+
[patch."https://github.com/rust-lang/rust-clippy"]
6969
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
7070
rustc_tools_util = { path = "src/tools/clippy/rustc_tools_util" }

src/doc/unstable-book/src/language-features/marker-trait-attr.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ when they'd need to do the same thing for every type anyway).
1717
```rust
1818
#![feature(marker_trait_attr)]
1919

20-
use std::fmt::{Debug, Display};
20+
#[marker] trait CheapToClone: Clone {}
2121

22-
#[marker] trait MyMarker {}
22+
impl<T: Copy> CheapToClone for T {}
2323

24-
impl<T: Debug> MyMarker for T {}
25-
impl<T: Display> MyMarker for T {}
24+
// These could potentally overlap with the blanket implementation above,
25+
// so are only allowed because CheapToClone is a marker trait.
26+
impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
27+
impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}
2628

27-
fn foo<T: MyMarker>(t: T) -> T {
28-
t
29+
fn cheap_clone<T: CheapToClone>(t: T) -> T {
30+
t.clone()
2931
}
3032
```
3133

src/doc/unstable-book/src/language-features/self-in-typedefs.md

-24
This file was deleted.

src/librustc/ty/inhabitedness/mod.rs

+23-24
Original file line numberDiff line numberDiff line change
@@ -167,23 +167,16 @@ impl<'a, 'gcx, 'tcx> VariantDef {
167167
substs: &'tcx Substs<'tcx>,
168168
adt_kind: AdtKind) -> DefIdForest
169169
{
170-
match adt_kind {
171-
AdtKind::Union => {
172-
DefIdForest::intersection(tcx, self.fields.iter().map(|f| {
173-
f.uninhabited_from(visited, tcx, substs, false)
174-
}))
175-
},
176-
AdtKind::Struct => {
177-
DefIdForest::union(tcx, self.fields.iter().map(|f| {
178-
f.uninhabited_from(visited, tcx, substs, false)
179-
}))
180-
},
181-
AdtKind::Enum => {
182-
DefIdForest::union(tcx, self.fields.iter().map(|f| {
183-
f.uninhabited_from(visited, tcx, substs, true)
184-
}))
185-
},
186-
}
170+
let is_enum = match adt_kind {
171+
// For now, `union`s are never considered uninhabited.
172+
// The precise semantics of inhabitedness with respect to unions is currently undecided.
173+
AdtKind::Union => return DefIdForest::empty(),
174+
AdtKind::Enum => true,
175+
AdtKind::Struct => false,
176+
};
177+
DefIdForest::union(tcx, self.fields.iter().map(|f| {
178+
f.uninhabited_from(visited, tcx, substs, is_enum)
179+
}))
187180
}
188181
}
189182

@@ -194,8 +187,8 @@ impl<'a, 'gcx, 'tcx> FieldDef {
194187
visited: &mut FxHashMap<DefId, FxHashSet<&'tcx Substs<'tcx>>>,
195188
tcx: TyCtxt<'a, 'gcx, 'tcx>,
196189
substs: &'tcx Substs<'tcx>,
197-
is_enum: bool) -> DefIdForest
198-
{
190+
is_enum: bool,
191+
) -> DefIdForest {
199192
let mut data_uninhabitedness = move || {
200193
self.ty(tcx, substs).uninhabited_from(visited, tcx)
201194
};
@@ -253,14 +246,16 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
253246
let substs_set = visited.get_mut(&def.did).unwrap();
254247
substs_set.remove(substs);
255248
ret
256-
},
249+
}
257250

258251
Never => DefIdForest::full(tcx),
252+
259253
Tuple(ref tys) => {
260254
DefIdForest::union(tcx, tys.iter().map(|ty| {
261255
ty.uninhabited_from(visited, tcx)
262256
}))
263-
},
257+
}
258+
264259
Array(ty, len) => {
265260
match len.assert_usize(tcx) {
266261
// If the array is definitely non-empty, it's uninhabited if
@@ -269,9 +264,13 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
269264
_ => DefIdForest::empty()
270265
}
271266
}
272-
Ref(_, ty, _) => {
273-
ty.uninhabited_from(visited, tcx)
274-
}
267+
268+
// References to uninitialised memory is valid for any type, including
269+
// uninhabited types, in unsafe code, so we treat all references as
270+
// inhabited.
271+
// The precise semantics of inhabitedness with respect to references is currently
272+
// undecided.
273+
Ref(..) => DefIdForest::empty(),
275274

276275
_ => DefIdForest::empty(),
277276
}

src/librustc_borrowck/borrowck/check_loans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
615615
let new_loan_str = &new_loan.kind.to_user_str();
616616
self.bccx.cannot_reborrow_already_uniquely_borrowed(
617617
new_loan.span, "closure", &nl, &new_loan_msg, new_loan_str,
618-
old_loan.span, &old_loan_msg, previous_end_span, Origin::Ast)
618+
old_loan.span, &old_loan_msg, previous_end_span, "", Origin::Ast)
619619
}
620620
(..) =>
621621
self.bccx.cannot_reborrow_already_borrowed(

0 commit comments

Comments
 (0)