about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-12-14Auto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercotebors-17/+17
manually implement `Hash` for `DefId` This might speed up hashing for hashers that can work on individual u64s. Just as an experiment, suggested in a reddit thread on `FxHasher`. cc `@nnethercote` Note that this should not be merged as is without cfg-ing the code path for 64 bits.
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-13Rollup merge of #91846 - camelid:doctest-cleanup, r=GuillaumeGomezMatthias Krüger-69/+64
rustdoc: Reduce number of arguments for `run_test` a bit - rustdoc: Coalesce some `run_test` args as one `LangString` arg - Rename `TestOptions` to `GlobalTestOptions` - doctest: Rename `options` to `rustdoc_options`
2021-12-13Rollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomezMatthias Krüger-0/+4
Add `-webkit-appearance: none` to search input This fixes an issue when displaying on iPad, where the search box had no borders. r? ``@GuillaumeGomez`` Demo https://rustdoc.crud.net/jsha/webkit-appearance-search-input/std/string/struct.String.html
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-12Add -webkit-appearance: none to search inputJacob Hoffman-Andrews-0/+4
This fixes an issue when displaying on iPad, where the search box had no borders.
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-12doctest: Rename `options` to `rustdoc_options`Noah Lev-26/+26
These are the rustdoc-wide options. It's easy to confuse them with options for doctests in particular, so this change should help.
2021-12-12Rename `TestOptions` to `GlobalTestOptions`Noah Lev-26/+27
It seems to apply to all doctests in the crate.
2021-12-12rustdoc: Coalesce some `run_test` args as one `LangString` argNoah Lev-19/+13
2021-12-12Auto merge of #91549 - fee1-dead:const_env, r=spastorinobors-18/+90
Eliminate ConstnessAnd again Closes #91489. Closes #89432. Reverts #91491. Reverts #89450. r? `@spastorino`
2021-12-12Auto merge of #90716 - euclio:libloading, r=cjgillotbors-21/+20
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-281/+83
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-12clippy owoEllen-12/+11
2021-12-12Rollup merge of #91811 - itzurabhi:boostrap-dist-wix-unwrap-issue, ↵Matthias Krüger-1/+3
r=Mark-Simulacrum bootstrap: Change unwrap() to expect() for WIX path On Windows, `x.py dist` command panics without proper error message if `WIX` environment variable is not set. This patch changes `Option::unwrap()` to `Option::expect()`.
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-9/+9
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-12bootstrap: Change `unwrap()` to `expect()` for `WIX` pathAbhishek Sudhakaran-1/+3
On Windows, `x.py dist` command panics without proper error message if 'WIX' environment variable is not set. This patch changes `Option::unwrap()` to `Option::expect()`.
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-13/+51
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/+13
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-11Auto merge of #91776 - matthiaskrgr:rollup-tlb4bw1, r=matthiaskrgrbors-7/+120
Rollup of 6 pull requests Successful merges: - #91127 (Add `<*{const|mut} T>::{to|from}_bits`) - #91310 (Add --out-dir flag for rustdoc) - #91373 (Add needs-unwind to tests that depend on panicking) - #91426 (Make IdFunctor::try_map_id panic-safe) - #91515 (Add rsplit_array variants to slices and arrays) - #91553 (socket ancillary data implementation for dragonflybsd.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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-5/+57
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 #91720 - Aaron1011:skip-llvm-ci-tools, r=Mark-Simulacrumbors-1/+6
Don't copy llvm tools to sysroot when using download-ci-llvm Fixes #91710
2021-12-11Auto merge of #91761 - matthiaskrgr:rollup-bjowmvz, r=matthiaskrgrbors-11/+555
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 #91716 - jyn514:x.py-defaults, r=Mark-SimulacrumMatthias Krüger-8/+15
Improve x.py logging and defaults a bit more r? ```@Mark-Simulacrum```
2021-12-10Rollup merge of #91706 - Amanieu:asm_unstable_book2, r=joshtriplettMatthias Krüger-0/+150
Add unstable book entries for parts of asm that are not being stabilized These are extracted from the existing `asm` documentation in the unstable book that will be removed when `asm` is stabilized. r? ```@joshtriplett```