Skip to content

Commit 6e4644f

Browse files
authored
Merge pull request rust-lang#20329 from jackh726/next-trait-solver-querify
Switch from Chalk to the next trait solver
2 parents 40b8d41 + eb2bbbb commit 6e4644f

File tree

109 files changed

+19140
-1309
lines changed

Some content is hidden

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

109 files changed

+19140
-1309
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
259259

260260
[[package]]
261261
name = "chalk-derive"
262-
version = "0.103.0"
262+
version = "0.104.0"
263263
source = "registry+https://github.com/rust-lang/crates.io-index"
264-
checksum = "eb4899682de915ca7c0b025bdd0a3d34c75fe12184122fda6805a7baddaa293c"
264+
checksum = "9ea9b1e80910f66ae87c772247591432032ef3f6a67367ff17f8343db05beafa"
265265
dependencies = [
266266
"proc-macro2",
267267
"quote",
@@ -271,19 +271,19 @@ dependencies = [
271271

272272
[[package]]
273273
name = "chalk-ir"
274-
version = "0.103.0"
274+
version = "0.104.0"
275275
source = "registry+https://github.com/rust-lang/crates.io-index"
276-
checksum = "90a37d2ab99352b4caca135061e7b4ac67024b648c28ed0b787feec4bea4caed"
276+
checksum = "7047a516de16226cd17344d41a319d0ea1064bf9e60bd612ab341ab4a34bbfa8"
277277
dependencies = [
278278
"bitflags 2.9.1",
279279
"chalk-derive",
280280
]
281281

282282
[[package]]
283283
name = "chalk-recursive"
284-
version = "0.103.0"
284+
version = "0.104.0"
285285
source = "registry+https://github.com/rust-lang/crates.io-index"
286-
checksum = "c855be60e646664bc37c2496d3dc81ca5ef60520930e5e0f0057a0575aff6c19"
286+
checksum = "882959c242558cc686de7ff0aa59860295598d119e84a4b100215f44c3d606c4"
287287
dependencies = [
288288
"chalk-derive",
289289
"chalk-ir",
@@ -294,9 +294,9 @@ dependencies = [
294294

295295
[[package]]
296296
name = "chalk-solve"
297-
version = "0.103.0"
297+
version = "0.104.0"
298298
source = "registry+https://github.com/rust-lang/crates.io-index"
299-
checksum = "477ac6cdfd2013e9f93b09b036c2b607a67b2e728f4777b8422d55a79e9e3a34"
299+
checksum = "72860086494ccfa05bbd3779a74babb8ace27da9a0cbabffa1315223c7290927"
300300
dependencies = [
301301
"chalk-derive",
302302
"chalk-ir",
@@ -445,6 +445,17 @@ dependencies = [
445445
"powerfmt",
446446
]
447447

448+
[[package]]
449+
name = "derive-where"
450+
version = "1.5.0"
451+
source = "registry+https://github.com/rust-lang/crates.io-index"
452+
checksum = "510c292c8cf384b1a340b816a9a6cf2599eb8f566a44949024af88418000c50b"
453+
dependencies = [
454+
"proc-macro2",
455+
"quote",
456+
"syn",
457+
]
458+
448459
[[package]]
449460
name = "derive_arbitrary"
450461
version = "1.4.1"
@@ -696,6 +707,7 @@ dependencies = [
696707
"indexmap",
697708
"intern",
698709
"itertools 0.14.0",
710+
"ra-ap-rustc_type_ir",
699711
"rustc-hash 2.1.1",
700712
"smallvec",
701713
"span",
@@ -705,6 +717,8 @@ dependencies = [
705717
"test-fixture",
706718
"test-utils",
707719
"tracing",
720+
"tracing-subscriber",
721+
"tracing-tree",
708722
"triomphe",
709723
"tt",
710724
]
@@ -801,8 +815,11 @@ dependencies = [
801815
"project-model",
802816
"query-group-macro",
803817
"ra-ap-rustc_abi",
818+
"ra-ap-rustc_ast_ir",
804819
"ra-ap-rustc_index",
820+
"ra-ap-rustc_next_trait_solver",
805821
"ra-ap-rustc_pattern_analysis",
822+
"ra-ap-rustc_type_ir",
806823
"rustc-hash 2.1.1",
807824
"rustc_apfloat",
808825
"salsa",
@@ -1856,6 +1873,12 @@ dependencies = [
18561873
"tracing",
18571874
]
18581875

1876+
[[package]]
1877+
name = "ra-ap-rustc_ast_ir"
1878+
version = "0.123.0"
1879+
source = "registry+https://github.com/rust-lang/crates.io-index"
1880+
checksum = "87cc17e8ce797f2a8d03b838fbf166749b876164432ce81e37d283bf69e3cf80"
1881+
18591882
[[package]]
18601883
name = "ra-ap-rustc_hashes"
18611884
version = "0.123.0"
@@ -1908,6 +1931,19 @@ dependencies = [
19081931
"unicode-xid",
19091932
]
19101933

1934+
[[package]]
1935+
name = "ra-ap-rustc_next_trait_solver"
1936+
version = "0.123.0"
1937+
source = "registry+https://github.com/rust-lang/crates.io-index"
1938+
checksum = "14f7dfbdf1d045ff4e385e1efdfc3799379895e9c3f3b9b379a0bef4cb238441"
1939+
dependencies = [
1940+
"derive-where",
1941+
"ra-ap-rustc_index",
1942+
"ra-ap-rustc_type_ir",
1943+
"ra-ap-rustc_type_ir_macros",
1944+
"tracing",
1945+
]
1946+
19111947
[[package]]
19121948
name = "ra-ap-rustc_parse_format"
19131949
version = "0.121.0"
@@ -1931,6 +1967,37 @@ dependencies = [
19311967
"tracing",
19321968
]
19331969

1970+
[[package]]
1971+
name = "ra-ap-rustc_type_ir"
1972+
version = "0.123.0"
1973+
source = "registry+https://github.com/rust-lang/crates.io-index"
1974+
checksum = "0bc59fb10a922c38a24cb8a1494f799b0af30bd041acbea689378d3bf330534b"
1975+
dependencies = [
1976+
"bitflags 2.9.1",
1977+
"derive-where",
1978+
"ena",
1979+
"indexmap",
1980+
"ra-ap-rustc_ast_ir",
1981+
"ra-ap-rustc_index",
1982+
"ra-ap-rustc_type_ir_macros",
1983+
"rustc-hash 2.1.1",
1984+
"smallvec",
1985+
"thin-vec",
1986+
"tracing",
1987+
]
1988+
1989+
[[package]]
1990+
name = "ra-ap-rustc_type_ir_macros"
1991+
version = "0.123.0"
1992+
source = "registry+https://github.com/rust-lang/crates.io-index"
1993+
checksum = "58878914b6dac7499baeecc8dbb4b9d9dda88030e4ab90cd3b4e87523fbedafe"
1994+
dependencies = [
1995+
"proc-macro2",
1996+
"quote",
1997+
"syn",
1998+
"synstructure",
1999+
]
2000+
19342001
[[package]]
19352002
name = "rayon"
19362003
version = "1.10.0"

src/tools/rust-analyzer/Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ ra-ap-rustc_parse_format = { version = "0.121", default-features = false }
9494
ra-ap-rustc_index = { version = "0.123", default-features = false }
9595
ra-ap-rustc_abi = { version = "0.123", default-features = false }
9696
ra-ap-rustc_pattern_analysis = { version = "0.123", default-features = false }
97+
ra-ap-rustc_ast_ir = { version = "0.123", default-features = false }
98+
ra-ap-rustc_type_ir = { version = "0.123", default-features = false }
99+
ra-ap-rustc_next_trait_solver = { version = "0.123", default-features = false }
97100

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

@@ -108,10 +111,10 @@ arrayvec = "0.7.6"
108111
bitflags = "2.9.1"
109112
cargo_metadata = "0.21.0"
110113
camino = "1.1.10"
111-
chalk-solve = { version = "0.103.0", default-features = false }
112-
chalk-ir = "0.103.0"
113-
chalk-recursive = { version = "0.103.0", default-features = false }
114-
chalk-derive = "0.103.0"
114+
chalk-solve = { version = "0.104.0", default-features = false }
115+
chalk-ir = "0.104.0"
116+
chalk-recursive = { version = "0.104.0", default-features = false }
117+
chalk-derive = "0.104.0"
115118
crossbeam-channel = "0.5.15"
116119
dissimilar = "1.0.10"
117120
dot = "0.1.4"

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,17 @@ language_item_table! {
383383
AsyncFnMut, sym::async_fn_mut, async_fn_mut_trait, Target::Trait, GenericRequirement::Exact(1);
384384
AsyncFnOnce, sym::async_fn_once, async_fn_once_trait, Target::Trait, GenericRequirement::Exact(1);
385385

386-
AsyncFnOnceOutput, sym::async_fn_once_output,async_fn_once_output, Target::AssocTy, GenericRequirement::None;
386+
CallRefFuture, sym::call_ref_future, call_ref_future_ty, Target::AssocTy, GenericRequirement::None;
387+
CallOnceFuture, sym::call_once_future, call_once_future_ty, Target::AssocTy, GenericRequirement::None;
388+
AsyncFnOnceOutput, sym::async_fn_once_output, async_fn_once_output_ty, Target::AssocTy, GenericRequirement::None;
389+
387390
FnOnceOutput, sym::fn_once_output, fn_once_output, Target::AssocTy, GenericRequirement::None;
388391

389392
Future, sym::future_trait, future_trait, Target::Trait, GenericRequirement::Exact(0);
390393
CoroutineState, sym::coroutine_state, coroutine_state, Target::Enum, GenericRequirement::None;
391394
Coroutine, sym::coroutine, coroutine_trait, Target::Trait, GenericRequirement::Minimum(1);
395+
CoroutineReturn, sym::coroutine_return, coroutine_return_ty, Target::AssocTy, GenericRequirement::None;
396+
CoroutineYield, sym::coroutine_yield, coroutine_yield_ty, Target::AssocTy, GenericRequirement::None;
392397
Unpin, sym::unpin, unpin_trait, Target::Trait, GenericRequirement::None;
393398
Pin, sym::pin, pin_type, Target::Struct, GenericRequirement::None;
394399

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,15 @@ impl ImplSignature {
395395

396396
bitflags::bitflags! {
397397
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
398-
pub struct TraitFlags: u8 {
398+
pub struct TraitFlags: u16 {
399399
const RUSTC_HAS_INCOHERENT_INHERENT_IMPLS = 1 << 1;
400400
const FUNDAMENTAL = 1 << 2;
401401
const UNSAFE = 1 << 3;
402402
const AUTO = 1 << 4;
403403
const SKIP_ARRAY_DURING_METHOD_DISPATCH = 1 << 5;
404404
const SKIP_BOXED_SLICE_DURING_METHOD_DISPATCH = 1 << 6;
405405
const RUSTC_PAREN_SUGAR = 1 << 7;
406+
const COINDUCTIVE = 1 << 8;
406407
}
407408
}
408409

@@ -436,6 +437,9 @@ impl TraitSignature {
436437
if attrs.by_key(sym::rustc_paren_sugar).exists() {
437438
flags |= TraitFlags::RUSTC_PAREN_SUGAR;
438439
}
440+
if attrs.by_key(sym::rustc_coinductive).exists() {
441+
flags |= TraitFlags::COINDUCTIVE;
442+
}
439443
let mut skip_array_during_method_dispatch =
440444
attrs.by_key(sym::rustc_skip_array_during_method_dispatch).exists();
441445
let mut skip_boxed_slice_during_method_dispatch = false;

src/tools/rust-analyzer/crates/hir-ty/Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ salsa-macros.workspace = true
4040
ra-ap-rustc_abi.workspace = true
4141
ra-ap-rustc_index.workspace = true
4242
ra-ap-rustc_pattern_analysis.workspace = true
43+
ra-ap-rustc_ast_ir.workspace = true
44+
ra-ap-rustc_type_ir.workspace = true
45+
ra-ap-rustc_next_trait_solver.workspace = true
4346

47+
# These moved to dev deps if `setup_tracing` was a macro and dependents also
48+
# included these
49+
tracing-subscriber.workspace = true
50+
tracing-tree.workspace = true
4451

4552
# local deps
4653
stdx.workspace = true
@@ -53,9 +60,6 @@ span.workspace = true
5360

5461
[dev-dependencies]
5562
expect-test = "1.5.1"
56-
tracing.workspace = true
57-
tracing-subscriber.workspace = true
58-
tracing-tree.workspace = true
5963
project-model.workspace = true
6064

6165
# local deps

src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ pub(crate) fn deref_by_trait(
225225
// Check that the type implements Deref at all
226226
let trait_ref = projection.trait_ref(db);
227227
let implements_goal: Goal = trait_ref.cast(Interner);
228-
table.try_obligation(implements_goal.clone())?;
228+
if table.try_obligation(implements_goal.clone()).no_solution() {
229+
return None;
230+
}
229231

230232
table.register_obligation(implements_goal);
231233

0 commit comments

Comments
 (0)