Merge pull request #18746 from lnicola/sync-from-rust

minor: Sync from downstream
This commit is contained in:
Laurențiu Nicola 2024-12-23 10:12:23 +00:00 committed by GitHub
commit 80c97cab43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 21 deletions

24
Cargo.lock generated
View file

@ -1507,9 +1507,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_abi" name = "ra-ap-rustc_abi"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af462c3a2d524b84a51b6848b439787f01b35c6c1086d3e3086a5f5eea92ed9a" checksum = "28b782af0a7a8df16ddf43cd70da9f17bc3b1ce712c9e4992b6edb16f5f53632"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"ra-ap-rustc_index", "ra-ap-rustc_index",
@ -1518,9 +1518,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_index" name = "ra-ap-rustc_index"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be6bb8cb0ab78d94a222f1ffd3e87254cdfb57413382b8d6ebe26a85482f99d1" checksum = "ce5742f134960482f543b35ecebec3cacc6d79a9a685713518b4d8d70c5f9aa8"
dependencies = [ dependencies = [
"ra-ap-rustc_index_macros", "ra-ap-rustc_index_macros",
"smallvec", "smallvec",
@ -1528,9 +1528,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_index_macros" name = "ra-ap-rustc_index_macros"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24b1641455b46e87435b7321219672077066e678963d239a4a2904732979b16" checksum = "d7ea011fcf68309a8835ad01d91c032cb18444617b00e2cab21d45b208164441"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1539,9 +1539,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_lexer" name = "ra-ap-rustc_lexer"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94daa86974417981fed2f12bd8fb00158dfa6fee561152bed689278c846d0272" checksum = "eb76f0a4d4c20859e41f0a23bff0f37ab9ca9171c214a6c7dd72ea69434865dc"
dependencies = [ dependencies = [
"unicode-properties", "unicode-properties",
"unicode-xid", "unicode-xid",
@ -1549,9 +1549,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_parse_format" name = "ra-ap-rustc_parse_format"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc07f6bd581746f358e39c4b6bfe8d455b3d6ad1a857821016d0d42eeb5e1e3e" checksum = "06080bd35078305421a62da77f3c128482d8d44441b6da8ce9d146d1cd9cdb5b"
dependencies = [ dependencies = [
"ra-ap-rustc_index", "ra-ap-rustc_index",
"ra-ap-rustc_lexer", "ra-ap-rustc_lexer",
@ -1559,9 +1559,9 @@ dependencies = [
[[package]] [[package]]
name = "ra-ap-rustc_pattern_analysis" name = "ra-ap-rustc_pattern_analysis"
version = "0.85.0" version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f49b86e1276c1c3c72898410def29b699415f4e7d1dfb3531daf79794694372" checksum = "68a3154fe4c20c177d7b3c678a2d3a97aba0cca156ddef88959915041889daf0"
dependencies = [ dependencies = [
"ra-ap-rustc_index", "ra-ap-rustc_index",
"rustc-hash 2.0.0", "rustc-hash 2.0.0",

View file

@ -85,11 +85,11 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" } vfs = { path = "./crates/vfs", version = "0.0.0" }
edition = { path = "./crates/edition", version = "0.0.0" } edition = { path = "./crates/edition", version = "0.0.0" }
ra-ap-rustc_lexer = { version = "0.85", default-features = false } ra-ap-rustc_lexer = { version = "0.87", default-features = false }
ra-ap-rustc_parse_format = { version = "0.85", default-features = false } ra-ap-rustc_parse_format = { version = "0.87", default-features = false }
ra-ap-rustc_index = { version = "0.85", default-features = false } ra-ap-rustc_index = { version = "0.87", default-features = false }
ra-ap-rustc_abi = { version = "0.85", default-features = false } ra-ap-rustc_abi = { version = "0.87", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.85", default-features = false } ra-ap-rustc_pattern_analysis = { version = "0.87", default-features = false }
# local crates that aren't published to crates.io. These should not have versions. # local crates that aren't published to crates.io. These should not have versions.
test-fixture = { path = "./crates/test-fixture" } test-fixture = { path = "./crates/test-fixture" }

View file

@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
template!(List: "address, kcfi, memory, thread"), DuplicatesOk, template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
experimental!(no_sanitize) experimental!(no_sanitize)
), ),
gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)), ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing),
ungated!( ungated!(
doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk

View file

@ -813,7 +813,7 @@ impl Evaluator<'_> {
ProjectionElem::Field(Either::Left(f)) => { ProjectionElem::Field(Either::Left(f)) => {
let layout = self.layout(&prev_ty)?; let layout = self.layout(&prev_ty)?;
let variant_layout = match &layout.variants { let variant_layout = match &layout.variants {
Variants::Single { .. } => &layout, Variants::Single { .. } | Variants::Empty => &layout,
Variants::Multiple { variants, .. } => { Variants::Multiple { variants, .. } => {
&variants[match f.parent { &variants[match f.parent {
hir_def::VariantId::EnumVariantId(it) => { hir_def::VariantId::EnumVariantId(it) => {
@ -1638,6 +1638,7 @@ impl Evaluator<'_> {
return Ok(0); return Ok(0);
}; };
match &layout.variants { match &layout.variants {
Variants::Empty => unreachable!(),
Variants::Single { index } => { Variants::Single { index } => {
let r = self.const_eval_discriminant(self.db.enum_data(e).variants[index.0].0)?; let r = self.const_eval_discriminant(self.db.enum_data(e).variants[index.0].0)?;
Ok(r) Ok(r)
@ -1800,7 +1801,7 @@ impl Evaluator<'_> {
} }
let layout = self.layout_adt(adt, subst)?; let layout = self.layout_adt(adt, subst)?;
Ok(match &layout.variants { Ok(match &layout.variants {
Variants::Single { .. } => (layout.size.bytes_usize(), layout, None), Variants::Single { .. } | Variants::Empty => (layout.size.bytes_usize(), layout, None),
Variants::Multiple { variants, tag, tag_encoding, .. } => { Variants::Multiple { variants, tag, tag_encoding, .. } => {
let enum_variant_id = match it { let enum_variant_id = match it {
VariantId::EnumVariantId(it) => it, VariantId::EnumVariantId(it) => it,

View file

@ -334,6 +334,7 @@ pub(crate) fn detect_variant_from_bytes<'a>(
e: EnumId, e: EnumId,
) -> Option<(EnumVariantId, &'a Layout)> { ) -> Option<(EnumVariantId, &'a Layout)> {
let (var_id, var_layout) = match &layout.variants { let (var_id, var_layout) = match &layout.variants {
hir_def::layout::Variants::Empty => unreachable!(),
hir_def::layout::Variants::Single { index } => { hir_def::layout::Variants::Single { index } => {
(db.enum_data(e).variants[index.0].0, layout) (db.enum_data(e).variants[index.0].0, layout)
} }

View file

@ -1 +1 @@
5a6036a1802262f8cf02192b02026688d396f1d7 0eca4dd3205a01dba4bd7b7c140ec370aff03440