Skip to content

Commit 1e7decd

Browse files
Merge pull request #22048 from ChayimFriedman2/upgrade-rustc
internal: Upgrade rustc crates
2 parents 94421fe + 20b02ef commit 1e7decd

50 files changed

Lines changed: 1827 additions & 2200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

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

Cargo.toml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ 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.143", default-features = false }
90-
ra-ap-rustc_parse_format = { version = "0.143", default-features = false }
91-
ra-ap-rustc_index = { version = "0.143", default-features = false }
92-
ra-ap-rustc_abi = { version = "0.143", default-features = false }
93-
ra-ap-rustc_pattern_analysis = { version = "0.143", default-features = false }
94-
ra-ap-rustc_ast_ir = { version = "0.143", default-features = false }
95-
ra-ap-rustc_type_ir = { version = "0.143", default-features = false }
96-
ra-ap-rustc_next_trait_solver = { version = "0.143", default-features = false }
89+
ra-ap-rustc_lexer = { version = "0.160", default-features = false }
90+
ra-ap-rustc_parse_format = { version = "0.160", default-features = false }
91+
ra-ap-rustc_index = { version = "0.160", default-features = false }
92+
ra-ap-rustc_abi = { version = "0.160", default-features = false }
93+
ra-ap-rustc_pattern_analysis = { version = "0.160", default-features = false }
94+
ra-ap-rustc_ast_ir = { version = "0.160", default-features = false }
95+
ra-ap-rustc_type_ir = { version = "0.160", default-features = false }
96+
ra-ap-rustc_next_trait_solver = { version = "0.160", default-features = false }
9797

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

