about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-06-14update codegent test to be independent of panic strategyPietro Albini-1/+1
2023-06-14mark relevant tests as requiring unwindingPietro Albini-0/+2
2023-06-14ensure test harness test works on panic=abort targetsPietro Albini-1/+1
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 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-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-12Fix debug ICE for extern type with where clauses许杰友 Jieyou Xu (Joe)-1/+70
2023-06-12Auto merge of #112261 - jieyouxu:c-like-ptr-arithmetics-diagnostics, ↵bors-0/+74
r=WaffleLapkin Add help for trying to do C-like pointer arithmetics This PR adds help messages for these cases: ```rust fn main() { let ptr1: *const u32 = std::ptr::null(); let ptr2: *const u32 = std::ptr::null(); let a = ptr1 + 5; let b = ptr1 - 5; let c = ptr2 - ptr1; let d = ptr1[5]; } ``` ### Current Output ``` error[E0369]: cannot add `{integer}` to `*const u32` --> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:4:18 | 4 | let a = ptr1 + 5; //~ ERROR cannot add | ---- ^ - {integer} | | | *const u32 error[E0369]: cannot subtract `{integer}` from `*const u32` --> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:5:18 | 5 | let b = ptr1 - 5; //~ ERROR cannot subtract | ---- ^ - {integer} | | | *const u32 error[E0369]: cannot subtract `*const u32` from `*const u32` --> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:6:18 | 6 | let c = ptr2 - ptr1; //~ ERROR cannot subtract | ---- ^ ---- *const u32 | | | *const u32 error[E0608]: cannot index into a value of type `*const u32` --> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:7:13 | 7 | let d = ptr1[5]; //~ ERROR cannot index | ^^^^^^^ error: aborting due to 4 previous errors ``` ### Output After This PR ``` error[E0369]: cannot add `{integer}` to `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:6:20 | LL | let _a = _ptr1 + 5; | ------^-- | | | | | {integer} | *const u32 | help: consider using `wrapping_add` or `add` for pointer + {integer}: `_ptr1.wrapping_add(5)` error[E0369]: cannot subtract `{integer}` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:7:20 | LL | let _b = _ptr1 - 5; | ------^-- | | | | | {integer} | *const u32 | help: consider using `offset` for pointer - {integer}: `unsafe { _ptr1.offset(-5) }` error[E0369]: cannot subtract `*const u32` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:8:20 | LL | let _c = _ptr2 - _ptr1; | ------^------ | | | | | *const u32 | *const u32 | help: consider using `offset_from` for pointer - pointer if the pointers point to the same allocation: `_ptr2.offset_from(_ptr1)` error[E0608]: cannot index into a value of type `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:14 | LL | let _d = _ptr1[5]; | ^^^^^^^^ | help: consider using `wrapping_add` or `add` for indexing into raw pointer | LL | let _d = _ptr1.wrapping_add(5); | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 4 previous errors ``` Closes #112252.
2023-06-11Auto merge of #111801 - Bryanskiy:lints1, r=petrochenkovbors-36/+541
Private-in-public lints implementation Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-06-12Private-in-public lints implementationBryanskiy-36/+541
2023-06-11Auto merge of #112530 - matthiaskrgr:rollup-qee1kc1, r=matthiaskrgrbors-0/+25
Rollup of 3 pull requests Successful merges: - #112487 (Update documentation for `tools` defaults) - #112513 (Dont compute `opt_suggest_box_span` span for TAIT) - #112528 (bootstrap: Don't override `debuginfo-level = 1` to mean `line-tables-only`) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-11Rollup merge of #112513 - compiler-errors:dont-compute-box-span-for-tait, ↵Matthias Krüger-0/+25
r=cjgillot Dont compute `opt_suggest_box_span` span for TAIT Fixes #112434 Also a couple more commits on top, pruning some dead code and fixing another weird suggestion encountered in the above issue.
2023-06-11Auto merge of #111958 - notriddle:notriddle/type-search-slice-array, ↵bors-0/+342
r=GuillaumeGomez rustdoc: search for slices and arrays by type with `[]` This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for slices and arrays. Part of #60485 Function signature searches already support arrays and slices. The explicit name `primitive:slice<u8>` and `primitive:array<u8>` can be used to match a slice or array of bytes, while square brackets `[u8]` will match either one. Empty square brackets, `[]`, will match any slice regardless of what it contains. Preview: * [`option -> []`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=option%20-%3E%20%5B%5D) * [`[u8] -> str`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=%5Bu8%5D%20-%3E%20str) * [`Box<[u8]> -> str`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=Box%3C%5Bu8%5D%3E%20-%3E%20str) Motivation: When type-based search was first landed, it was directly described as "incomplete". Here's [a comment] from the discussion thread: [a comment]: https://github.com/rust-lang/rust/pull/23289#issuecomment-79437386 > This is looking really great, nice work! I can think of a number of cases that aren't quite covered by this, but I feel like this is a great improvement regardless and it can always be iterated on so I'm fine landing with a few known cases where it may not work :) Filling out the missing functionality is going to mean adding support for more of Rust's [type expression] syntax, such as slices (in this PR), tuples, references, raw pointers, function pointers, and generics. [type expression]: https://doc.rust-lang.org/reference/types.html#type-expressions There does seem to be demand for this sort of thing, such as [this Discord message](https://discord.com/channels/442252698964721669/443150878111694848/1042145740065099796) expressing regret at rustdoc not supporting tuples in search queries.
2023-06-11Migrate GUI colors test to original CSS color formatGuillaume Gomez-11/+11
2023-06-11Fix the overflow issue for transmute_generic_constsyukang-0/+19
2023-06-11Don't suggest boxing an empty if/else armMichael Goulet-0/+25
2023-06-11Rollup merge of #112498 - SamZhang3:rust-reference-link-update, r=NilstriebMatthias Krüger-8/+8
Update links to Rust Reference in diagnostic Instead of linking to the [old Rust Reference site](https://static.rust-lang.org/doc/master/reference.html#literals), which is severely outdated (Rust 1.17), link to the [current website](https://doc.rust-lang.org/stable/reference/expressions/literal-expr.html) in diagnostic about incorrect literals.
2023-06-11Rollup merge of #112493 - fmease:iat-select-complete-bound-var-erasure, ↵Matthias Krüger-0/+35
r=compiler-errors iat selection: normalize self ty & completely erase bound vars Erase bound vars (most notably late-bound regions) irrespective of their binding level instead of just at the innermost one. Fixes #111404.
2023-06-11Rollup merge of #112492 - GuillaumeGomez:migrate-gui-test-color-13, r=notriddleMatthias Krüger-2/+2
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-06-11Rollup merge of #112475 - chenyukang:yukang-fix-112278, r=compiler-errorsMatthias Krüger-1/+79
Fix issue for module name when surround the struct literal with parentheses Fixes #112278
2023-06-11iat selection: normalize self ty & completely erase bound varsLeón Orell Valerian Liehr-0/+35
2023-06-10rustdoc: add note about slice/array searches to help popupMichael Howell-22/+18
2023-06-10rustdoc: search for slices and arrays by type with `[]`Michael Howell-0/+336
Part of #60485
2023-06-10rustdoc: add test case for `OsString::into_string`Michael Howell-0/+10
2023-06-10Use a better linkHankai Zhang-8/+8
2023-06-10Auto merge of #107637 - fmease:rustdoc-reelide-x-crate-def-tr-obj-lt-bnds, ↵bors-19/+167
r=notriddle,cgillot,GuillaumeGomez rustdoc: re-elide cross-crate default trait-object lifetime bounds Hide trait-object lifetime bounds (re-exported from an external crate) if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes). Partially addresses #44306. Follow-up to #103885. [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097). Most notably, if `std` exported something from `core` containing a type like `Box<dyn Fn()>`, then it would now be rendered as `Box<dyn Fn(), Global>` instead of `Box<dyn Fn() + 'static, Global>` (hiding `+ 'static` as it is the default in this case). Showing `Global` here is a separate issue, #80379, which is on my agenda. Note that I am not really fond of the fact that I had to add a parameter to such a widely used function (30+ call sites) to address such a niche bug. CC `@GuillaumeGomez` Requesting a review from a compiler contributor or team member as recommended on Zulip. r? compiler --- `@rustbot` label T-compiler T-rustdoc A-cross-crate-reexports
2023-06-10Update links to Rust Reference page on literals in diagnosticHankai Zhang-8/+8
Instead of linking to the old Rust Reference site on static.rust-lang.org, link to the current website doc.rust-lang.org/stable/reference instead in diagnostic about incorrect literals.
2023-06-10Auto merge of #112494 - matthiaskrgr:rollup-xdf3om8, r=matthiaskrgrbors-13/+36
Rollup of 5 pull requests Successful merges: - #112297 (bootstrap: Disallow `--exclude test::std`) - #112298 (Update field-offset and enable unstable_offset_of) - #112335 (ci: Upgrade loongarch64-linux-gnu GCC to 13.1.0) - #112413 (Adjust span labels for `HIDDEN_GLOB_REEXPORTS`) - #112483 (Add deprecation warning to python versions <3.6 in x.py) r? `@ghost` `@rustbot` modify labels: rollup