Skip to content
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

Rollup of 10 pull requests #138366

Merged
merged 35 commits into from
Mar 12, 2025
Merged

Rollup of 10 pull requests #138366

merged 35 commits into from
Mar 12, 2025

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Sa4dUs and others added 30 commits March 2, 2025 23:58
Currently, when enabling CFI via -Zsanitizer=cfi and executing e.g.
std::sys::random::getrandom, we can observe a CFI violation. This is
the case for all consumers of the std::sys::pal::weak::weak macro,
as it is defining weak functions which don't show up in LLVM IR
metadata. CFI fails for all these functions.

Similar to other such cases in
rust-lang#115199, this change stops
emitting the CFI typecheck for consumers of the macro via the
\#[no_sanitize(cfi)] attribute.
remove unnecessary `body`  arguments
…oxyUwU

Allow int literals for pattern types with int base types

r? ``@BoxyUwU``

I also added an error at layout computation time for layouts that contain wrapping ranges (happens at monomorphization time). This is obviously hacky, but at least prevents such types from making it to codegen for now. It made writing the tests for int literals easier as I didn't have to think about that edge case

Basically this PR allows you to stop using transmutes for creating pattern types and instead just use literals:

```rust
let x: pattern_type!(u32 is 5..10) = 7;
```

works, and if the literal is out of range you get a type mismatch because it just stays at the base type and the base type can't be coerced to the pattern type.

cc ``@joshtriplett`` ``@scottmcm``
…valle

Disable CFI for weakly linked syscalls

Currently, when enabling CFI via -Zsanitizer=cfi and executing e.g. std::sys::random::getrandom, we can observe a CFI violation. This is the case for all consumers of the std::sys::pal::weak::syscall macro, as it is defining weak functions which don't show up in LLVM IR metadata. CFI fails for all these functions.

Similar to other such cases in
rust-lang#115199, this change stops emitting the CFI typecheck for consumers of the macro via the `#[no_sanitize(cfi)]` attribute.

r? ``````@rcvalle``````
Add support for downloading GCC from CI

This PR adds a new bootstrap config section called `gcc` and implements a single config `download-ci-gcc`. Its behavior is similar to `download-ci-llvm`. Since rust-lang#137667, we distribute a CI component that contains the prebuilt `libgccjit.so` library on x64 Linux. With `download-ci-gcc`, this component is downloaded from CI to avoid building GCC locally.

This is an MVP of this functionality, designed for local usage. This PR does not enable this functionality on the LLVM 18 PR CI job which builds `cg_gcc`, and does not implement more complex detection logic. It simply uses `false` (build locally) or `true` (download from CI if you're on the right target, if CI download fails, then bootstrap fails).

The original LLVM CI download functionality has a lot of features and complexity, which we don't need for GCC (yet). I don't like how the LLVM CI stuff is threaded through multiple parts of bootstrap, so with GCC I would like to take a more centralized approach, where the `build::Gcc` step handles download from CI internally. This means that:
- For the rest of bootstrap, it should be transparent whether GCC was built locally or downloaded from CI.
- GCC is not downloaded eagerly unless you actually requested GCC (either you requested `x build gcc` or you asked to build/test the GCC backend).

This approach will require some modifications once we extend this feature, but so far I like this approach much more than putting this stuff into `Config[::parse]`, which already does a ton of stuff that it arguably shouldn't (but it's super difficult to extract its logic out).

This PR is an alternative to rust-lang#130749, which did a more 1:1 copy of the `download-ci-llvm` logic.

r? ``@onur-ozkan``
Prevent ICE in autodiff validation by emitting user-friendly errors

This PR moves `valid_ret_activity` and `valid_input_activity` checks to the macro expansion phase in compiler/rustc_builtin_macros/src/autodiff.rs, replacing the following internal compiler error (ICE):
```
error: internal compiler error:
compiler/rustc_codegen_ssa/src/codegen_attrs.rs:935:13:
Invalid input activity Dual for Reverse mode
```
with a more user-friendly message.

The issue specifically affected the test file `tests/ui/autodiff/autodiff_illegal.rs`, impacting the functions `f5` and `f6`.

