Skip to content

Don't name variables from external macros in borrow errors. #140580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 4, 2025

Conversation

jdonszelmann
Copy link
Contributor

This came up as part of the expansion of format_args. However, it's a more general problem (and now solution).

I noticed that this does change another test, moving out of fields in derives on packed struct. However, I think this is a better error simply because it used to refer to other.0 which is an implementation detail which doesn't really make sense.

cc @m-ou-se

@jdonszelmann jdonszelmann marked this pull request as ready for review May 2, 2025 11:46
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2025
@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the variables-external-macros branch from d943832 to af3a29b Compare May 2, 2025 12:30
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2025

Some changes occurred in src/tools/cargo

cc @ehuss

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the variables-external-macros branch 2 times, most recently from c88f60d to 97320dd Compare May 2, 2025 14:39
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

Could you please fix the second to last commit (e341bf0) so that it doesn't touch submodules?

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@jdonszelmann jdonszelmann force-pushed the variables-external-macros branch 4 times, most recently from 9096b44 to d8d9159 Compare May 2, 2025 15:58
@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the variables-external-macros branch from d8d9159 to 5424e4f Compare May 2, 2025 16:12
@jdonszelmann
Copy link
Contributor Author

mhm, was working on it :) @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 2, 2025
@m-ou-se
Copy link
Member

m-ou-se commented May 4, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented May 4, 2025

📌 Commit 5424e4f has been approved by m-ou-se

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2025
@m-ou-se m-ou-se assigned m-ou-se and unassigned wesleywiser May 4, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request May 4, 2025
…cros, r=m-ou-se

Don't name variables from external macros in borrow errors.

This came up as part of the expansion of format_args. However, it's a more general problem (and now solution).

I noticed that this does change another test, moving out of fields in derives on packed struct. However, I think this is a better error simply because it used to refer to `other.0` which is an implementation detail which doesn't really make sense.

cc `@m-ou-se`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2025
Rollup of 3 pull requests

Successful merges:

 - rust-lang#140357 (bypass linker configuration and cross target check on `x check`)
 - rust-lang#140580 (Don't name variables from external macros in borrow errors.)
 - rust-lang#140630 (Async drop source info fix for proxy-drop-coroutine)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented May 4, 2025

⌛ Testing commit 5424e4f with merge ab62d56...

@bors
Copy link
Collaborator

bors commented May 4, 2025

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing ab62d56 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 4, 2025
@bors bors merged commit ab62d56 into rust-lang:master May 4, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 4, 2025
Copy link

github-actions bot commented May 4, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 62c5f58 (parent) -> ab62d56 (this PR)

Test differences

Show 33084 test diffs

