about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-07-14Auto merge of #113703 - matthiaskrgr:rollup-19uhwuh, r=matthiaskrgrbors-1/+202
Rollup of 9 pull requests Successful merges: - #113599 (Use maybe_body_owned_by for multiple suggestions) - #113662 (Rename VecDeque's `rotate_left` and `rotate_right` parameters) - #113681 (rustdoc-json: Add test for private supertrait.) - #113682 (trait system refactor ping: also apply to nested modules of `solve`) - #113685 (Print artifact sizes in `opt-dist`) - #113688 (llvm-wrapper: update for LLVM API change) - #113692 (tests: adapt for removal of -opaque-pointers in LLVM 17) - #113698 (Make it clearer that we're just checking for an RPITIT) - #113699 (update Miri) Failed merges: - #113625 (Structurally normalize in selection) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-14Rollup merge of #113692 - krasimirgg:llvm-17-no-opaque, r=nikicMatthias Krüger-0/+2
tests: adapt for removal of -opaque-pointers in LLVM 17 The commit https://github.com/llvm/llvm-project/commit/53717cabf837a589dd54a47dd8b4b3b9677f0b85 removed the flag from LLVM. Found via our experimental rust + LLVM@HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/20777#01895454-40b2-4e2f-978b-1294a83e1cce
2023-07-14Rollup merge of #113681 - aDotInTheVoid:rdj-priv-supertrait, r=GuillaumeGomezMatthias Krüger-0/+15
rustdoc-json: Add test for private supertrait. Helps with https://github.com/rust-lang/rust/issues/81359 r? ``@GuillaumeGomez``
2023-07-14Rollup merge of #113599 - chenyukang:yukang-fix-use-maybe_body_owned_by, ↵Matthias Krüger-1/+185
r=cjgillot Use maybe_body_owned_by for multiple suggestions This is a continued work from https://github.com/rust-lang/rust/pull/113567 We have several other suggestions not working for closure, this PR use `maybe_body_owned_by` to fix them and add test cases for them.
2023-07-14Auto merge of #109025 - cjgillot:refprop-dbg, r=JakobDegenbors-886/+676
Enable MIR reference propagation by default
2023-07-14tests: adapt for removal of -opaque-pointers in LLVM 17Krasimir Georgiev-0/+2
The commit https://github.com/llvm/llvm-project/commit/53717cabf837a589dd54a47dd8b4b3b9677f0b85 removed the flag from LLVM.
2023-07-14Bless codegen test.Camille GILLOT-1/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-74/+74
2023-07-14rustdoc-json: Add test for private supertrait.Alona Enraght-Moony-0/+15
2023-07-14Auto merge of #113519 - SparrowLii:parallel_typeck, r=cjgillotbors-29/+31
typeck in parallel #108118 caused `typeck` to be transferred to the serial part (`check_unused`), which made the performance of parallel rustc significantly reduced. This pr re-parallelize this part, which increases the average performance improvement of parallel rustc in `full` and `incr-full` scenarios from [14.4%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1545354608) to [23.2%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1624770626). r? `@cjgillot` cc `@oli-obk` `@Zoxc`
2023-07-14Auto merge of #113113 - Amanieu:box-vec-zst, r=Mark-Simulacrumbors-1/+1
Eliminate ZST allocations in `Box` and `Vec` This PR fixes 2 issues with `Box` and `RawVec` related to ZST allocations. Specifically, the `Allocator` trait requires that: - If you allocate a zero-sized layout then you must later deallocate it, otherwise the allocator may leak memory. - You cannot pass a ZST pointer to the allocator that you haven't previously allocated. These restrictions exist because an allocator implementation is allowed to allocate non-zero amounts of memory for a zero-sized allocation. For example, `malloc` in libc does this. Currently, ZSTs are handled differently in `Box` and `Vec`: - `Vec` never allocates when `T` is a ZST or if the vector capacity is 0. - `Box` just blindly passes everything on to the allocator, including ZSTs. This causes problems due to the free conversions between `Box<[T]>` and `Vec<T>`, specifically that ZST allocations could get leaked or a dangling pointer could be passed to `deallocate`. This PR fixes this by changing `Box` to not allocate for zero-sized values and slices. It also fixes a bug in `RawVec::shrink` where shrinking to a size of zero did not actually free the backing memory.
2023-07-14fix the issue of shorthand in suggest_cloningyukang-3/+4
2023-07-14use maybe_body_owned_by for closureyukang-0/+183
2023-07-14Rollup merge of #112729 - jieyouxu:unused-qualifications-suggestion, r=b-naberMatthias Krüger-0/+79
Add machine-applicable suggestion for `unused_qualifications` lint ``` error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL | foo::bar(); | ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL | bar(); | ~~~ ``` Closes #92198.
2023-07-13Rollup merge of #113623 - GuillaumeGomez:add-jump-to-doc, r=notriddleMatthias Krüger-12/+64
Add jump to doc I'm using the source code pages of the compiler quite a lot, but one thing missing is the possibility to jump back from the source code to the item documentation. Since I also got a few others complaining about it, I think it's fine to add it since this option is nightly only. This PR adds a link to jump back to item's documentation on the item definition (so on `Bar` in `struct Bar {... }`, as described in the unofficial [RFC](https://github.com/GuillaumeGomez/rfcs/blob/rustdoc-jump-to-definition/text/000-rustdoc-jump-to-definition.md)). r? ````@notriddle````
2023-07-13Eliminate ZST allocations in `Box` and `Vec`Amanieu d'Antras-1/+1
2023-07-13Rollup merge of #113603 - workingjubilee:test-for-98016, r=oli-obkMatthias Krüger-4/+8
Test simd-wide-sum for codegen error This adds the necessary test infrastructure to "build-pass" codegen tests, for the purpose of doing that for a single revision of a codegen test. When mir-opts are tested, the output may vary from the usual, and maybe for positive reasons... but we don't necessarily want to output such bad LLVMIR that LLVM starts crashing on it. Currently when enabling MIR opts at higher levels this LLVMIR is still emitted, but it was previously disabled for getting in mir-opt's way and as this new revision without `// [mir-opt3]build-pass` would make it more likely to, I would like to not see the testing for the actual results regress again just because it was bundled with an ICE check as well. This fixes https://github.com/rust-lang/rust/issues/98016
2023-07-13Rollup merge of #113353 - compiler-errors:select-better, r=lcnrMatthias Krüger-3/+32
Implement selection for `Unsize` for better coercion behavior In order for much of coercion to succeed, we need to be able to deal with partial ambiguity of `Unsize` traits during selection. However, I pessimistically implemented selection in the new trait solver to just bail out with ambiguity if it was a built-in impl: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs#L126 This implements a proper "rematch" procedure for dealing with built-in `Unsize` goals, so that even if the goal is ambiguous, we are able to get nested obligations which are used in the coercion selection-like loop: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_hir_typeck/src/coercion.rs#L702 Second commit just moves a `resolve_vars_if_possible` call to fix a bug where we weren't detecting a trait upcasting to occur. r? ``@lcnr``
2023-07-13Add machine-applicable suggestion for `unused_qualifications` lint许杰友 Jieyou Xu (Joe)-0/+79
2023-07-12Update jump to def testsGuillaume Gomez-12/+64
2023-07-12Auto merge of #112945 - compiler-errors:tighten-span-of-adjustment-error, ↵bors-405/+413
r=oli-obk (re-)tighten sourceinfo span of adjustments in MIR Diagnostics rely on the spans of MIR statements being (approximately) correct in order to give suggestions relative to that span (i.e. `shrink_to_hi` and `shrink_to_lo`). I discovered that we're *intentionally* lowering THIR exprs with their parent expr's span if they come from adjustments that are due to a parent expression. While I understand why that may be desirable to demonstrate the relationship of an adjustment and the expression that requires it, it leads to 1. very verbose borrowck output 2. incorrect spans for suggestions Some diagnostics get around that by giving suggestions relative to other spans we've collected during MIR lowering, such as the span of the method's identifier (e.g. `name` in `.name()`), but this doesn't work too well when things come from desugaring. I assume it also has lead to numerous tweaks and complications to diagnostics code down the road, which this PR doesn't necessarily aim to fix but may open the gates to fixing later... The last three commits are simplifications due to the fact that we can assume that the move span actually points to what is being moved (and a test). This regressed in #89110, which was debated somewhat in #90286. cc `@Aaron1011` who originally made this change. r? diagnostics Fixes #113547 Fixes #111016
2023-07-11Rollup merge of #113567 - chenyukang:yukang-fix-113354-while-let, r=cjgillotJubilee-0/+22
While let suggestion will work for closure body Fixes #113354
2023-07-11Rollup merge of #113373 - jyn514:download-rustc-fixes, r=albertlarsan68Jubilee-14/+9
various download-rustc fixes separated out from https://github.com/rust-lang/rust/pull/112143 because it keeps getting stuck in limbo. best reviewed commit-by-commit
2023-07-11Don't depend on crate names in tests/ui-fulldeps/missing-rustc-driver-error.rsjyn-13/+3
Not only are they a pain to update, but they differ depending on whether `parallel-rustc` is enabled or not
2023-07-11Reenable all cases of simd-wide-sumJubilee Young-4/+3
2023-07-11Add mir-opt3 rev to simd-wide-sum testJubilee Young-0/+5
2023-07-11Auto merge of #113577 - matthiaskrgr:rollup-vaa83ip, r=matthiaskrgrbors-5/+90
Rollup of 4 pull requests Successful merges: - #112717 (Implement a few more rvalue translation to smir) - #113310 (Don't suggest `impl Trait` in path position) - #113497 (Support explicit 32-bit MIPS ABI for the synthetic object) - #113560 (Lint against misplaced where-clauses on associated types in traits) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-11Rollup merge of #113560 - fmease:assoc-tys-in-traits-depr-wc-loc, ↵Matthias Krüger-5/+64
r=compiler-errors Lint against misplaced where-clauses on associated types in traits Extends the scope of the lint `deprecated_where_clause_location` (#89122) from associated types in impls to associated types in any location (impl or trait). This is only relevant for `#![feature(associated_type_defaults)]`. Previously we didn't warn on the following code for example: ```rs #![feature(associated_type_defaults)] trait Trait { type Assoc where u32: Copy = (); } ``` Personally I would've preferred to emit a *hard* error here instead of a lint warning since the feature is unstable but unfortunately we are constrained by back compat as associated type defaults won't necessarily trigger the feature-gate error if they are inside of a macro call (since they use a post-expansion feature-gate due to historical reasons, see also #66004). I've renamed and moved related preexisting tests: 1. They test AST validation passes not the parser & thus shouldn't live in `parser/` (historical reasons?). 2. One test file was named after type aliases even though it tests assoc tys. `@rustbot` label A-lint
2023-07-11Rollup merge of #113310 - jieyouxu:dont-suggest-impl-trait-in-paths, r=lcnrMatthias Krüger-0/+26
Don't suggest `impl Trait` in path position Fixes #113264.
2023-07-11Auto merge of #113470 - compiler-errors:new-solver-structurally-resolve-pat, ↵bors-0/+2
r=lcnr Structurally resolve in pattern matching when peeling refs in new solver Let me know if you want me to commit the minimized test: ```rust fn test() {} fn test2() {} fn main() { let tests: &[(_, fn())] = &[ ("test", test), ("test2", test2), ]; for (a, b) in tests { todo!(); } } ``` In that test above, the match scrutinee is `<std::vec::Iter<(&'static str, fn())> as Iterator>::Item`, which we cannot peel the refs from. We also need to structurally resolve in the loop, since structural resolve is inherently shallow. I haven't come up with a test where this matters, but I can if you care. Also, I removed two other calls to `resolve_vars_with_obligations` in diagnostics code that I'm pretty convinced are not useful. r? `@lcnr`
2023-07-11While let suggestion will work for closureyukang-0/+22
2023-07-11Auto merge of #113175 - bryangarza:safe-transmute-rustc-coinductive, ↵bors-56/+4
r=compiler-errors Enable coinduction support for Safe Transmute This patch adds the `#[rustc_coinductive]` annotation to `BikeshedIntrinsicFrom`, so that it's possible to compute transmutability for recursive types. ## Motivation Safe Transmute currently already supports references (#110662). However, if a type is implemented recursively, it leads to an infinite loop when we try to check if transmutation is safe. A couple simple examples that one might want to write, that are currently not possible to check transmutability for: ```rs #[repr(C)] struct A(&'static B); #[repr(C)] struct B(&'static A); ``` ```rs #[repr(C)] enum IList<'a> { Nil, Cons(isize, &'a IList<'a>) } #[repr(C)] enum UList<'a> { Nil, Cons(usize, &'a UList<'a>) } ``` Previously, `@jswrenn` was considering writing a co-inductive solver from scratch, just for the `rustc_tranmsute` crate. Later on as I started working on Safe Transmute myself, I came across the `#[rustc_coinductive]` annotation, which is currently only being used for the `Sized` trait. Leveraging this trait actually solved the problem entirely, and it saves a lot of duplicate work that would have had to happen in `rustc_transmute`.
2023-07-11typeck in parallelSparrowLii-29/+31
2023-07-11Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obkbors-0/+97
Uplift `clippy::fn_null_check` lint This PR aims at uplifting the `clippy::fn_null_check` lint into rustc. ## `incorrect_fn_null_checks` (warn-by-default) The `incorrect_fn_null_checks` lint checks for expression that checks if a function pointer is null. ### Example ```rust let fn_ptr: fn() = /* somehow obtained nullable function pointer */ if (fn_ptr as *const ()).is_null() { /* ... */ } ``` ### Explanation Function pointers are assumed to be non-null, checking for their nullity is incorrect. ----- Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751 `@rustbot` label: +I-lang-nominated r? compiler
2023-07-11Structurally resolve in pattern matching when peeling refs in new solverMichael Goulet-0/+2
2023-07-11Lint against misplaced where-clauses on assoc tys in traitsLeón Orell Valerian Liehr-5/+64
2023-07-10Fix another strange suggestion spanMichael Goulet-2/+2
2023-07-10Don't use method span on clone suggestionMichael Goulet-13/+56
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-390/+355
2023-07-10Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errorsbors-191/+1031
Replace RPITIT current impl with new strategy that lowers as a GAT This PR replaces the current implementation of RPITITs with the new implementation that we had under -Zlower-impl-trait-in-trait-to-assoc-ty flag that lowers the RPIT as a GAT on the trait and on the impls that implement that trait. Opening this PR as a draft because this goes after #112682, ~#112981~ and ~#112983~. As soon as those are merged, I can rebase and we should run perf, crater and test a lot. r? `@compiler-errors`
2023-07-10Uplift `clippy::fn_null_check` to rustcUrgau-0/+97
2023-07-10Call super for debuginfo.Camille GILLOT-287/+250
2023-07-10Bless incremental test.Camille GILLOT-1/+1
2023-07-10Perform reference propagation earlier.Camille GILLOT-85/+95
2023-07-10Enable by default.Camille GILLOT-760/+573
2023-07-10Fortify codegen test.Camille GILLOT-6/+10
2023-07-10Rollup merge of #113331 - chenyukang:yukang-fix-112590-false-positive, ↵Matthias Krüger-23/+250
r=estebank Add filter with following segment while lookup typo for path From the discussion: https://github.com/rust-lang/rust/pull/112917#discussion_r1239150173 Seems we can not get the assoc items for `Struct`, `Enum` in the resolving phase. A obvious filter is avoid suggesting the same name with the following segment path. Use `following_seg` can extend the function `smart_resolve_partial_mod_path_errors` for more scenarios, such as `std::sync_error::atomic::AtomicBool` in test case. r? `@estebank`
2023-07-10Auto merge of #113127 - jieyouxu:fix-error-color-summary, r=davidtwcobors-7/+13
Set error handler output format as soon as possible Should fix https://github.com/rust-lang/rust/pull/112692#issuecomment-1611585904.
2023-07-09Auto merge of #113389 - Zalathar:re-enable, r=Mark-Simulacrumbors-8/+8
Re-enable some coverage tests on Linux These tests were originally disabled (on all platforms) in #110393, because those changes had made them start failing on Linux for unclear reasons. I tried to re-enable them unconditionally in #111179, since they worked locally on my Mac, but I found that they were still failing on Linux, so I gave up at that time. Later while working on #112300 I was able to re-enable them on Windows and Mac, since those changes made it possible to add specific `ignore-` directives to individual tests. I noticed at the time that the tests actually seemed to be working again on Linux, but by that point I didn't want to risk more CI failures, so I left them disabled on Linux with an intention to re-enable them later. Now I'm going back to re-enable them on Linux too, since they seem to work fine. --- Because `run-coverage` tests are sensitive to line numbers, and `x test tidy` doesn't like leading blank lines, I've replaced the old comment/ignore with an informative comment that occupies the same number of lines.
2023-07-09Rollup merge of #113469 - JohnTitor:rm-default-free-fn, r=AmanieuMatthias Krüger-15/+6
Remove `default_free_fn` feature Closes #73014 r? ``@Amanieu``