Skip to content

Commit 27dca57

Browse files
authored
Merge pull request #20243 from lnicola/sync-from-rust
minor: Sync from downstream
2 parents 4ddf2f2 + 0e2e6e7 commit 27dca57

File tree

13 files changed

+76
-67
lines changed

13 files changed

+76
-67
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8989
vfs = { path = "./crates/vfs", version = "0.0.0" }
9090
edition = { path = "./crates/edition", version = "0.0.0" }
9191

92-
ra-ap-rustc_lexer = { version = "0.116", default-features = false }
93-
ra-ap-rustc_parse_format = { version = "0.116", default-features = false }
94-
ra-ap-rustc_index = { version = "0.116", default-features = false }
95-
ra-ap-rustc_abi = { version = "0.116", default-features = false }
96-
ra-ap-rustc_pattern_analysis = { version = "0.116", default-features = false }
92+
ra-ap-rustc_lexer = { version = "0.121", default-features = false }
93+
ra-ap-rustc_parse_format = { version = "0.121", default-features = false }
94+
ra-ap-rustc_index = { version = "0.121", default-features = false }
95+
ra-ap-rustc_abi = { version = "0.121", default-features = false }
96+
ra-ap-rustc_pattern_analysis = { version = "0.121", default-features = false }
9797

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

@@ -138,7 +138,11 @@ rayon = "1.10.0"
138138
rowan = "=0.15.15"
139139
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
140140
# on impls without it
141-
salsa = { version = "0.23.0", default-features = true, features = ["rayon","salsa_unstable", "macros"] }
141+
salsa = { version = "0.23.0", default-features = true, features = [
142+
"rayon",
143+
"salsa_unstable",
144+
"macros",
145+
] }
142146
salsa-macros = "0.23.0"
143147
semver = "1.0.26"
144148
serde = { version = "1.0.219" }

crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,14 @@ impl PatCx for MatchCheckCtx<'_> {
489489
fn complexity_exceeded(&self) -> Result<(), Self::Error> {
490490
Err(())
491491
}
492+
493+
fn report_mixed_deref_pat_ctors(
494+
&self,
495+
_deref_pat: &DeconstructedPat<'_>,
496+
_normal_pat: &DeconstructedPat<'_>,
497+
) {
498+
// FIXME(deref_patterns): This could report an error comparable to the one in rustc.
499+
}
492500
}
493501

494502
impl fmt::Debug for MatchCheckCtx<'_> {

