Skip to content

Commit d1fbfc6

Browse files
authored
Merge pull request #18457 from lnicola/sync-from-rust
minor: Sync from downstream
2 parents 0ba893e + b385bf2 commit d1fbfc6

File tree

7 files changed

+38
-55
lines changed

7 files changed

+38
-55
lines changed

Cargo.lock

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

Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
8484
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8585
vfs = { path = "./crates/vfs", version = "0.0.0" }
8686

87-
ra-ap-rustc_lexer = { version = "0.75", default-features = false }
88-
ra-ap-rustc_parse_format = { version = "0.75", default-features = false }
89-
ra-ap-rustc_index = { version = "0.75", default-features = false }
90-
ra-ap-rustc_abi = { version = "0.75", default-features = false }
91-
ra-ap-rustc_pattern_analysis = { version = "0.75", default-features = false }
87+
ra-ap-rustc_lexer = { version = "0.76", default-features = false }
88+
ra-ap-rustc_parse_format = { version = "0.76", default-features = false }
89+
ra-ap-rustc_index = { version = "0.76", default-features = false }
90+
ra-ap-rustc_abi = { version = "0.76", default-features = false }
91+
ra-ap-rustc_pattern_analysis = { version = "0.76", default-features = false }
9292

9393
# local crates that aren't published to crates.io. These should not have versions.
9494
test-fixture = { path = "./crates/test-fixture" }
@@ -145,7 +145,6 @@ smallvec = { version = "1.10.0", features = [
145145
"const_generics",
146146
] }
147147
smol_str = "0.3.2"
148-
snap = "1.1.0"
149148
text-size = "1.1.1"
150149
tracing = "0.1.40"
151150
tracing-tree = "0.3.0"

crates/hir-ty/src/layout.rs

