Skip to content

Commit 498ae9f

Browse files
committed
Auto merge of #144603 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@511c999. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
2 parents e3514bd + 36df2c9 commit 498ae9f

File tree

97 files changed

+2182
-1424
lines changed

Some content is hidden

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

97 files changed

+2182
-1424
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: rustc-pull
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run at 04:00 UTC every Monday and Thursday
7+
- cron: '0 4 * * 1,4'
8+
9+
jobs:
10+
pull:
11+
if: github.repository == 'rust-lang/rust-analyzer'
12+
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
13+
with:
14+
zulip-stream-id: 185405
15+
zulip-bot-email: "rust-analyzer-ci-bot@rust-lang.zulipchat.com"
16+
pr-base-branch: master
17+
branch-name: rustc-pull
18+
secrets:
19+
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
20+
token: ${{ secrets.GITHUB_TOKEN }}

src/tools/rust-analyzer/Cargo.lock

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,6 @@ dependencies = [
395395
"syn",
396396
]
397397

398-
[[package]]
399-
name = "directories"
400-
version = "6.0.0"
401-
source = "registry+https://github.com/rust-lang/crates.io-index"
402-
checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
403-
dependencies = [
404-
"dirs-sys",
405-
]
406-
407398
[[package]]
408399
name = "dirs"
409400
version = "6.0.0"
@@ -1268,7 +1259,7 @@ dependencies = [
12681259
"expect-test",
12691260
"intern",
12701261
"parser",
1271-
"ra-ap-rustc_lexer 0.122.0",
1262+
"ra-ap-rustc_lexer 0.123.0",
12721263
"rustc-hash 2.1.1",
12731264
"smallvec",
12741265
"span",
@@ -1504,7 +1495,7 @@ dependencies = [
15041495
"drop_bomb",
15051496
"edition",
15061497
"expect-test",
1507-
"ra-ap-rustc_lexer 0.122.0",
1498+
"ra-ap-rustc_lexer 0.123.0",
15081499
"rustc-literal-escaper",
15091500
"stdx",
15101501
"tracing",
@@ -1614,7 +1605,7 @@ dependencies = [
16141605
"object",
16151606
"paths",
16161607
"proc-macro-test",
1617-
"ra-ap-rustc_lexer 0.122.0",
1608+
"ra-ap-rustc_lexer 0.123.0",
16181609
"span",
16191610
"syntax-bridge",
16201611
"tt",
@@ -1688,6 +1679,7 @@ dependencies = [
16881679
"serde_json",
16891680
"span",
16901681
"stdx",
1682+
"temp-dir",
16911683
"toolchain",
16921684
"tracing",
16931685
"triomphe",
@@ -1756,9 +1748,9 @@ dependencies = [
17561748

17571749
[[package]]
17581750
name = "ra-ap-rustc_abi"
1759-
version = "0.122.0"
1751+
version = "0.123.0"
17601752
source = "registry+https://github.com/rust-lang/crates.io-index"
1761-
checksum = "fb01e1fec578003c85481c1cad4ff8cd8195b07c2dc85ae3f716108507ae15d5"
1753+
checksum = "f18c877575c259d127072e9bfc41d985202262fb4d6bfdae3d1252147c2562c2"
17621754
dependencies = [
17631755
"bitflags 2.9.1",
17641756
"ra-ap-rustc_hashes",
@@ -1768,28 +1760,28 @@ dependencies = [
17681760

17691761
[[package]]
17701762
name = "ra-ap-rustc_hashes"
1771-
version = "0.122.0"
1763+
version = "0.123.0"
17721764
source = "registry+https://github.com/rust-lang/crates.io-index"
1773-
checksum = "e0ec056e72a472ffef8761ce96ece6c626eb07368c09d0105b6df30d27d07673"
1765+
checksum = "2439ed1df3472443133b66949f81080dff88089b42f825761455463709ee1cad"
17741766
dependencies = [
17751767
"rustc-stable-hash",
17761768
]
17771769

17781770
[[package]]
17791771
name = "ra-ap-rustc_index"
1780-
version = "0.122.0"
1772+
version = "0.123.0"
17811773
source = "registry+https://github.com/rust-lang/crates.io-index"
1782-
checksum = "0fcdd1001db0295e59052e9f53aeda588bbe81e362534f4687d41bd44777b5a7"
1774+
checksum = "57a24fe0be21be1f8ebc21dcb40129214fb4cefb0f2753f3d46b6dbe656a1a45"
17831775
dependencies = [
17841776
"ra-ap-rustc_index_macros",
17851777
"smallvec",
17861778
]
17871779

17881780
[[package]]
17891781
name = "ra-ap-rustc_index_macros"
1790-
version = "0.122.0"
1782+
version = "0.123.0"
17911783
source = "registry+https://github.com/rust-lang/crates.io-index"
1792-
checksum = "728d64dd98e25530b32e3f7c7c1e844e52722b269360daa1cdeba9dff9727a26"
1784+
checksum = "844a27ddcad0116facae2df8e741fd788662cf93dc13029cd864f2b8013b81f9"
17931785
dependencies = [
17941786
"proc-macro2",
17951787
"quote",
@@ -1809,9 +1801,9 @@ dependencies = [
18091801

18101802
[[package]]
18111803
name = "ra-ap-rustc_lexer"
1812-
version = "0.122.0"
1804+
version = "0.123.0"
18131805
source = "registry+https://github.com/rust-lang/crates.io-index"
1814-
checksum = "415f0821f512608d825b3215489a6a6a2c18ed9f0045953d514e7ec23d4b90ab"
1806+
checksum = "2b734cfcb577d09877799a22742f1bd398be6c00bc428d9de56d48d11ece5771"
18151807
dependencies = [
18161808
"memchr",
18171809
"unicode-properties",
@@ -1830,9 +1822,9 @@ dependencies = [
18301822

18311823
[[package]]
18321824
name = "ra-ap-rustc_pattern_analysis"
1833-
version = "0.122.0"
1825+
version = "0.123.0"
18341826
source = "registry+https://github.com/rust-lang/crates.io-index"
1835-
checksum = "4657fcfdfe06e2a02ec8180d4e7c95aecf4811ba50367e363d1a2300b7623284"
1827+
checksum = "75b0ee1f059b9dea0818c6c7267478926eee95ba4c7dcf89c8db32fa165d3904"
18361828
dependencies = [
18371829
"ra-ap-rustc_index",
18381830
"rustc-hash 2.1.1",
@@ -2293,6 +2285,12 @@ dependencies = [
22932285
"tt",
22942286
]
22952287

2288+
[[package]]
2289+
name = "temp-dir"
2290+
version = "0.1.16"
2291+
source = "registry+https://github.com/rust-lang/crates.io-index"
2292+
checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964"
2293+
22962294
[[package]]
22972295
name = "tenthash"
22982296
version = "1.1.0"
@@ -2592,7 +2590,7 @@ version = "0.0.0"
25922590
dependencies = [
25932591
"arrayvec",
25942592
"intern",
2595-
"ra-ap-rustc_lexer 0.122.0",
2593+
"ra-ap-rustc_lexer 0.123.0",
25962594
"stdx",
25972595
"text-size",
25982596
]
@@ -3105,7 +3103,6 @@ name = "xtask"
31053103
version = "0.1.0"
31063104
dependencies = [
31073105
"anyhow",
3108-
"directories",
31093106
"edition",
31103107
"either",
31113108
"flate2",

src/tools/rust-analyzer/Cargo.toml

Lines changed: 5 additions & 4 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.122", default-features = false }
92+
ra-ap-rustc_lexer = { version = "0.123", default-features = false }
9393
ra-ap-rustc_parse_format = { version = "0.121", default-features = false }
94-
ra-ap-rustc_index = { version = "0.122", default-features = false }
95-
ra-ap-rustc_abi = { version = "0.122", default-features = false }
96-
ra-ap-rustc_pattern_analysis = { version = "0.122", default-features = false }
94+
ra-ap-rustc_index = { version = "0.123", default-features = false }
95+
ra-ap-rustc_abi = { version = "0.123", default-features = false }
96+
ra-ap-rustc_pattern_analysis = { version = "0.123", default-features = false }
9797

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

@@ -156,6 +156,7 @@ smallvec = { version = "1.15.1", features = [
156156
"const_generics",
157157
] }
158158
smol_str = "0.3.2"
159+
temp-dir = "0.1.16"
159160
text-size = "1.1.1"
160161
tracing = "0.1.41"
161162
tracing-tree = "0.4.0"

src/tools/rust-analyzer/crates/base-db/src/input.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub type ProcMacroPaths =
3030
pub enum ProcMacroLoadingError {
3131
Disabled,
3232
FailedToBuild,
33+
ExpectedProcMacroArtifact,
3334
MissingDylibPath,
3435
NotYetBuilt,
3536
NoProcMacros,
@@ -39,7 +40,8 @@ impl ProcMacroLoadingError {
3940
pub fn is_hard_error(&self) -> bool {
4041
match self {
4142
ProcMacroLoadingError::Disabled | ProcMacroLoadingError::NotYetBuilt => false,
42-
ProcMacroLoadingError::FailedToBuild
43+
ProcMacroLoadingError::ExpectedProcMacroArtifact
44+
| ProcMacroLoadingError::FailedToBuild
4345
| ProcMacroLoadingError::MissingDylibPath
4446
| ProcMacroLoadingError::NoProcMacros
4547
| ProcMacroLoadingError::ProcMacroSrvError(_) => true,
@@ -51,10 +53,16 @@ impl Error for ProcMacroLoadingError {}
5153
impl fmt::Display for ProcMacroLoadingError {
5254
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5355
match self {
56+
ProcMacroLoadingError::ExpectedProcMacroArtifact => {
57+
write!(f, "proc-macro crate did not build proc-macro artifact")
58+
}
5459
ProcMacroLoadingError::Disabled => write!(f, "proc-macro expansion is disabled"),
5560
ProcMacroLoadingError::FailedToBuild => write!(f, "proc-macro failed to build"),
5661
ProcMacroLoadingError::MissingDylibPath => {
57-
write!(f, "proc-macro crate build data is missing a dylib path")
62+
write!(
63+
f,
64+
"proc-macro crate built but the dylib path is missing, this indicates a problem with your build system."
65+
)
5866
}
5967
ProcMacroLoadingError::NotYetBuilt => write!(f, "proc-macro not yet built"),
6068
ProcMacroLoadingError::NoProcMacros => {

src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::{
1616

1717
use cfg::{CfgExpr, CfgOptions};
1818
use either::Either;
19-
use hir_expand::{ExpandError, InFile, MacroCallId, mod_path::ModPath, name::Name};
19+
use hir_expand::{InFile, MacroCallId, mod_path::ModPath, name::Name};
2020
use la_arena::{Arena, ArenaMap};
2121
use rustc_hash::FxHashMap;
2222
use smallvec::SmallVec;
@@ -281,7 +281,6 @@ struct FormatTemplate {
281281
#[derive(Debug, Eq, PartialEq)]
282282
pub enum ExpressionStoreDiagnostics {
283283
InactiveCode { node: InFile<SyntaxNodePtr>, cfg: CfgExpr, opts: CfgOptions },
284-
MacroError { node: InFile<MacroCallPtr>, err: ExpandError },
285284
UnresolvedMacroCall { node: InFile<MacroCallPtr>, path: ModPath },
286285
UnreachableLabel { node: InFile<AstPtr<ast::Lifetime>>, name: Name },
287286
AwaitOutsideOfAsync { node: InFile<AstPtr<ast::AwaitExpr>>, location: String },

src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -960,38 +960,29 @@ impl ExprCollector<'_> {
960960
impl_trait_lower_fn: ImplTraitLowerFn<'_>,
961961
) -> TypeBound {
962962
match node.kind() {
963-
ast::TypeBoundKind::PathType(path_type) => {
963+
ast::TypeBoundKind::PathType(binder, path_type) => {
964+
let binder = match binder.and_then(|it| it.generic_param_list()) {
965+
Some(gpl) => gpl
966+
.lifetime_params()
967+
.flat_map(|lp| lp.lifetime().map(|lt| Name::new_lifetime(&lt.text())))
968+
.collect(),
969+
None => ThinVec::default(),
970+
};
964971
let m = match node.question_mark_token() {
965972
Some(_) => TraitBoundModifier::Maybe,
966973
None => TraitBoundModifier::None,
967974
};
968975
self.lower_path_type(&path_type, impl_trait_lower_fn)
969976
.map(|p| {
970-
TypeBound::Path(self.alloc_path(p, AstPtr::new(&path_type).upcast()), m)
977+
let path = self.alloc_path(p, AstPtr::new(&path_type).upcast());
978+
if binder.is_empty() {
979+
TypeBound::Path(path, m)
980+
} else {
981+
TypeBound::ForLifetime(binder, path)
982+
}
971983
})
972984
.unwrap_or(TypeBound::Error)
973985
}
974-
ast::TypeBoundKind::ForType(for_type) => {
975-
let lt_refs = match for_type.generic_param_list() {
976-
Some(gpl) => gpl
977-
.lifetime_params()
978-
.flat_map(|lp| lp.lifetime().map(|lt| Name::new_lifetime(&lt.text())))
979-
.collect(),
980-
None => ThinVec::default(),
981-
};
982-
let path = for_type.ty().and_then(|ty| match &ty {
983-
ast::Type::PathType(path_type) => {
984-
self.lower_path_type(path_type, impl_trait_lower_fn).map(|p| (p, ty))
985-
}
986-
_ => None,
987-
});
988-
match path {
989-
Some((p, ty)) => {
990-
TypeBound::ForLifetime(lt_refs, self.alloc_path(p, AstPtr::new(&ty)))
991-
}
992-
None => TypeBound::Error,
993-
}
994-
}
995986
ast::TypeBoundKind::Use(gal) => TypeBound::Use(
996987
gal.use_bound_generic_args()
997988
.map(|p| match p {
@@ -1981,13 +1972,7 @@ impl ExprCollector<'_> {
19811972
return collector(self, None);
19821973
}
19831974
};
1984-
if record_diagnostics {
1985-
if let Some(err) = res.err {
1986-
self.store
1987-
.diagnostics
1988-
.push(ExpressionStoreDiagnostics::MacroError { node: macro_call_ptr, err });
1989-
}
1990-
}
1975+
// No need to push macro and parsing errors as they'll be recreated from `macro_calls()`.
19911976

19921977
match res.value {
19931978
Some((mark, expansion)) => {
@@ -1997,10 +1982,6 @@ impl ExprCollector<'_> {
19971982
self.store.expansions.insert(macro_call_ptr, macro_file);
19981983
}
19991984

2000-
if record_diagnostics {
2001-
// FIXME: Report parse errors here
2002-
}
2003-
20041985
let id = collector(self, expansion.map(|it| it.tree()));
20051986
self.expander.exit(mark);
20061987
id

src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,18 @@ impl GenericParamsCollector {
180180
continue;
181181
};
182182

183-
let lifetimes: Option<Box<_>> = pred.generic_param_list().map(|param_list| {
184-
// Higher-Ranked Trait Bounds
185-
param_list
186-
.lifetime_params()
187-
.map(|lifetime_param| {
188-
lifetime_param
189-
.lifetime()
190-
.map_or_else(Name::missing, |lt| Name::new_lifetime(&lt.text()))
191-
})
192-
.collect()
193-
});
183+
let lifetimes: Option<Box<_>> =
184+
pred.for_binder().and_then(|it| it.generic_param_list()).map(|param_list| {
185+
// Higher-Ranked Trait Bounds
186+
param_list
187+
.lifetime_params()
188+
.map(|lifetime_param| {
189+
lifetime_param
190+
.lifetime()
191+
.map_or_else(Name::missing, |lt| Name::new_lifetime(&lt.text()))
192+
})
193+
.collect()
194+
});
194195
for bound in pred.type_bound_list().iter().flat_map(|l| l.bounds()) {
195196
self.lower_type_bound_as_predicate(ec, bound, lifetimes.as_deref(), target);
196197
}

src/tools/rust-analyzer/crates/hir-def/src/expr_store/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum Path {
2727
}
2828

2929
// This type is being used a lot, make sure it doesn't grow unintentionally.
30-
#[cfg(target_arch = "x86_64")]
30+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
3131
const _: () = {
3232
assert!(size_of::<Path>() == 24);
3333
assert!(size_of::<Option<Path>>() == 24);

src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub enum TypeRef {
148148
Error,
149149
}
150150

151-
#[cfg(target_arch = "x86_64")]
151+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
152152
const _: () = assert!(size_of::<TypeRef>() == 24);
153153

154154
pub type TypeRefId = Idx<TypeRef>;

0 commit comments

Comments
 (0)