Dylan DPC [Sun, 12 Jun 2022 10:14:28 +0000 (12:14 +0200)]
Rollup merge of #97991 - davidkna:fix-macos-strip, r=joshtriplett
Use safer `strip=symbols`-flag for dylibs on macOS
Closes #93988
To safely strip dylibs on macOS, the `-x` flag is needed per the manpage (see the discussion here: https://github.com/rust-lang/rust/issues/93988#issuecomment-1042574854).
Thus, when the current `crate_type` is producing a dylib (I assume this is the case for proc macros) use the `-x` flag instead of bare `strip` for `strip=symbols`.
bors [Sun, 12 Jun 2022 00:47:54 +0000 (00:47 +0000)]
Auto merge of #97778 - compiler-errors:misc-diagnostics-tidy, r=cjgillot
Tidy up miscellaneous bounds suggestions
Just some small fixes to suggestions
- Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty`
- Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in #97640)
- Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes #97760)
- Fixes some poor handling of `where` clauses with no predicates (also #97760)
- Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes #97677)
Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
bors [Sat, 11 Jun 2022 20:08:48 +0000 (20:08 +0000)]
Auto merge of #95880 - cjgillot:def-ident-span, r=petrochenkov
Handle `def_ident_span` like `def_span`.
`def_ident_span` had an ad-hoc status in the compiler.
This PR refactors it to be a first-class citizen like `def_span`:
- it gets encoded in the main metadata loop, instead of the visitor;
- its implementation is updated to mirror the one of `def_span`.
We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
bors [Sat, 11 Jun 2022 17:49:22 +0000 (17:49 +0000)]
Auto merge of #97996 - matthiaskrgr:rollup-bvbjlid, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #97904 (Small grammar fix in the compile_error documentation)
- #97943 (line 1352, change `self` to `*self`, other to `*other`)
- #97969 (Make -Cpasses= only apply to pre-link optimization)
- #97990 (Add more eslint checks)
- #97994 (feat(fix): update some links in `hir.rs`)
- current page
https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.QPath.html
https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.ExprKind.html#variant.MethodCall
Matthias Krüger [Sat, 11 Jun 2022 16:05:34 +0000 (18:05 +0200)]
Rollup merge of #97969 - inglorion:prelinkpasses, r=nikic
Make -Cpasses= only apply to pre-link optimization
This change causes passes specified in -Cpasses= to be applied
only during pre-link optimization, not during LTO. This avoids
such passes running multiple times, which they may not be
designed for.
Matthias Krüger [Sat, 11 Jun 2022 16:05:33 +0000 (18:05 +0200)]
Rollup merge of #97943 - Warrenren:master, r=Dylan-DPC
line 1352, change `self` to `*self`, other to `*other`
The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
bors [Sat, 11 Jun 2022 15:08:41 +0000 (15:08 +0000)]
Auto merge of #97989 - Dylan-DPC:rollup-wol1a1y, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #97761 (validating the vtable can lead to Stacked Borrows errors)
- #97789 (Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`)
- #97913 (Wrap `HirId`s of locals into `LocalVarId`s for THIR nodes)
- #97979 (Fix typos in Provider API docs)
- #97987 (remove an unnecessary `String`)
Dylan DPC [Sat, 11 Jun 2022 10:59:28 +0000 (12:59 +0200)]
Rollup merge of #97913 - dingxiangfei2009:wrap-into-local-var-id, r=nikomatsakis
Wrap `HirId`s of locals into `LocalVarId`s for THIR nodes
This is the first effort to decouple `HirId`s from THIR. `HirId` is not very relevant in building THIR and MIR.
Based on the changeset, I think there are a few other pending refactoring that we could perform after this, in case we want to eliminate use of `HirId` in THIR.
- `TypeckResults::closure_min_captures` could be remapped from the variable `HirId`s to `LocalVarId` while the THIR is getting built.
- Use of `ScopeTree::var_scope` could be eliminated as well, since we will consider deprecating `ScopeTree` in the future.
Dylan DPC [Sat, 11 Jun 2022 10:59:27 +0000 (12:59 +0200)]
Rollup merge of #97789 - ferrocene:pa-fix-issue-71363-test, r=cjgillot
Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`
The test relies on `library/std/src/error.rs` not corresponding to a local path, but remapping might still find the related local file of a remapped path. To fix the test, this PR adds a new `-Z` flag to disable finding the corresponding local path of a remapped path.
bors [Sat, 11 Jun 2022 08:46:21 +0000 (08:46 +0000)]
Auto merge of #97903 - est31:unused_macro_rules_compile_error, r=petrochenkov
Never regard macro rules with compile_error! invocations as unused
The very point of compile_error! is to never be reached, and one of
the use cases of the macro, currently also listed as examples in the
documentation of compile_error, is to create nicer errors for wrong
macro invocations. Thus, we should never warn about unused macro arms
that contain invocations of compile_error.
See also https://github.com/rust-lang/rust/pull/96150#issuecomment-1126599107 and the discussion after that.
Furthermore, the PR also contains two commits to silence `unused_macro_rules` when a macro has an invalid rule, and to add a test that `unused_macros` does not behave badly in the same situation.
r? `@petrochenkov` as I've talked to them about this
bors [Sat, 11 Jun 2022 06:17:54 +0000 (06:17 +0000)]
Auto merge of #97980 - Dylan-DPC:rollup-l8exe4b, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #96868 (Stabilize explicit_generic_args_with_impl_trait)
- #97703 (some additional `need_type_info.rs` cleanup)
- #97812 (Suggest to swap a struct and a trait in trait impls)
- #97958 (ExitStatus docs fixups)
- #97967 (Mention `infer::Trace` methods on `infer::At` methods' docs)
- #97972 (Update #[doc(html_playground_url)] documentation to mention what the request will be)
Dylan DPC [Sat, 11 Jun 2022 05:42:17 +0000 (07:42 +0200)]
Rollup merge of #97972 - hamza1311:patch-1, r=Dylan-DPC
Update #[doc(html_playground_url)] documentation to mention what the request will be
The [documentation for `#![doc(html_playground_url = "_")]`](https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#html_playground_url) specifies that a request will be made to the given URL but does specify what the contents of the request will be. This PR updates the documentation to include the query parameters through which the code is provided to the playground.
Dylan DPC [Sat, 11 Jun 2022 05:42:16 +0000 (07:42 +0200)]
Rollup merge of #97967 - BoxyUwU:at_docs_mention_trace, r=compiler-errors
Mention `infer::Trace` methods on `infer::At` methods' docs
I missed that you could do `infcx.at(...).trace(...).eq(a, b)` when `a` and `b` dont implement `ToTrace` but does implement `Relate` these docs would have helped see that :sweat_smile:
Dylan DPC [Sat, 11 Jun 2022 05:42:12 +0000 (07:42 +0200)]
Rollup merge of #96868 - nrc:turbo-stable, r=jhpratt,nbdd0121,nagisa
Stabilize explicit_generic_args_with_impl_trait
This is a stabilisation PR for `explicit_generic_args_with_impl_trait`.
* [tracking issue](https://github.com/rust-lang/rust/issues/83701)
- [Stabilisation report](https://github.com/rust-lang/rust/issues/83701#issuecomment-1109949897)
- [FCP entered](https://github.com/rust-lang/rust/issues/83701#issuecomment-1120285703)
* [implementation PR](https://github.com/rust-lang/rust/pull/86176)
* [Reference PR](https://github.com/rust-lang/reference/pull/1212)
* There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
bors [Sat, 11 Jun 2022 04:00:23 +0000 (04:00 +0000)]
Auto merge of #97905 - nnethercote:revert-infallible-encoder, r=bjorn3
Revert part of #94372 to improve performance
#94732 was supposed to give small but widespread performance improvements, as judged from three per-merge performance runs. But the performance run that occurred after merging included a roughly equal number of improvements and regressions, for unclear reasons.
This PR is for a test run reverting those changes, to see what happens.
bors [Sat, 11 Jun 2022 01:39:43 +0000 (01:39 +0000)]
Auto merge of #97648 - lcnr:bound-var-replacer, r=jackh726
cleanup bound variable handling
each commit should be pretty self-contained and hopefully straightforward to review.
I've added 677ec23a8dbf8ff5f1c03ccebd46f8b85e5ec1fc so that we can stop returning the region map from `replace_bound_vars_with_fresh_vars` in the following commit.
bors [Fri, 10 Jun 2022 22:50:17 +0000 (22:50 +0000)]
Auto merge of #97968 - matthiaskrgr:rollup-qtd4i5h, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #93331 (refactor write_output_file to merge two invocation paths into one.)
- #97928 (Removes debug settings from wasm32_unknown_emscripten default link args)
- #97940 (Use relative links instead of linking to doc.rust-lang.org when possible)
- #97941 (nit: Fixed several error_codes/Exxxx.md messages which used UpperCamelCase…)
- #97953 (Add regression test for #54378)
- #97957 (Make `std::` prefix suggestion test `run-rustfix`)
Bob Haarman [Fri, 10 Jun 2022 18:53:25 +0000 (11:53 -0700)]
Make -Cpasses= only apply to pre-link optimization
This change causes passes specified in -Cpasses= to be applied
only during pre-link optimization, not during LTO. This avoids
such passes running multiple times, which they may not be
designed for.
Matthias Krüger [Fri, 10 Jun 2022 20:32:30 +0000 (22:32 +0200)]
Rollup merge of #97928 - hoodmane:emscripten-no-assertions, r=tlively
Removes debug settings from wasm32_unknown_emscripten default link args
This is a debug setting. We should only make debug builds if user requests
a debug build. Currently this is inserted in release builds.
Furthermore, it would be better to insert these settings in --pre-link-args
because then it would be possible to override them if appropriate. Because
these are inserted at the end, it is necessary to patch emscripten to remove
them.
Warrenren [Fri, 10 Jun 2022 11:08:03 +0000 (19:08 +0800)]
line 1352, change self to (*self), other to (*other)
The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
bors [Fri, 10 Jun 2022 09:05:50 +0000 (09:05 +0000)]
Auto merge of #97939 - JohnTitor:rollup-79pxupb, r=JohnTitor
Rollup of 6 pull requests
Successful merges:
- #97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383))
- #97876 (update docs for `std::future::IntoFuture`)
- #97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target)
- #97922 (Remove redundant calls to reserve in impl Write for VecDeque)
- #97927 (Do not introduce bindings for types and consts in HRTB.)
- #97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`)
Yuki Okushi [Fri, 10 Jun 2022 08:22:30 +0000 (17:22 +0900)]
Rollup merge of #97888 - hoodmane:emscripten-eh-personality, r=Amanieu
Don't use __gxx_personality_v0 in panic_unwind on emscripten target
This resolves #85821. See also the discussion here:
https://github.com/emscripten-core/emscripten/issues/17128
The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
bors [Fri, 10 Jun 2022 01:10:59 +0000 (01:10 +0000)]
Auto merge of #91970 - nrc:provide-any, r=scottmcm
Add the Provider api to core::any
This is an implementation of [RFC 3192](https://github.com/rust-lang/rfcs/pull/3192) ~~(which is yet to be merged, thus why this is a draft PR)~~. It adds an API for type-driven requests and provision of data from trait objects. A primary use case is for the `Error` trait, though that is not implemented in this PR. The only major difference to the RFC is that the functionality is added to the `any` module, rather than being in a sibling `provide_any` module (as discussed in the RFC thread).
~~Still todo: improve documentation on items, including adding examples.~~
est31 [Thu, 9 Jun 2022 21:46:40 +0000 (23:46 +0200)]
Test that the unused_macros lint works correctly if rules are malformed
The unused_macro_rules lint had a bug where it would regard all rules of
a macro as unused if one rule were malformed. This bug doesn't exist
with the unused_macros lint. To ensure it doesn't appear in the future,
we add a test for it.
est31 [Thu, 9 Jun 2022 21:34:06 +0000 (23:34 +0200)]
Suppress the unused_macro_rules lint if malformed rules are encountered
Prior to this commit, if a macro had any malformed rules, all rules would
be reported as unused, regardless of whether they were used or not.
So we just turn off unused rule checking completely for macros with
malformed rules.