about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-04-21Auto merge of #124241 - matthiaskrgr:rollup-xhu90xr, r=matthiaskrgrbors-0/+643
Rollup of 5 pull requests Successful merges: - #123840 (Add an intrinsic for `ptr::from_raw_parts(_mut)`) - #124224 (cleanup: unnecessary clone during lower generics args) - #124229 (Add gnullvm targets to manifest) - #124231 (remove from reviewers) - #124235 (Move some tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-21Rollup merge of #124235 - c410-f3r:tests98765, r=jieyouxuMatthias Krüger-0/+0
Move some tests r? `@petrochenkov`
2024-04-21Rollup merge of #123840 - scottmcm:aggregate-kind-rawptr, r=cjgillotMatthias Krüger-0/+643
Add an intrinsic for `ptr::from_raw_parts(_mut)` Fixes #123174 cc `@CAD97` `@saethlin` r? `@cjgillot` As suggested in https://github.com/rust-lang/rust/pull/123190#issuecomment-2028717967, this adds a new `AggregateKind::RawPtr` for creating a pointer from its data pointer and its metadata. That means that `slice::from_raw_parts` and friends no longer need to hard-code pointer layout into `libcore`, and because it no longer does union hacks the MIR is shorter and more amenable to optimizations.
2024-04-21Auto merge of #124203 - lukas-code:delete-deleting-caches, r=compiler-errorsbors-0/+4
fix normalizing in different `ParamEnv`s with the same `InferCtxt` This PR changes the key of the projection cache from just `AliasTy` to `(AliasTy, ParamEnv)` to allow normalizing in different `ParamEnv`s without resetting caches. Previously, normalizing the same alias in different param envs would always reuse the cached result from the first normalization, which is incorrect if the projection clauses in the param env have changed. Fixing this bug allows us to get rid of `InferCtxt::clear_caches`, which was only used by the `AutoTraitFinder`, because it requires normalizing in different param envs. r? `@fmease`
2024-04-21Move some testsCaio-0/+0
2024-04-21Update tests after 123949Scott McMurray-82/+0
2024-04-21InstSimplify `from_raw_parts(p, ())` → `p as _`Scott McMurray-40/+13
2024-04-21Use it in the library, and `InstSimplify` it away in the easy placesScott McMurray-18/+234
2024-04-21Add an intrinsic that lowers to AggregateKind::RawPtrScott McMurray-0/+200
2024-04-21Add a mir-opt test for `byte_add` on pointersScott McMurray-0/+248
2024-04-21Add a MIR pre-codegen test for Vec::derefScott McMurray-0/+41
2024-04-21New slice indexing pre-codegen MIR testScott McMurray-0/+47
2024-04-21Auto merge of #123594 - Urgau:fix-non_local_def-lint-overflow, r=lcnrbors-0/+28
Fix trait solver overflow with `non_local_definitions` lint This PR fixes the trait solver overflow with the `non_local_definitions` lint reported in https://github.com/rust-lang/rust/issues/123573 using the suggestion from `@lcnr:` https://github.com/rust-lang/rust/issues/123573#issuecomment-2041348320 to use the next trait solver. ~~I have not (yet) tried to create a minimized repro~~ ``@compiler-errors`` did the minimization (thanks you) but I have manually tested on the `starlark-rust` project that it fixes the issue. Fixes #123573 r? `@lcnr`
2024-04-21also remap RPITITs nested in other types back to their opaquesLukas Markeffsky-0/+4
2024-04-21Rollup merge of #124198 - compiler-errors:improve-ty-ct-param-span, r=NadrierilGuillaume Gomez-17/+19
Flip spans for precise capturing syntax not capturing a ty/const param, and for implicit captures of lifetime params Make the primary span point to the opaque, rather than the param which might be very far away (e.g. in an impl header hundreds of lines above).
2024-04-21Auto merge of #117457 - daxpedda:wasm-nontrapping-fptoint, r=wesleywiserbors-8/+2
Stabilize Wasm target features that are in phase 4 and 5 This stabilizes the Wasm target features that are known to be working and in [phase 4 and 5](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180). Feature stabilized: - [Non-trapping float-to-int conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) - [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global) - [Sign-extension operators](https://github.com/WebAssembly/sign-extension-ops) - [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations) - [Extended Constant Expressions](https://github.com/WebAssembly/extended-const) Features not stabilized: - [Multi-value](https://github.com/WebAssembly/multi-value): requires rebuilding `std` #73755. - [Reference Types](https://github.com/WebAssembly/reference-types): no point stabilizing without #103516. - [Threads](https://github.com/webassembly/threads): requires rebuilding `std` #77839. - [Relaxed SIMD](https://github.com/WebAssembly/relaxed-simd): separate PR #117468. - [Multi Memory](https://github.com/WebAssembly/multi-memory): not implemented. See https://github.com/rust-lang/rust/pull/117457#issuecomment-1787648070 for more context. Documentation: https://github.com/rust-lang/reference/pull/1420 Tracking issue: https://github.com/rust-lang/rust/issues/44839
2024-04-21Auto merge of #123930 - Mark-Simulacrum:vec-length-invariant, r=jhprattbors-0/+16
Tell LLVM Vec::len is invariant across growth This allows LLVM to avoid re-loading it from memory.
2024-04-20Avoid reloading Vec::len across grow_one in pushMark Rousskov-0/+16
This saves an extra load from memory.
2024-04-20Rollup merge of #124196 - RalfJung:mir-opt-tests, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-153/+154
mir-opt tests: rename unit-test -> test-mir-pass "unit-test" is extremely non-descriptive, no idea how one is supposed to read that and know that this specifies the MIR pass being tested.
2024-04-20Rollup merge of #124053 - Zalathar:lazy-boolean, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-15/+385
coverage: Branch coverage tests for lazy boolean operators The current branch coverage implementation already supports the `&&` and `||` operators (even outside of an `if` condition), as a natural consequence of how they are desugared/lowered, but we didn't have any specific tests for them. This PR adds some appropriate tests. I've also moved the existing branch coverage tests into a `coverage/branch` subdirectory, so that they don't become unwieldy as I add more branch coverage tests. ``@rustbot`` label +A-code-coverage
2024-04-20Rollup merge of #123379 - wutchzone:119266, r=compiler-errors许杰友 Jieyou Xu (Joe)-0/+29
Print note with closure signature on type mismatch Fixes #119266 r? Nilstrieb
2024-04-20Explicitly mention `Self`Michael Goulet-5/+5
2024-04-20Flip spans for precise capturing syntax not capturing a ty/ct paramMichael Goulet-14/+16
2024-04-20Print note with closure signature on type mismatchDaniel Sedlak-0/+29
2024-04-20mir-opt tests: rename unit-test -> test-mir-passRalf Jung-153/+154
2024-04-20Auto merge of #124194 - matthiaskrgr:rollup-40s0c4q, r=matthiaskrgrbors-1/+656
Rollup of 3 pull requests Successful merges: - #123409 (Implement Modified Condition/Decision Coverage) - #124104 (Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`)) - #124137 (Match hyphen in multi-revision comment matchers) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-20Rollup merge of #124104 - compiler-errors:parent-generic-use, r=oli-obkMatthias Krüger-0/+66
Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`) For technical reasons related to the way that `Self` and `T::Assoc` are lowered from HIR -> `rustc_middle::ty`, an opaque may mention in its bounds both the original early-bound lifetime from the parent `impl`/`fn`, *and* the *duplicated* early-bound lifetime on the opaque. This is fine -- and has been fine since `@cjgillot` rewrote the way we handled opaque lifetime captures, and we went further to allow this behavior explicitly in https://github.com/rust-lang/rust/pull/115659. It's worthwhile to read this PR's technical section to recall how this duplication works and when it acts surprisingly. The problem here is that the check that make sure that `impl use<'a, 'b>` lists all of the opaque's captured lifetimes wasn't smart enough to consider both these captured lifetimes and the original lifetimes they're duplicated from to be equal. This PR fixes that. r? oli-obk
2024-04-20Rollup merge of #123409 - ZhuUx:master, r=oli-obkMatthias Krüger-1/+590
Implement Modified Condition/Decision Coverage This is an implementation based on llvm backend support (>= 18) by `@evodius96` and branch coverage support by `@Zalathar.` ### Major changes: * Add -Zcoverage-options=mcdc as switch. Now coverage options accept either `no-branch`, `branch`, or `mcdc`. `mcdc` also enables `branch` because it is essential to work. * Add coverage mapping for MCDCBranch and MCDCDecision. Note that MCDCParameter evolves from llvm 18 to llvm 19. The mapping in rust side mainly references to 19 and is casted to 18 types in llvm wrapper. * Add wrapper for mcdc instrinc functions from llvm. And inject associated statements to mir. * Add BcbMappingKind::Decision, I'm not sure is it proper but can't find a better way temporarily. * Let coverage-dump support parsing MCDCBranch and MCDCDecision from llvm ir. * Add simple tests to check whether mcdc works. * Same as clang, currently rustc does not generate instrument for decision with more than 6 condtions or only 1 condition due to considerations of resource. ### Implementation Details 1. To get information about conditions and decisions, `MCDCState` in `BranchInfoBuilder` is used during hir lowering to mir. For expressions with logical op we call `Builder::visit_coverage_branch_operation` to record its sub conditions, generate condition ids for them and save their spans (to construct the span of whole decision). This process mainly references to the implementation in clang and is described in comments over `MCDCState::record_conditions`. Also true marks and false marks introduced by branch coverage are used to detect where the decision evaluation ends: the next id of the condition == 0. 2. Once the `MCDCState::decision_stack` popped all recorded conditions, we can ensure that the decision is checked over and push it into `decision_spans`. We do not manually insert decision span to avoid complexity from then_else_break in nested if scopes. 3. When constructing CoverageSpans, add condition info to BcbMappingKind::Branch and decision info to BcbMappingKind::Decision. If the branch mapping has non-zero condition id it will be transformed to MCDCBranch mapping and insert `CondBitmapUpdate` statements to its evaluated blocks. While decision bcb mapping will insert `TestVectorBitmapUpdate` in all its end blocks. ### Usage ```bash echo "[build]\nprofiler=true" >> config.toml ./x build --stage 1 ./x test tests/coverage/mcdc_if.rs ``` to build the compiler and run tests. ```shell export PATH=path/to/llvm-build:$PATH rustup toolchain link mcdc build/host/stage1 cargo +mcdc rustc --bin foo -- -Cinstrument-coverage -Zcoverage-options=mcdc cd target/debug LLVM_PROFILE_FILE="foo.profraw" ./foo llvm-profdata merge -sparse foo.profraw -o foo.profdata llvm-cov show ./foo -instr-profile=foo.profdata --show-mcdc ``` to check "foo" code. ### Problems to solve For now decision mapping will insert statements to its all end blocks, which may be optimized by inserting a final block of the decision. To do this we must also trace the evaluated value at each end of the decision and join them separately. This implementation is not heavily tested so there should be some unrevealed issues. We are going to check our rust products in the next. Please let me know if you had any suggestions or comments.
2024-04-20Auto merge of #124156 - DianQK:disable-match_branches, r=RalfJungbors-201/+156
Disable SimplifyToExp in MatchBranchSimplification Due to the miscompilation mentioned in #124150, We need to disable MatchBranchSimplification temporarily. To fully resolve this issue, my plan is: 1. Disable SimplifyToExp in MatchBranchSimplification (this PR). 2. Remove all potentially unclear transforms in #124122. 3. Gradually add back the removed transforms (possibly multiple PRs). r? `@Nilstrieb` or `@oli-obk`
2024-04-20Auto merge of #124176 - matthiaskrgr:tests_are_the_best, r=jieyouxubors-0/+169
add more known crashes tests r? `@jieyouxu`
2024-04-20Auto merge of #124114 - scottmcm:better-checked, r=workingjubileebors-81/+113
Make `checked` ops emit *unchecked* LLVM operations where feasible For things with easily pre-checked overflow conditions -- shifts and unsigned subtraction -- write the checked methods in such a way that we stop emitting wrapping versions of them. For example, today <https://rust.godbolt.org/z/qM9YK8Txb> neither ```rust a.checked_sub(b).unwrap() ``` nor ```rust a.checked_sub(b).unwrap_unchecked() ``` actually optimizes to `sub nuw`. After this PR they do. cc #103299
2024-04-20Auto merge of #124166 - oli-obk:define_opaque_types11, r=compiler-errorsbors-0/+18
Let inherent associated types constrain opaque types during projection r? `@compiler-errors` The same test ICEs on master: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f4ff62663a5a3a0e16d00953ee7414d5
2024-04-20Disable SimplifyToExp in MatchBranchSimplificationDianQK-201/+156
2024-04-19add more known-crashes testsMatthias Krüger-0/+122
2024-04-19add test for #83993Matthias Krüger-0/+47
Fixes #83993
2024-04-19Fix capturing duplicated lifetimes via parentMichael Goulet-0/+66
2024-04-19Rollup merge of #124149 - notriddle:notriddle/desc-alias, r=GuillaumeGomezMatthias Krüger-1/+5
rustdoc-search: fix description on aliases in results This needs to start downloading the descriptions after aliases have been added to the result set.
2024-04-19Rollup merge of #124106 - compiler-errors:tait-lifetime-dedup, r=oli-obkMatthias Krüger-1/+79
Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT Make it so that nested TAITs inherit the lifetimes from their parent item, not their parent TAIT. This is because we don't need to re-duplicate lifetimes for nested TAITs over and over, since the only lifetimes they can capture are from the parent item anyways. This mirrors how RPITs work. This is **not** a functional change that should be observable, since the whole point of duplicating lifetimes and marking the shadowed ones (and uncaptured ones) as bivariant is designed to *not* be observable. r? oli-obk
2024-04-19Rollup merge of #123729 - jieyouxu:rmake-refactor-2, r=oli-obkMatthias Krüger-42/+19
run-make: refactor out command wrappers for `clang` and `llvm-readobj` This PR is rebased on top of https://github.com/rust-lang/rust/pull/123699. This PR is a follow up to https://github.com/rust-lang/rust/pull/123612 to refactor out command wrappers into the support library for `llvm-readobj` and `clang`. r? ghost
2024-04-19Rollup merge of #123571 - WaffleLapkin:properly-adjust-never, r=compiler-errorsMatthias Krüger-24/+79
Correctly change type when adding adjustments on top of `NeverToAny` I'm concerned that the check only caught the problem with `fallback = !`, because at least MIR contained `<() as PartialEq>::eq(move _5, move _7)` where `_5: ()`. I rediscovered the issue when looking at #123482's crater run. r? compiler-errors Fixes #120600
2024-04-20coverage. Add basic tests for MC/DCzhuyunxing-0/+583
2024-04-19Let inherent associated types constrain opaque types during projectionOli Scherer-0/+18
2024-04-19Auto merge of #118441 - GuillaumeGomez:display-stability-version, r=rustdocbors-5/+5
Always display stability version even if it's the same as the containing item Fixes https://github.com/rust-lang/rust/issues/118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in https://github.com/rust-lang/rust/pull/30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
2024-04-19Remove old ICE tests that no longer ICE (yay!)Maybe Waffle-24/+0
2024-04-19Correctly change type when adding adjustments on top of `NeverToAny`Maybe Waffle-31/+2
2024-04-19Add a test for `a == b` where `a: !, b: !`Maybe Waffle-0/+66
(this currently produces malformed mir: we call `eq` with first argument not being a reference)
2024-04-19Add regression test for issue 120600Maybe Waffle-0/+42
2024-04-18rustdoc-search: fix description on aliases in resultsMichael Howell-1/+5
This needs to start downloading the descriptions after aliases have been added to the result set.
2024-04-18Rollup merge of #124110 - beetrees:neg-f16-f128, r=compiler-errorsJubilee-0/+16
Fix negating `f16` and `f128` constants Make `f16` and `f128` constants respect `neg` in `parse_float_into_scalar`. Tracking issue: #116909 ```@rustbot``` label +F-f16_and_f128
2024-04-18Rollup merge of #123935 - tstsrt:fix-115423, r=oli-obkJubilee-0/+70
Don't inline integer literals when they overflow - new attempt Basically #116633 but I implemented the suggested changes. Fixes #115423. Fixes #116631. This is my first contribution to this repo so please let me know if I'm supposed to change something :)