@@ -127,7 +127,7 @@ object = { version = "0.36.7", default-features = false, features = [
127127
"macho",
128128
"pe",
129129
] }
130-
postcard = {version = "1.1.3", features = ["alloc"]}
130+
postcard = { version = "1.1.3", features = ["alloc"] }
131131
process-wrap = { version = "8.2.1", features = ["std"] }
132132
pulldown-cmark-to-cmark = "10.0.4"
133133
pulldown-cmark = { version = "0.9.6", default-features = false }
@@ -186,7 +186,10 @@ hashbrown = { version = "0.14.*", features = [
186186
elided_lifetimes_in_paths = "warn"
187187
explicit_outlives_requirements = "warn"
188188
unsafe_op_in_unsafe_fn = "warn"
189-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)', "cfg(no_salsa_async_drops)"] }
189+
unexpected_cfgs = { level = "warn", check-cfg = [
190+
'cfg(bootstrap)',
191+
"cfg(no_salsa_async_drops)",
192+
] }
190193
unused_extern_crates = "warn"
191194
unused_lifetimes = "warn"
192195
unreachable_pub = "warn"

crates/hir-def/src/attrs.rs

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn match_attr_flags(attr_flags: &mut AttrFlags, attr: ast::Meta) -> ControlFlow<
159159
None => match &*first_segment {
160160
"deprecated" => attr_flags.insert(AttrFlags::IS_DEPRECATED),
161161
"doc" => extract_doc_tt_attr(attr_flags, tt),
162-
"repr" => attr_flags.insert(AttrFlags::HAS_REPR),
162+
"repr" | "rustc_scalable_vector" => attr_flags.insert(AttrFlags::HAS_REPR),
163163
"target_feature" => attr_flags.insert(AttrFlags::HAS_TARGET_FEATURE),
164164
"proc_macro_derive" | "rustc_builtin_macro" => {
165165
attr_flags.insert(AttrFlags::IS_DERIVE_OR_BUILTIN_MACRO)
@@ -217,6 +217,7 @@ fn match_attr_flags(attr_flags: &mut AttrFlags, attr: ast::Meta) -> ControlFlow<
217217
"rustc_allow_incoherent_impl" => {
218218
attr_flags.insert(AttrFlags::RUSTC_ALLOW_INCOHERENT_IMPL)
219219
}
220+
"rustc_scalable_vector" => attr_flags.insert(AttrFlags::HAS_REPR),
220221
"fundamental" => attr_flags.insert(AttrFlags::FUNDAMENTAL),
221222
"no_std" => attr_flags.insert(AttrFlags::IS_NO_STD),
222223
"may_dangle" => attr_flags.insert(AttrFlags::MAY_DANGLE),
@@ -724,14 +725,40 @@ impl AttrFlags {
724725
fn repr(db: &dyn DefDatabase, owner: AdtId) -> Option<ReprOptions> {
725726
let mut result = None;
726727
collect_attrs::<Infallible>(db, owner.into(), |attr| {
727-
if let ast::Meta::TokenTreeMeta(attr) = attr
728-
&& attr.path().is1("repr")
728+
let mut current = None;
729+
if let ast::Meta::TokenTreeMeta(attr) = &attr
730+
&& let Some(path) = attr.path()
729731
&& let Some(tt) = attr.token_tree()
730-
&& let Some(repr) = parse_repr_tt(&tt)
731732
{
733+
if path.is1("repr")
734+
&& let Some(repr) = parse_repr_tt(&tt)
735+
{
736+
current = Some(repr);
737+
} else if path.is1("rustc_scalable_vector")
738+
&& let mut tt = TokenTreeChildren::new(&tt)
739+
&& let Some(NodeOrToken::Token(scalable)) = tt.next()
740+
&& let Some(scalable) = ast::IntNumber::cast(scalable)
741+
&& let Ok(scalable) = scalable.value()
742+
&& let Ok(scalable) = scalable.try_into()
743+
{
744+
current = Some(ReprOptions {
745+
scalable: Some(rustc_abi::ScalableElt::ElementCount(scalable)),
746+
..ReprOptions::default()
747+
});
748+
}
749+
} else if let ast::Meta::PathMeta(attr) = &attr
750+
&& attr.path().is1("rustc_scalable_vector")
751+
{
752+
current = Some(ReprOptions {
753+
scalable: Some(rustc_abi::ScalableElt::Container),
754+
..ReprOptions::default()
755+
});
756+
}
757+
758+
if let Some(current) = current {
732759
match &mut result {
733-
Some(existing) => merge_repr(existing, repr),
734-
None => result = Some(repr),
760+
Some(existing) => merge_repr(existing, current),
761+
None => result = Some(current),
735762
}
736763
}
737764
ControlFlow::Continue(())
@@ -1114,7 +1141,7 @@ impl AttrFlags {
11141141
}
11151142

11161143
fn merge_repr(this: &mut ReprOptions, other: ReprOptions) {
1117-
let ReprOptions { int, align, pack, flags, field_shuffle_seed: _ } = this;
1144+
let ReprOptions { int, align, pack, flags, scalable, field_shuffle_seed: _ } = this;
11181145
flags.insert(other.flags);
11191146
*align = (*align).max(other.align);
11201147
*pack = match (*pack, other.pack) {
@@ -1124,6 +1151,9 @@ fn merge_repr(this: &mut ReprOptions, other: ReprOptions) {
11241151
if other.int.is_some() {
11251152
*int = other.int;
11261153
}
1154+
if other.scalable.is_some() {
1155+
*scalable = other.scalable;
1156+
}
11271157
}
11281158

11291159
fn parse_repr_tt(tt: &ast::TokenTree) -> Option<ReprOptions> {

crates/hir-def/src/hir.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::fmt;
2121
use hir_expand::{MacroDefId, name::Name};
2222
use intern::Symbol;
2323
use la_arena::Idx;
24-
use rustc_apfloat::ieee::{Half as f16, Quad as f128};
24+
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
2525
use syntax::ast;
2626
use type_ref::TypeRefId;
2727

@@ -94,19 +94,19 @@ impl FloatTypeWrapper {
9494
Self(sym)
9595
}
9696

97-
pub fn to_f128(&self) -> f128 {
97+
pub fn to_f128(&self) -> Quad {
9898
self.0.as_str().parse().unwrap_or_default()
9999
}
100100

101-
pub fn to_f64(&self) -> f64 {
101+
pub fn to_f64(&self) -> Double {
102102
self.0.as_str().parse().unwrap_or_default()
103103
}
104104

105-
pub fn to_f32(&self) -> f32 {
105+
pub fn to_f32(&self) -> Single {
106106
self.0.as_str().parse().unwrap_or_default()
107107
}
108108

109-
pub fn to_f16(&self) -> f16 {
109+
pub fn to_f16(&self) -> Half {
110110
self.0.as_str().parse().unwrap_or_default()
111111
}
112112
}

0 commit comments

Comments
 (0)