about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2023-10-25Merge from rustcThe Miri Conjob Bot-2/+14
2023-10-25Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-10-25add some more gamma function testsRalf Jung-3/+2
2023-10-24Expose a non-Symbol way to access current rustc version stringDavid Tolnay-4/+3
2023-10-24Handle structured stable attribute 'since' version in clippyDavid Tolnay-12/+19
2023-10-24Update cargoWeihang Lo-0/+0
2023-10-25tidy: add unit tests for alphabetical markers.Nicholas Nethercote-25/+238
This requires introducing `tidy_error_ext!` as an alternative to `tidy_error!`. It is passed a closure that is called for an error. This lets tests capture tidy error messages in a buffer instead of printing them to stderr. It also requires pulling part of `check` out into a new function `check_lines`, so that tests can pass in an iterator over some strings instead of a file.
2023-10-25tidy: some minor improvements.Nicholas Nethercote-9/+20
- Tweak some comments. - No need to do the `concat!` trick on `START_MARKER` because it's immediately followed by `END_MARKER`. - Fix an off-by-one error in the line number for an error message. - When a second start marker is found without an intervening end marker, after giving an error, treat it as though it ends the section. It's hard to know exactly what to do in this case, but it makes unit testing this case a little simpler (in the next commit). - If an end marker occurs without a preceding start marker, issue an error.
2023-10-25tidy: skip lines starting with `#` in alphabetical check.Nicholas Nethercote-3/+8
These are comment lines in `Cargo.toml` files. But exclude lines starting with `#!` from the skipping, because we want to check them. (Rust `#![feature(...)]` lines.) Also allow empty lines, which are occasionally useful.
2023-10-25Fix a bug in tidy's alphabetical checking.Nicholas Nethercote-17/+14
Currently, if a `tidy-alphabetical-end` marker appears on the last line of a file, tidy will erroneously issue a "reach end of file expecting `tidy-alphabetical-end`" error. This is because it uses `take_while` within `check_section`, which consumes the line with the end marker, and then after `check_section` returns `check` peeks for at least one more line, which won't be there is the marker was on the last line. This commit fixes the problem, by removing the use of `take_while`, and doing the "reached end of file" test within `check_section` without using `peek`. It also renames `{START,END}_COMMENT` as `{START,END}_MARKER`, which is a more appropriate name.
2023-10-24Test match underscore on void from union.Camille GILLOT-0/+18
2023-10-24Add miri test matching on `!`.Camille GILLOT-0/+25
2023-10-24Add miri tests.Camille GILLOT-0/+46
2023-10-24Auto merge of #116773 - dtolnay:validatestable, r=compiler-errorsbors-2/+2
Validate `feature` and `since` values inside `#[stable(…)]` Previously the string passed to `#[unstable(feature = "...")]` would be validated as an identifier, but not `#[stable(feature = "...")]`. In the standard library there were `stable` attributes containing the empty string, and kebab-case string, neither of which should be allowed. Pre-existing validation of `unstable`: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![unstable(feature = "kebab-case", issue = "none")] #[unstable(feature = "kebab-case", issue = "none")] pub struct Struct; ``` ```console error[E0546]: 'feature' is not an identifier --> src/lib.rs:5:1 | 5 | #![unstable(feature = "kebab-case", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` For an `unstable` attribute, the need for an identifier is obvious because the downstream code needs to write a `#![feature(...)]` attribute containing that identifier. `#![feature(kebab-case)]` is not valid syntax and `#![feature(kebab_case)]` would not work if that is not the name of the feature. Having a valid identifier even in `stable` is less essential but still useful because it allows for informative diagnostic about the stabilization of a feature. Compare: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![stable(feature = "kebab-case", since = "1.0.0")] #[stable(feature = "kebab-case", since = "1.0.0")] pub struct Struct; ``` ```rust // src/main.rs #![feature(kebab_case)] use repro::Struct; fn main() {} ``` ```console error[E0635]: unknown feature `kebab_case` --> src/main.rs:3:12 | 3 | #![feature(kebab_case)] | ^^^^^^^^^^ ``` vs the situation if we correctly use `feature = "snake_case"` and `#![feature(snake_case)]`, as enforced by this PR: ```console warning: the feature `snake_case` has been stable since 1.0.0 and no longer requires an attribute to enable --> src/main.rs:3:12 | 3 | #![feature(snake_case)] | ^^^^^^^^^^ | = note: `#[warn(stable_features)]` on by default ```
2023-10-24update suggest-testsPietro Albini-2/+19
2023-10-24Auto merge of #116461 - ChrisDenton:sleep, r=thomccbors-0/+12
Windows: Support sub-millisecond sleep Use `CreateWaitableTimerExW` with `CREATE_WAITABLE_TIMER_HIGH_RESOLUTION`. Does not work before Windows 10, version 1803 so in that case we fallback to using `Sleep`. I've created a `WaitableTimer` type so it can one day be adapted to also support waiting to an absolute time (which has been talked about). Note though that it currently returns `Err(())` because we can't do anything with the errors other than fallback to the old `Sleep`. Feel free to tell me to do errors properly. It just didn't seem worth constructing an `io::Error` if we're never going to surface it to the user. And it *should* all be infallible anyway unless the OS is too old to support it. Closes #43376
2023-10-24allow configuring the parent GitHub repositoryPietro Albini-14/+53
The git integration in build_helper hardcoded `rust-lang/rust` as the parent GitHub repository, and `master` as the branch name. This works great for `rust-lang/rust`, but causes problems in downstream forks like Ferrocene whenever those functions are invoked (like `./x fmt`). In `src/stage0.json` there was already a configuration key for the name of the nightly branch, but it wasn't used by build_helper. This commit adds the `github_repository` key to the file, and requires both values to be passed to build_helper whenever a git function is called. This will allow downstream forks to tweak the values.
2023-10-24Auto merge of #3137 - RalfJung:data-race, r=oli-obkbors-225/+416
Detect mixed-size and mixed-atomicity non-synchronized accesses Fixes https://github.com/rust-lang/miri/issues/2303
2023-10-24we don't support thread::scope on freebsdRalf Jung-1/+1
2023-10-24futex text: avoid spurious non-atomic readsRalf Jung-13/+13
2023-10-24fix error read-read reporting when there's also an unsynchronized non-atomic ↵Ralf Jung-22/+45
read (which is fine)
2023-10-24Merge from rustcThe Miri Conjob Bot-805/+2829
2023-10-24Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-10-23Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkovbors-3/+6
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2023-10-23Fix stable feature names in testsDavid Tolnay-2/+2
2023-10-23Rollup merge of #117040 - Zalathar:instrument-coverage-ui, r=cjgillotMatthias Krüger-2/+2
coverage: Add UI tests for values accepted by `-Cinstrument-coverage` I wanted to clean up the code in `parse_instrument_coverage`, but it occurred to me that we currently don't have any UI tests for the various stable and unstable values supported by this flag. --- Normally it might be overkill to individually test all the different variants of `on`/`off`, but in this case the parsing of those values is mixed in with some other custom code, so I think it's worthwhile being thorough.
2023-10-23Partial Revert: "Auto merge of #117018 - Kobzol:opt-dist-cargo-stage0"Urgau-1/+6
2023-10-23don't talk about 'Data race' when both accesses are atomicRalf Jung-14/+22
2023-10-23clean up imperfect overlap detection in weak-mem emulationRalf Jung-90/+28
2023-10-23detect mixed-size atomic accessesRalf Jung-72/+196
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-12/+2
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23data_race: detect races between atomic and non-atomic accesses, even if both ↵Ralf Jung-2/+95
are reads
2023-10-23data_race: clarify and slightly refactor non-atomic handlingRalf Jung-45/+50
2023-10-23Fix comment: coverage-map tests compile to LLVM IR, not MIRZalathar-1/+1
2023-10-23coverage: Add UI tests for values accepted by `-Cinstrument-coverage`Zalathar-1/+1
2023-10-23fmtThe Miri Conjob Bot-8/+9
2023-10-23Rollup merge of #117049 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3Matthias Krüger-0/+1
add a `csky-unknown-linux-gnuabiv2hf` target This is the rustc side changes to support csky based Linux target(`csky-unknown-linux-gnuabiv2`). Tier 3 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.) I pledge to do my best maintaining it. > 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. This `csky` section is the arch name and the `unknown-linux` section is the same as other linux target, and `gnuabiv2` is from the cross-compile toolchain of `gcc`. the `hf`means hardfloat. > 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. I think the explanation in platform support doc is enough to make this aspect clear. > 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. It's using open source tools only. > The target must not introduce license incompatibilities. No new license > Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0). Understood. > 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. There are no new dependencies/features required. > 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. As previously said it's using open source tools only. > "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. There are no such terms present/ > 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. I'm not the reviewer here. > 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. I'm not the reviewer here. > 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. It supports for std > 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. I have added the documentation, and I think it's clear. > 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. Understood. > 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. I believe I didn't break any other 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. I think there are no such problems in this PR.
2023-10-23Rollup merge of #117044 - RalfJung:miri, r=RalfJungMatthias Krüger-9/+9
Miri subtree update This should unblock https://github.com/rust-lang/rust/pull/116581
2023-10-23Merge from rustcThe Miri Conjob Bot-8/+5
2023-10-23Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-10-23Auto merge of #117066 - calebcartwright:rustfmt-sync, r=calebcartwrightbors-788/+2818
rustfmt subtree update r? `@ghost` Includes let chain formatting amongst a few other smaller changes and fixes
2023-10-22Merge commit '81fe905ca83cffe84322f27ca43950b617861ff7' into rustfmt-syncCaleb Cartwright-788/+2818
2023-10-22Auto merge of #117062 - Kobzol:update-rustc-perf, r=Mark-Simulacrumbors-2/+2
Update rustc-perf version Needed to unblock https://github.com/rust-lang/rust/pull/116033. The commit first needs to be uploaded to our mirrors. r? `@Mark-Simulacrum`
2023-10-22Auto merge of #117000 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2 2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000 - chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851) - refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860) - If there's a version in the lock file only use that exact version (rust-lang/cargo#12772) - Make the precise field of a source an Enum (rust-lang/cargo#12849) - fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857) - fix(remove): Preserve feature comments (rust-lang/cargo#12837) - docs: fix typo (rust-lang/cargo#12844) - chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856) - fix(add): Preserve more comments (rust-lang/cargo#12838) - ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853) - docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850) - docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846) - docs: remove review capacity notice (rust-lang/cargo#12842) - fix(help):Clarify install's positional (rust-lang/cargo#12841) - Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845) - fix(replace): Partial-version spec support (rust-lang/cargo#12806) - Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829) - fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840) - docs(contrib): Policy on manifest editing (rust-lang/cargo#12836) - ci/contrib: use separate concurrency group (rust-lang/cargo#12835) - ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834) - Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823) r? ghost
2023-10-22Update rustc-perf versionJakub Beránek-2/+2
2023-10-22Auto merge of #3134 - RalfJung:log-not-lin, r=saethlinbors-4/+9
avoid a linear scan over the entire int_to_ptr_map on each deallocation
2023-10-22use visibility to check unused imports and delete some stmtsbohan-3/+6
2023-10-22add target csky-unknown-linux-gnuabiv2hfdirreke-0/+1
2023-10-22Pass host triple when running tests in `opt-dist`Jakub Beránek-0/+2
2023-10-22Use beta cargo in opt-distJakub Beránek-6/+1
Using the new cargo caused issues when a backwards-incompatible change was made to cargo.