about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-06-15Rollup merge of #111212 - nicklimmm:issue-107896-fix, r=pnkfelixMatthias Krüger-2/+26
Add casting suggestion when assigning negative 2's complement bin or hex literal to a size compatible signed integer Fixes #107896 The issue stated the case for `iX::MIN` variants. This PR extends the cases for other negative values (in the 2's complement). Leveraged sign bits to detect such cases. Example cases: - <img width="845" alt="image" src="https://user-images.githubusercontent.com/65026286/236289682-19859f59-a9c5-48c5-b15f-78a935fbfcec.png"> - <img width="831" alt="image" src="https://user-images.githubusercontent.com/65026286/236289805-5b16488d-9138-4363-a1b6-a5c027c50aba.png"> - <img width="912" alt="image" src="https://user-images.githubusercontent.com/65026286/236290065-685a9777-034b-4def-83a8-cc4e20b1ed0c.png">
2023-06-15Auto merge of #106343 - the8472:slice-iter-fold, r=scottmcmbors-8/+14
optimize slice::Iter::fold Fixes 2 of 4 cases from #106288 ``` OLD: test slice::fold_to_last ... bench: 248 ns/iter (+/- 3) NEW: test slice::fold_to_last ... bench: 0 ns/iter (+/- 0) ```
2023-06-15Auto merge of #112233 - notriddle:notriddle/search-unify, r=GuillaumeGomezbors-0/+194
rustdoc-search: clean up type unification and "unboxing" This PR redesigns parameter matching, return matching, and generics matching to use a single function that compares two lists of types. It also makes the algorithms more consistent, so the "unboxing" behavior where `Vec<i32>` is considered a match for `i32` works inside generics, and not just at the top level.
2023-06-15Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieubors-3/+3
Don't drain-on-drop in DrainFilter impls of various collections. This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288). closes #101122 [ACP](https://github.com/rust-lang/libs-team/issues/136) affected tracking issues * #43244 * #70530 * #59618 Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
2023-06-14use indexed loop instead of ptr bumpingThe 8472-8/+0
this seems to produce less IR
2023-06-14Auto merge of #112625 - matthiaskrgr:rollup-jcobj3g, r=matthiaskrgrbors-95/+174
Rollup of 7 pull requests Successful merges: - #112584 (loongarch64-none*: Remove environment component from llvm target) - #112600 (Introduce a `Stable` trait to translate MIR to SMIR) - #112605 (Improve docs/clean up negative overlap functions) - #112611 (Error on unconstrained lifetime in RPITIT) - #112612 (Fix explicit-outlives-requirements lint span) - #112613 (Fix rustdoc-gui tests on Windows) - #112620 (Fix small typo) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-14Auto merge of #112624 - matthiaskrgr:rollup-db6ta1b, r=matthiaskrgrbors-21/+47
Rollup of 6 pull requests Successful merges: - #98202 (Implement `TryFrom<&OsStr>` for `&str`) - #107619 (Specify behavior of HashSet::insert) - #109814 (Stabilize String::leak) - #111974 (Update runtime guarantee for `select_nth_unstable`) - #112109 (Don't print unsupported split-debuginfo modes with `-Zunstable-options`) - #112506 (Properly check associated consts for infer placeholders) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-14Rollup merge of #112613 - GuillaumeGomez:fix-gui-test-windows, r=notriddleMatthias Krüger-15/+15
Fix rustdoc-gui tests on Windows The browser-ui-test update contains fixes needed for backslash handling (they were not correctly escaped). Since we have a mix of slash and backslash in some tests, I replaced `DOC_FOLDER` variable backslashes with slashes. And finally it seemed like the unicode escaped wasn't much appreciated on Windows for some reason so I used the character directly. cc `@klensy` r? `@notriddle`
2023-06-14Rollup merge of #112612 - sginnett:issue-105150, r=compiler-errorsMatthias Krüger-1/+24
Fix explicit-outlives-requirements lint span Fixes #105150 which caused the span reported by the explicit-outlives-requirements lint to be incorrect when 1) the lint should suggest the entire where clause to be removed and 2) there are inline bounds present that are not inferable outlives requirements In particular, this would cause rustfix to leave a dangling empty where clause.
2023-06-14Rollup merge of #112611 - compiler-errors:unconstrained-lt-in-rpitit, r=oli-obkMatthias Krüger-79/+135
Error on unconstrained lifetime in RPITIT Fixes #109468 The only thing is that I had to split `tests/ui/impl-trait/in-trait/method-signature-matches.rs` into a bunch of different revisions because some error aren't being emitted if all the different examples are all together in one file :thinking: r? `@oli-obk` just because i know you'll review it, feel free to re-roll
2023-06-14Rollup merge of #112506 - compiler-errors:const-infer-ice, r=b-naberMatthias Krüger-21/+47
Properly check associated consts for infer placeholders We only reported an error if it was in a "suggestable" position (according to `is_suggestable_infer_ty`) -- this isn't correct for infer tys that can show up in other places in the constant's type, like behind a dyn trait. fixes #112491
2023-06-14Fix `href` attribute value check on Windows (`DOC_PATH` lacks an extra `/`)Guillaume Gomez-12/+12
2023-06-14Auto merge of #112418 - ferrocene:pa-mir-opt-panic, r=ozkanonur,saethlinbors-142/+11297
Add support for targets without unwinding in `mir-opt`, and improve `--bless` for it The main goal of this PR is to add support for targets without unwinding support in the `mir-opt` test suite, by adding the `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment. Similarly to 32bit vs 64bit, when that comment is present, blessed output files will have the `.panic-unwind` or `.panic-abort` suffix, and the right one will be chosen depending on the target's panic strategy. The `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment replaced all the `ignore-wasm32` comments in the `mir-opt` test suite, as those comments were added due to `wasm32` being a target without unwinding support. The comment was also added on other tests that were only executed on x86 but were still panic strategy dependent. The `mir-opt` suite was then blessed, which caused a ton of churn as most of the existing output files had to be renamed and (mostly) duplicated with the abort strategy. --- After [asking on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mir-opt.20tests.20and.20panic.3Dabort), the main concern about this change is it'd make blessing the `mir-opt` suite even harder, as you'd need to both bless it with an unwinding target and an aborting target. This exacerbated the current situation, where you'd need to bless it with a 32bit and a 64bit target already. Because of that, this PR also makes significant enhancements to `--bless` for the `mir-opt` suite, where it will automatically bless the suite four times with different targets, while requiring minimal cross-compilation. To handle the 32bit vs 64bit blessing, there is now an hardcoded list of target mapping between 32bit and 64bit. The goal of the list is to find a related target that will *probably* work without requiring additional cross-compilation toolchains on the system. If a mapping is found, bootstrap will bless the suite with both targets, otherwise just with the current target. To handle the panic strategy blessing (abort vs unwind), I had to resort to what I call "synthetic targets". For each of the target we're blessing (so either the current one, or a 32bit and a 64bit depending on the previous paragraph), bootstrap will extract the JSON spec of the target and change it to include `"panic-strategy": "abort"`. It will then build the standard library with this synthetic target, and bless the `mir-opt` suite with it. As a result of these changes, blessing the `mir-opt` suite will actually bless it two or four times with different targets, ensuring all possible variants are actually blessed. --- This PR is best reviewed commit-by-commit. r? `@jyn514` cc `@saethlin` `@oli-obk`
2023-06-14Auto merge of #112400 - WaffleLapkin:vtable_stats, r=compiler-errorsbors-0/+72
Collect VTable stats & add `-Zprint-vtable-sizes` This is a bit hacky/buggy, but I'm not entirely sure how to fix it, so I want to ask reviewers for help... To try this, use either of those: - `cargo clean && RUSTFLAGS="-Zprint-vtable-sizes" cargo +toolchain b` - `cargo clean && cargo rustc +toolchain -Zprint-vtable-sizes` - `rustc +toolchain -Zprint-vtable-sizes ./file.rs`
2023-06-14Replace unicode value with character in shortcuts.goml testGuillaume Gomez-3/+3
2023-06-14Auto merge of #110662 - bryangarza:safe-transmute-reference-types, ↵bors-43/+387
r=compiler-errors Safe Transmute: Enable handling references This patch enables support for references in Safe Transmute, by generating nested obligations during trait selection. Specifically, when we call `confirm_transmutability_candidate(...)`, we now recursively traverse the `rustc_transmute::Answer` tree and create obligations for all the `Answer` variants, some of which include multiple nested `Answer`s.
2023-06-14s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedListThe 8472-3/+3
2023-06-13Fix explicit-outlives-requirements lint spanSam Ginnett-1/+24
2023-06-14Error on unconstrained lifetime in RPITITMichael Goulet-79/+135
2023-06-14Rollup merge of #112571 - notriddle:notriddle/never-search, r=GuillaumeGomezMatthias Krüger-19/+157
rustdoc-search: search never type with `!` This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of #60485 It's already possible to do this search with `primitive:never`, but that's not what the Rust language itself uses, so nobody will try it if they aren't told or helped along.
2023-06-14Rollup merge of #112520 - chenyukang:yukang-fix-112505, r=fee1-deadMatthias Krüger-0/+19
Fix the overflow issue for transmute_generic_consts Fixes #112505
2023-06-14Rollup merge of #112495 - bvanjoi:fix-109153, r=petrochenkovMatthias Krüger-1/+40
fix(resolve): update shadowed_glob more precision - Fixes #109153 - Fixes #109962 ## Why does it panic? We use #109153 as an illustration. The process of `resolve_imports` is: | Iter | resolve | resolution of **`(Mod(root), Ident(bar) in type ns)`** | | - | - | - | | 0 | `use foo::*` | `binding` -> foo::bar, `shallowed_glob` -> `None` | | 1 | `use bar::bar` | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar | | 2 | `use bar::*` | `binding` -> foo::bar::bar, `shallowed_glob` -> foo::bar::bar::bar | So during `finalize_import`, the `root::bar` in `use bar::bar` had been pointed to `foo::bar::bar::bar`, which is different from the `initial_module` valued of `foo::bar`, therefore, the panic had been triggered. ## Try to solve it ~I think #109153 should check-pass rather than throw an ambiguous error. Following this idea, there are two ways to solve this problem:~ ~1. Give up the `initial_module` and update `import.imported_module` after each resolution update. However, I think this method may have too much impact.~ ~2. Do not update the `shadowed_glob` when it is defined.~ ~To be honest, I am not sure if this is the right way to solve this ICE. Perhaps there is a better resolution.~ Edit: we had made the `resolution.shadowed_glob` update more detailed. r? `@petrochenkov`
2023-06-14Rollup merge of #112197 - compiler-errors:next-solver-erase, r=lcnrMatthias Krüger-7/+37
Erase regions even if normalization fails in writeback (in new solver) Or else we ICE during writeback on some programs that error
2023-06-13Auto merge of #112062 - lukas-code:unsized-layout, r=wesleywiserbors-0/+55
Make struct layout not depend on unsizeable tail fixes (after backport) https://github.com/rust-lang/rust/issues/112048 Since unsizing `Ptr<Foo<T>>` -> `Ptr<Foo<U>` just copies the pointer and adds the metadata, the layout of `Foo` must not depend on niches in and alignment of the tail `T`. Nominating for beta 1.71, because it will have this issue: `@rustbot` label beta-nominated
2023-06-13Move testMichael Goulet-11/+11
2023-06-13Erase regions even if normalization fails in writebackMichael Goulet-1/+31
2023-06-13Add test case for unsizing with nicheWesley Wiser-0/+30
2023-06-14fix(resolve): update `shadowed_glob` more precisionbohan-1/+40
2023-06-13Auto merge of #112017 - Nemo157:unsafe-block-rustfix, r=eholkbors-0/+245
Add MVP suggestion for `unsafe_op_in_unsafe_fn` Rebase of https://github.com/rust-lang/rust/pull/99827 cc tracking issue https://github.com/rust-lang/rust/issues/71668 No real changes since the original PR, just migrated the new suggestion to use fluent messages and added a couple more testcases, AFAICT from the discussion there were no outstanding changes requested.
2023-06-13Add a test for `-Zprint-vtable-sizes`Maybe Waffle-0/+72
2023-06-13Add test cases for suggestions with unsafe operations contained inside macrosWim Looman-11/+100
2023-06-13Add note about unsafe functions body not being unsafeWim Looman-8/+63
2023-06-13Hide suggestion to wrap function in unsafe blockWim Looman-37/+0
2023-06-13Test that a couple more types of unsafe-ops get a wrapping unsafe block addedWim Looman-1/+69
2023-06-13Add MVP suggestion for `unsafe_op_in_unsafe_fn`Léo Lanteri Thauvin-0/+70
Nemo157 rebase notes: Migrated the changes to the lint into fluent
2023-06-13Auto merge of #112549 - jieyouxu:fix-tests-for-unit-bindings, r=Nilstriebbors-117/+117
Adjust UI tests for `unit_bindings` lint - Explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Use `let () = init;` or `let pat = ();` where appropriate. - Fix disjoint-capture-in-same-closure test which wasn't actually testing a closure: `tests/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs`. Note that unfortunately there's *a lot* of UI tests, there are a couple of places where I may have left something like `let (): ()` (this is not needed but is left over from an ealier version of the lint) which is bad style. This PR is to help with the `unit_bindings` lint at #112380.
2023-06-13Rollup merge of #111885 - compiler-errors:rust-call-abi-sized, r=eholkMatthias Krüger-0/+25
Don't ICE on unsized `extern "rust-call"` call Conceptually builds on #111864, but doesn't depend on it.
2023-06-13Auto merge of #112524 - GuillaumeGomez:migrate-gui-test-color-14, r=notriddlebors-11/+11
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-06-12rustdoc-search: search never type with `!`Michael Howell-19/+157
This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of #60485 It's already possible to do this search with `primitive:never`, but that's not what the Rust language itself uses, so nobody will try it if they aren't told or helped along.
2023-06-12Safe Transmute: Refactor error handling and Answer typeBryan Garza-3/+19
- Create `Answer` type that is not just a type alias of `Result` - Remove a usage of `map_layouts` to make the code easier to read - Don't hide errors related to Unknown Layout when computing transmutability
2023-06-12add codegen test for slice::Iter::foldThe 8472-0/+14
2023-06-12Rollup merge of #112416 - jieyouxu:issue-112363, r=wesleywiserMatthias Krüger-1/+70
Fix debug ICE for extern type with where clauses Fixes #112363.
2023-06-12Rollup merge of #112302 - jieyouxu:issue-85184, r=WaffleLapkinMatthias Krüger-0/+43
Suggest using `ptr::null_mut` when user provided `ptr::null` to a function expecting `ptr::null_mut` ``` error[E0308]: mismatched types --> $DIR/ptr-null-mutability-suggestions.rs:9:24 | LL | expecting_null_mut(ptr::null()); | ------------------ ^^^^^^^^^^^ | | | | | types differ in mutability | | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()` | arguments to this function are incorrect | = note: expected raw pointer `*mut u8` found raw pointer `*const _` note: function defined here --> $DIR/ptr-null-mutability-suggestions.rs:6:4 | LL | fn expecting_null_mut(_: *mut u8) {} | ^^^^^^^^^^^^^^^^^^ ---------- ``` Closes #85184.
2023-06-12Adjust UI tests for `unit_bindings`许杰友 Jieyou Xu (Joe)-117/+117
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-06-12Auto merge of #112543 - GuillaumeGomez:revert-112429, r=lcnrbors-59/+30
[rustdoc] Fix infinite loop when retrieving impls for type alias Fixes #112515. Reverts #112429. r? `@lcnr`
2023-06-12Add regression test for #112515Guillaume Gomez-0/+30
2023-06-12Revert "Add regression test for #32077"Guillaume Gomez-59/+0
This reverts commit 6f552c800b38b3e71c5e33a295e8b490d2018c71.
2023-06-12bless mir-optPietro Albini-38/+11189
To reproduce the changes in this commit locally: - Run `./x test tidy` and remove all the output files not associated with a test file anymore, as reported by tidy. - Run `./x test tests/mir-opt --bless` to generate the new outputs.
2023-06-12properly mark tests that require panic=abortPietro Albini-104/+108
2023-06-12Fix debug ICE for extern type with where clauses许杰友 Jieyou Xu (Joe)-1/+70