+16-14
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ use base_db::ra_salsa::Cycle;
66
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
77
use hir_def::{
88
layout::{
9-
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutData,
10-
Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
9+
BackendRepr, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError,
10+
LayoutData, Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout,
11+
WrappingRange,
1112
},
1213
LocalFieldId, StructId,
1314
};
@@ -168,7 +169,7 @@ fn layout_of_simd_ty(
168169

169170
// Compute the ABI of the element type:
170171
let e_ly = db.layout_of_ty(e_ty, env)?;
171-
let Abi::Scalar(e_abi) = e_ly.abi else {
172+
let BackendRepr::Scalar(e_abi) = e_ly.backend_repr else {
172173
return Err(LayoutError::Unknown);
173174
};
174175

@@ -190,7 +191,7 @@ fn layout_of_simd_ty(
190191
Ok(Arc::new(Layout {
191192
variants: Variants::Single { index: struct_variant_idx() },
192193
fields,
193-
abi: Abi::Vector { element: e_abi, count: e_len },
194+
backend_repr: BackendRepr::Vector { element: e_abi, count: e_len },
194195
largest_niche: e_ly.largest_niche,
195196
size,
196197
align,
@@ -294,18 +295,19 @@ pub fn layout_of_ty_query(
294295
.checked_mul(count, dl)
295296
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
296297

297-
let abi = if count != 0 && matches!(element.abi, Abi::Uninhabited) {
298-
Abi::Uninhabited
299-
} else {
300-
Abi::Aggregate { sized: true }
301-
};
298+
let backend_repr =
299+
if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
300+
BackendRepr::Uninhabited
301+
} else {
302+
BackendRepr::Memory { sized: true }
303+
};
302304

303305
let largest_niche = if count != 0 { element.largest_niche } else { None };
304306

305307
Layout {
306308
variants: Variants::Single { index: struct_variant_idx() },
307309
fields: FieldsShape::Array { stride: element.size, count },
308-
abi,
310+
backend_repr,
309311
largest_niche,
310312
align: element.align,
311313
size,
@@ -318,7 +320,7 @@ pub fn layout_of_ty_query(
318320
Layout {
319321
variants: Variants::Single { index: struct_variant_idx() },
320322
fields: FieldsShape::Array { stride: element.size, count: 0 },
321-
abi: Abi::Aggregate { sized: false },
323+
backend_repr: BackendRepr::Memory { sized: false },
322324
largest_niche: None,
323325
align: element.align,
324326
size: Size::ZERO,
@@ -329,7 +331,7 @@ pub fn layout_of_ty_query(
329331
TyKind::Str => Layout {
330332
variants: Variants::Single { index: struct_variant_idx() },
331333
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
332-
abi: Abi::Aggregate { sized: false },
334+
backend_repr: BackendRepr::Memory { sized: false },
333335
largest_niche: None,
334336
align: dl.i8_align,
335337
size: Size::ZERO,
@@ -379,8 +381,8 @@ pub fn layout_of_ty_query(
379381
TyKind::Never => cx.calc.layout_of_never_type(),
380382
TyKind::Dyn(_) | TyKind::Foreign(_) => {
381383
let mut unit = layout_of_unit(&cx)?;
382-
match &mut unit.abi {
383-
Abi::Aggregate { sized } => *sized = false,
384+
match &mut unit.backend_repr {
385+
BackendRepr::Memory { sized } => *sized = false,
384386
_ => return Err(LayoutError::Unknown),
385387
}
386388
unit

crates/proc-macro-srv/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ doctest = false
1616
object.workspace = true
1717
libloading.workspace = true
1818
memmap2.workspace = true
19-
snap.workspace = true
2019

2120
stdx.workspace = true
2221
tt.workspace = true

crates/proc-macro-srv/src/dylib/version.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::{
88
use memmap2::Mmap;
99
use object::read::{File as BinaryFile, Object, ObjectSection};
1010
use paths::AbsPath;
11-
use snap::read::FrameDecoder as SnapDecoder;
1211

1312
#[derive(Debug)]
1413
#[allow(dead_code)]
@@ -123,9 +122,8 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
123122
let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
124123
// Last supported version is:
125124
// https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
126-
let (snappy_portion, bytes_before_version) = match version {
127-
5 | 6 => (&dot_rustc[8..], 13),
128-
7 | 8 => {
125+
let (mut metadata_portion, bytes_before_version) = match version {
126+
8 => {
129127
let len_bytes = &dot_rustc[8..12];
130128
let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
131129
(&dot_rustc[12..data_len + 12], 13)
@@ -143,25 +141,18 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
143141
}
144142
};
145143

146-
let mut uncompressed: Box<dyn Read> = if &snappy_portion[0..4] == b"rust" {
147-
// Not compressed.
148-
Box::new(snappy_portion)
149-
} else {
150-
Box::new(SnapDecoder::new(snappy_portion))
151-
};
152-
153144
// We're going to skip over the bytes before the version string, so basically:
154145
// 8 bytes for [b'r',b'u',b's',b't',0,0,0,5]
155146
// 4 or 8 bytes for [crate root bytes]
156147
// 1 byte for length of version string
157148
// so 13 or 17 bytes in total, and we should check the last of those bytes
158149
// to know the length
159150
let mut bytes = [0u8; 17];
160-
uncompressed.read_exact(&mut bytes[..bytes_before_version])?;
151+
metadata_portion.read_exact(&mut bytes[..bytes_before_version])?;
161152
let length = bytes[bytes_before_version - 1];
162153

163154
let mut version_string_utf8 = vec![0u8; length as usize];
164-
uncompressed.read_exact(&mut version_string_utf8)?;
155+
metadata_portion.read_exact(&mut version_string_utf8)?;
165156
let version_string = String::from_utf8(version_string_utf8);
166157
version_string.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
167158
}

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a9d17627d241645a54c1134a20f1596127fedb60
1+
145f9cf95de1fbde3fa11e98461310e0373253e6

xtask/src/tidy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ Apache-2.0 WITH LLVM-exception
135135
Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
136136
Apache-2.0/MIT
137137
BSD-2-Clause OR Apache-2.0 OR MIT
138-
BSD-3-Clause
139138
CC0-1.0
140139
ISC
141140
MIT

0 commit comments

Comments
 (0)