Commit graph

7097 commits

Author SHA1 Message Date
Jakub Beránek
a4b9a1b4da Remove git_repository field from GitConfig
It is no longer needed after a recent refactoring.
2025-04-23 10:41:20 +02:00
Jakub Beránek
40058519ba Use --author-date-order when looking up upstream commits to support subtree synces 2025-04-20 09:35:42 +02:00
Jakub Beránek
3a1dd440de Make git_dir required in several git functions
It was always called with `Some`, so no need to complicate it with `Option`.
2025-04-20 09:35:42 +02:00
Jakub Beránek
c32c076f34 Return PathFreshness::MissingUpstream from detect_[gcc|llvm]_freshness functions 2025-04-20 09:35:42 +02:00
Jakub Beránek
6ca2a0dd26 Extend ci_rustc_if_unchanged tests 2025-04-20 09:35:42 +02:00
Jakub Beránek
f414afbf9f Move freshness test to bootstrap 2025-04-20 09:35:42 +02:00
Jakub Beránek
8515d7e257 Cache result of check_path_modifications 2025-04-20 09:13:56 +02:00
Jakub Beránek
1f5320e57b Unify usages of path modifications and log them in verbose mode 2025-04-20 09:13:55 +02:00
Jakub Beránek
1dabb76f40 Explicitly model missing upstream
It shouldn't really happen, but if it does, at least we will have an explicit record of it.
2025-04-20 09:13:55 +02:00
Jakub Beránek
22280337f6 Use check_path_modifications for detecting local rustc changes
And get rid of `get_closest_merge_commit`.
2025-04-20 09:13:55 +02:00
Jakub Beránek
0396f0e522 Use check_path_modifications for detecting local LLVM changes 2025-04-20 09:13:55 +02:00
Jakub Beránek
1d1f248093 Use check_path_modifications for detecting local GCC changes 2025-04-20 09:13:29 +02:00
Jakub Beránek
082ab9c6d8 Implement a new unified function for figuring out how if a set of paths have been modified locally
Also adds several git tests to make sure that the behavior works in common cases (PR CI, auto CI, local usage).
2025-04-20 09:11:21 +02:00
bors
49e5e4e3a5 Auto merge of #140043 - ChrisDenton:rollup-vwf0s9j, r=ChrisDenton
Rollup of 8 pull requests

Successful merges:

 - #138934 (support config extensions)
 - #139091 (Rewrite on_unimplemented format string parser.)
 - #139753 (Make `#[naked]` an unsafe attribute)
 - #139762 (Don't assemble non-env/bound candidates if projection is rigid)
 - #139834 (Don't canonicalize crate paths)
 - #139868 (Move `pal::env` to `std::sys::env_consts`)
 - #139978 (Add citool command for generating a test dashboard)
 - #139995 (Clean UI tests 4 of n)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-20 02:08:02 +00:00
Chris Denton
c9c25c876c
Rollup merge of #140000 - EnzymeAD:autodiff-check-builds, r=onur-ozkan
skip llvm-config in autodiff check builds, when its unavailable

As you suggested, this indeed fixes `./x.py check` builds when autodiff is enabled.

r? ```@onur-ozkan```

closes #139936

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-04-19 19:30:48 +00:00
Chris Denton
8955c6c6ee
Rollup merge of #139843 - thaliaarchi:editor-file-associations, r=Mark-Simulacrum
Setup editor file associations for non-rs extensions

.gitattributes lists `*.fixed`, `*.pp`, and `*.mir` as file extensions which should be treated as Rust source code. Do the same for VS Code and Zed. This only does syntax highlighting, which is appropriate, as MIR isn't really Rust code.

At the same time, consistently order `rust-analyzer.linkedProjects` between editors. For some reason, Eglot didn't include `library/Cargo.toml`.

I have tested this with VS Code and Zed. I have not implemented it for Emacs/Eglot or Helix.
2025-04-19 19:30:47 +00:00
Chris Denton
237064a0c4
Rollup merge of #138934 - onur-ozkan:extended-config-profiles, r=Kobzol
support config extensions

_Copied from the `rustc-dev-guide` addition:_

