about summary refs log tree commit diff
path: root/compiler/rustc_macros/src
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-08-29 09:47:39 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-08-30 08:15:08 -0400
commit9131d23cc0fb5461050bc19e40a3858b61487069 (patch)
treef14a5e764cad14880cff4bb500b6372877629a57 /compiler/rustc_macros/src
parenta1c71a17090cd5ef732d852ee878114375ff9254 (diff)
downloadrust-9131d23cc0fb5461050bc19e40a3858b61487069.tar.gz
rust-9131d23cc0fb5461050bc19e40a3858b61487069.zip
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.
Diffstat (limited to 'compiler/rustc_macros/src')
0 files changed, 0 insertions, 0 deletions