Skip to content

Commit b766506

Browse files
authored
Merge pull request #19212 from lnicola/sync-from-rust
minor: sync from downstream
2 parents 6d68c47 + c96554a commit b766506

File tree

11 files changed

+251
-184
lines changed

11 files changed

+251
-184
lines changed

Diff for: Cargo.lock

+30-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+6-5
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8686
vfs = { path = "./crates/vfs", version = "0.0.0" }
8787
edition = { path = "./crates/edition", version = "0.0.0" }
8888

89-
ra-ap-rustc_lexer = { version = "0.95", default-features = false }
90-
ra-ap-rustc_parse_format = { version = "0.95", default-features = false }
91-
ra-ap-rustc_index = { version = "0.95", default-features = false }
92-
ra-ap-rustc_abi = { version = "0.95", default-features = false }
93-
ra-ap-rustc_pattern_analysis = { version = "0.95", default-features = false }
89+
ra-ap-rustc_hashes = { version = "0.97", default-features = false }
90+
ra-ap-rustc_lexer = { version = "0.97", default-features = false }
91+
ra-ap-rustc_parse_format = { version = "0.97", default-features = false }
92+
ra-ap-rustc_index = { version = "0.97", default-features = false }
93+
ra-ap-rustc_abi = { version = "0.97", default-features = false }
94+
ra-ap-rustc_pattern_analysis = { version = "0.97", default-features = false }
9495

9596
# local crates that aren't published to crates.io. These should not have versions.
9697

Diff for: crates/hir-def/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ triomphe.workspace = true
3131
rustc_apfloat = "0.2.0"
3232
text-size.workspace = true
3333

34+
ra-ap-rustc_hashes.workspace = true
3435
ra-ap-rustc_parse_format.workspace = true
3536
ra-ap-rustc_abi.workspace = true
3637

Diff for: crates/hir-def/src/data/adt.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use hir_expand::name::Name;
99
use intern::sym;
1010
use la_arena::Arena;
1111
use rustc_abi::{Align, Integer, IntegerType, ReprFlags, ReprOptions};
12+
use rustc_hashes::Hash64;
1213
use triomphe::Arc;
1314
use tt::iter::TtElement;
1415

@@ -172,7 +173,13 @@ fn parse_repr_tt(tt: &TopSubtree) -> Option<ReprOptions> {
172173
}
173174
}
174175

175-
Some(ReprOptions { int, align: max_align, pack: min_pack, flags, field_shuffle_seed: 0 })
176+
Some(ReprOptions {
177+
int,
178+
align: max_align,
179+
pack: min_pack,
180+
flags,
181+
field_shuffle_seed: Hash64::ZERO,
182+
})
176183
}
177184

178185
impl StructData {

Diff for: crates/hir-def/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ extern crate ra_ap_rustc_parse_format as rustc_parse_format;
1818
#[cfg(feature = "in-rust-tree")]
1919
extern crate rustc_abi;
2020

21+
#[cfg(feature = "in-rust-tree")]
22+
extern crate rustc_hashes;
23+
2124
#[cfg(not(feature = "in-rust-tree"))]
2225
extern crate ra_ap_rustc_abi as rustc_abi;
2326

27+
#[cfg(not(feature = "in-rust-tree"))]
28+
extern crate ra_ap_rustc_hashes as rustc_hashes;
29+
2430
pub mod db;
2531

2632
pub mod attr;

Diff for: crates/hir-ty/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ indexmap.workspace = true
3636
rustc_apfloat = "0.2.0"
3737

3838
ra-ap-rustc_abi.workspace = true
39+
ra-ap-rustc_hashes.workspace = true
3940
ra-ap-rustc_index.workspace = true
4041
ra-ap-rustc_pattern_analysis.workspace = true
4142

Diff for: crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,11 @@ impl PatCx for MatchCheckCtx<'_> {
361361
}
362362
}
363363