crates/hir-ty/src/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub fn layout_of_ty_query(
261261
}
262262
// Potentially-wide pointers.
263263
TyKind::Ref(_, _, pointee) | TyKind::Raw(_, pointee) => {
264-
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
264+
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
265265
if matches!(ty.kind(Interner), TyKind::Ref(..)) {
266266
data_ptr.valid_range_mut().start = 1;
267267
}
@@ -285,7 +285,7 @@ pub fn layout_of_ty_query(
285285
scalar_unit(dl, Primitive::Int(dl.ptr_sized_integer(), false))
286286
}
287287
TyKind::Dyn(..) => {
288-
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
288+
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
289289
vtable.valid_range_mut().start = 1;
290290
vtable
291291
}

crates/hir-ty/src/layout/target.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use base_db::Crate;
44
use hir_def::layout::TargetDataLayout;
5-
use rustc_abi::{AlignFromBytesError, TargetDataLayoutErrors};
5+
use rustc_abi::{AddressSpace, AlignFromBytesError, TargetDataLayoutErrors};
66
use triomphe::Arc;
77

88
use crate::db::HirDatabase;
@@ -12,7 +12,7 @@ pub fn target_data_layout_query(
1212
krate: Crate,
1313
) -> Result<Arc<TargetDataLayout>, Arc<str>> {
1414
match &krate.workspace_data(db).data_layout {
15-
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it) {
15+
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it, AddressSpace::ZERO) {
1616
Ok(it) => Ok(Arc::new(it)),
1717
Err(e) => {
1818
Err(match e {
@@ -39,6 +39,7 @@ pub fn target_data_layout_query(
3939
target,
4040
} => format!(r#"inconsistent target specification: "data-layout" claims pointers are {pointer_size}-bit, while "target-pointer-width" is `{target}`"#),
4141
TargetDataLayoutErrors::InvalidBitsSize { err } => err,
42+
TargetDataLayoutErrors::UnknownPointerSpecification { err } => format!(r#"use of unknown pointer specifer in "data-layout": {err}"#),
4243
}.into())
4344
}
4445
},

crates/hir-ty/src/mir/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl Evaluator<'_> {
630630
Ok(target_data_layout) => target_data_layout,
631631
Err(e) => return Err(MirEvalError::TargetDataLayoutNotAvailable(e)),
632632
};
633-
let cached_ptr_size = target_data_layout.pointer_size.bytes_usize();
633+
let cached_ptr_size = target_data_layout.pointer_size().bytes_usize();
634634
Ok(Evaluator {
635635
target_data_layout,
636636
stack: vec![0],

crates/ide-db/src/generated/lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4711,9 +4711,9 @@ The tracking issue for this feature is: [#133668]
47114711
label: "const_trait_impl",
47124712
description: r##"# `const_trait_impl`
47134713

4714-
The tracking issue for this feature is: [#67792]
4714+
The tracking issue for this feature is: [#143874]
47154715

4716-
[#67792]: https://github.com/rust-lang/rust/issues/67792
4716+
[#143874]: https://github.com/rust-lang/rust/issues/143874
47174717

47184718
------------------------
47194719
"##,

crates/ide/src/file_structure.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ macro_rules! mcexp {
329329
#[deprecated]
330330
fn obsolete() {}
331331
332-
#[deprecated(note = "for awhile")]
332+
#[deprecated(note = "for a while")]
333333
fn very_obsolete() {}
334334
335335
// region: Some region name
@@ -608,8 +608,8 @@ fn let_statements() {
608608
StructureNode {
609609
parent: None,
610610
label: "very_obsolete",
611-
navigation_range: 511..524,
612-
node_range: 473..529,
611+
navigation_range: 512..525,
612+
node_range: 473..530,
613613
kind: SymbolKind(
614614
Function,
615615
),
@@ -621,17 +621,17 @@ fn let_statements() {
621621
StructureNode {
622622
parent: None,
623623
label: "Some region name",
624-
navigation_range: 531..558,
625-
node_range: 531..558,
624+
navigation_range: 532..559,
625+
node_range: 532..559,
626626
kind: Region,
627627
detail: None,
628628
deprecated: false,
629629
},
630630
StructureNode {
631631
parent: None,
632632
label: "m",
633-
navigation_range: 598..599,
634-
node_range: 573..636,
633+
navigation_range: 599..600,
634+
node_range: 574..637,
635635
kind: SymbolKind(
636636
Module,
637637
),
@@ -643,8 +643,8 @@ fn let_statements() {
643643
22,
644644
),
645645
label: "dontpanic",
646-
navigation_range: 573..593,
647-
node_range: 573..593,
646+
navigation_range: 574..594,
647+
node_range: 574..594,
648648
kind: Region,
649649
detail: None,
650650
deprecated: false,
@@ -654,8 +654,8 @@ fn let_statements() {
654654
22,
655655
),
656656
label: "f",
657-
navigation_range: 605..606,
658-
node_range: 602..611,
657+
navigation_range: 606..607,
658+
node_range: 603..612,
659659
kind: SymbolKind(
660660
Function,
661661
),
@@ -669,8 +669,8 @@ fn let_statements() {
669669
22,
670670
),
671671
label: "g",
672-
navigation_range: 628..629,
673-
node_range: 612..634,
672+
navigation_range: 629..630,
673+
node_range: 613..635,
674674
kind: SymbolKind(
675675
Function,
676676
),
@@ -682,17 +682,17 @@ fn let_statements() {
682682
StructureNode {
683683
parent: None,
684684
label: "extern \"C\"",
685-
navigation_range: 638..648,
686-
node_range: 638..651,
685+
navigation_range: 639..649,
686+
node_range: 639..652,
687687
kind: ExternBlock,
688688
detail: None,
689689
deprecated: false,
690690
},
691691
StructureNode {
692692
parent: None,
693693
label: "let_statements",
694-
navigation_range: 656..670,
695-
node_range: 653..813,
694+
navigation_range: 657..671,
695+
node_range: 654..814,
696696
kind: SymbolKind(
697697
Function,
698698
),
@@ -706,8 +706,8 @@ fn let_statements() {
706706
27,
707707
),
708708
label: "x",
709-
navigation_range: 683..684,
710-
node_range: 679..690,
709+
navigation_range: 684..685,
710+
node_range: 680..691,
711711
kind: SymbolKind(
712712
Local,
713713
),
@@ -719,8 +719,8 @@ fn let_statements() {
719719
27,
720720
),
721721
label: "mut y",
722-
navigation_range: 699..704,
723-
node_range: 695..709,
722+
navigation_range: 700..705,
723+
node_range: 696..710,
724724
kind: SymbolKind(
725725
Local,
726726
),
@@ -732,8 +732,8 @@ fn let_statements() {
732732
27,
733733
),
734734
label: "Foo { .. }",
735-
navigation_range: 718..740,
736-
node_range: 714..753,
735+
navigation_range: 719..741,
736+
node_range: 715..754,
737737
kind: SymbolKind(
738738
Local,
739739
),
@@ -745,8 +745,8 @@ fn let_statements() {
745745
27,
746746
),
747747
label: "_",
748-
navigation_range: 803..804,
749-
node_range: 799..811,
748+
navigation_range: 804..805,
749+
node_range: 800..812,
750750
kind: SymbolKind(
751751
Local,
752752
),

crates/parser/src/lexed_str.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ impl<'a> LexedStr<'a> {
4444

4545
// Re-create the tokenizer from scratch every token because `GuardedStrPrefix` is one token in the lexer
4646
// but we want to split it to two in edition <2024.
47-
while let Some(token) = rustc_lexer::tokenize(&text[conv.offset..]).next() {
47+
while let Some(token) =
48+
rustc_lexer::tokenize(&text[conv.offset..], rustc_lexer::FrontmatterAllowed::No).next()
49+
{
4850
let token_text = &text[conv.offset..][..token.len as usize];
4951

5052
conv.extend_token(&token.kind, token_text);
@@ -58,7 +60,7 @@ impl<'a> LexedStr<'a> {
5860
return None;
5961
}
6062

61-
let token = rustc_lexer::tokenize(text).next()?;
63+
let token = rustc_lexer::tokenize(text, rustc_lexer::FrontmatterAllowed::No).next()?;
6264
if token.len as usize != text.len() {
6365
return None;
6466
}

crates/proc-macro-srv/src/server_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub(super) fn literal_from_str<Span: Copy>(
121121
use proc_macro::bridge::LitKind;
122122
use rustc_lexer::{LiteralKind, Token, TokenKind};
123123

124-
let mut tokens = rustc_lexer::tokenize(s);
124+
let mut tokens = rustc_lexer::tokenize(s, rustc_lexer::FrontmatterAllowed::No);
125125
let minus_or_lit = tokens.next().unwrap_or(Token { kind: TokenKind::Eof, len: 0 });
126126

127127
let lit = if minus_or_lit.kind == TokenKind::Minus {

0 commit comments

Comments
 (0)