>When working on different tasks, you might need to switch between different bootstrap >configurations.
>Sometimes you may want to keep an old configuration for future use. But saving raw config >values in
>random files and manually copying and pasting them can quickly become messy, especially if >you have a
>long history of different configurations.
>
>To simplify managing multiple configurations, you can create config extensions.
>
>For example, you can create a simple config file named `cross.toml`:
>
>```toml
>[build]
>build = "x86_64-unknown-linux-gnu"
>host = ["i686-unknown-linux-gnu"]
>target = ["i686-unknown-linux-gnu"]
>
>
>[llvm]
>download-ci-llvm = false
>
>[target.x86_64-unknown-linux-gnu]
>llvm-config = "/path/to/llvm-19/bin/llvm-config"
>```
>
>Then, include this in your `bootstrap.toml`:
>
>```toml
>include = ["cross.toml"]
>```
>
>You can also include extensions within extensions recursively.
>
>**Note:** In the `include` field, the overriding logic follows a right-to-left order. For example,
in `include = ["a.toml", "b.toml"]`, extension `b.toml` overrides `a.toml`. Also, parent extensions
always overrides the inner ones.

try-job: x86_64-mingw-2
2025-04-19 15:09:32 +00:00
onur-ozkan
ac7d1be031 add coverage on config include logic
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-18 12:29:18 +00:00
Manuel Drehwald
136171c8d8 skip llvm-config in autodiff check builds, when its unavailable 2025-04-18 00:58:04 -04:00
Matthias Krüger
ac00a37516
Rollup merge of #139853 - Kobzol:lld-llvm-config, r=onur-ozkan
Disable combining LLD with external llvm-config

When an external `llvm-config` is used, we don't really know anything about the external LLD, as we don't build it ourselves. Therefore, we probably shouldn't allow using `rust-lld` nor copy it to the target sysroot.

Fixes: https://github.com/rust-lang/rust/issues/139477

CC ``@cuviper``

r? ``@onur-ozkan``

try-job: dist-x86_64-linux
try-job: dist-aarch64-linux
2025-04-18 05:16:30 +02:00
Matthias Krüger
dce750644f
Rollup merge of #139931 - ognevny:bootstrap-llvm-zlib, r=Kobzol
bootstrap: enable zlib for LLVM for Windows GNU

when compiling target LLVM with `opt-dist local` on Windows/MinGW, profraw files are being compressed with zlib, so compiling without it will make `llvm-profdata` complain about lacking of zlib support. this error is shown:

`profile uses zlib compression but the profile reader was built without zlib support`

example from llvm test suite: 76b5fcbf97/llvm/test/tools/llvm-profdata/nocompress.test (L15).

implementation of step 3. from https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/experiment.20with.20.60opt-dist.20local.60.20in.20MSYS2/near/512393873

r? Kobzol
2025-04-17 17:40:29 +02:00
Maksim Bondarenkov
bf2696311b bootstrap: enable zlib for LLVM when we compile it for profiling
when compiling target LLVM with `opt-dist local` on Windows/MinGW,
profraw files are being compressed with zlib, so compiling without it
will make `llvm-profdata` complain about lacking of zlib support. this
error is shown:

`profile uses zlib compression but the profile reader was built without
zlib support`

example from llvm test suite: 76b5fcbf97/llvm/test/tools/llvm-profdata/nocompress.test (L15)
2025-04-17 12:53:17 +03:00
bors
3920514036 Auto merge of #138011 - tnewsome-lynx:lynxos_178-nostd, r=davidtwco
Add minimal x86_64-lynx-lynxos178 support.

Add minimal x86_64-lynx-lynxos178 support. It's possible to build no_std
programs with this compiler.

## Tier 3 Target Policy

> A tier 3 target must have a designated developer or developers (the "target
maintainers") on record to be CCed when issues arise regarding the target. (The
mechanism to track and CC such developers may evolve over time.)

