Skip to content

Commit 7338788

Browse files
committed
Auto merge of #18364 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2 parents de2ff17 + a320392 commit 7338788

File tree

4 files changed

+31
-34
lines changed

4 files changed

+31
-34
lines changed

Cargo.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
8585
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8686
vfs = { path = "./crates/vfs", version = "0.0.0" }
8787

88-
ra-ap-rustc_lexer = { version = "0.71.0", default-features = false }
89-
ra-ap-rustc_parse_format = { version = "0.71.0", default-features = false }
90-
ra-ap-rustc_index = { version = "0.71.0", default-features = false }
91-
ra-ap-rustc_abi = { version = "0.71.0", default-features = false }
92-
ra-ap-rustc_pattern_analysis = { version = "0.71.0", default-features = false }
88+
ra-ap-rustc_lexer = { version = "0.73", default-features = false }
89+
ra-ap-rustc_parse_format = { version = "0.73", default-features = false }
90+
ra-ap-rustc_index = { version = "0.73", default-features = false }
91+
ra-ap-rustc_abi = { version = "0.73", default-features = false }
92+
ra-ap-rustc_pattern_analysis = { version = "0.73", default-features = false }
9393

9494
# local crates that aren't published to crates.io. These should not have versions.
9595
test-fixture = { path = "./crates/test-fixture" }

crates/hir-ty/src/layout.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,15 @@ pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx
7272

7373
#[derive(Debug, PartialEq, Eq, Clone)]
7474
pub enum LayoutError {
75-
EmptyUnion,
75+
// FIXME: Remove more variants once they get added to LayoutCalculatorError
76+
BadCalc(LayoutCalculatorError<()>),
7677
HasErrorConst,
7778
HasErrorType,
7879
HasPlaceholder,
7980
InvalidSimdType,
8081
NotImplemented,
8182
RecursiveTypeWithoutIndirection,
82-
SizeOverflow,
8383
TargetLayoutNotAvailable,
84-
UnexpectedUnsized,
8584
Unknown,
8685
UserReprTooSmall,
8786
}
@@ -90,7 +89,7 @@ impl std::error::Error for LayoutError {}
9089
impl fmt::Display for LayoutError {
9190
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9291
match self {
93-
LayoutError::EmptyUnion => write!(f, "type is an union with no fields"),
92+
LayoutError::BadCalc(err) => err.fallback_fmt(f),
9493
LayoutError::HasErrorConst => write!(f, "type contains an unevaluatable const"),
9594
LayoutError::HasErrorType => write!(f, "type contains an error"),
9695
LayoutError::HasPlaceholder => write!(f, "type contains placeholders"),
@@ -99,11 +98,7 @@ impl fmt::Display for LayoutError {
9998
LayoutError::RecursiveTypeWithoutIndirection => {
10099
write!(f, "recursive type without indirection")
101100
}
102-
LayoutError::SizeOverflow => write!(f, "size overflow"),
103101
LayoutError::TargetLayoutNotAvailable => write!(f, "target layout not available"),
104-
LayoutError::UnexpectedUnsized => {
105-
write!(f, "an unsized type was found where a sized type was expected")
106-
}
107102
LayoutError::Unknown => write!(f, "unknown"),
108103
LayoutError::UserReprTooSmall => {
109104
write!(f, "the `#[repr]` hint is too small to hold the discriminants of the enum")
@@ -114,11 +109,7 @@ impl fmt::Display for LayoutError {
114109

115110
impl<F> From<LayoutCalculatorError<F>> for LayoutError {
116111
fn from(err: LayoutCalculatorError<F>) -> Self {
117-
match err {
118-
LayoutCalculatorError::EmptyUnion => LayoutError::EmptyUnion,
119-
LayoutCalculatorError::UnexpectedUnsized(_) => LayoutError::UnexpectedUnsized,
120-
LayoutCalculatorError::SizeOverflow => LayoutError::SizeOverflow,
121-
}
112+
LayoutError::BadCalc(err.without_payload())
122113
}
123114
}
124115

@@ -182,7 +173,10 @@ fn layout_of_simd_ty(
182173
};
183174

184175
// Compute the size and alignment of the vector:
185-
let size = e_ly.size.checked_mul(e_len, dl).ok_or(LayoutError::SizeOverflow)?;
176+
let size = e_ly
177+
.size
178+
.checked_mul(e_len, dl)
179+
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
186180
let align = dl.vector_align(size);
187181
let size = size.align_to(align.abi);
188182

@@ -295,7 +289,10 @@ pub fn layout_of_ty_query(
295289
TyKind::Array(element, count) => {
296290
let count = try_const_usize(db, count).ok_or(LayoutError::HasErrorConst)? as u64;
297291
let element = db.layout_of_ty(element.clone(), trait_env)?;
298-
let size = element.size.checked_mul(count, dl).ok_or(LayoutError::SizeOverflow)?;
292+
let size = element
293+
.size
294+
.checked_mul(count, dl)
295+
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
299296

300297
let abi = if count != 0 && matches!(element.abi, Abi::Uninhabited) {
301298
Abi::Uninhabited

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dd5127615ad626741a1116d022cf784637ac05df
1+
1de57a5ce952c722f7053aeacfc6c90bc139b678

0 commit comments

Comments
 (0)