about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-12-14Make TyS::is_suggestable more structualMichael Goulet-89/+58
2021-12-13Rollup merge of #91849 - jackh726:gats-outlives-lint-part2, r=nikomatsakisMatthias Krüger-40/+109
GATs outlives lint: Try to prove bounds Fixes #91036 Fixes #90888 Fixes #91348 (better error + documentation to be added to linked issue) Instead of checking for bounds directly, try to prove them in the associated type environment. Also, add a bit of extra information to the error, including a link to the relevant discussion issue (#87479). That should be edited to include a brief summary of the current state of the outlives lint, including a brief background. It also might or might not be worth it to bump this to a full error code at some point. r? ``@nikomatsakis``
2021-12-13Rollup merge of #91847 - BoxyUwU:generic_arg_infer_fixme, r=lcnrMatthias Krüger-0/+41
Fix FIXME for `generic_arg_infer` in `create_substs_for_ast_path` Fixes a FIXME, does some general refactoring of this fn, and also fixes a bug where we would use a const params defaults instead of an inference var ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=19456f65ea5dc3fcaa9b696f842ab380)) (lot of stuff in one PR but it was all so close together...) r? `@lcnr` Fixes #91614
2021-12-13Adjust wording for reviewJack Huey-28/+28
2021-12-13Auto merge of #91657 - nikic:update-llvm, r=cuviperbors-0/+14
Update LLVM submodule Update LLVM submodule with recent cherry-picks. In particular: * https://github.com/rust-lang/llvm-project/pull/123 * https://github.com/rust-lang/llvm-project/pull/124
2021-12-13Instead of checking for exact bounds, try to prove themJack Huey-40/+109
2021-12-13Auto merge of #91569 - erikdesjardins:vt-align, r=nikicbors-0/+45
Attach range metadata to alignment loads from vtables ...because alignment is always nonzero[0]. This helps eliminate redundant runtime alignment checks, when a DST is a field of a struct whose remaining fields have alignment 1. Fixes #91438. --- [0]: The [reference](https://doc.rust-lang.org/reference/type-layout.html) says that alignment must be at least 1. And in practice, the alignment field for all vtables is generated here: https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_middle/src/ty/vtable.rs#L68-L90 and is nonzero because [`Align::bytes()`](https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_target/src/abi/mod.rs#L547-L549) is always nonzero.
2021-12-13extra test for bug i foundEllen-0/+15
2021-12-13hurray for portable simd finding a nice test for this FIXMEEllen-0/+26
2021-12-12Auto merge of #91549 - fee1-dead:const_env, r=spastorinobors-14/+85
Eliminate ConstnessAnd again Closes #91489. Closes #89432. Reverts #91491. Reverts #89450. r? `@spastorino`
2021-12-12Auto merge of #90716 - euclio:libloading, r=cjgillotbors-20/+18
replace dynamic library module with libloading This PR deletes the `rustc_metadata::dynamic_lib` module in favor of the popular and better tested [`libloading` crate](https://github.com/nagisa/rust_libloading/). We don't benefit from `libloading`'s symbol lifetimes since we end up leaking the loaded library in all cases, but the call-sites look much nicer by improving error handling and abstracting away some transmutes. We also can remove `rustc_metadata`'s direct dependencies on `libc` and `winapi`. This PR also adds an exception for `libloading` (and its license) to tidy, so this will need sign-off from the compiler team.
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-269/+72
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-12Rollup merge of #91748 - ↵Matthias Krüger-0/+23
notriddle:notriddle/doc-notable_trait-mut_t_is_not_an_iterator, r=Mark-Simulacrum rustdoc: Add regression test for Iterator as notable trait on &mut T Closes #80737
2021-12-12Add trailing newlineDeadbeef-1/+1
2021-12-12Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"Deadbeef-9/+23
This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-5/+4
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-12add regression test for #91489SNCPlay42-0/+40
2021-12-12Fix #91489Deadbeef-0/+18
2021-12-12Auto merge of #91813 - matthiaskrgr:rollup-nryyeyj, r=matthiaskrgrbors-19/+104
Rollup of 8 pull requests Successful merges: - #90081 (Make `intrinsics::write_bytes` const) - #91643 (asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target) - #91737 (Make certain panicky stdlib functions behave better under panic_immediate_abort) - #91750 (rustdoc: Add regression test for Iterator as notable trait on &T) - #91764 (Do not ICE when suggesting elided lifetimes on non-existent spans.) - #91780 (Remove hir::Node::hir_id.) - #91797 (Fix zero-sized reference to deallocated memory) - #91806 (Make `Unique`s methods `const`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-11Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726Matthias Krüger-0/+72
Do not ICE when suggesting elided lifetimes on non-existent spans. Fixes https://github.com/rust-lang/rust/issues/91763 r? `@jackh726`
2021-12-11Rollup merge of #91750 - ↵Matthias Krüger-0/+21
notriddle:notriddle/doc-notable_trait-mut_t_is_not_ref_t, r=Mark-Simulacrum rustdoc: Add regression test for Iterator as notable trait on &T Closes #78160 This regression test is different from the one in #91748, because while neither of these function should have Iterator marked as a notable trait, the reasons are different. * In this PR, it returns `&T where T: Iterator`. The `mut` is what's missing. * In #91748, it returns `&mut T`. The trait bounds are what's missing.
2021-12-11Rollup merge of #91643 - Amanieu:r9x18, r=joshtriplettMatthias Krüger-19/+11
asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target This supersedes https://github.com/rust-lang/rust/pull/88879. cc `@Skirmisher` r? `@joshtriplett`
2021-12-11Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obkbors-238/+386
Tweak assoc type obligation spans * Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors r? `@oli-obk` This is a(n uncontroversial) subset of #85799.
2021-12-11Auto merge of #91799 - matthiaskrgr:rollup-b38xx6i, r=matthiaskrgrbors-50/+494
Rollup of 6 pull requests Successful merges: - #83174 (Suggest using a temporary variable to fix borrowck errors) - #89734 (Point at capture points for non-`'static` reference crossing a `yield` point) - #90270 (Make `Borrow` and `BorrowMut` impls `const`) - #90741 (Const `Option::cloned`) - #91548 (Add spin_loop hint for RISC-V architecture) - #91721 (Minor improvements to `future::join!`'s implementation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-11Fix AArch64 asm ui testsAmanieu d'Antras-19/+11
2021-12-11Rollup merge of #89734 - estebank:issue-72312, r=nikomatsakisMatthias Krüger-50/+313
Point at capture points for non-`'static` reference crossing a `yield` point ``` error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement --> $DIR/issue-72312.rs:10:24 | LL | pub async fn start(&self) { | ^^^^^ this data with an anonymous lifetime `'_`... ... LL | require_static(async move { | -------------- ...is required to live as long as `'static` here... LL | &self; | ----- ...and is captured here | note: `'static` lifetime requirement introduced by this trait bound --> $DIR/issue-72312.rs:2:22 | LL | fn require_static<T: 'static>(val: T) -> T { | ^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0759`. ``` Fix #72312.
2021-12-11Rollup merge of #83174 - camelid:borrow-help, r=oli-obkMatthias Krüger-0/+181
Suggest using a temporary variable to fix borrowck errors Fixes #77834. In Rust, nesting method calls with both require `&mut` access to `self` produces a borrow-check error: error[E0499]: cannot borrow `*self` as mutable more than once at a time --> src/lib.rs:7:14 | 7 | self.foo(self.bar()); | ---------^^^^^^^^^^- | | | | | | | second mutable borrow occurs here | | first borrow later used by call | first mutable borrow occurs here That's because Rust has a left-to-right evaluation order, and the method receiver is passed first. Thus, the argument to the method cannot then mutate `self`. There's an easy solution to this error: just extract a local variable for the inner argument: let tmp = self.bar(); self.foo(tmp); However, the error doesn't give any suggestion of how to solve the problem. As a result, new users may assume that it's impossible to express their code correctly and get stuck. This commit adds a (non-structured) suggestion to extract a local variable for the inner argument to solve the error. The suggestion uses heuristics that eliminate most false positives, though there are a few false negatives (cases where the suggestion should be emitted but is not). Those other cases can be implemented in a future change.
2021-12-11Rollup merge of #91718 - RalfJung:unaligned_references, r=nagisaMatthias Krüger-0/+20
give more help in the unaligned_references lint Cc https://github.com/rust-lang/rust/issues/82523#issuecomment-988138440 ``@kaisq``
2021-12-11Rollup merge of #91717 - inashivb:issue-91713, r=jyn514Matthias Krüger-0/+38
Add deprecation warning for --passes Issue https://github.com/rust-lang/rust/issues/91713 mentored by ```@jyn514```
2021-12-11Rollup merge of #91682 - camelid:alias-layout, r=jyn514Matthias Krüger-0/+12
rustdoc: Show type layout for type aliases Fixes #91265. At first, you might think, "Why not just click through to the aliased type?" But, if a type alias instantiates all of the generic parameters of the aliased type, then it can show layout info even though the aliased type cannot (because we can't compute layout for generic types). So, I think it's useful to show layout info for type aliases. This is a followup of 78d4b453ad2e19d44011b26fc55c949bff5dba3d (originally part of #83501).
2021-12-11Rollup merge of #91640 - cjgillot:in-band-collect, r=oli-obkMatthias Krüger-0/+11
Simplify collection of in-band lifetimes Split from https://github.com/rust-lang/rust/pull/91403 r? ````@oli-obk````
2021-12-11Add test.Camille GILLOT-0/+72
2021-12-11Rollup merge of #91373 - djkoloski:fuchsia_test_suite, r=Mark-SimulacrumMatthias Krüger-2/+63
Add needs-unwind to tests that depend on panicking These tests were found by running the test suite on fuchsia which compiles with `panic=abort` by default, then picking through the failures manually to locate the tests that require unwinding support. Most of these tests are already opted-out on platforms that compile with `panic=abort` by default. This just generalizes it a bit more so that fuchsia tests can be run properly. Currently, the `needs-unwind` directive needs to be manually passed to compiletest (e.g. via `--test-args '--target-panic=abort'`). Eventually, I would like `x.py` or compiletest to determine whether the directive should be used automatically based on the target panic settings.
2021-12-11Rollup merge of #91310 - hi-rustin:rustin-patch-rustdoc, r=jyn514Matthias Krüger-0/+33
Add --out-dir flag for rustdoc part of https://github.com/rust-lang/rust/issues/91260 Add --out-dir flag for rustdoc and change the `-o` option to point to out-dir. I'm not quite sure if it should be stable, also I'm not sure if this parameter priority is appropriate? Or should I just refuse to pass both parameters at the same time? r? `@jyn514`
2021-12-11Auto merge of #91761 - matthiaskrgr:rollup-bjowmvz, r=matthiaskrgrbors-0/+387
Rollup of 11 pull requests Successful merges: - #91668 (Remove the match on `ErrorKind::Other`) - #91678 (Add tests fixed by #90023) - #91679 (Move core/stream/stream/mod.rs to core/stream/stream.rs) - #91681 (fix typo in `intrinsics::raw_eq` docs) - #91686 (Fix `Vec::reserve_exact` documentation) - #91697 (Delete Utf8Lossy::from_str) - #91706 (Add unstable book entries for parts of asm that are not being stabilized) - #91709 (Replace iterator-based set construction by *Set::From<[T; N]>) - #91716 (Improve x.py logging and defaults a bit more) - #91747 (Add pierwill to .mailmap) - #91755 (Fix since attribute for const_linked_list_new feature) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-11Tweak assoc type obligation spansEsteban Kuber-238/+386
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-10Suggest using a temporary variable to fix borrowck errorsNoah Lev-0/+181
In Rust, nesting method calls with both require `&mut` access to `self` produces a borrow-check error: error[E0499]: cannot borrow `*self` as mutable more than once at a time --> src/lib.rs:7:14 | 7 | self.foo(self.bar()); | ---------^^^^^^^^^^- | | | | | | | second mutable borrow occurs here | | first borrow later used by call | first mutable borrow occurs here That's because Rust has a left-to-right evaluation order, and the method receiver is passed first. Thus, the argument to the method cannot then mutate `self`. There's an easy solution to this error: just extract a local variable for the inner argument: let tmp = self.bar(); self.foo(tmp); However, the error doesn't give any suggestion of how to solve the problem. As a result, new users may assume that it's impossible to express their code correctly and get stuck. This commit adds a (non-structured) suggestion to extract a local variable for the inner argument to solve the error. The suggestion uses heuristics that eliminate most false positives, though there are a few false negatives (cases where the suggestion should be emitted but is not). Those other cases can be implemented in a future change.
2021-12-10Rollup merge of #91678 - b-naber:tests-for-postpone-const-eval, r=jackh726Matthias Krüger-0/+387
Add tests fixed by #90023 The following issues were fixed by https://github.com/rust-lang/rust/pull/90023 Fixes https://github.com/rust-lang/rust/issues/79674 Fixes https://github.com/rust-lang/rust/issues/83765 Fixes https://github.com/rust-lang/rust/issues/86033 Fixes https://github.com/rust-lang/rust/issues/90318 Fixes https://github.com/rust-lang/rust/issues/88468 The following issues were duplicates of https://github.com/rust-lang/rust/issues/90654 Fixes https://github.com/rust-lang/rust/issues/86850 Fixes https://github.com/rust-lang/rust/issues/89022 r? ````@jackh726````
2021-12-10Rollup merge of #91575 - compiler-errors:issue-91556, r=cjgillotMatthias Krüger-0/+19
Fix ICE on format string of macro with secondary-label This generalizes the fix #86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well. We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed. Fixes #91556
2021-12-10Rollup merge of #91470 - wesleywiser:code_coverage_link_error, r=tmandryMatthias Krüger-0/+95
code-cov: generate dead functions with private/default linkage As discovered in #85461, the MSVC linker treats weak symbols slightly differently than unix-y linkers do. This causes link.exe to fail with LNK1227 "conflicting weak extern definition" where as other targets are able to link successfully. This changes the dead functions from being generated as weak/hidden to private/default which, as the LLVM reference says: > Global values with “private” linkage are only directly accessible by objects in the current module. In particular, linking code into a module with a private global value may cause the private to be renamed as necessary to avoid collisions. Because the symbol is private to the module, all references can be updated. This doesn’t show up in any symbol table in the object file. This fixes the conflicting weak symbols but doesn't address the reason *why* we have conflicting symbols for these dead functions. The test cases added in this commit contain a minimal repro of the fundamental issue which is that the logic used to decide what dead code functions should be codegen'd in the current CGU doesn't take into account that functions can be duplicated across multiple CGUs (for instance, in the case of `#[inline(always)]` functions). Fixing that is likely to be a more complex change (see https://github.com/rust-lang/rust/issues/85461#issuecomment-985005805). Fixes #85461
2021-12-10bless testsEllen-54/+24
2021-12-10update testsEllen-215/+48
2021-12-10Add regression test for #78160Michael Howell-0/+21
2021-12-10Add regression test for #80737Michael Howell-0/+23
2021-12-10fix tests after rebaseEsteban Kuber-9/+20
2021-12-10Tweak wordingEsteban Kuber-47/+47
2021-12-10rebase and update nll testEsteban Kuber-2/+8
2021-12-10Update nll testEsteban Kuber-0/+15
2021-12-10Use a more accurate `Span` for `'static` obligation from return typeEsteban Kuber-40/+40
2021-12-10Point at return type when it introduces `'static` obligationEsteban Kuber-0/+122