Stage 1

  • errors::verify_codegen_ssa_invalid_literal_value_26: [missing] -> pass (J0)
  • errors::verify_expand_duplicate_matcher_binding_35: [missing] -> pass (J0)
  • errors::verify_hir_typeck_yield_expr_outside_of_coroutine_3: [missing] -> pass (J0)
  • errors::verify_incremental_missing_depnode_1: [missing] -> pass (J0)
  • errors::verify_parse_dot_dot_range_attribute_162: [missing] -> pass (J0)
  • errors::verify_parse_macro_rules_missing_bang_144: [missing] -> pass (J0)
  • errors::verify_passes_deprecated_92: [missing] -> pass (J0)
  • errors::verify_resolve_tool_module_imported_20: [missing] -> pass (J0)
  • errors::verify_session_file_is_not_writeable_28: [missing] -> pass (J0)
  • errors::verify_session_int_literal_too_large_38: [missing] -> pass (J0)
  • errors::verify_trait_selection_but_needs_to_satisfy_18: [missing] -> pass (J0)
  • html::markdown::tests::test_plain_text_summary: [missing] -> pass (J0)
  • lints::verify_lint_type_ir_trait_usage_62: [missing] -> pass (J0)
  • lints::verify_lint_unused_allocation_mut_99: [missing] -> pass (J0)
  • mir::interpret::allocation::init_mask::tests::grow_same_state_within_unused_bits: [missing] -> pass (J0)
  • transitive_relation::tests::mubs_best_choice_scc: [missing] -> pass (J0)
  • vec_cache::tests::concurrent_stress_check: [missing] -> pass (J0)
  • fs::tests::recursive_rmdir: [missing] -> pass (J1)
  • num::flt2dec::strategy::dragon::bench_small_exact_inf: [missing] -> pass (J1)
  • num::int_log::u16_log10_random: [missing] -> pass (J1)
  • process::tests::test_override_env: [missing] -> pass (J1)
  • sort::tests::unstable::correct_1k_random_d2: [missing] -> pass (J1)
  • str::split_space_str::short_ascii: [missing] -> pass (J1)
  • str::to_lowercase::short_mixed: [missing] -> pass (J1)
  • tests::shuffle_tests_with_seed: [missing] -> pass (J1)
  • char::test_escape_default: [missing] -> pass (J2)
  • collections::binary_heap::test_drain_sorted_forget: [missing] -> pass (J2)
  • collections::btree::map::tests::test_insert_remove_intertwined: [missing] -> pass (J2)
  • collections::btree::map::tests::test_range_equal_empty_cases: [missing] -> pass (J2)
  • collections::btree::map::tests::test_range_mut: [missing] -> pass (J2)
  • cow_str::check_cow_add_str: [missing] -> pass (J2)
  • f128::test_one: [missing] -> pass (J2)
  • lazy::clone: [missing] -> pass (J2)
  • mpmc::chan_gone_concurrent: [missing] -> pass (J2)
  • num::f32::div_euclid: [missing] -> pass (J2)
  • num::f64::minimum: [missing] -> pass (J2)
  • num::i8::test_borrowing_sub: [missing] -> pass (J2)
  • num::i8::test_widening_mul: [missing] -> pass (J2)
  • num::test_try_i32i16: [missing] -> pass (J2)
  • num::u128::test_isqrt: [missing] -> pass (J2)
  • num::u32::test_num: [missing] -> pass (J2)
  • ptr::test: [missing] -> pass (J2)
  • ptr::test_as_ref: [missing] -> pass (J2)
  • rwlock::frob: [missing] -> pass (J2)
  • rwlock::test_rw_arc_poison_wr: [missing] -> pass (J2)
  • slice::test_chunks_exact_mut_zip_aliasing: [missing] -> pass (J2)
  • slice::test_rchunks_next: [missing] -> pass (J2)
  • str::pattern::str_searcher_empty_needle_multibyte_haystack::fwd: [missing] -> pass (J2)
  • str::pattern::str_searcher_nonempty_needle_empty_haystack::bwd: [missing] -> pass (J2)
  • str::test_str_slice_rangetoinclusive_ok: [missing] -> pass (J2)
  • time::checked_div: [missing] -> pass (J2)
  • vec::test_retain_drop_panic: [missing] -> pass (J2)
  • vec_deque::test_as_mut_slices: [missing] -> pass (J2)
  • sort::tests::stable::correct_string_random_d2: [missing] -> ignore (J3)

