You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/rustc-driver/external-rustc-drivers.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Remarks on perma unstable features
1
+
# External `rustc_driver`s
2
2
3
3
## `rustc_private`
4
4
@@ -49,6 +49,29 @@ For custom-built toolchains or environments not using rustup, additional configu
49
49
```
50
50
3.**Check version compatibility**: Ensure your LLVM version is compatible with your Rust toolchain
51
51
52
+
### Configuring `rust-analyzer` for Out-of-Tree Projects
53
+
54
+
When developing out-of-tree projects that use `rustc_private` crates, you can configure `rust-analyzer` to recognize these crates.
55
+
56
+
#### Configuration Steps
57
+
58
+
1.**Set rust-analyzer configuration**
59
+
Configure `rust-analyzer.rustc.source` to `"discover"` in your editor settings.
60
+
For VS Code, add to `rust_analyzer_settings.json`:
61
+
```json
62
+
{
63
+
"rust-analyzer.rustc.source": "discover"
64
+
}
65
+
```
66
+
2.**Add metadata to Cargo.toml**
67
+
Add the following to the `Cargo.toml` of every crate that uses `rustc_private`:
68
+
```toml
69
+
[package.metadata.rust-analyzer]
70
+
rustc_private = true
71
+
```
72
+
73
+
This configuration allows `rust-analyzer` to properly recognize and provide IDE support for `rustc_private` crates in out-of-tree projects.
74
+
52
75
### Additional Resources
53
76
54
77
-[GitHub Issue #137421](https://github.com/rust-lang/rust/issues/137421): Explains that `rustc_private` linker failures often occur because `llvm-tools` is not installed
Copy file name to clipboardExpand all lines: src/solve/candidate-preference.md
+64-26Lines changed: 64 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,31 +260,6 @@ We prefer builtin trait object impls over user-written impls. This is **unsound*
260
260
261
261
The candidate preference behavior during normalization is implemented in [`fn assemble_and_merge_candidates`].
262
262
263
-
### Where-bounds shadow impls
264
-
265
-
Normalization of associated items does not consider impls if the corresponding trait goal has been proven via a `ParamEnv` or `AliasBound` candidate.
266
-
This means that for where-bounds which do not constrain associated types, the associated types remain *rigid*.
267
-
268
-
This is necessary to avoid unnecessary region constraints from applying impls.
269
-
```rust
270
-
traitTrait<'a> {
271
-
typeAssoc;
272
-
}
273
-
implTrait<'static> foru32 {
274
-
typeAssoc=u32;
275
-
}
276
-
277
-
fnbar<'b, T:Trait<'b>>() ->T::Assoc { todo!() }
278
-
fnfoo<'a>()
279
-
where
280
-
u32:Trait<'a>,
281
-
{
282
-
// Normalizing the return type would use the impl, proving
283
-
// the `T: Trait` where-bound would use the where-bound, resulting
284
-
// in different region constraints.
285
-
bar::<'_, u32>();
286
-
}
287
-
```
288
263
289
264
### We always consider `AliasBound` candidates
290
265
@@ -418,10 +393,73 @@ where
418
393
}
419
394
```
420
395
396
+
### Trait where-bounds shadow impls
397
+
398
+
Normalization of associated items does not consider impls if the corresponding trait goal has been proven via a `ParamEnv` or `AliasBound` candidate.
399
+
This means that for where-bounds which do not constrain associated types, the associated types remain *rigid*.
400
+
401
+
#### Using impls results in different region constraints
402
+
403
+
This is necessary to avoid unnecessary region constraints from applying impls.
404
+
```rust
405
+
traitTrait<'a> {
406
+
typeAssoc;
407
+
}
408
+
implTrait<'static> foru32 {
409
+
typeAssoc=u32;
410
+
}
411
+
412
+
fnbar<'b, T:Trait<'b>>() ->T::Assoc { todo!() }
413
+
fnfoo<'a>()
414
+
where
415
+
u32:Trait<'a>,
416
+
{
417
+
// Normalizing the return type would use the impl, proving
418
+
// the `T: Trait` where-bound would use the where-bound, resulting
419
+
// in different region constraints.
420
+
bar::<'_, u32>();
421
+
}
422
+
```
423
+
424
+
#### RPITIT `type_of` cycles
425
+
426
+
We currently have to avoid impl candidates if there are where-bounds to avoid query cycles for RPITIT, see [#139762]. It feels desirable to me to stop relying on auto-trait leakage of during RPITIT computation to remove this issue, see [#139788].
427
+
428
+
```rust
429
+
usestd::future::Future;
430
+
pubtraitReactiveFunction:Send {
431
+
typeOutput;
432
+
433
+
fninvoke(self) ->Self::Output;
434
+
}
435
+
436
+
traitAttributeValue {
437
+
fnresolve(self) ->implFuture<Output= ()> +Send;
438
+
}
439
+
440
+
impl<F, V> AttributeValueforF
441
+
where
442
+
F:ReactiveFunction<Output=V>,
443
+
V:AttributeValue,
444
+
{
445
+
asyncfnresolve(self) {
446
+
// We're awaiting `<V as AttributeValue>::{synthetic#0}` here.
447
+
// Normalizing that one via the the impl we're currently in
448
+
// relies on `collect_return_position_impl_trait_in_trait_tys` which
449
+
// ends up relying on auto-trait leakage when checking that the
450
+
// opaque return type of this function implements the `Send` item
0 commit comments