mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge pull request #18457 from lnicola/sync-from-rust
minor: Sync from downstream
This commit is contained in:
commit
d1fbfc676b
7 changed files with 38 additions and 55 deletions
31
Cargo.lock
generated
31
Cargo.lock
generated
|
@ -1364,7 +1364,6 @@ dependencies = [
|
|||
"proc-macro-api",
|
||||
"proc-macro-test",
|
||||
"ra-ap-rustc_lexer",
|
||||
"snap",
|
||||
"span",
|
||||
"stdx",
|
||||
"syntax-bridge",
|
||||
|
@ -1493,9 +1492,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_abi"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5bc2cfc7264d84215a08875ef90a1d35f76b5c9ad1993515d2da7e4e40b2b4b"
|
||||
checksum = "709fde78db053c78c87776ec738677649f791645883f82ff145f68caf9f18e1a"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"ra-ap-rustc_index",
|
||||
|
@ -1504,9 +1503,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8929140697812e5dd09e19cf446d85146332363f0dbc125d4214834c34ead96"
|
||||
checksum = "da115d496e5abd65e2dceb6883d7597593badfe23fea3439202b8da5a11ea250"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ra-ap-rustc_index_macros",
|
||||
|
@ -1515,9 +1514,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514a3f5d04c8b4a2750f29746cc9abb1f78deb7e72e4ad1dc95bbc608f3db157"
|
||||
checksum = "be86d06a75a8125c1ace197d5030e6e02721348d32e572baea35c891669ad1e2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1526,9 +1525,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_lexer"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "276fcb1205da071a0cd64416f3f0e198043c11f176c5b501a45dbf0cb33979f2"
|
||||
checksum = "b64b46ae0d8f59acc32e64e0085532b831f0d6182d870a7cd86c046c2c46e722"
|
||||
dependencies = [
|
||||
"unicode-properties",
|
||||
"unicode-xid",
|
||||
|
@ -1536,9 +1535,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_parse_format"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "961b30b22cfac296b14b72e9f95e79c16cebc8c926872755fb1568a6c4243a62"
|
||||
checksum = "dbdaad19ddbd0ff46e947ca8dbb6ae678a112d3938669fb3ad6bfd244917e24b"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index",
|
||||
"ra-ap-rustc_lexer",
|
||||
|
@ -1546,9 +1545,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_pattern_analysis"
|
||||
version = "0.75.0"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "614232513814a4b714fea7f11345d31c0c277bca3089bb6ca1ec20870bfc022a"
|
||||
checksum = "dc5761e37c78d98ede9f20f6b66526093d0be66aa256d5cbdf214495843ba74d"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index",
|
||||
"rustc-hash 2.0.0",
|
||||
|
@ -1888,12 +1887,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snap"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b"
|
||||
|
||||
[[package]]
|
||||
name = "span"
|
||||
version = "0.0.0"
|
||||
|
|
11
Cargo.toml
11
Cargo.toml
|
@ -84,11 +84,11 @@ tt = { path = "./crates/tt", version = "0.0.0" }
|
|||
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
|
||||
vfs = { path = "./crates/vfs", version = "0.0.0" }
|
||||
|
||||
ra-ap-rustc_lexer = { version = "0.75", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.75", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.75", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.75", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.75", default-features = false }
|
||||
ra-ap-rustc_lexer = { version = "0.76", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.76", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.76", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.76", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.76", default-features = false }
|
||||
|
||||
# local crates that aren't published to crates.io. These should not have versions.
|
||||
test-fixture = { path = "./crates/test-fixture" }
|
||||
|
@ -145,7 +145,6 @@ smallvec = { version = "1.10.0", features = [
|
|||
"const_generics",
|
||||
] }
|
||||
smol_str = "0.3.2"
|
||||
snap = "1.1.0"
|
||||
text-size = "1.1.1"
|
||||
tracing = "0.1.40"
|
||||
tracing-tree = "0.3.0"
|
||||
|
|
|
@ -6,8 +6,9 @@ use base_db::ra_salsa::Cycle;
|
|||
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
|
||||
use hir_def::{
|
||||
layout::{
|
||||
Abi, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutData,
|
||||
Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout, WrappingRange,
|
||||
BackendRepr, FieldsShape, Float, Integer, LayoutCalculator, LayoutCalculatorError,
|
||||
LayoutData, Primitive, ReprOptions, Scalar, Size, StructKind, TargetDataLayout,
|
||||
WrappingRange,
|
||||
},
|
||||
LocalFieldId, StructId,
|
||||
};
|
||||
|
@ -168,7 +169,7 @@ fn layout_of_simd_ty(
|
|||
|
||||
// Compute the ABI of the element type:
|
||||
let e_ly = db.layout_of_ty(e_ty, env)?;
|
||||
let Abi::Scalar(e_abi) = e_ly.abi else {
|
||||
let BackendRepr::Scalar(e_abi) = e_ly.backend_repr else {
|
||||
return Err(LayoutError::Unknown);
|
||||
};
|
||||
|
||||
|
@ -190,7 +191,7 @@ fn layout_of_simd_ty(
|
|||
Ok(Arc::new(Layout {
|
||||
variants: Variants::Single { index: struct_variant_idx() },
|
||||
fields,
|
||||
abi: Abi::Vector { element: e_abi, count: e_len },
|
||||
backend_repr: BackendRepr::Vector { element: e_abi, count: e_len },
|
||||
largest_niche: e_ly.largest_niche,
|
||||
size,
|
||||
align,
|
||||
|
@ -294,18 +295,19 @@ pub fn layout_of_ty_query(
|
|||
.checked_mul(count, dl)
|
||||
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
|
||||
|
||||
let abi = if count != 0 && matches!(element.abi, Abi::Uninhabited) {
|
||||
Abi::Uninhabited
|
||||
} else {
|
||||
Abi::Aggregate { sized: true }
|
||||
};
|
||||
let backend_repr =
|
||||
if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
|
||||
BackendRepr::Uninhabited
|
||||
} else {
|
||||
BackendRepr::Memory { sized: true }
|
||||
};
|
||||
|
||||
let largest_niche = if count != 0 { element.largest_niche } else { None };
|
||||
|
||||
Layout {
|
||||
variants: Variants::Single { index: struct_variant_idx() },
|
||||
fields: FieldsShape::Array { stride: element.size, count },
|
||||
abi,
|
||||
backend_repr,
|
||||
largest_niche,
|
||||
align: element.align,
|
||||
size,
|
||||
|
@ -318,7 +320,7 @@ pub fn layout_of_ty_query(
|
|||
Layout {
|
||||
variants: Variants::Single { index: struct_variant_idx() },
|
||||
fields: FieldsShape::Array { stride: element.size, count: 0 },
|
||||
abi: Abi::Aggregate { sized: false },
|
||||
backend_repr: BackendRepr::Memory { sized: false },
|
||||
largest_niche: None,
|
||||
align: element.align,
|
||||
size: Size::ZERO,
|
||||
|
@ -329,7 +331,7 @@ pub fn layout_of_ty_query(
|
|||
TyKind::Str => Layout {
|
||||
variants: Variants::Single { index: struct_variant_idx() },
|
||||
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
|
||||
abi: Abi::Aggregate { sized: false },
|
||||
backend_repr: BackendRepr::Memory { sized: false },
|
||||
largest_niche: None,
|
||||
align: dl.i8_align,
|
||||
size: Size::ZERO,
|
||||
|
@ -379,8 +381,8 @@ pub fn layout_of_ty_query(
|
|||
TyKind::Never => cx.calc.layout_of_never_type(),
|
||||
TyKind::Dyn(_) | TyKind::Foreign(_) => {
|
||||
let mut unit = layout_of_unit(&cx)?;
|
||||
match &mut unit.abi {
|
||||
Abi::Aggregate { sized } => *sized = false,
|
||||
match &mut unit.backend_repr {
|
||||
BackendRepr::Memory { sized } => *sized = false,
|
||||
_ => return Err(LayoutError::Unknown),
|
||||
}
|
||||
unit
|
||||
|
|
|
@ -16,7 +16,6 @@ doctest = false
|
|||
object.workspace = true
|
||||
libloading.workspace = true
|
||||
memmap2.workspace = true
|
||||
snap.workspace = true
|
||||
|
||||
stdx.workspace = true
|
||||
tt.workspace = true
|
||||
|
|
|
@ -8,7 +8,6 @@ use std::{
|
|||
use memmap2::Mmap;
|
||||
use object::read::{File as BinaryFile, Object, ObjectSection};
|
||||
use paths::AbsPath;
|
||||
use snap::read::FrameDecoder as SnapDecoder;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
|
@ -123,9 +122,8 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
|
|||
let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
|
||||
// Last supported version is:
|
||||
// https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
|
||||
let (snappy_portion, bytes_before_version) = match version {
|
||||
5 | 6 => (&dot_rustc[8..], 13),
|
||||
7 | 8 => {
|
||||
let (mut metadata_portion, bytes_before_version) = match version {
|
||||
8 => {
|
||||
let len_bytes = &dot_rustc[8..12];
|
||||
let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
|
||||
(&dot_rustc[12..data_len + 12], 13)
|
||||
|
@ -143,13 +141,6 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
|
|||
}
|
||||
};
|
||||
|
||||
let mut uncompressed: Box<dyn Read> = if &snappy_portion[0..4] == b"rust" {
|
||||
// Not compressed.
|
||||
Box::new(snappy_portion)
|
||||
} else {
|
||||
Box::new(SnapDecoder::new(snappy_portion))
|
||||
};
|
||||
|
||||
// We're going to skip over the bytes before the version string, so basically:
|
||||
// 8 bytes for [b'r',b'u',b's',b't',0,0,0,5]
|
||||
// 4 or 8 bytes for [crate root bytes]
|
||||
|
@ -157,11 +148,11 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
|
|||
// so 13 or 17 bytes in total, and we should check the last of those bytes
|
||||
// to know the length
|
||||
let mut bytes = [0u8; 17];
|
||||
uncompressed.read_exact(&mut bytes[..bytes_before_version])?;
|
||||
metadata_portion.read_exact(&mut bytes[..bytes_before_version])?;
|
||||
let length = bytes[bytes_before_version - 1];
|
||||
|
||||
let mut version_string_utf8 = vec![0u8; length as usize];
|
||||
uncompressed.read_exact(&mut version_string_utf8)?;
|
||||
metadata_portion.read_exact(&mut version_string_utf8)?;
|
||||
let version_string = String::from_utf8(version_string_utf8);
|
||||
version_string.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
a9d17627d241645a54c1134a20f1596127fedb60
|
||||
145f9cf95de1fbde3fa11e98461310e0373253e6
|
||||
|
|
|
@ -135,7 +135,6 @@ Apache-2.0 WITH LLVM-exception
|
|||
Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
|
||||
Apache-2.0/MIT
|
||||
BSD-2-Clause OR Apache-2.0 OR MIT
|
||||
BSD-3-Clause
|
||||
CC0-1.0
|
||||
ISC
|
||||
MIT
|
||||
|
|
Loading…
Reference in a new issue