Stage 2

  • clean::cfg::tests::test_cfg_or: pass -> [missing] (J0)
  • error::verify_middle_autodiff_unsafe_inner_const_ref_3: pass -> [missing] (J0)
  • errors::autodiff::verify_builtin_macros_autodiff_34: pass -> [missing] (J0)
  • errors::verify_ast_passes_const_and_coroutine_50: pass -> [missing] (J0)
  • errors::verify_incremental_repeated_depnode_label_8: pass -> [missing] (J0)
  • errors::verify_metadata_stable_crate_id_collision_63: pass -> [missing] (J0)
  • lints::verify_lint_byte_slice_in_packed_struct_with_derive_140: pass -> [missing] (J0)
  • markdown::parse::tests::test_parse_simple: pass -> [missing] (J0)
  • maybe_transmutable::tests::union::union: pass -> [missing] (J0)
  • parser::tokenstream::tests::test_concat: pass -> [missing] (J0)
  • snapshot_map::tests::basic: pass -> [missing] (J0)
  • spec::tests::amdgcn_amd_amdhsa: pass -> [missing] (J0)
  • spec::tests::bpfel_unknown_none: pass -> [missing] (J0)
  • symbols::tests::check_dup_symbol: pass -> [missing] (J0)
  • btree::map::clone_slim_100_and_pop_all: pass -> [missing] (J1)
  • btree::map::clone_slim_10k_and_into_iter: pass -> [missing] (J1)
  • btree::set::clone_100_and_remove_half: pass -> [missing] (J1)
  • net::udp::tests::udp_clone_two_write: pass -> [missing] (J1)
  • num::int_log::u128_log10_predictable: pass -> [missing] (J1)
  • vec::bench_from_iter_0010: pass -> [missing] (J1)
  • cmp::test_user_defined_eq: pass -> [missing] (J2)
  • collections::hash::map::tests::test_keys: pass -> [missing] (J2)
  • collections::vec_deque::tests::bench_push_back_100: pass -> [missing] (J2)
  • condvar::wait_timeout_while_wake: pass -> [missing] (J2)
  • fmt::builders::debug_tuple::test_empty: pass -> [missing] (J2)
  • iter::adapters::peekable::test_iterator_peekable_last: pass -> [missing] (J2)
  • mpsc::smoke_chan_gone_shared: pass -> [missing] (J2)
  • num::flt2dec::strategy::grisu::test_max_pow10_no_more_than: pass -> [missing] (J2)
  • num::i64::test_checked_next_multiple_of: pass -> [missing] (J2)
  • num::int_sqrt::u16::isqrt: pass -> [missing] (J2)
  • num::test_try_i32isize: pass -> [missing] (J2)
  • num::u32::test_borrowing_sub: pass -> [missing] (J2)
  • num::wrapping::test_wrapping_i64: pass -> [missing] (J2)
  • pattern::test_forward_search_shared_bytes: pass -> [missing] (J2)
  • slice::test_chunks_exact_mut_last: pass -> [missing] (J2)
  • slice::test_iter_as_slice: pass -> [missing] (J2)
  • slice::test_rotate_left: pass -> [missing] (J2)
  • slice::test_to_vec: pass -> [missing] (J2)
  • str::to_lowercase: pass -> [missing] (J2)
  • string::test_split_off_empty: pass -> [missing] (J2)
  • sync::test_into_from_raw_unsized: pass -> [missing] (J2)
  • thread::tests::test_size_of_option_thread_id: pass -> [missing] (J2)
  • vec::test_vec_from_array_mut_ref: pass -> [missing] (J2)
  • sort::tests::unstable::correct_f128_random: ignore -> [missing] (J3)
  • sort::tests::unstable::violate_ord_retain_orig_set_i32_random_s95: ignore -> [missing] (J3)
  • sort::tests::unstable::violate_ord_retain_orig_set_string_random_s95: ignore -> [missing] (J3)

(and 16442 additional test diffs)

Additionally, 16542 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ab62d56603293e9264b4d811d2d6f5b49a3264f9 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-2: 1374.5s -> 4972.4s (261.8%)
  2. test-various: 2298.2s -> 4158.5s (80.9%)
  3. aarch64-apple: 2841.9s -> 3926.8s (38.2%)
  4. x86_64-gnu-aux: 4349.0s -> 5860.2s (34.7%)
  5. x86_64-apple-1: 5588.7s -> 6557.5s (17.3%)
  6. dist-arm-linux: 5033.5s -> 4522.6s (-10.2%)
  7. dist-apple-various: 6429.0s -> 5932.8s (-7.7%)
  8. dist-aarch64-apple: 4919.8s -> 5283.1s (7.4%)
  9. dist-various-2: 3167.5s -> 3338.6s (5.4%)
  10. x86_64-msvc-ext3: 7911.6s -> 7540.6s (-4.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ab62d56): comparison URL.

Overall result: ❌ regressions - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
1.7% [1.7%, 1.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.7% [1.7%, 1.7%] 1

Max RSS (memory usage)

Results (primary 0.5%, secondary 2.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.4%, 1.4%] 14
Regressions ❌
(secondary)
2.0% [1.9%, 2.2%] 2
Improvements ✅
(primary)
-0.6% [-0.9%, -0.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-0.9%, 1.4%] 16

Cycles

Results (primary -0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.4% [1.4%, 1.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-1.0%, -0.4%] 32
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-1.0%, 1.4%] 33

Binary size

Results (primary 0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Bootstrap: 770.413s -> 769.013s (-0.18%)
Artifact size: 365.46 MiB -> 365.42 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label May 4, 2025
@Mark-Simulacrum Mark-Simulacrum removed the perf-regression Performance regression. label May 5, 2025
@Mark-Simulacrum
Copy link
Member

Affected benchmark is within noise threshold (and new, so not yet automatically ignored).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants