rust/tests/incremental
Matthias Krüger 221b53c9b0
Rollup merge of #127279 - bvanjoi:fix-112680, r=petrochenkov
use old ctx if has same expand environment during decode span

Fixes #112680

The root reason why #112680 failed with incremental compilation on the second attempt is the difference in `opaque` between the span of the field [`ident`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_typeck/src/expr.rs#L2348) and the span in the incremental cache at `tcx.def_ident_span(field.did)`.

-  Let's call the span of `ident` as `span_a`, which is generated by [`apply_mark_internal`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/hygiene.rs#L553-L554). Its content is similar to:

```rs
span_a_ctx -> SyntaxContextData {
      opaque: span_a_ctx,
      opaque_and_semitransparent: span_a_ctx,
      // ....
}
```

- And call the span of `tcx.def_ident_span` as `span_b`, which is generated by [`decode_syntax_context`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/hygiene.rs#L1390). Its content is:

```rs
span_b_ctx -> SyntaxContextData {
      opaque: span_b_ctx,
      // note `span_b_ctx` is not same as `span_a_ctx`
      opaque_and_semitransparent: span_b_ctx,
      // ....
}
```

Although they have the same `parent` (both refer to the root) and `outer_expn`, I cannot find the specific connection between them. Therefore, I chose a solution that may not be the best: give up the incremental compile cache to ensure we can use `span_a` in this case.

r?  `@petrochenkov` Do you have any advice on this? Or perhaps this solution is acceptable?
2024-08-21 19:35:10 +02:00
..
add_private_fn_at_krate_root_cc
auxiliary
callee_caller_cross_crate
change_add_field
change_crate_order
change_implementation_cross_crate
change_private_fn
change_private_fn_cc
change_private_impl_method
change_private_impl_method_cc
change_pub_inherent_method_body
change_pub_inherent_method_sig
const-generics Taint infcx when reporting errors 2024-06-19 04:41:56 +00:00
extern_static
hashes Do not normalize constants eagerly. 2024-07-31 00:59:12 +00:00
hygiene
inlined_hir_34991
issue-39828
issue-49595
issue-85197-invalid-span
issue-92163-missing-sourcefile
issue-110457-same-span-closures
krate_reassign_34991
link_order
remapped_paths_cc
remove_crate
remove_source_file
remove-private-item-cross-crate
rlib_cross_crate
span_hash_stable
static_cycle
static_refering_to_other_static
static_refering_to_other_static2
static_refering_to_other_static3
static_stable_hash
struct_change_field_type_cross_crate
thinlto
type_alias_cross_crate
async-lifetimes.rs
cache_file_headers.rs
change_crate_dep_kind.rs
change_name_of_static_in_fn.rs
change_symbol_export_status.rs
circular-dependencies.rs
commandline-args.rs
const-generic-type-cycle.rs
crate_hash_reorder.rs
cyclic-trait-hierarchy.rs
decl_macro.rs use old ctx if has same expand environment during decode span 2024-07-05 01:00:13 +08:00
delayed_span_bug.rs
dirty_clean.rs
feature_gate.rs
foreign.rs
hash-module-order.rs
hello_world.rs
ich_method_call_trait_scope.rs
ich_nested_items.rs
ich_resolve_results.rs
incremental_proc_macro.rs
issue-35593.rs
issue-38222.rs
issue-39569.rs
issue-42602.rs
issue-49043.rs
issue-49482.rs
issue-51409.rs
issue-54059.rs
issue-54242.rs
issue-59523-on-implemented-is-not-unused.rs
issue-59524-layout-scalar-valid-range-is-not-unused.rs
issue-60629.rs
issue-61323.rs
issue-61530.rs
issue-62649-path-collisions-happen.rs
issue-69596.rs
issue-72386.rs
issue-79661-missing-def-path-hash.rs
issue-79890-imported-crates-changed.rs
issue-80336-invalid-span.rs
issue-80691-bad-eval-cache.rs
issue-82920-predicate-order-miscompile.rs
issue-84252-global-alloc.rs
issue-85360-eval-obligation-ice.rs
issue-86753.rs
issue-92987-provisional-dep-node.rs
issue-96319-coinductive-cycle.rs
issue-100521-change-struct-name-assocty.rs
issue-101518.rs
issue-108481-feed-eval-always.rs
krate-inherent.rs
krate-inlined.rs
lto-in-linker.rs
lto.rs
macro_export.rs
mir-opt.rs
no_mangle.rs
reorder_vtable.rs
rlib-lto.rs
rustc-rust-log.rs
slice-pattern-const-ice-83085.rs
source_loc_macros.rs
spans_in_type_debuginfo.rs
spans_significant_w_debuginfo.rs
spans_significant_w_panic.rs
spike-neg1.rs
spike-neg2.rs
spike.rs
split_debuginfo_cached.rs
split_debuginfo_mode.rs
string_constant.rs
struct_add_field.rs
struct_change_field_name.rs
struct_change_field_type.rs
struct_change_nothing.rs
struct_remove_field.rs
unchecked_dirty_clean.rs
unrecoverable_query.rs Allow for try_force_from_dep_node to fail 2024-06-19 07:21:41 -04:00
warnings-reemitted.rs