about summary refs log tree commit diff
path: root/src/tools/tidy
AgeCommit message (Collapse)AuthorLines
2024-03-03Move testsCaio-117/+117
2024-03-03Auto merge of #121877 - estebank:fancy-svg, r=compiler-errorsbors-0/+1
On tests that specify `--color=always` emit SVG file with stderr output Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly. <img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-02On tests that specify --color=always emit SVG file with stderr outputEsteban Kuber-0/+1
Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.
2024-03-01Add initial support for DataFlowSanitizerRamon de C Valle-0/+1
Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-01Rollup merge of #121811 - ↵Matthias Krüger-3/+3
rcvalle:rust-cfi-move-ui-tests-to-sanitizer-directory, r=compiler-errors Move sanitizer ui tests to sanitizer directory Moves the sanitizer ui tests to the sanitizer directory and removes the sanitizer prefix from tests file names similarly to how the sanitizer codegen tests are organized.
2024-03-01Rollup merge of #121475 - jieyouxu:tidy-stderr-check, r=the8472,compiler-errorsMatthias Krüger-24/+202
Add tidy check for .stderr/.stdout files for non-existent test revisions Closes #77498.
2024-02-29Move sanitizer ui tests to sanitizer directoryRamon de C Valle-3/+3
Moves the sanitizer ui tests to the sanitizer directory and removes the sanitizer prefix from tests file names similarly to how the sanitizer codegen tests are organized.
2024-02-29Error on stray .stderr/.stdout files for (un-)revisioned tests许杰友 Jieyou Xu (Joe)-24/+202
2024-02-29Rollup merge of #121681 - jswrenn:nix-visibility-analysis, r=compiler-errorsMatthias Krüger-1/+0
Safe Transmute: Revise safety analysis This PR migrates `BikeshedIntrinsicFrom` to a simplified safety analysis (described [here](https://github.com/rust-lang/project-safe-transmute/issues/15)) that does not rely on analyzing the visibility of types and fields. The revised analysis treats primitive types as safe, and user-defined types as potentially carrying safety invariants. If Rust gains explicit (un)safe fields, this PR is structured so that it will be fairly easy to thread support for those annotations into the analysis. Notably, this PR removes the `Context` type parameter from `BikeshedIntrinsicFrom`. Most of the files changed by this PR are just UI tests tweaked to accommodate the removed parameter. r? `@compiler-errors`
2024-02-27safe transmute: revise safety analysisJack Wrenn-1/+0
Migrate to a simplified safety analysis that does not use visibility. Closes https://github.com/rust-lang/project-safe-transmute/issues/15
2024-02-23rustc: Fix wasm64 metadata object filesAlex Crichton-0/+3
It looks like LLD will detect object files being either 32 or 64-bit depending on any memory present. LLD will additionally reject 32-bit objects during a 64-bit link. Previously metadata objects did not have any memories in them which led LLD to conclude they were 32-bit objects which broke 64-bit targets for wasm. This commit fixes this by ensuring that for 64-bit targets there's a memory object present to get LLD to detect it's a 64-bit target. Additionally this commit moves away from a hand-crafted wasm encoder to the `wasm-encoder` crate on crates.io as the complexity grows for the generated object file. Closes #121460
2024-02-23Auto merge of #121432 - mj10021:issue-119851-fix, r=nnethercotebors-1/+0
Move as many tests from tests/ui/numbers-arithmetic to tests/ui/lint as possible Fixes #119851 , and also consolidates as many individual tests as possible from numbers-arithmetic. I might have moved the tests in too aggressively, so let me know
2024-02-22Update tidy target_specific_tests to account for `//@` directives许杰友 Jieyou Xu (Joe)-1/+1
2024-02-22Update tidy target_policy to account for `//@` directives许杰友 Jieyou Xu (Joe)-1/+1
2024-02-22remove exceptionJames Dietz-1/+0
2024-02-21Auto merge of #121383 - Dylan-DPC:rollup-735p4u4, r=Dylan-DPCbors-1/+1
Rollup of 7 pull requests Successful merges: - #121208 (Convert `delayed_bug`s to `bug`s.) - #121288 (make rustc_expand translatable) - #121304 (Add docs for extension proc-macro) - #121328 (Make --verbose imply -Z write-long-types-to-disk=no) - #121338 (Downgrade ambiguous_wide_pointer_comparisons suggestions to MaybeIncorrect) - #121361 (diagnostic items for legacy numeric modules) - #121375 (Print proper relative path for descriptive name check) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-21print proper relative path for descriptive name checkyukang-1/+1
2024-02-20wasm: Store rlib metadata in wasm object filesAlex Crichton-0/+17
The goal of this commit is to remove warnings using LLVM tip-of-tree `wasm-ld`. In llvm/llvm-project#78658 the `wasm-ld` LLD driver no longer looks at archive indices and instead looks at all the objects in archives. Previously `lib.rmeta` files were simply raw rustc metadata bytes, not wasm objects, meaning that `wasm-ld` would emit a warning indicating so. WebAssembly targets previously passed `--fatal-warnings` to `wasm-ld` by default which meant that if Rust were to update to LLVM 18 then all wasm targets would not work. This immediate blocker was resolved in rust-lang/rust#120278 which removed `--fatal-warnings` which enabled a theoretical update to LLVM 18 for wasm targets. This current state is ok-enough for now because rustc squashes all linker output by default if it doesn't fail. This means, for example, that rustc squashes all the linker warnings coming out of `wasm-ld` about `lib.rmeta` files with LLVM 18. This again isn't a pressing issue because the information is all hidden, but it runs the risk of being annoying if another linker error were to happen and then the output would have all these unrelated warnings that couldn't be fixed. Thus, this PR comes into the picture. The goal of this PR is to resolve these warnings by using the WebAssembly object file format on wasm targets instead of using raw rustc metadata. When I first implemented the rlib-in-objects scheme in #84449 I remember either concluding that `wasm-ld` would either include the metadata in the output or I thought we didn't have to do anything there at all. I think I was wrong on both counts as `wasm-ld` does not include the metadata in the final output unless the object is referenced and we do actually need to do something to resolve these warnings. This PR updates the object file format containing rustc metadata on WebAssembly targets to be an actual WebAssembly file. This enables the `wasm` feature of the `object` crate to be able to read the custom section in the same manner as other platforms, but currently `object` doesn't support writing wasm object files so a handwritten encoder is used instead. The only caveat I know of with this is that if `wasm-ld` does indeed look at the object file then the metadata will be included in the final output. I believe the only thing that could cause that at this time is `--whole-archive` which I don't think is passed for rlibs. I would clarify that I'm not 100% certain about this, however.
2024-02-20Auto merge of #120628 - workingjubilee:reimpl-meaningful-test-name-lint, ↵bors-9/+4462
r=compiler-errors Reimpl meaningful test name lint MCP658 This reintroduces the tidy rule originally proposed in https://github.com/rust-lang/rust/pull/113583 that then became an MCP in https://github.com/rust-lang/compiler-team/issues/658 which eventually surfaced a quite-reasonable request for a diagnostic enhancement. I have added that to the rule. It produces output like this: ``` tidy error: file `ui/unsized/issue-115809.rs` must begin with a descriptive name, try `{reason}-issue-115809.rs` tidy error: file `ui/unsized/issue-115203.rs` must begin with a descriptive name, try `{reason}-issue-115203.rs` tidy error: file `ui/privacy/issue-113860-2.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs` tidy error: file `ui/privacy/issue-117997.rs` must begin with a descriptive name, try `{reason}-issue-117997.rs` tidy error: file `ui/privacy/issue-119463.rs` must begin with a descriptive name, try `{reason}-issue-119463.rs` tidy error: file `ui/privacy/auxiliary/issue-117997.rs` must begin with a descriptive name, try `{reason}-issue-117997.rs` tidy error: file `ui/privacy/auxiliary/issue-119463-extern.rs` must begin with a descriptive name, try `{reason}-issue-119463.rs` tidy error: file `ui/privacy/issue-113860-1.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs` tidy error: file `ui/privacy/issue-113860.rs` must begin with a descriptive name, try `{reason}-issue-113860.rs` tidy error: file `ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.rs` must begin with a descriptive name, try `{reason}-issue-114151.rs` tidy error: file `ui/did_you_mean/issue-114112.rs` must begin with a descriptive name, try `{reason}-issue-114112.rs` tidy error: file `ui/did_you_mean/issue-105225.rs` must begin with a descriptive name, try `{reason}-issue-105225.rs` tidy error: file `ui/did_you_mean/issue-105225-named-args.rs` must begin with a descriptive name, try `{reason}-issue-105225.rs` ``` You get the idea. There are some tests which merely would require reordering of the name according to the rule. I could modify the diagnostic further to identify those, but doing such would make it prone to bad suggestions. I have opted to trust contributors to recognize the diagnostic is robotic, as the pattern we are linting on is easier to match if we do not speculate on what parts of the name are meaningful: sometimes a word is a reason, but sometimes it is a mere "tag", such as with a pair like: - issue-314159265-blue.rs - issue-314159265-red.rs Starting them with `red-` and `blue-` means they do not sort together, despite being related, and the color names are still not very descriptive. Recognizing a good name is an open-ended task, though this pair might be: - colored-circle-gen-blue.rs - colored-circle-gen-red.rs Deciding exactly *how* to solve this is not the business of tidy, only recognizing a what. r? `@compiler-errors`
2024-02-18Add `Future` and `IntoFuture` to the 2024 preludeNilstrieb-1/+1
Implements RFC 3509.
2024-02-18Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrumbors-0/+1
bump some deps First commit dedupes darling* crates and remove one more syn 1.* dep Second one bumps windows crate to 0.52
2024-02-18tidy: add windows-coreklensy-0/+1
2024-02-17Remove old issues.txt entries with --blessJubilee Young-124/+97
2024-02-17Implement --bless for the issues lintJubilee Young-8/+33
2024-02-17Grandfather new questionably-named testsJubilee Young-1387/+1519
~130 new entries, depending on how you count, with the rest being sorting churn.
2024-02-17Suggest pattern in meaningful test diagnosticJubilee Young-4/+4
As the reason for tidy failing the test name may seem slightly opaque, provide a suggestion on how to rename the file. There are some tests which merely would require reordering of the name according to the rule. I could modify the diagnostic further to identify those, but doing such would make it prone to bad suggestions. I have opted to trust contributors to recognize the diagnostic is robotic, as the pattern we are linting on is easier to match if we do not speculate on what parts of the name are meaningful: sometimes a word is a reason, but sometimes it is a mere "tag", such as with a pair like: issue-314159265-blue.rs issue-314159265-red.rs Starting them with `red-` and `blue-` means they do not sort together, despite being related, and the color names are still not very descriptive. Recognizing a good name is an open-ended task, though this pair might be: colored-circle-gen-blue.rs colored-circle-gen-red.rs Deciding exactly how to solve this is not the business of tidy, only recognizing a what.
2024-02-17Reapply "add tidy check that forbids issue ui test filenames"Jubilee Young-6/+4329
This reverts commit 686b3debfc19f124c9c2ec8a856c06892f6086a1.
2024-02-17tidy: wrap regexes with lazy_staticklensy-4/+8
yes, once_cell better, but ... this reduces from ==31349== Total: 1,365,199,543 bytes in 4,774,213 blocks ==31349== At t-gmax: 10,975,708 bytes in 66,093 blocks ==31349== At t-end: 2,880,947 bytes in 12,332 blocks ==31349== Reads: 5,210,008,956 bytes ==31349== Writes: 1,280,920,127 bytes to ==47796== Total: 821,467,407 bytes in 3,955,595 blocks ==47796== At t-gmax: 10,976,209 bytes in 66,100 blocks ==47796== At t-end: 2,944,016 bytes in 12,490 blocks ==47796== Reads: 4,788,959,023 bytes ==47796== Writes: 975,493,639 bytes miropt-test-tools: remove regex usage this removes regex usage and slightly refactors ext stripping in one case
2024-02-16Implement infra support for migrating from `//` to `//@` ui test directives许杰友 Jieyou Xu (Joe)-2/+14
2024-02-14Rollup merge of #120893 - c410-f3r:testsssssss, r=petrochenkovGuillaume Gomez-1/+1
Move some tests r? `@petrochenkov`
2024-02-13`cargo update`clubby789-1/+3
2024-02-13Move testsCaio-1/+1
2024-02-13Bump `time` and allow new dependenciesclubby789-0/+2
2024-02-09Move some testsCaio-2/+2
2024-02-08Add new ui testsBen Kimock-1/+1
2024-02-07Add parallel rustc ui testsSparrowLii-1/+1
2024-02-07Update testsr0cky-2/+3
2024-02-06Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errorsMatthias Krüger-1/+1
Remove `ffi_returns_twice` feature The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years. There is also an attribute gate in R-A which should be removed if this lands.
2024-02-05Auto merge of #117372 - Amanieu:stdarch_update, r=Mark-Simulacrumbors-0/+6
Update stdarch submodule Splits up #27731 into multiple tracking issues. Closes #27731
2024-02-01Auto merge of #120447 - lnicola:sync-from-ra, r=lnicolabors-0/+1
Subtree update of `rust-analyzer` r? ghost
2024-01-30Remove `ffi_returns_twice` featureclubby789-1/+1
2024-01-30Update allowed depdendencies for craneliftAmanieu d'Antras-0/+6
2024-01-29Move multiple UI issue tests to subdirectoriesMarek 'seqre' Grzelak-2/+5
Issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 were moved to relevant better-named subdirectories. ISSUES_ENTRY_LIMIT was adjusted to match new number of files and FIXME note was expanded.
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-17/+17
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-28Add rustc_apfloat license exception for RALaurențiu Nicola-0/+1
2024-01-27Auto merge of #120201 - clubby789:dep-update, r=dtolnaybors-2/+0
Bump some deps with syn 1.0 dependencies cc #109302 `cargo update`ing `unic-langid` and `object` removes two dependencies on Syn 1.0.
2024-01-27Auto merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleywiserbors-3/+4
llvm: change data layout bug to an error and make it trigger more Fixes #33446. Don't skip the inconsistent data layout check for custom LLVMs or non-built-in targets. With #118708, all targets will have a simple test that would trigger this error if LLVM's data layouts do change - so data layouts would be corrected during the LLVM upgrade. Therefore, with builtin targets, this error won't happen with our LLVM because each target will have been confirmed to work. With non-builtin targets, this error is probably useful to have because you can change the data layout in your target and if it is wrong then that could lead to bugs. When using a custom LLVM, the same justification makes sense for non-builtin targets as with our LLVM, the user can update their target to match their LLVM and that's probably a good thing to do. However, with a custom LLVM, the user cannot change the builtin target data layouts if they don't match - though given that the compiler's data layout is used for layout computation and a bunch of other things - you could get some bugs because of the mismatch and probably want to know about that. I'm not sure if this is something that people do and is okay, but I doubt it? `CFG_LLVM_ROOT` was also always set during local development with `download-ci-llvm` so this bug would never trigger locally. In #33446, two points are raised: - In the issue itself, changing this from a `bug!` to a proper error is what is suggested, by using `isCompatibleDataLayout` from LLVM, but that function still just does the same thing that we do and check for equality, so I've avoided the additional code necessary to do that FFI call. - `@Mark-Simulacrum` suggests a different check is necessary to maintain backwards compatibility with old LLVM versions. I don't know how often this comes up, but we can do that with some simple string manipulation + LLVM version checks as happens already for LLVM 17 just above this diff.
2024-01-21Bump `object` versionclubby789-2/+0
2024-01-19Teach tidy about line/col information for malformed featuresOli Scherer-6/+26
2024-01-18llvm: simplify data layout checkDavid Wood-3/+4
Don't skip the inconsistent data layout check for custom LLVMs. With #118708, all targets will have a simple test that would trigger this check if LLVM's data layouts do change - so data layouts would be corrected during the LLVM upgrade. Therefore, with builtin targets, this check won't trigger with our LLVM because each target will have been confirmed to work. With non-builtin targets, this check is probably useful to have because you can change the data layout in your target and if its wrong then that could lead to bugs. When using a custom LLVM, the same justification makes sense for non-builtin targets as with our LLVM, the user can update their target to match their LLVM and that's probably a good thing to do. However, with a custom LLVM, the user cannot change the builtin target data layouts if they don't match - though given that the compiler's data layout is used for layout computation and a bunch of other things - you could get some bugs because of the mismatch and probably want to know about that. `CFG_LLVM_ROOT` was also always set during local development with `download-ci-llvm` so this bug would never trigger locally. Signed-off-by: David Wood <david@davidtw.co>