Commit 9131d23
committed
resolve: Don't speculatively load crates if this is a speculative resolution
This avoids a rare rustdoc bug where loading `core` twice caused a
'cannot find a built-in macro' error:
1. `x.py build --stage 1` builds the standard library and creates a sysroot
2. `cargo doc` does something like `cargo check` to create `rmeta`s for all the crates (unrelated to what was built above)
3. the `cargo check`-like `libcore-*.rmeta` is loaded as a transitive dependency *and claims ownership* of builtin macros
4. `rustdoc` later tries to resolve some path in a doc link
5. suggestion logic fires and loads "extern prelude" crates by name
6. the sysroot `libcore-*.rlib` is loaded and *fails to claim ownership* of builtin macros
This fixes step 5. by not running suggestion logic if this is a
speculative resolution. Additionally, it marks `resolve_ast_path` as a
speculative resolution.1 parent a1c71a1 commit 9131d23
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2385 | 2385 | | |
2386 | 2386 | | |
2387 | 2387 | | |
2388 | | - | |
2389 | | - | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
2390 | 2394 | | |
2391 | 2395 | | |
2392 | 2396 | | |
| |||
3200 | 3204 | | |
3201 | 3205 | | |
3202 | 3206 | | |
3203 | | - | |
| 3207 | + | |
3204 | 3208 | | |
3205 | 3209 | | |
3206 | 3210 | | |
| |||
0 commit comments