364-
fn ctor_sub_tys<'a>(
365-
&'a self,
366-
ctor: &'a rustc_pattern_analysis::constructor::Constructor<Self>,
367-
ty: &'a Self::Ty,
368-
) -> impl ExactSizeIterator<Item = (Self::Ty, PrivateUninhabitedField)> + Captures<'a> {
364+
fn ctor_sub_tys(
365+
&self,
366+
ctor: &rustc_pattern_analysis::constructor::Constructor<Self>,
367+
ty: &Self::Ty,
368+
) -> impl ExactSizeIterator<Item = (Self::Ty, PrivateUninhabitedField)> {
369369
let single = |ty| smallvec![(ty, PrivateUninhabitedField(false))];
370370
let tys: SmallVec<[_; 2]> = match ctor {
371371
Struct | Variant(_) | UnionField => match ty.kind(Interner) {

Diff for: crates/hir-ty/src/layout.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use hir_def::{
1414
};
1515
use la_arena::{Idx, RawIdx};
1616
use rustc_abi::AddressSpace;
17+
use rustc_hashes::Hash64;
1718
use rustc_index::{IndexSlice, IndexVec};
1819

1920
use triomphe::Arc;
@@ -178,7 +179,7 @@ fn layout_of_simd_ty(
178179
.size
179180
.checked_mul(e_len, dl)
180181
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
181-
let align = dl.vector_align(size);
182+
let align = dl.llvmlike_vector_align(size);
182183
let size = size.align_to(align.abi);
183184

184185
// Compute the placement of the vector fields:
@@ -193,11 +194,12 @@ fn layout_of_simd_ty(
193194
fields,
194195
backend_repr: BackendRepr::Vector { element: e_abi, count: e_len },
195196
largest_niche: e_ly.largest_niche,
197+
uninhabited: false,
196198
size,
197199
align,
198200
max_repr_align: None,
199201
unadjusted_abi_align: align.abi,
200-
randomization_seed: 0,
202+
randomization_seed: Hash64::ZERO,
201203
}))
202204
}
203205

@@ -296,25 +298,22 @@ pub fn layout_of_ty_query(
296298
.checked_mul(count, dl)
297299
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
298300

299-
let backend_repr =
300-
if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
301-
BackendRepr::Uninhabited
302-
} else {
303-
BackendRepr::Memory { sized: true }
304-
};
301+
let backend_repr = BackendRepr::Memory { sized: true };
305302

306303
let largest_niche = if count != 0 { element.largest_niche } else { None };
304+
let uninhabited = if count != 0 { element.uninhabited } else { false };
307305

308306
Layout {
309307
variants: Variants::Single { index: struct_variant_idx() },
310308
fields: FieldsShape::Array { stride: element.size, count },
311309
backend_repr,
312310
largest_niche,
311+
uninhabited,
313312
align: element.align,
314313
size,
315314
max_repr_align: None,
316315
unadjusted_abi_align: element.align.abi,
317-
randomization_seed: 0,
316+
randomization_seed: Hash64::ZERO,
318317
}
319318
}
320319
TyKind::Slice(element) => {
@@ -324,23 +323,25 @@ pub fn layout_of_ty_query(
324323
fields: FieldsShape::Array { stride: element.size, count: 0 },
325324
backend_repr: BackendRepr::Memory { sized: false },
326325
largest_niche: None,
326+
uninhabited: false,
327327
align: element.align,
328328
size: Size::ZERO,
329329
max_repr_align: None,
330330
unadjusted_abi_align: element.align.abi,
331-
randomization_seed: 0,
331+
randomization_seed: Hash64::ZERO,
332332
}
333333
}
334334
TyKind::Str => Layout {
335335
variants: Variants::Single { index: struct_variant_idx() },
336336
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
337337
backend_repr: BackendRepr::Memory { sized: false },
338338
largest_niche: None,
339+
uninhabited: false,
339340
align: dl.i8_align,
340341
size: Size::ZERO,
341342
max_repr_align: None,
342343
unadjusted_abi_align: dl.i8_align.abi,
343-
randomization_seed: 0,
344+
randomization_seed: Hash64::ZERO,
344345
},
345346
// Potentially-wide pointers.
346347
TyKind::Ref(_, _, pointee) | TyKind::Raw(_, pointee) => {

Diff for: crates/hir-ty/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ extern crate ra_ap_rustc_index as rustc_index;
1212
#[cfg(feature = "in-rust-tree")]
1313
extern crate rustc_abi;
1414

15+
#[cfg(feature = "in-rust-tree")]
16+
extern crate rustc_hashes;
17+
1518
#[cfg(not(feature = "in-rust-tree"))]
1619
extern crate ra_ap_rustc_abi as rustc_abi;
1720

@@ -21,6 +24,9 @@ extern crate rustc_pattern_analysis;
2124
#[cfg(not(feature = "in-rust-tree"))]
2225
extern crate ra_ap_rustc_pattern_analysis as rustc_pattern_analysis;
2326

27+
#[cfg(not(feature = "in-rust-tree"))]
28+
extern crate ra_ap_rustc_hashes as rustc_hashes;
29+
2430
mod builder;
2531
mod chalk_db;
2632
mod chalk_ext;

0 commit comments

Comments
 (0)