about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-05-04Auto merge of #124345 - Urgau:compiletest-check-cfg, r=jieyouxubors-217/+273
Enable `--check-cfg` by default in UI tests This PR enables-by-default `--check-cfg` in UI tests, now that it has become stable. To do so this PR does 2 main things: - it introduce the `no-auto-check-cfg` directive to `compiletest`, to prevent any `--check-cfg` args (only to be used for `--check-cfg` tests) - it updates the _remaining_[^1] UI tests by either: - allowing the lint when neither expecting the lint nor giving the check-cfg args make sense - give the appropriate check-cfg args - or expect the lint, when it useful [^1]: some preparation work was done in #123577 #123702 I highly recommend reviewing this PR commit-by-commit. r? `@jieyouxu`
2024-05-04compiletest: add enable-by-default check-cfgUrgau-60/+92
2024-05-04compiletest: add no-auto-check-cfg directiveUrgau-119/+148
this directive prevents compiletest from adding any implicit and automatic --check-cfg arguments
2024-05-04tests/ui: prepare some tests for --check-cfg by defaultUrgau-38/+33
2024-05-03Rollup merge of #124658 - GuillaumeGomez:migrate-to-run-make, r=jieyouxuMichael Goulet-33/+68
Migrate `run-make/doctests-keep-binaries` to new rmake.rs format r? ```@jieyouxu```
2024-05-03Rollup merge of #124480 - Enselic:on-broken-pipe, r=jieyouxuMichael Goulet-230/+46
Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...` In the stabilization [attempt](https://github.com/rust-lang/rust/pull/120832) of `#[unix_sigpipe = "sig_dfl"]`, a concern was [raised ](https://github.com/rust-lang/rust/pull/120832#issuecomment-2007394609) related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was [also raised](https://github.com/rust-lang/rust/pull/120832#issuecomment-1987023484), namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2024-05-03Rollup merge of #124418 - compiler-errors:better-cause, r=lcnrMichael Goulet-62/+271
Use a proof tree visitor to refine the `Obligation` for error reporting in new solver With the magic of `ProofTreeVisitor`, we can close the gap that we have on `ObligationCause`s being not as descriptive in the new trait solver. r? lcnr Needs some work and obviously documentation.
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-13/+13
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-05-03Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obkbors-260/+513
Account for immutably borrowed locals in MIR copy-prop and GVN For the most part, we consider that immutably borrowed `Freeze` locals still fulfill SSA conditions. As the borrow is immutable, any use of the local will have the value given by the single assignment, and there can be no surprise. This allows copy-prop to merge a non-borrowed local with a borrowed local. We chose to keep copy-classes heads unborrowed, as those may be easier to optimize in later passes. This also allows to GVN the value behind an immutable borrow. If a SSA local is borrowed, dereferencing that borrow is equivalent to copying the local's value: re-executing the assignment between the borrow and the dereference would be UB. r? `@ghost` for perf
2024-05-03Migrate `run-make/doctests-keep-binaries` to new `rmake.rs` formatGuillaume Gomez-33/+68
2024-05-03Rollup merge of #124510 - linyihai:raw-ident-in-typo-suggestion, r=fmeaseMatthias Krüger-0/+29
Add raw identifier in a typo suggestion Fixes #68962
2024-05-03Rollup merge of #124613 - GuillaumeGomez:fmt-run-make, r=onur-ozkanMatthias Krüger-68/+37
Allow fmt to run on rmake.rs test files As discussed with `@jieyouxu,` `rmake.rs` from the `run-make` testsuite would benefit from being formatted as well. Only thing needed to be done for it to work: allow support for `!` in our `rustfmt.toml` file parsing. r? `@onur-ozkan`
2024-05-03Rollup merge of #124612 - Urgau:run-make-stdin, r=jieyouxuMatthias Krüger-7/+26
Add support for inputing via stdin with run-make-support This PR adds the facility to set a input bytes that will be passed via the standard input. This is useful for testing `rustc -` (and soon `rustdoc -`). In #124611 took the approach of having a dedicated `run` method but it is not very convenient to use and would necessitate many functions, one for success, one for fail, ... Instead this PR takes a different approach and allows setting the input bytes as if it were a parameter and when calling the (now custom) `output` function, we write the input bytes into stdin. I think this gives us maximum flexibility in the implementation and a simple interface for users. To test this new logic I ported `tests/run-make/stdin-non-utf8/` to an `rmake.rs` one. r? `@jieyouxu`
2024-05-03Allow `fmt` to run on `rmake.rs` test filesGuillaume Gomez-68/+37
2024-05-03run-make: port stdin-rustc to Rust-based rmake.rsUrgau-7/+26
2024-05-02Higher ranked goal source, do overflow handling less badlyMichael Goulet-64/+73
2024-05-02Use a proof tree visitor to refine the Obligation for error reportingMichael Goulet-59/+259
2024-05-02Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`Martin Nordholts-230/+46
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern was raised related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was also raised, namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization.
2024-05-02Rollup merge of #124622 - fmease:yeet-extern-crate-run_make_support, r=jieyouxuMatthias Krüger-55/+0
Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;` `run_make_support` is part of the *extern prelude* of `rmake` test runners rendering `extern crate run_make_support` redundant: https://github.com/rust-lang/rust/blob/80451a485b006bd32732c003a54ee7de457d8266/src/tools/compiletest/src/runtest.rs#L3826-L3827 ~~Contains some fmt'ing changes because I've enabled format-on-save in my editor and because we don't run `x fmt` for `rmake` test runners yet (this gets addressed by #124613). I can revert those if you'd like me to.~~ (reverted) r? jieyouxu or testing-devex(?) or boostrap(?)
2024-05-02Rollup merge of #124138 - mati865:ignore-llvm-abi-in-dlltool-tests, r=davidtwcoMatthias Krüger-7/+2
Ignore LLVM ABI in dlltool tests since those targets don't use dlltool Otherwise those two tests fail when running `./x.py test` with this target.
2024-05-02Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`León Orell Valerian Liehr-55/+0
2024-05-02Rollup merge of #124597 - cuviper:x86-64-v3, r=workingjubileeGuillaume Gomez-25/+34
Use an explicit x86-64 cpu in tests that are sensitive to it There are a few tests that depend on some target features **not** being enabled by default, and usually they are correct with the default x86-64 target CPU. However, in downstream builds we have modified the default to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10 -- and the latter especially trips tests that expect not to have AVX. These cases are few enough that we can just set them back explicitly.
2024-05-02Rollup merge of #124568 - Urgau:non-local-defs-doctest, ↵Guillaume Gomez-0/+30
r=michaelwoerister,GuillaumeGomez Adjust `#[macro_export]`/doctest help suggestion for non_local_defs lint This PR adjust the help suggestion of the `non_local_definitions` lint when encountering a `#[macro_export]` at top-level doctest. So instead of a non-sentential help suggestion to move the `macro_rules!` up above the `rustdoc`-generated function. We now suggest users to declare their own function. Fixes *(partially, needs backport)* #124534
2024-05-02Auto merge of #123939 - WaffleLapkin:never-fallback-unsafe-lint, ↵bors-0/+228
r=compiler-errors Add a lint against never type fallback affecting unsafe code ~~I'm not very happy with the code quality... `VecGraph` not allowing you to get predecessors is very annoying. This should work though, so there is that.~~ (ended up updating `VecGraph` to support getting predecessors) ~~First few commits are from https://github.com/rust-lang/rust/pull/123934 https://github.com/rust-lang/rust/pull/123980~~
2024-05-02Add proper support for all kinds of unsafe ops to the lintWaffle Lapkin-5/+175
(never_type_fallback_flowing_into_unsafe)
2024-05-02Add a lint against never type fallback affecting unsafe codeMaybe Waffle-0/+58
2024-05-02Auto merge of #124529 - compiler-errors:select, r=lcnrbors-0/+9
Rewrite select (in the new solver) to use a `ProofTreeVisitor` We can use a proof tree visitor rather than collecting and recomputing all the nested goals ourselves. Based on #124415
2024-05-01Use an outlandish target feature for the negative caseJosh Stone-3/+3
2024-05-01Add inline comments why we're forcing the target cpuJosh Stone-19/+25
2024-05-01Use an explicit x86-64 cpu in tests that are sensitive to itJosh Stone-23/+26
There are a few tests that depend on some target features **not** being enabled by default, and usually they are correct with the default x86-64 target CPU. However, in downstream builds we have modified the default to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10 -- and the latter especially trips tests that expect not to have AVX. These cases are few enough that we can just set them back explicitly.
2024-05-01Rewrite select to use a ProofTreeVisitorMichael Goulet-0/+9
2024-05-01Rollup merge of #124566 - lcnr:normalizes-to-proof-tree, r=compiler-errorsMatthias Krüger-2/+59
fix `NormalizesTo` proof tree issue fixes #124422 cc #121848 r? ``@compiler-errors``
2024-05-01Adjust `#[macro_export]`/doctest help suggestion for non_local_defs lintUrgau-0/+30
2024-05-01Auto merge of #124539 - Urgau:non-local-defs_modulo_modules, r=lcnrbors-0/+38
Consider inner modules to be local in the `non_local_definitions` lint This PR implements the [proposed fix](https://github.com/rust-lang/rust/issues/124396#issuecomment-2079553642) for #124396, that is to consider inner modules to be local in the `non_local_definitions` lint. This PR is voluntarily kept as minimal as possible so it can be backported easily. T-lang [nomination](https://github.com/rust-lang/rust/issues/124396#issuecomment-2079692820) will need to be removed before this can be merged. Fixes *(nearly, needs backport)* https://github.com/rust-lang/rust/issues/124396
2024-05-01Auto merge of #124356 - fmease:fewer-magic-numbers-in-names, r=lcnrbors-15/+15
Cleanup: Replace item names referencing GitHub issues or error codes with something more meaningful **lcnr** in https://github.com/rust-lang/rust/pull/117164#pullrequestreview-1969935387: > […] while I know that there's precendent to name things `Issue69420`, I really dislike this as it requires looking up the issue to figure out the purpose of such a variant. Actually referring to the underlying issue, e.g. `AliasMayNormToUncovered` or whatever and then linking to the issue in a doc comment feels a lot more desirable to me. We should ideally rename all the functions and enums which currently use issue numbers. I've grepped through `compiler/` like crazy and think that I've found all instances of this pattern. However, I haven't renamed `compute_2229_migrations_*`. Should I? The first commit introduces an abhorrent and super long name for an item because naming is hard but also scary looking / unwelcoming names are good for things related to temporary-ish backcompat hacks. I'll let you discover it by yourself. Contains a bit of drive-by cleanup and a diag migration bc that was the simplest option. r? lcnr or compiler
2024-04-30Auto merge of #117164 - fmease:orphan-norm, r=lcnrbors-1/+594
Lazily normalize inside trait ref during orphan check & consider ty params in rigid alias types to be uncovered Fixes #99554, fixes rust-lang/types-team#104. Fixes #114061. Supersedes #100555. Tracking issue for the future compatibility lint: #124559. r? lcnr
2024-04-30Replace item names containing an error code with something more meaningfulLeón Orell Valerian Liehr-15/+15
or inline such functions if useless.
2024-04-30fix `NormalizesTo` proof tree issuelcnr-2/+59
2024-04-30Normalize trait ref before orphan check & consider ty params in alias types ↵León Orell Valerian Liehr-1/+594
to be uncovered
2024-04-30Rollup merge of #124299 - clubby789:106269-test, r=nikic许杰友 Jieyou Xu (Joe)-0/+22
Add test for issue 106269 Closes #106269 Made this an assembly test as the LLVM codegen is still quite verbose and doesn't really indicate the behaviour we want
2024-04-30Rollup merge of #124280 - beetrees:repr128-test-rmake, r=jieyouxu许杰友 Jieyou Xu (Joe)-17/+79
Port repr128-dwarf run-make test to rmake This PR ports the repr128-dwarf run-make test to rmake, using the `gimli` crate instead of the `llvm-dwarfdump` command. Note that this PR changes `rmake.rs` files to be compiled with the 2021 edition (previously no edition was passed to `rustc`, meaning they were compiled with the 2015 edition). This means that `panic!("{variable}")` will now work as expected in `rmake.rs` files (there's already a usage in the [wasm-symbols-not-exported test](https://github.com/rust-lang/rust/blob/aca749eefceaed0cda19a7ec5e472fce9387bc00/tests/run-make/wasm-symbols-not-exported/rmake.rs#L34) that this will fix). Tracking issue: #121876
2024-04-30Port repr128-dwarf run-make test to rmakebeetrees-17/+79
2024-04-30Add test for efficient codegen of manual `eq` implementations of a small structclubby789-0/+22
2024-04-30Auto merge of #124547 - matthiaskrgr:rollup-9tv8upg, r=matthiaskrgrbors-16/+16
Rollup of 4 pull requests Successful merges: - #124519 (adapt a codegen test for llvm 19) - #124524 (Add StaticForeignItem and use it on ForeignItemKind) - #124540 (Give proof tree visitors the ability to instantiate nested goals directly) - #124543 (codegen tests: Tolerate `range()` qualifications in enum tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-30Rollup merge of #124543 - maurer:llvm-range, r=nikicMatthias Krüger-3/+3
codegen tests: Tolerate `range()` qualifications in enum tests Current LLVM can infer range bounds on the i8s involved with these tests, and annotates it. Accept these bounds if present. `@rustbot` label: +llvm-main cc `@durin42`
2024-04-30Rollup merge of #124524 - spastorino:make-foreign-static-use-struct, r=oli-obkMatthias Krüger-10/+10
Add StaticForeignItem and use it on ForeignItemKind This is in preparation for unsafe extern blocks that adds a safe variant for functions inside extern blocks. r? `@oli-obk` cc `@compiler-errors`
2024-04-30Rollup merge of #124519 - krasimirgg:test-ranges, r=nikicMatthias Krüger-3/+3
adapt a codegen test for llvm 19 No functional changes intended. Found by our experimental rust + LLVM @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/27747#018f2570-018c-4b12-9c5a-38cf81453683/957-965 `@rustbot` label: +llvm-main r? `@durin42`
2024-04-30Auto merge of #124507 - Zalathar:coverage-level, r=compiler-errorsbors-8/+5
coverage: Replace boolean options with a `CoverageLevel` enum After #123409, and some discussion at https://github.com/rust-lang/rust/issues/79649#issuecomment-2042093553 and #124120, it became clear to me that we should have a unified concept of “coverage level”, instead of having several separate boolean flags that aren't actually independent. This PR therefore introduces a `CoverageLevel` enum, to replace the existing boolean flags for `branch` and `mcdc`. The `no-branch` value (for `-Zcoverage-options`) has been renamed to `block`, instructing the compiler to only instrument for block coverage, with no branch coverage or MD/DC instrumentation. `@rustbot` label +A-code-coverage cc `@ZhuUx` `@Lambdaris` `@RenjiSann`
2024-04-30Auto merge of #124398 - klensy:trailing-ws, r=compiler-errorsbors-47/+47
tests: remove some trailing ws Cleans one more case of trailing whitespace in tests.
2024-04-30codegen tests: Tolerate `range()` qualifications in enum testsMatthew Maurer-3/+3
Current LLVM can infer range bounds on the i8s involved with these tests, and annotates it. Accept these bounds if present.