Tim Newsome (`@tnewsome-lynx)` will be the designated developer for
x86_64-lynx-lynxos178 support.

> Targets must use naming consistent with any existing targets; for instance, a
target for the same CPU or OS as an existing Rust target should use the same
name for that CPU or OS. Targets should normally use the same names and naming
conventions as used elsewhere in the broader ecosystem beyond Rust (such as in
other toolchains), unless they have a very good reason to diverge. Changing the
name of a target can be highly disruptive, especially once the target reaches a
higher tier, so getting the name right is important even for a tier 3 target.

I believe the target is named appropriately.

> Target names should not introduce undue confusion or ambiguity unless
absolutely necessary to maintain ecosystem compatibility. For example, if the
name of the target makes people extremely likely to form incorrect beliefs about
what it targets, the name should be changed or augmented to disambiguate it.

The target name is not confusing.

> If possible, use only letters, numbers, dashes and underscores for the name.
Periods (.) are known to cause issues in Cargo.

Done.

> Tier 3 targets may have unusual requirements to build or use, but must not
create legal issues or impose onerous legal terms for the Rust project or for
Rust developers or users.
> The target must not introduce license incompatibilities.
> Anything added to the Rust repository must be under the standard Rust license
(MIT OR Apache-2.0).

All this new code is licensed under the Apache-2.0 license.

> The target must not cause the Rust tools or libraries built for any other host
(even when supporting cross-compilation to the target) to depend on any new
dependency less permissive than the Rust licensing policy. This applies whether
the dependency is a Rust crate that would require adding new license exceptions
(as specified by the tidy tool in the rust-lang/rust repository), or whether the
dependency is a native library or binary. In other words, the introduction of
the target must not cause a user installing or running a version of Rust or the
Rust tools to be subject to any new license requirements.

Done.

> Compiling, linking, and emitting functional binaries, libraries, or other code
for the target (whether hosted on the target itself or cross-compiling from
another target) must not depend on proprietary (non-FOSS) libraries. Host tools
built for the target itself may depend on the ordinary runtime libraries
supplied by the platform and commonly used by other applications built for the
target, but those libraries must not be required for code generation for the
target; cross-compilation to the target must not require such libraries at all.
For instance, rustc built for the target may depend on a common proprietary C
runtime library or console output library, but must not depend on a proprietary
code generation library or code optimization library. Rust's license permits
such combinations, but the Rust project has no interest in maintaining such
combinations within the scope of Rust itself, even at tier 3.

I think we're in the clear here. We do link against some static libraries that
are proprietary (like libm and libc), but those are not used to generate code.
E.g. the VxWorks target requires `wr-c++` to be installed, which is not
publically available.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous"
legal/licensing terms include but are not limited to: non-disclosure
requirements, non-compete requirements, contributor license agreements (CLAs) or
equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional
on the employer or employment of any particular Rust developers, revocable
terms, any requirements that create liability for the Rust project or its
developers or users, or any requirements that adversely affect the livelihood or
prospects of the Rust project or its developers or users.

Our intention is to allow anyone with access to LynxOS CDK to use Rust for it.

> Neither this policy nor any decisions made regarding targets shall create any
binding agreement or estoppel by any party. If any member of an approving Rust
team serves as one of the maintainers of a target, or has any legal or
employment requirement (explicit or implicit) that might affect their decisions
regarding a target, they must recuse themselves from any approval decisions
regarding the target's tier status, though they may otherwise participate in
discussions.
> This requirement does not prevent part or all of this policy from being cited
in an explicit contract or work agreement (e.g. to implement or maintain support
for a target). This requirement exists to ensure that a developer or team
responsible for reviewing and approving a target does not face any legal threats
or obligations that would prevent them from freely exercising their judgment in
such approval, even if such judgment involves subjective matters or goes beyond
the letter of these requirements.

No problem.

> Tier 3 targets should attempt to implement as much of the standard libraries
as possible and appropriate (core for most targets, alloc for targets that can
support dynamic memory allocation, std for targets with an operating system or
equivalent layer of system-provided functionality), but may leave some code
unimplemented (either unavailable or stubbed out as appropriate), whether
because the target makes it impossible to implement or challenging to implement.
The authors of pull requests are not obligated to avoid calling any portions of
the standard library on the basis of a tier 3 target not implementing those
portions.

With this first PR, only core is supported. I am working on support for the std
library and intend to submit that once all the tests are passing.

> The target must provide documentation for the Rust community explaining how to
build for the target, using cross-compilation if possible. If the target
supports running binaries, or running tests (even if they do not pass), the
documentation must explain how to run such binaries or tests for the target,
using emulation if possible or dedicated hardware if necessary.

This is documented in `src/doc/rustc/src/platform-support/lynxos178.md`.

> Tier 3 targets must not impose burden on the authors of pull requests, or
other developers in the community, to maintain the target. In particular, do not
post comments (automated or manual) on a PR that derail or suggest a block on
the PR based on a tier 3 target. Do not send automated messages or notifications
(via any medium, including via `@)` to a PR author or others involved with a PR
regarding a tier 3 target, unless they have opted into such messages.
> Backlinks such as those generated by the issue/PR tracker when linking to an
issue or PR are not considered a violation of this policy, within reason.
However, such messages (even on a separate repository) must not generate
notifications to anyone involved with a PR who has not requested such
notifications.

Understood.

> Patches adding or updating tier 3 targets must not break any existing tier 2
or tier 1 target, and must not knowingly break another tier 3 target without
approval of either the compiler team or the maintainers of the other tier 3
target.
> In particular, this may come up when working on closely related targets, such
as variations of the same architecture with different features. Avoid
introducing unconditional uses of features that another variation of the target
may not have; use conditional compilation or runtime detection, as appropriate,
to let each target run code supported by that target.

As far as I know this change does not affect any other targets.

> Tier 3 targets must be able to produce assembly using at least one of rustc's
supported backends from any host target. (Having support in a fork of the
backend is not sufficient, it must be upstream.)

Many targets produce assembly for x86_64 so that also works for LynxOS-178.
2025-04-16 22:14:01 +00:00
onur-ozkan
827047895a resolve config include FIXME
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-16 21:20:14 +03:00
Jakub Beránek
a870bba0d6 Add a warning when combining LLD with external LLVM config 2025-04-16 17:38:37 +02:00
Matthias Krüger
b65e6b7c40
Rollup merge of #139867 - WaffleLapkin:tidypaper, r=jieyouxu
Fix some tidy paper cuts

The main thing this fixes is that currently, if you run `x t tidy` it will format ~6K files, even though it's supposed to format only modified files (whatever this is a useful optimization or not is besides the point). The problem is that `x t tidy` never writes the `rustfmt` stamp, so it always assumes `rustfmt` that was last used is outdated and we need to recheck everything. This PR fixes it by actually writing the stamp.

There are also some minor tweaks to comments/diagnostics. cc ```@Kobzol``` this probably conflicts with #138591. I didn't fix anything, just tried to document better the status quo.

r? ```@jieyouxu```
2025-04-16 13:45:29 +02:00
Matthias Krüger
f7b6f15298
Rollup merge of #139823 - WaffleLapkin:bootpaper, r=jieyouxu
Fix some bootstrap papercuts

... related to jj and my `./build` symlink setup[^1].

I'm not sure if these are good solutions, but they seem to work. See commits for a bit more info.

r? ``@jieyouxu``

[^1]: see #139804
2025-04-16 13:45:28 +02:00
Waffle Lapkin
90aec13674
commit rustfmt stump in x t tidy even on check
If checking succeeded, it's equivalent to successfully formatting.
2025-04-15 21:51:33 +02:00
onur-ozkan
6d52b51d3e add comment in TomlConfig::merge about the merge order
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 19:10:31 +03:00
Waffle Lapkin
8934ac5759
add a comment for code that isn't 2025-04-15 15:02:05 +02:00
Waffle Lapkin
dda4d7bc44
slightly correct comments and diagnostics about checking modifications
I feel like they are still wrong, but maybe less so .-.

The `info:` was unhelpful -- we only use upstream in CI nowdays.
2025-04-15 15:02:05 +02:00
Waffle Lapkin
52f4b16075
use helper function instead of writing rustfmt stamp by hand 2025-04-15 15:02:05 +02:00
Jakub Beránek
3c01dfe2ae
Rename is_builder_target to is_host_target 2025-04-15 14:13:53 +02:00
Jakub Beránek
2907ab5bf9
Move is_builder_target, is_system_llvm and is_rust_llvm from Builder to Config 2025-04-15 14:12:48 +02:00
onur-ozkan
7dfb457745 add FIXME note in TomlConfig::merge
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 11:53:21 +03:00
onur-ozkan
8e6f50bb4d fix path and the ordering logic
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 11:33:15 +03:00
onur-ozkan
3f70f197f2 apply nit notes
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 11:33:11 +03:00
onur-ozkan
4e80659b32 implement cyclic inclusion handling
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 11:33:01 +03:00
onur-ozkan
1c1febc59d add new config option: include
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15 11:32:46 +03:00
Waffle Lapkin
fc8df06f4f
update submodules if the directory doesn't exist 2025-04-15 09:42:25 +02:00
Thalia Archibald
d1e82ba37c Setup editor file associations for non-rs extensions
.gitattributes lists *.fixed, *.pp, and *.mir as file extensions which
should be treated as Rust source code. Do the same for VS Code and Zed.
This only does syntax highlighting, which is appropriate, as MIR isn't
really Rust code.

At the same time, consistently order `rust-analyzer.linkedProjects`
between editors. For some reason, Eglot didn't include
library/Cargo.toml.
2025-04-14 23:16:11 -07:00
Zalathar
e3d6813920 compiletest: Add an experimental new executor to replace libtest
The new executor can be enabled by passing `--new-executor` or `-n` to
compiletest.

For example: `./x test ui -- -n`
2025-04-15 13:00:36 +10:00
Zalathar
4c23295dd9 Use a constant for unstable features needed by compiletest 2025-04-15 12:36:45 +10:00
Matthias Krüger
b70e119e37
Rollup merge of #139804 - WaffleLapkin:real, r=jieyouxu
use `realpath` in `bootstrap.py` when creating build-dir

Fixes #139800
r? `@jieyouxu`

My use case for `./build` being a symlink is this: my "default" ~~partition~~ btrfs subvolume is snapshotted/backed up. I don't want to backup target-likes, so I move them to a special subvolume which isn't backed up. `./build` is a symlink into that subvolume. (`build.build-dir` configuration is not fully sufficient, it is still nice to be able to check build files with `ls ./build` or call tools from there)
2025-04-14 18:15:34 +02:00
Waffle Lapkin
d5de2fa8bb
use realpath in bootstrap.py when creating build-dir
this avoids crashes when `./build` is a symlink to a non-existent
directory.
2025-04-14 15:37:12 +02:00
bors
65fa0ab924 Auto merge of #139734 - ChrisDenton:rollup-28qn740, r=ChrisDenton
Rollup of 6 pull requests

Successful merges:

 - #139107 (std: make `cmath` functions safe)
 - #139607 (Add regression test for #127424)
 - #139691 (Document that `opt-dist` requires metrics to be enabled)
 - #139707 (Fix comment in bootstrap)
 - #139708 (Fix name of field in doc comment)
 - #139709 (bootstrap: fix typo in doc string)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-13 07:10:43 +00:00
Chris Denton
6b26d3c37c
Rollup merge of #139709 - tshepang:patch-5, r=Kobzol
bootstrap: fix typo in doc string
2025-04-13 03:07:09 +00:00
Chris Denton
0149a43f8a
Rollup merge of #139315 - clubby789:deranged-bump, r=Mark-Simulacrum
Switch `time` to `jiff` for time formatting in ICE dumps

Due to https://github.com/jhpratt/deranged/issues/21, Clippy, R-A and Miri currently fail to build if we bump to 0.4.1, pulled in via `time`. ~~Add some specific type annotations so we don't have to just pin it.~~

~~I can open 3 PRs to the tool repos if preferred, but I thought it might be easier to do this than to pin the transitive dep and go back and remove it once the changes are synced back.~~
2025-04-12 21:05:28 +00:00
Tshepang Mbambo
32dd3831f5
bootstrap: fix typo in doc string 2025-04-12 11:38:55 +02:00
Jakub Beránek
ddf8237bcb
Fix comment in bootstrap 2025-04-12 10:05:50 +02:00