The ICE can be reproduced by following [Enzyme's Rustbook](https://enzymead.github.io/rustbook/installation.html) installation guide.

Additionally, this PR adds tests for invalid return activity in `autodiff_illegal.rs`, which previously triggered an unnoticed ICE before these fixes.

r? ``@oli-obk``
…eyouxu

stabilize `ci_rustc_if_unchanged_logic` test for local environments

Fixes rust-lang#138239
…otation, r=BoxyUwU

Do not write user type annotation for const param value path

As I noted in the code comment, `DefKind::ConstParam` isn't actually *generic* over its own args, we just use the identity args from the body when lowering the value path so we have something to plug into the `EarlyBinder` we get back from `type_of` for the const param. So skip over it in `write_user_type_annotation_from_args`.

Somewhat unrelated, but I left an explanation for a somewhat mysterious quirk in the THIR lowering of user type annotations for patterns having to do with ctors and their `type_of` not actually being the type of the pattern node it's ascribing.

Fixes rust-lang#138048

r? ``@BoxyUwU``
Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT

cc rust-lang#131045, which removed anonymous ADTs from the compiler

I forgot more stuff I guess.
…, r=oli-obk

miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access

In native call mode, the interpreter memory itself is accessed directly by external code via pointers created from integers and passed via libffi, so we have to ensure the provenance in Miri itself (on the meta level) is sufficiently exposed. So far we only exposed the provenance for read-only accesses. This may we enough as that may actually be the same provenance as for mutable accesses, but it's hard to be sure, and anyway there's no reason to do such a gambit -- we have this function, `prepare_for_native_call`, which iterates all memory the call can access. let's just also (re-)expose Miri's own allocations there. We expose the read-only provenance for all of them and the mutable provenance for the mutable allocations.

r? ``@oli-obk``
…ler-errors

remove redundant `body`  arguments

it's already stored in the `TypeChecker` itself
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 11, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 11, 2025

📌 Commit 4c1a186 has been approved by matthiaskrgr

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 Mar 11, 2025
@bors
Copy link
Contributor

bors commented Mar 11, 2025

⌛ Testing commit 4c1a186 with merge c625102...

@bors
Copy link
Contributor

bors commented Mar 12, 2025

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing c625102 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 12, 2025
@bors bors merged commit c625102 into rust-lang:master Mar 12, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 12, 2025
Copy link

Post-merge analysis result

Test differences

  • x86_64-gnu-stable
    • errors::verify_builtin_macros_format_unused_arg_61: [missing] -> pass
    • errors::ad_fallback::verify_builtin_macros_autodiff_not_build_35: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_missing_literal_38: [missing] -> pass
    • errors::verify_builtin_macros_cannot_derive_union_52: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_usable_with_crate_type_91: [missing] -> pass
    • errors::verify_builtin_macros_asm_mayunwind_79: [missing] -> pass
    • errors::verify_builtin_macros_format_positional_after_named_59: [missing] -> pass
    • errors::verify_builtin_macros_concat_idents_ident_args_43: [missing] -> pass
    • errors::verify_builtin_macros_asm_explicit_register_name_64: [missing] -> pass
    • errors::verify_builtin_macros_test_bad_fn_63: [missing] -> pass
    • (and 127 additional testss)
  • x86_64-gnu-nopt
    • errors::verify_builtin_macros_concat_bytes_non_u8_37: [missing] -> pass
    • errors::verify_builtin_macros_cannot_derive_union_52: [missing] -> pass
    • errors::verify_builtin_macros_asm_mutually_exclusive_65: [missing] -> pass
    • errors::verify_builtin_macros_asm_requires_template_69: [missing] -> pass
    • errors::verify_builtin_macros_asm_unsupported_option_81: [missing] -> pass
    • errors::autodiff::verify_builtin_macros_autodiff_mode_33: [missing] -> pass
    • errors::verify_builtin_macros_asm_duplicate_arg_75: [missing] -> pass
    • errors::verify_builtin_macros_asm_sym_no_path_73: [missing] -> pass
    • errors::verify_builtin_macros_derive_macro_call_51: [missing] -> pass
    • errors::verify_builtin_macros_format_duplicate_arg_58: [missing] -> pass
    • (and 127 additional testss)
  • aarch64-gnu
    • errors::verify_builtin_macros_test_bad_fn_63: [missing] -> pass
    • errors::verify_builtin_macros_asm_opt_already_provided_80: [missing] -> pass
    • errors::autodiff::verify_builtin_macros_autodiff_mode_33: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_be_used_on_bare_functions_90: [missing] -> pass
    • errors::verify_builtin_macros_format_duplicate_arg_58: [missing] -> pass
    • compiler/rustc_trait_selection/src/traits/select/mod.rs - traits::select::SelectionContext<'_,'tcx>::constituent_types_for_ty (line 2274): [missing] -> ignore
    • errors::verify_builtin_macros_asm_mayunwind_79: [missing] -> pass
    • errors::verify_builtin_macros_only_one_argument_88: [missing] -> pass
    • errors::verify_builtin_macros_asm_unsupported_clobber_abi_83: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_bad_repeat_40: [missing] -> pass
    • (and 127 additional testss)
  • x86_64-gnu-llvm-18-3
    • errors::verify_builtin_macros_concat_bytes_oob_36: [missing] -> pass
    • errors::verify_builtin_macros_non_generic_pointee_94: [missing] -> pass
    • errors::verify_builtin_macros_env_not_defined_55: [missing] -> pass
    • errors::verify_builtin_macros_cannot_derive_union_52: [missing] -> pass
    • compiler/rustc_middle/src/ty/adt.rs - ty::adt::AdtDefData (line 81): [missing] -> pass
    • compiler/rustc_borrowck/src/type_check/mod.rs - type_check::Locations::All (line 679): [missing] -> pass
    • errors::verify_builtin_macros_expected_register_class_or_explicit_register_86: [missing] -> pass
    • [ui] tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs#nofeat: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_bad_repeat_40: [missing] -> pass
    • errors::verify_builtin_macros_format_requires_string_57: [missing] -> pass
    • (and 127 additional testss)
  • x86_64-gnu
    • errors::verify_builtin_macros_bad_derive_target_44: [missing] -> pass
    • compiler/rustc_middle/src/ty/adt.rs - ty::adt::AdtDefData (line 87): [missing] -> ignore
    • errors::verify_builtin_macros_expected_register_class_or_explicit_register_86: [missing] -> pass
    • errors::verify_builtin_macros_env_not_defined_55: [missing] -> pass
    • errors::verify_builtin_macros_asm_mutually_exclusive_65: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_be_used_on_bare_functions_90: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_missing_literal_38: [missing] -> pass
    • errors::verify_builtin_macros_format_unused_arg_61: [missing] -> pass
    • errors::verify_builtin_macros_asm_explicit_register_name_64: [missing] -> pass
    • errors::autodiff::verify_builtin_macros_autodiff_34: [missing] -> pass
    • (and 127 additional testss)
  • x86_64-gnu-llvm-19-3
    • errors::verify_builtin_macros_concat_bytes_bad_repeat_40: [missing] -> pass
    • errors::verify_builtin_macros_asm_expected_other_74: [missing] -> pass
    • errors::verify_builtin_macros_asm_unsupported_clobber_abi_83: [missing] -> pass
    • [ui] tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs#nofeat: [missing] -> pass
    • errors::verify_builtin_macros_asm_noreturn_77: [missing] -> pass
    • errors::verify_builtin_macros_concat_idents_missing_args_41: [missing] -> pass
    • errors::verify_builtin_macros_test_runner_nargs_85: [missing] -> pass
    • errors::verify_builtin_macros_test_runner_invalid_84: [missing] -> pass
    • errors::verify_builtin_macros_asm_mayunwind_79: [missing] -> pass
    • errors::verify_builtin_macros_derive_path_args_list_46: [missing] -> pass
    • (and 127 additional testss)
  • aarch64-apple
    • errors::autodiff::verify_builtin_macros_autodiff_34: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_be_used_on_bare_functions_90: [missing] -> pass
    • compiler/rustc_borrowck/src/type_check/mod.rs - type_check::Locations::All (line 679): [missing] -> pass
    • errors::verify_builtin_macros_format_requires_string_57: [missing] -> pass
    • errors::verify_builtin_macros_concat_idents_missing_comma_42: [missing] -> pass
    • errors::verify_builtin_macros_asm_underscore_input_72: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_bad_repeat_40: [missing] -> pass
    • errors::autodiff::verify_builtin_macros_autodiff_ret_activity_32: [missing] -> pass
    • errors::verify_builtin_macros_test_case_non_item_62: [missing] -> pass
    • errors::verify_builtin_macros_test_bad_fn_63: [missing] -> pass
    • (and 127 additional testss)
  • x86_64-apple-1
    • errors::autodiff::verify_builtin_macros_autodiff_34: [missing] -> pass
    • compiler/rustc_trait_selection/src/traits/select/mod.rs - traits::select::SelectionContext<'_,'tcx>::constituent_types_for_ty (line 2274): [missing] -> ignore
    • errors::verify_builtin_macros_asm_duplicate_arg_75: [missing] -> pass
    • errors::verify_builtin_macros_test_bad_fn_63: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_usable_with_crate_type_91: [missing] -> pass
    • errors::verify_builtin_macros_expected_register_class_or_explicit_register_86: [missing] -> pass
    • errors::verify_builtin_macros_derive_macro_call_51: [missing] -> pass
    • errors::verify_builtin_macros_format_no_arg_named_60: [missing] -> pass
    • errors::verify_builtin_macros_asm_expected_other_74: [missing] -> pass
    • errors::verify_builtin_macros_non_unit_default_48: [missing] -> pass
    • (and 123 additional testss)
  • i686-gnu-nopt-2
    • errors::verify_builtin_macros_bad_derive_target_44: [missing] -> pass
    • errors::verify_builtin_macros_asm_unsupported_option_81: [missing] -> pass
    • errors::verify_builtin_macros_test_case_non_item_62: [missing] -> pass
    • errors::verify_builtin_macros_format_requires_string_57: [missing] -> pass
    • errors::verify_builtin_macros_concat_bytes_array_39: [missing] -> pass
    • errors::verify_builtin_macros_asm_unsupported_operand_82: [missing] -> pass
    • errors::verify_builtin_macros_derive_path_args_list_46: [missing] -> pass
    • errors::verify_builtin_macros_proc_macro_attribute_only_usable_with_crate_type_91: [missing] -> pass
    • errors::verify_builtin_macros_asm_pure_combine_66: [missing] -> pass
    • errors::verify_builtin_macros_takes_no_arguments_89: [missing] -> pass
    • (and 121 additional testss)
  • i686-mingw-2
    • errors::verify_builtin_macros_concat_bytes_non_u8_37: [missing] -> pass
    • errors::verify_builtin_macros_test_bad_fn_63: [missing] -> pass
    • errors::verify_builtin_macros_derive_macro_call_51: [missing] -> pass
    • errors::verify_builtin_macros_non_unit_default_48: [missing] -> pass
    • errors::verify_builtin_macros_test_case_non_item_62: [missing] -> pass
    • errors::verify_builtin_macros_takes_no_arguments_89: [missing] -> pass
    • errors::verify_builtin_macros_format_no_arg_named_60: [missing] -> pass
    • errors::verify_builtin_macros_tests_not_support_45: [missing] -> pass
    • errors::verify_builtin_macros_bad_derive_target_44: [missing] -> pass
    • errors::verify_builtin_macros_cannot_derive_union_52: [missing] -> pass
    • (and 121 additional testss)

(and 15 additional diffs)

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c625102): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.1%, secondary -3.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)
2.5% [1.0%, 3.4%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-3.0% [-3.0%, -3.0%] 1
All ❌✅ (primary) 1.1% [-3.1%, 3.4%] 4

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 780.09s -> 779.867s (-0.03%)
Artifact size: 365.26 MiB -> 365.28 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.