about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-05-21Okay actually check only alias TYPESMichael Goulet-0/+20
2024-05-21Auto merge of #124676 - djkoloski:relax_multiple_sanitizers, r=cuviper,rcvallebors-10/+2
Relax restrictions on multiple sanitizers Most combinations of LLVM sanitizers are legal-enough to enable simultaneously. This change will allow simultaneously enabling ASAN and shadow call stacks on supported platforms. I used this python script to generate the mutually-exclusive sanitizer combinations: ```python #!/usr/bin/python3 import subprocess flags = [ ["-fsanitize=address"], ["-fsanitize=leak"], ["-fsanitize=memory"], ["-fsanitize=thread"], ["-fsanitize=hwaddress"], ["-fsanitize=cfi", "-flto", "-fvisibility=hidden"], ["-fsanitize=memtag", "--target=aarch64-linux-android", "-march=armv8a+memtag"], ["-fsanitize=shadow-call-stack"], ["-fsanitize=kcfi", "-flto", "-fvisibility=hidden"], ["-fsanitize=kernel-address"], ["-fsanitize=safe-stack"], ["-fsanitize=dataflow"], ] for i in range(len(flags)): for j in range(i): command = ["clang++"] + flags[i] + flags[j] + ["-o", "main.o", "-c", "main.cpp"] completed = subprocess.run(command, stderr=subprocess.DEVNULL) if completed.returncode != 0: first = flags[i][0][11:].replace('-', '').upper() second = flags[j][0][11:].replace('-', '').upper() print(f"(SanitizerSet::{first}, SanitizerSet::{second}),") ```
2024-05-21Auto merge of #125358 - matthiaskrgr:rollup-mx841tg, r=matthiaskrgrbors-29/+55
Rollup of 7 pull requests Successful merges: - #124570 (Miscellaneous cleanups) - #124772 (Refactor documentation for Apple targets) - #125011 (Add opt-for-size core lib feature flag) - #125218 (Migrate `run-make/no-intermediate-extras` to new `rmake.rs`) - #125225 (Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS) - #125266 (compiler: add simd_ctpop intrinsic) - #125348 (Small fixes to `std::path::absolute` docs) Failed merges: - #125296 (Fix `unexpected_cfgs` lint on std) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-21Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJung,nikicMatthias Krüger-21/+38
compiler: add simd_ctpop intrinsic Fairly straightforward addition. cc `@rust-lang/opsem` new (extremely boring) intrinsic
2024-05-21Rollup merge of #125218 - Oneirical:easy-test-the-third, r=jieyouxuMatthias Krüger-8/+17
Migrate `run-make/no-intermediate-extras` to new `rmake.rs` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-21Auto merge of #124097 - compiler-errors:box-into-iter, r=WaffleLapkinbors-19/+309
Add `IntoIterator` for `Box<[T]>` + edition 2024-specific lints * Adds a similar method probe opt-out mechanism to the `[T;N]: IntoIterator` implementation for edition 2021. * Adjusts the relevant lints (shadowed `.into_iter()` calls, new source of method ambiguity). * Adds some tests. * Took the liberty to rework the logic in the `ARRAY_INTO_ITER` lint, since it was kind of confusing. Based mostly off of #116607. ACP: rust-lang/libs-team#263 References #59878 Tracking for Rust 2024: https://github.com/rust-lang/rust/issues/123759 Crater run was done here: https://github.com/rust-lang/rust/pull/116607#issuecomment-1770293013 Consensus afaict was that there is too much breakage, so let's do this in an edition-dependent way much like `[T; N]: IntoIterator`.
2024-05-21Auto merge of #123812 - compiler-errors:additional-fixes, r=fmeasebors-21/+33
Follow-up fixes to `report_return_mismatched_types` Some renames, simplifications, fixes, etc. Follow-ups to #123804. I don't think it totally disentangles this code, but it does remove some of the worst offenders on the "I am so confused" scale (e.g. `get_node_fn_decl`).
2024-05-21Auto merge of #125298 - tesuji:arrcmp, r=nikicbors-0/+18
Add codegen test for array comparision opt Fixed since rust 1.55 closes #62531
2024-05-20simplifyOneirical-9/+4
2024-05-20Inline get_node_fn_decl into get_fn_decl, simplify/explain logic in ↵Michael Goulet-21/+33
report_return_mismatched_types
2024-05-21Add codegen test for array comparision optLzu Tao-0/+18
2024-05-20Adjust the method ambiguity lint tooMichael Goulet-0/+69
2024-05-20Implement BOXED_SLICE_INTO_ITERMichael Goulet-2/+223
2024-05-20BackticksMichael Goulet-17/+17
2024-05-21Rollup merge of #125308 - lcnr:search-graph-5, r=compiler-errorsMatthias Krüger-3/+31
track cycle participants per root The search graph may have multiple roots, e.g. in ``` A :- B B :- A, C C :- D D :- C ``` we first encounter the `A -> B -> A` cycle which causes `A` to be a root. We then later encounter the `C -> D -> C` cycle as a nested goal of `B`. This cycle is completely separate and `C` will get moved to the global cache. This previously caused us to use `[B, D]` as the `cycle_participants` for `C` and `[]` for `A`. split off from #125167 as I would like to merge this change separately and will rebase that PR on top of this one. There is no test for this issue and I don't quite know how to write one. It is probably worth it to generalize the search graph to enable us to write unit tests for it. r? `@compiler-errors`
2024-05-21Rollup merge of #125158 - Nilstrieb:block-indent, r=compiler-errorsMatthias Krüger-52/+52
hir pretty: fix block indent before: ```rust fn main() { { { ::std::io::_print(format_arguments::new_const(&["Hello, world!\n"])); }; } } ``` after: ```rust fn main() { { { ::std::io::_print(format_arguments::new_const(&["Hello, world!\n"])); }; } } ``` AST pretty does the same.
2024-05-21Rollup merge of #124283 - surechen:fix_123558, r=estebankMatthias Krüger-0/+40
Note for E0599 if shadowed bindings has the method. implement #123558 Use a visitor to find earlier shadowed bingings which has the method. r? ``@estebank``
2024-05-21Rollup merge of #124050 - saethlin:less-sysroot-libc, r=ChrisDentonMatthias Krüger-93/+105
Remove libc from MSVC targets ``@ChrisDenton`` started working on a project to remove libc from Windows MSVC targets. I'm completing that work here. The primary change is to cfg out the dependency in `library/`. And then there's a lot of test patching. Happy to separate this more if people want.
2024-05-20track cycle participants per entrylcnr-3/+31
2024-05-20Auto merge of #125219 - Urgau:check-cfg-cargo-config, r=fmeasebors-35/+96
Update `unexpected_cfgs` lint for Cargo new `check-cfg` config This PR updates the diagnostics output of the `unexpected_cfgs` lint for Cargo new `check-cfg` config. It's a simple and cost-less alternative to the build-script `cargo::rustc-check-cfg` instruction. ```toml [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo, values("bar"))'] } ``` This PR also adds a Cargo specific section regarding check-cfg and Cargo inside rustc's book (motivation is described inside the file, but mainly check-cfg is a rustc feature not a Cargo one, Cargo only enabled the feature, it does not own it; T-cargo even considers the `check-cfg` lint config to be an implementation detail). This PR also updates the links to refer to that sub-page when using Cargo from rustc. As well as updating the lint doc to refer to the check-cfg docs. ~**Not to be merged before https://github.com/rust-lang/cargo/pull/13913 reaches master!**~ (EDIT: merged in https://github.com/rust-lang/rust/pull/125237) `@rustbot` label +F-check-cfg r? `@fmease` *(feel free to roll)* Fixes https://github.com/rust-lang/rust/issues/124800 cc `@epage` `@weihanglo`
2024-05-20hir pretty: fix block indentNilstrieb-52/+52
2024-05-20Rollup merge of #125318 - ↵Matthias Krüger-5/+6
GuillaumeGomez:migrate-rustdoc-examples-whitespaces, r=jieyouxu Migrate `run-make/rustdoc-scrape-examples-whitespace` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-05-20Rollup merge of #125314 - jdonszelmann:global-registration-feature-gate, ↵Matthias Krüger-0/+16
r=pnkfelix Add an experimental feature gate for global registration See #125119 for the tracking issue.
2024-05-20Rollup merge of #125305 - jwong101:120493-codegen-test, r=the8472Matthias Krüger-0/+22
add some codegen tests for issue 120493 I forgot to add these in https://github.com/rust-lang/rust/pull/123878.
2024-05-20Rollup merge of #125173 - scottmcm:never-checked, r=davidtwcoMatthias Krüger-47/+47
Remove `Rvalue::CheckedBinaryOp` Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/intrinsics.20vs.20binop.2Funop/near/438729996> cc `@RalfJung` While it's a draft, r? ghost
2024-05-20Rollup merge of #125106 - Zalathar:expressions, r=davidtwcoMatthias Krüger-1315/+808
coverage: Memoize and simplify counter expressions When creating coverage counter expressions as part of coverage instrumentation, we often end up creating obviously-redundant expressions like `c1 + (c0 - c1)`, which is equivalent to just `c0`. To avoid doing so, this PR checks when we would create an expression matching one of 5 patterns, and uses the simplified form instead: - `(a - b) + b` → `a`. - `(a + b) - b` → `a`. - `(a + b) - a` → `b`. - `a + (b - a)` → `b`. - `a - (a - b)` → `b`. Of all the different ways to combine 3 operands and 2 operators, these are the patterns that allow simplification. (Some of those patterns currently don't occur in practice, but are included anyway for completeness, to avoid having to add them later as branch coverage and MC/DC coverage support expands.) --- This PR also adds memoization for newly-created (or newly-simplified) counter expressions, to avoid creating duplicates. This currently makes no difference to the final mappings, but is expected to be useful for MC/DC coverage of match expressions, as proposed by https://github.com/rust-lang/rust/pull/124278#issuecomment-2106754753.
2024-05-20Rollup merge of #124917 - cardigan1008:issue-124819, r=pnkfelixMatthias Krüger-0/+17
Check whether the next_node is else-less if in get_return_block Fix #124819
2024-05-20Rollup merge of #124682 - estebank:issue-40990, r=pnkfelixMatthias Krüger-181/+567
Suggest setting lifetime in borrowck error involving types with elided lifetimes ``` error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5 | LL | fn foo(mut x: Ref, y: Ref) { | ----- - has type `Ref<'_, '1>` | | | has type `Ref<'_, '2>` LL | x.b = y.b; | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` | help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'a, 'a>, y: Ref<'a, 'a>) { | ++++ ++++++++ ++++++++ ``` As can be seen above, it currently doesn't try to compare the `ty::Ty` lifetimes that diverged vs the `hir::Ty` to correctly suggest the following ``` help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'_, 'a>, y: Ref<'_, 'a>) { | ++++ ++++++++ ++++++++ ``` but I believe this to still be an improvement over the status quo. Fix #40990.
2024-05-20Undo accidental change to tests/ui/sanitizer/thread.rsBen Kimock-0/+1
2024-05-20Update tests/incremental/foreign.rsBen Kimock-22/+5
2024-05-20Fix feature-gates/rustc-private.rsBen Kimock-3/+3
2024-05-20Port stdout-during-shutdownBen Kimock-0/+22
2024-05-20Patch up foreign-fn-linkname.rsBen Kimock-9/+3
2024-05-20Add a Windows version of foreign2.rsBen Kimock-3/+25
2024-05-20Handle a few more simple testsBen Kimock-32/+34
2024-05-20Add only-unix to sigpipe testsBen Kimock-0/+5
2024-05-20Fix up a few more testsBen Kimock-25/+8
2024-05-20add codegen test for issue 120493Joshua Wong-0/+22
2024-05-20Rollup merge of #125309 - nnethercote:fix-strings-and-strs, r=Mark-SimulacrumMatthias Krüger-2/+2
Fix `tests/debuginfo/strings-and-strs`. It fails on my machine because it embeds pointer addresses in the expected output. This commit replaces the addresses with `0x[...]`. r? ```@Mark-Simulacrum```
2024-05-20Rollup merge of #125300 - compiler-errors:dont-strip-inherited-viz, r=fmeaseMatthias Krüger-0/+12
rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper` Enum variants return `None` in `Item::visibility`, which fails the comparison to `Some(Visibility::Public)`. This means that all enums in type aliases are being stripped, leading to this in the `rustc_middle` docs: <img width="474" alt="image" src="https://github.com/rust-lang/rust/assets/3674314/83704d94-a571-4c28-acbd-ca51c4efd46e"> This regressed in https://github.com/rust-lang/rust/pull/124939#discussion_r1606130566. This switches the `AliasedNonLocalStripper` to not strip items with `None` as their visibility.
2024-05-20Note for E0599 if shadowed bindings has the method.surechen-0/+40
implement #123558
2024-05-20Migrate `run-make/rustdoc-scrape-examples-whitespace` to `rmake.rs`Guillaume Gomez-5/+6
2024-05-20Fix quote escaping inside check-cfg valueUrgau-14/+47
2024-05-20add todo test for feature gatejdonszelmann-1/+16
2024-05-20Rollup merge of #125302 - workingjubilee:prefer-my-stack-neat, r=compiler-errorsMatthias Krüger-1/+13
defrost `RUST_MIN_STACK=ice rustc hello.rs` I didn't think too hard about testing my previous PR rust-lang/rust#122847 which makes our stack overflow handler assist people in discovering the `RUST_MIN_STACK` variable (which apparently is surprisingly useful for Really Big codebases). After it was merged, some useful comments left in a drive-by review led me to discover I had added an ICE. This reworks the code a bit to explain the rationale, remove the ICE that I introduced, and properly test one of the diagnostics.
2024-05-20Rollup merge of #125301 - jwong101:fix-static-coro-suggest, r=compiler-errorsMatthias Krüger-0/+64
fix suggestion in E0373 for !Unpin coroutines Coroutines can be prefixed with the `static` keyword to make them `!Unpin`. However, given the following function: ```rust fn check() -> impl Sized { let x = 0; #[coroutine] static || { yield; x } } ``` We currently suggest prefixing `move` before `static`, which is syntactically incorrect: ``` error[E0373]: coroutine may outlive the current function, but it borrows ... --> src/main.rs:6:5 | 6 | static || { | ^^^^^^^^^ may outlive borrowed value `x` 7 | yield; 8 | x | - `x` is borrowed here | note: coroutine is returned here --> src/main.rs:6:5 | 6 | / static || { 7 | | yield; 8 | | x 9 | | } | |_____^ help: to force the coroutine to take ownership of `x` (and any other referenced variables), use the `move` keyword | // this is syntactically incorrect, it should be `static move ||` 6 | move static || { | ++++ ``` This PR suggests adding `move` after `static` for these coroutines. I also added a UI test for this case.
2024-05-20Rollup merge of #125282 - WaffleLapkin:never-type-unsafe-improvements, ↵Matthias Krüger-9/+39
r=compiler-errors Never type unsafe lint improvements - Move linting code to a separate method - Remove mentions of `core::convert::absurd` (#124311 was rejected) - Make the lint into FCW The last thing is a bit weird though. On one hand it should be `EditionSemanticsChange(2024)`, but on the other hand it shouldn't, because we also plan to break it on all editions some time later. _Also_, it's weird that we don't have `FutureReleaseSemanticsChangeReportInDeps`, IMO "this might cause UB in a future release" is important enough to be reported in deps... IMO we ought to have three enums instead of [`FutureIncompatibilityReason`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.FutureIncompatibilityReason.html#): ```rust enum IncompatibilityWhen { FutureRelease, Edition(Edition), } enum IncompatibilyWhat { Error, SemanticChange, } enum IncompatibilityReportInDeps { No, Yes, } ``` Tracking: - https://github.com/rust-lang/rust/issues/123748
2024-05-20Fix `tests/debuginfo/strings-and-strs`.Nicholas Nethercote-2/+2
It fails on my machine because it embeds pointer addresses in the expected output. This commit replaces the addresses with `0x[...]`.
2024-05-19note value of RUST_MIN_STACK and explain unsettingJubilee Young-1/+3
2024-05-19defrost RUST_MIN_STACK=ice rustc hello.rsJubilee Young-0/+10
An earlier commit included the change for a suggestion here. Unfortunately, it also used unwrap instead of dying properly. Roll out the ~~rice paper~~ EarlyDiagCtxt before we do anything that might leave a mess.