mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
Merge pull request #20243 from lnicola/sync-from-rust
minor: Sync from downstream
This commit is contained in:
commit
27dca57e24
40
Cargo.lock
generated
40
Cargo.lock
generated
@ -1502,7 +1502,7 @@ dependencies = [
|
||||
"edition",
|
||||
"expect-test",
|
||||
"ra-ap-rustc_lexer",
|
||||
"rustc-literal-escaper 0.0.4",
|
||||
"rustc-literal-escaper",
|
||||
"stdx",
|
||||
"tracing",
|
||||
]
|
||||
@ -1753,9 +1753,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_abi"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a967e3a9cd3e38b543f503978e0eccee461e3aea3f7b10e944959bff41dbe612"
|
||||
checksum = "3ee51482d1c9d3e538acda8cce723db8eea1a81540544bf362bf4c3d841b2329"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"ra-ap-rustc_hashes",
|
||||
@ -1765,18 +1765,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_hashes"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ea4c755ecbbffa5743c251344f484ebe571ec7bc5b36d80b2a8ae775d1a7a40"
|
||||
checksum = "19c8f1e0c28e24e1b4c55dc08058c6c9829df2204497d4034259f491d348c204"
|
||||
dependencies = [
|
||||
"rustc-stable-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aca7ad7cf911538c619caa2162339fe98637e9e46f11bb0484ef96735df4d64a"
|
||||
checksum = "5f33f429cec6b92fa2c7243883279fb29dd233fdc3e94099aff32aa91aa87f50"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index_macros",
|
||||
"smallvec",
|
||||
@ -1784,9 +1784,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8767ba551c9355bc3031be072cc4bb0381106e5e7cd275e72b7a8c76051c4070"
|
||||
checksum = "b9b55910dbe1fe7ef34bdc1d1bcb41e99b377eb680ea58a1218d95d6b4152257"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1795,9 +1795,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_lexer"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6101374afb267e6c27e4e2eb0b1352e9f3504c1a8f716f619cd39244e2ed92ab"
|
||||
checksum = "22944e31fb91e9b3e75bcbc91e37d958b8c0825a6160927f2856831d2ce83b36"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"unicode-properties",
|
||||
@ -1806,19 +1806,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_parse_format"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecd88a19f00da4f43e6727d5013444cbc399804b5046dfa2bbcd28ebed3970ce"
|
||||
checksum = "81057891bc2063ad9e353f29462fbc47a0f5072560af34428ae9313aaa5e9d97"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_lexer",
|
||||
"rustc-literal-escaper 0.0.2",
|
||||
"rustc-literal-escaper",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_pattern_analysis"
|
||||
version = "0.116.0"
|
||||
version = "0.121.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb332dd32d7850a799862533b1c021e6062558861a4ad57817bf522499fbb892"
|
||||
checksum = "fe21a3542980d56d2435e96c2720773cac1c63fd4db666417e414729da192eb3"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index",
|
||||
"rustc-hash 2.1.1",
|
||||
@ -1963,12 +1963,6 @@ version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-literal-escaper"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0041b6238913c41fe704213a4a9329e2f685a156d1781998128b4149c230ad04"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-literal-escaper"
|
||||
version = "0.0.4"
|
||||
@ -2262,7 +2256,7 @@ dependencies = [
|
||||
"rayon",
|
||||
"rowan",
|
||||
"rustc-hash 2.1.1",
|
||||
"rustc-literal-escaper 0.0.4",
|
||||
"rustc-literal-escaper",
|
||||
"rustc_apfloat",
|
||||
"smol_str",
|
||||
"stdx",
|
||||
|
16
Cargo.toml
16
Cargo.toml
@ -89,11 +89,11 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
|
||||
vfs = { path = "./crates/vfs", version = "0.0.0" }
|
||||
edition = { path = "./crates/edition", version = "0.0.0" }
|
||||
|
||||
ra-ap-rustc_lexer = { version = "0.116", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.116", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.116", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.116", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.116", default-features = false }
|
||||
ra-ap-rustc_lexer = { version = "0.121", default-features = false }
|
||||
ra-ap-rustc_parse_format = { version = "0.121", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.121", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.121", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.121", default-features = false }
|
||||
|
||||
# local crates that aren't published to crates.io. These should not have versions.
|
||||
|
||||
@ -138,7 +138,11 @@ rayon = "1.10.0"
|
||||
rowan = "=0.15.15"
|
||||
# Ideally we'd not enable the macros feature but unfortunately the `tracked` attribute does not work
|
||||
# on impls without it
|
||||
salsa = { version = "0.23.0", default-features = true, features = ["rayon","salsa_unstable", "macros"] }
|
||||
salsa = { version = "0.23.0", default-features = true, features = [
|
||||
"rayon",
|
||||
"salsa_unstable",
|
||||
"macros",
|
||||
] }
|
||||
salsa-macros = "0.23.0"
|
||||
semver = "1.0.26"
|
||||
serde = { version = "1.0.219" }
|
||||
|
@ -489,6 +489,14 @@ impl PatCx for MatchCheckCtx<'_> {
|
||||
fn complexity_exceeded(&self) -> Result<(), Self::Error> {
|
||||
Err(())
|
||||
}
|
||||
|
||||
fn report_mixed_deref_pat_ctors(
|
||||
&self,
|
||||
_deref_pat: &DeconstructedPat<'_>,
|
||||
_normal_pat: &DeconstructedPat<'_>,
|
||||
) {
|
||||
// FIXME(deref_patterns): This could report an error comparable to the one in rustc.
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for MatchCheckCtx<'_> {
|
||||
|
@ -261,7 +261,7 @@ pub fn layout_of_ty_query(
|
||||
}
|
||||
// Potentially-wide pointers.
|
||||
TyKind::Ref(_, _, pointee) | TyKind::Raw(_, pointee) => {
|
||||
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
|
||||
let mut data_ptr = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
|
||||
if matches!(ty.kind(Interner), TyKind::Ref(..)) {
|
||||
data_ptr.valid_range_mut().start = 1;
|
||||
}
|
||||
@ -285,7 +285,7 @@ pub fn layout_of_ty_query(
|
||||
scalar_unit(dl, Primitive::Int(dl.ptr_sized_integer(), false))
|
||||
}
|
||||
TyKind::Dyn(..) => {
|
||||
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::DATA));
|
||||
let mut vtable = scalar_unit(dl, Primitive::Pointer(AddressSpace::ZERO));
|
||||
vtable.valid_range_mut().start = 1;
|
||||
vtable
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use base_db::Crate;
|
||||
use hir_def::layout::TargetDataLayout;
|
||||
use rustc_abi::{AlignFromBytesError, TargetDataLayoutErrors};
|
||||
use rustc_abi::{AddressSpace, AlignFromBytesError, TargetDataLayoutErrors};
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::db::HirDatabase;
|
||||
@ -12,7 +12,7 @@ pub fn target_data_layout_query(
|
||||
krate: Crate,
|
||||
) -> Result<Arc<TargetDataLayout>, Arc<str>> {
|
||||
match &krate.workspace_data(db).data_layout {
|
||||
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it) {
|
||||
Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it, AddressSpace::ZERO) {
|
||||
Ok(it) => Ok(Arc::new(it)),
|
||||
Err(e) => {
|
||||
Err(match e {
|
||||
@ -39,6 +39,7 @@ pub fn target_data_layout_query(
|
||||
target,
|
||||
} => format!(r#"inconsistent target specification: "data-layout" claims pointers are {pointer_size}-bit, while "target-pointer-width" is `{target}`"#),
|
||||
TargetDataLayoutErrors::InvalidBitsSize { err } => err,
|
||||
TargetDataLayoutErrors::UnknownPointerSpecification { err } => format!(r#"use of unknown pointer specifer in "data-layout": {err}"#),
|
||||
}.into())
|
||||
}
|
||||
},
|
||||
|
@ -630,7 +630,7 @@ impl Evaluator<'_> {
|
||||
Ok(target_data_layout) => target_data_layout,
|
||||
Err(e) => return Err(MirEvalError::TargetDataLayoutNotAvailable(e)),
|
||||
};
|
||||
let cached_ptr_size = target_data_layout.pointer_size.bytes_usize();
|
||||
let cached_ptr_size = target_data_layout.pointer_size().bytes_usize();
|
||||
Ok(Evaluator {
|
||||
target_data_layout,
|
||||
stack: vec![0],
|
||||
|
@ -4711,9 +4711,9 @@ The tracking issue for this feature is: [#133668]
|
||||
label: "const_trait_impl",
|
||||
description: r##"# `const_trait_impl`
|
||||
|
||||
The tracking issue for this feature is: [#67792]
|
||||
The tracking issue for this feature is: [#143874]
|
||||
|
||||
[#67792]: https://github.com/rust-lang/rust/issues/67792
|
||||
[#143874]: https://github.com/rust-lang/rust/issues/143874
|
||||
|
||||
------------------------
|
||||
"##,
|
||||
|
@ -329,7 +329,7 @@ macro_rules! mcexp {
|
||||
#[deprecated]
|
||||
fn obsolete() {}
|
||||
|
||||
#[deprecated(note = "for awhile")]
|
||||
#[deprecated(note = "for a while")]
|
||||
fn very_obsolete() {}
|
||||
|
||||
// region: Some region name
|
||||
@ -608,8 +608,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "very_obsolete",
|
||||
navigation_range: 511..524,
|
||||
node_range: 473..529,
|
||||
navigation_range: 512..525,
|
||||
node_range: 473..530,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -621,8 +621,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "Some region name",
|
||||
navigation_range: 531..558,
|
||||
node_range: 531..558,
|
||||
navigation_range: 532..559,
|
||||
node_range: 532..559,
|
||||
kind: Region,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -630,8 +630,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "m",
|
||||
navigation_range: 598..599,
|
||||
node_range: 573..636,
|
||||
navigation_range: 599..600,
|
||||
node_range: 574..637,
|
||||
kind: SymbolKind(
|
||||
Module,
|
||||
),
|
||||
@ -643,8 +643,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "dontpanic",
|
||||
navigation_range: 573..593,
|
||||
node_range: 573..593,
|
||||
navigation_range: 574..594,
|
||||
node_range: 574..594,
|
||||
kind: Region,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -654,8 +654,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "f",
|
||||
navigation_range: 605..606,
|
||||
node_range: 602..611,
|
||||
navigation_range: 606..607,
|
||||
node_range: 603..612,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -669,8 +669,8 @@ fn let_statements() {
|
||||
22,
|
||||
),
|
||||
label: "g",
|
||||
navigation_range: 628..629,
|
||||
node_range: 612..634,
|
||||
navigation_range: 629..630,
|
||||
node_range: 613..635,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -682,8 +682,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "extern \"C\"",
|
||||
navigation_range: 638..648,
|
||||
node_range: 638..651,
|
||||
navigation_range: 639..649,
|
||||
node_range: 639..652,
|
||||
kind: ExternBlock,
|
||||
detail: None,
|
||||
deprecated: false,
|
||||
@ -691,8 +691,8 @@ fn let_statements() {
|
||||
StructureNode {
|
||||
parent: None,
|
||||
label: "let_statements",
|
||||
navigation_range: 656..670,
|
||||
node_range: 653..813,
|
||||
navigation_range: 657..671,
|
||||
node_range: 654..814,
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
@ -706,8 +706,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "x",
|
||||
navigation_range: 683..684,
|
||||
node_range: 679..690,
|
||||
navigation_range: 684..685,
|
||||
node_range: 680..691,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -719,8 +719,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "mut y",
|
||||
navigation_range: 699..704,
|
||||
node_range: 695..709,
|
||||
navigation_range: 700..705,
|
||||
node_range: 696..710,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -732,8 +732,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "Foo { .. }",
|
||||
navigation_range: 718..740,
|
||||
node_range: 714..753,
|
||||
navigation_range: 719..741,
|
||||
node_range: 715..754,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
@ -745,8 +745,8 @@ fn let_statements() {
|
||||
27,
|
||||
),
|
||||
label: "_",
|
||||
navigation_range: 803..804,
|
||||
node_range: 799..811,
|
||||
navigation_range: 804..805,
|
||||
node_range: 800..812,
|
||||
kind: SymbolKind(
|
||||
Local,
|
||||
),
|
||||
|
@ -44,7 +44,9 @@ impl<'a> LexedStr<'a> {
|
||||
|
||||
// Re-create the tokenizer from scratch every token because `GuardedStrPrefix` is one token in the lexer
|
||||
// but we want to split it to two in edition <2024.
|
||||
while let Some(token) = rustc_lexer::tokenize(&text[conv.offset..]).next() {
|
||||
while let Some(token) =
|
||||
rustc_lexer::tokenize(&text[conv.offset..], rustc_lexer::FrontmatterAllowed::No).next()
|
||||
{
|
||||
let token_text = &text[conv.offset..][..token.len as usize];
|
||||
|
||||
conv.extend_token(&token.kind, token_text);
|
||||
@ -58,7 +60,7 @@ impl<'a> LexedStr<'a> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let token = rustc_lexer::tokenize(text).next()?;
|
||||
let token = rustc_lexer::tokenize(text, rustc_lexer::FrontmatterAllowed::No).next()?;
|
||||
if token.len as usize != text.len() {
|
||||
return None;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ pub(super) fn literal_from_str<Span: Copy>(
|
||||
use proc_macro::bridge::LitKind;
|
||||
use rustc_lexer::{LiteralKind, Token, TokenKind};
|
||||
|
||||
let mut tokens = rustc_lexer::tokenize(s);
|
||||
let mut tokens = rustc_lexer::tokenize(s, rustc_lexer::FrontmatterAllowed::No);
|
||||
let minus_or_lit = tokens.next().unwrap_or(Token { kind: TokenKind::Eof, len: 0 });
|
||||
|
||||
let lit = if minus_or_lit.kind == TokenKind::Minus {
|
||||
|
@ -25,7 +25,7 @@ impl flags::Scip {
|
||||
eprintln!("Generating SCIP start...");
|
||||
let now = Instant::now();
|
||||
|
||||
let no_progress = &|s| (eprintln!("rust-analyzer: Loading {s}"));
|
||||
let no_progress = &|s| eprintln!("rust-analyzer: Loading {s}");
|
||||
let root =
|
||||
vfs::AbsPathBuf::assert_utf8(std::env::current_dir()?.join(&self.path)).normalize();
|
||||
|
||||
|
@ -579,7 +579,7 @@ where
|
||||
{
|
||||
use rustc_lexer::LiteralKind;
|
||||
|
||||
let token = rustc_lexer::tokenize(text).next_tuple();
|
||||
let token = rustc_lexer::tokenize(text, rustc_lexer::FrontmatterAllowed::No).next_tuple();
|
||||
let Some((rustc_lexer::Token {
|
||||
kind: rustc_lexer::TokenKind::Literal { kind, suffix_start },
|
||||
..
|
||||
|
@ -1 +1 @@
|
||||
ad3b7257615c28aaf8212a189ec032b8af75de51
|
||||
a9fb6103b05c6ad6eee6bed4c0bb5a2e8e1024c6
|
||||
|
Loading…
x
Reference in New Issue
Block a user