| Age | Commit message (Collapse) | Author | Lines |
|
Link: https://github.com/llvm/llvm-project/pull/144383
|
|
Implement AST visitors using a derive macro.
AST visitors are large and error-prone beasts. This PR attempts to write them using a derive macro.
The design uses three traits: `Visitor`, `Visitable`, `Walkable`.
- `Visitor` is the trait implemented by downstream crates, it lists `visit_stuff` methods, which call `Walkable::walk_ref` by default;
- `Walkable` is derived using the macro, the generated `walk_ref` method calls `Visitable::visit` on each component;
- `Visitable` is implemented by `common_visitor_and_walkers` macro, to call the proper `Visitor::visit_stuff` method if it exists, to call `Walkable::walk_ref` if there is none.
I agree this is quite a lot of spaghetti macros. I'm open to suggestions on how to reduce the amount of boilerplate code.
If this PR is accepted, I believe the same design can be used for the HIR visitor.
|
|
Rename `tests/{assembly,codegen}` into `tests/{assembly,codegen}-llvm` and ignore these testsuites if configured backend doesn't match
Follow-up of https://github.com/rust-lang/rust/pull/144125.
This PR changes `compiletest` so that `asm` tests are only run if they match the current codegen backend. To better reflect it, I renamed the `tests/ui/asm` folder into `tests/ui/asm-llvm`. Like that, we can add new asm tests for other backends if we want without needing to add extra code to `compiletest`.
Next step will be to use the new code annotations added in rust-lang/rust#144125 to ignore ui tests failing in cg_gcc until it's fixed on our side.
cc `@antoyo` `@oli-obk`
r? `@Kobzol`
|
|
stdarch subtree update
Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/5531955678494ee28ec02130a6d94082ad4532da.
Created using https://github.com/rust-lang/josh-sync.
I saw that there were non-trivial changes made to `std_detect` in `stdarch` recently. So I want to get them merged here before we move forward with https://github.com/rust-lang/rust/pull/143412.
r? `@folkertdev`
|
|
current codegen backend
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#142454 (Add modern AVR mcus like avr128db28 and attiny3224)
- rust-lang/rust#142924 (tidy: move rustdoc js stuff into a tidy extra check)
- rust-lang/rust#143373 (Unquerify maybe_unused_trait_imports.)
- rust-lang/rust#144082 (tests: cover more `exported_private_dependencies` cases)
- rust-lang/rust#144126 (Fix empty target_config in apply_rust_config bootstrap)
- rust-lang/rust#144164 ( opt-dist: add an option for setting path to stage0 root)
- rust-lang/rust#144265 (Dont ICE on copy error being suppressed due to overflow)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
flt2dec: replace for loop by iter_mut
Perf is explored in https://github.com/rust-lang/rust/issues/144118, which initially showed small losses, but then also showed significant gains. Both are real, but given the smallness of the losses, this seems a good change.
|
|
Dont ICE on copy error being suppressed due to overflow
See comment in test file.
Fixes https://github.com/rust-lang/rust/issues/144165
|
|
opt-dist: add an option for setting path to stage0 root
in MSYS2 we have problems with stage0 for *-gnullvm hosts because prebuilt dist tarballs will be
available starting from 1.90.0-beta. also this change helps to match bootstrap.toml config
r? Kobzol
try-job: dist-x86_64-msvc
try-job: dist-x86_64-linux
|
|
r=Kobzol
Fix empty target_config in apply_rust_config bootstrap
This PR fixes the issue of an empty target_config in apply_rust_config, which was caused by the ordering of TOML config parsing. This was inadvertently introduced during the last config refactor. The test and the corresponding configuration order have been corrected in this PR.
r? ```@Kobzol```
|
|
tests: cover more `exported_private_dependencies` cases
This PR adds tests for all missing cases from rust-lang/rust#71043 and some on top of that. I believe with this, that issue can be closed.
Some of the lints can be improved, e.g. `provided_impl_trait` and `impl From<PublicWithStdImpl> for OtherType` lint twice.
cc ```@epage``` in case you want to double check I didn't miss anything.
|
|
Unquerify maybe_unused_trait_imports.
Based on https://github.com/rust-lang/rust/pull/143247
r? ```@ghost``` for perf
|
|
tidy: move rustdoc js stuff into a tidy extra check
Most of these were factored out of CI scripts, but `eslint` in particular was previously implemented with its own special cased logic.
A new option has been added to bootstrap, `build.tidy-extra-checks`, which serves as a default value for the `--extra-checks` flag. This is mostly for the benefit of rustdoc js maintainers, but should also help bootstrap py maintainers.
Additionally, `--extra-checks=cpp` has been documented.
I'm not super happy with how long the extra check names are in comparison to the others (in particular `typecheck`), but I couldn't think of anything better (I didn't want to name it `tsc` on the off chance we want to switch to a different typechecking engine in the future).
It would be nice to convert the extra checks arg into a proper enum, both for warning on unknown values and to provide better shell completion.
r? ```@GuillaumeGomez```
Fixes: https://github.com/rust-lang/rust/issues/144093
|
|
Add modern AVR mcus like avr128db28 and attiny3224
Related to https://github.com/llvm/llvm-project/pull/143914
r? ```@Patryk27```
|
|
|
|
Rollup of 14 pull requests
Successful merges:
- rust-lang/rust#142097 (gpu offload host code generation)
- rust-lang/rust#143430 (Lower extra lifetimes before normal generic params.)
- rust-lang/rust#143768 (Constify Try, From, TryFrom and relevant traits)
- rust-lang/rust#143816 (Implement `check` for compiletest and RA using tool macro)
- rust-lang/rust#143985 (rustc_public: de-StableMIR-ize)
- rust-lang/rust#144027 (clippy: make tests work in stage 1)
- rust-lang/rust#144080 (Mitigate `#[align]` name resolution ambiguity regression with a rename)
- rust-lang/rust#144176 (Add approval blocking labels for new bors)
- rust-lang/rust#144187 (fix handling of base address for TypeId allocations)
- rust-lang/rust#144212 (Remove the ptr_unique lang item)
- rust-lang/rust#144243 (Subtree update of `rust-analyzer`)
- rust-lang/rust#144246 (Don't use another main test file as auxiliary)
- rust-lang/rust#144251 (rustc-dev-guide subtree update)
- rust-lang/rust#144254 (opt-dist: make `artifact-dir` an absolute path for `opt-dist local`)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
opt-dist: make `artifact-dir` an absolute path for `opt-dist local`
...like for CI environments. the same logic applied as for `build_dir`. fixes the issue where some intermediate steps fail due to path being relative to an active directory
r? Kobzol
try-job: dist-x86_64-msvc
try-job: dist-x86_64-linux
|
|
rustc-dev-guide subtree update
Subtree update of `rustc-dev-guide` to https://github.com/rust-lang/rustc-dev-guide/commit/cca233729f03d0c59456cd3e866f92681faf4c54.
Created using https://github.com/rust-lang/josh-sync.
r? ```@ghost```
|
|
Don't use another main test file as auxiliary
In this case, the exact extern crate isn't very important, it just needs to not be another main test file.
This is part of the changes needed to address the spurious failures from a main test `../removing-extern-crate.rs` being both an auxiliary and a main test file, causing fs races due to multiple `rustc` processes in multiple test threads trying to build the main test file both as a main test and also as an auxiliary at around the same time.
Part 1 of rust-lang/rust#144237.
r? ``@RalfJung`` (or compiler)
|
|
Subtree update of `rust-analyzer`
r? ```@ghost```
|
|
Remove the ptr_unique lang item
Miri no longer uses it since https://github.com/rust-lang/miri/pull/4307.
|
|
fix handling of base address for TypeId allocations
This fixes the problems discovered by ````@theemathas```` in https://github.com/rust-lang/rust/pull/142789:
- const-eval would sometimes consider TypeId pointers to be null
- the type ID is different in Miri than in regular executions
Both boil down to the same issue: the TypeId "allocation" has a guaranteed 0 base address, but const-eval assumes it was non-zero (like normal allocations) and Miri randomized it (like normal allocations).
r? ````@oli-obk````
|
|
Add approval blocking labels for new bors
If a PR contains these labels, new bors won't let anyone approve it. We don't merge PRs using new bors yet, ofc, but I wanted to prepare this so that I don't forget about it.
This was proposed here: [#t-lang/meetings > Triage meeting 2025-07-23 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/410673-t-lang.2Fmeetings/topic/Triage.20meeting.202025-07-23/near/529407150) and implemented [here](https://github.com/rust-lang/bors/pull/367).
CC ````@RalfJung````
r? ````@oli-obk````
|
|
Mitigate `#[align]` name resolution ambiguity regression with a rename
Mitigates beta regression rust-lang/rust#143834 after a beta backport.
### Background on the beta regression
The name resolution regression arises due to rust-lang/rust#142507 adding a new feature-gated built-in attribute named `#[align]`. However, unfortunately even [introducing new feature-gated unstable built-in attributes can break user code](https://www.github.com/rust-lang/rust/issues/134963) such as
```rs
macro_rules! align {
() => {
/* .. */
};
}
pub(crate) use align; // `use` here becomes ambiguous
```
### Mitigation approach
This PR renames `#[align]` to `#[rustc_align]` to mitigate the beta regression by:
1. Undoing the introduction of a new built-in attribute with a common name, i.e. `#[align]`.
2. Renaming `#[align]` to `#[rustc_align]`. The renamed attribute being `rustc_align` will not introduce new stable breakages, as attributes beginning with `rustc` are reserved and perma-unstable. This does mean existing nightly code using `fn_align` feature will additionally need to specify `#![feature(rustc_attrs)]`.
This PR is very much a short-term mitigation to alleviate time pressure from having to fully fix the current limitation of inevitable name resolution regressions that would arise from adding any built-in attributes. Long-term solutions are discussed in [#t-lang > namespacing macro attrs to reduce conflicts with new adds](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/namespacing.20macro.20attrs.20to.20reduce.20conflicts.20with.20new.20adds/with/529249622).
### Alternative mitigation options
[Various mitigation options were considered during the compiler triage meeting](https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277), and those consideration are partly reproduced here:
- Reverting the PR doesn't seem very minimal/trivial, and carries risks of its own.
- Rename to a less-common but aim-to-stabilization name is itself not safe nor convenient, because (1) that risks introducing new regressions (i.e. ambiguity against the new name), and (2) lang would have to FCP the new name hastily for the mitigation to land timely and have a chance to be backported. This also makes the path towards stabilization annoying.
- Rename the attribute to a rustc attribute, which will be perma-unstable and does not cause new ambiguities in stable code.
- This alleviates the time pressure to address *this* regression, or for lang to have to rush an FCP for some new name that can still break user code.
- This avoids backing out a whole implementation.
### Review advice
This PR is best reviewed commit-by-commit.
- Commit 1 adds a test `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` which demonstrates the current name resolution regression re. `align`. This test fails against current master.
- Commit 2 carries out the renames and test reblesses. Notably, commit 2 will cause `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` to change from fail (nameres regression) to pass.
This PR, if the approach still seems acceptable, will need a beta-backport to address the beta regression.
|
|
clippy: make tests work in stage 1
This finally fixes https://github.com/rust-lang/rust/issues/78717 :)
Similar to what Miri already does, the clippy test step needs to carefully consider which compiler is used to build clippy and which compiler is linked into clippy (and thus must be used to build the test dependencies). On top of that we have some extra complications that Miri avoided by using `cargo-miri` for building its test dependencies: we need cargo to use the right rustc and the right sysroot, but https://github.com/rust-lang/cargo/issues/4423 makes this quite hard to do. See the long comment in `src/tools/clippy/tests/compile-test.rs` for details.
Some clippy tests tried to import rustc crates; that fundamentally requires a full bootstrap loop so it cannot work in stage 1. I had to kind of guess what those tests were doing so I don't know if my changes there make any sense.
Cc ```@flip1995``` ```@Kobzol```
|
|
rustc_public: de-StableMIR-ize
This PR updates relevant docs about StableMIR, basically just rewording StableMIR/SMIR to rustc_public/rustc_public's IR.
The README.md in the `rustc_public` crate is out-dated. I plan to rewrite it after we fork rustc_public into its own repository.
This PR doesn't change the fact that we still use `-Z unpretty=stable-mir` as a rustc parameter for printing the IR, since I feel it's a bit verbose and weird if we use `-Z unpretty=rustc-public-ir`. I was wondering if we can have a short and easy alias for rustc_public's IR.
|
|
Implement `check` for compiletest and RA using tool macro
Small cleanup to reduce the number of places that require custom check steps. Of course I had to include one mini hack because of Rust Analyzer.. but I think it's worth it here.
r? ````@jieyouxu````
|
|
Constify Try, From, TryFrom and relevant traits
|
|
Lower extra lifetimes before normal generic params.
Fixes https://github.com/rust-lang/rust/issues/143413
|
|
gpu offload host code generation
r? ghost
This will generate most of the host side code to use llvm's offload feature.
The first PR will only handle automatic mem-transfers to and from the device.
So if a user calls a kernel, we will copy inputs back and forth, but we won't do the actual kernel launch.
Before merging, we will use LLVM's Info infrastructure to verify that the memcopies match what openmp offloa generates in C++. `LIBOMPTARGET_INFO=-1 ./my_rust_binary` should print that a memcpy to and later from the device is happening.
A follow-up PR will generate the actual device-side kernel which will then do computations on the GPU.
A third PR will implement manual host2device and device2host functionality, but the goal is to minimize cases where a user has to overwrite our default handling due to performance issues.
I'm trying to get a full MVP out first, so this just recognizes GPU functions based on magic names. The final frontend will obviously move this over to use proper macros, like I'm already doing it for the autodiff work.
This work will also be compatible with std::autodiff, so one can differentiate GPU kernels.
Tracking:
- https://github.com/rust-lang/rust/issues/131513
|
|
|
|
|
|
add test for lld opt in and also add thread_local defined state to change opt in targets
make the config lld test parameter smoother to work, and have no_llvm_config set even when target_config is not present
|
|
in MSYS2 we have problems with stage0 for *-gnullvm hosts because prebuilt dist tarballs will be
available starting from 1.90.0-beta. also this change helps to match bootstrap.toml config
|
|
...like for CI environments. the same logic applied as for `build_dir`. fixes the issue where some
intermediate steps fail due to path being relative to an active directory
|
|
compiler-builtins subtree update
Subtree update of `compiler-builtins` to https://github.com/rust-lang/compiler-builtins/commit/2cdde03950e8d10d37b8d13e1c1d3ce2e54f36c4.
Created using https://github.com/rust-lang/josh-sync.
Fixes: https://github.com/rust-lang/rust/issues/144076
r? `@ghost`
|
|
|
|
Rustc pull update
|
|
In this case, the exact extern crate isn't very important.
This is part of the changes needed to address the spurious failures from
a main test `../removing-extern-crate.rs` being both an auxiliary and a
main test file, causing fs races due to multiple `rustc` processes in
multiple test threads trying to build the main test file both as a main
test and also as an auxiliary at around the same time.
|
|
fix some typos
|
|
|
|
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#144144 (tests: Skip supported-crate-types test on musl hosts)
- rust-lang/rust#144159 (opt-dist: change build_dir field to be an actual build dir)
- rust-lang/rust#144162 (Debug impls for DropElaborators)
- rust-lang/rust#144189 (Add non-regression test for rust-lang/rust#144168)
- rust-lang/rust#144216 (Don't consider unstable fields always-inhabited)
- rust-lang/rust#144229 (Miri subtree update)
- rust-lang/rust#144230 (Option::as_slice: fix comment)
- rust-lang/rust#144235 (Fix run-make tests on musl hosts)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
minor: Sync from downstream
|
|
|
|
This reverts commit 9f3adc540b51a4c2d0472d94033f6d9147b36f6e.
|
|
|
|
|