about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-12-12Auto merge of #91549 - fee1-dead:const_env, r=spastorinobors-434/+501
Eliminate ConstnessAnd again Closes #91489. Closes #89432. Reverts #91491. Reverts #89450. r? `@spastorino`
2021-12-12Auto merge of #90716 - euclio:libloading, r=cjgillotbors-290/+57
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-99/+18
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-12Auto merge of #90423 - Aaron1011:deduplicate-projection, r=jackh726bors-0/+6
Deduplicate projection sub-obligations
2021-12-12Auto merge of #91825 - matthiaskrgr:rollup-e4s8lwp, r=matthiaskrgrbors-4/+4
Rollup of 6 pull requests Successful merges: - #91746 (Btree: assert more API compatibility) - #91748 (rustdoc: Add regression test for Iterator as notable trait on &mut T) - #91811 (bootstrap: Change unwrap() to expect() for WIX path) - #91814 (doc: fix typo in comments) - #91815 (better span for unexpected normalization failure in CTFE engine) - #91817 (rustbot: Add autolabeling for `T-rustdoc`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-12Rollup merge of #91815 - RalfJung:span, r=oli-obkMatthias Krüger-2/+2
better span for unexpected normalization failure in CTFE engine No reason to use `DUMMY_SP` here.
2021-12-12Rollup merge of #91814 - japm48:spelling-fix, r=RalfJungMatthias Krüger-2/+2
doc: fix typo in comments `dereferencable -> dereferenceable` Fixes #91802.
2021-12-12Remove function from rebaseDeadbeef-28/+0
2021-12-12Small performance tweaksDeadbeef-9/+9
2021-12-12Remap more env constness for queriesDeadbeef-18/+40
2021-12-12Remap predicate/env constness before queryingDeadbeef-4/+24
2021-12-12Query modifierDeadbeef-0/+72
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-415/+391
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-12Fix #91489Deadbeef-1/+6
2021-12-12Auto merge of #89404 - Kobzol:hash-stable-sort, r=Mark-Simulacrumbors-1/+2
Slightly optimize hash map stable hashing I was profiling some of the `rustc-perf` benchmarks locally and noticed that quite some time is spent inside the stable hash of hashmaps. I tried to use a `SmallVec` instead of a `Vec` there, which helped very slightly. Then I tried to remove the sorting, which was a bottleneck, and replaced it with insertion into a binary heap. Locally, it yielded nice improvements in instruction counts and RSS in several benchmarks for incremental builds. The implementation could probably be much nicer and possibly extended to other stable hashes, but first I wanted to test the perf impact properly. Can I ask someone to do a perf run? Thank you!
2021-12-12Auto merge of #91813 - matthiaskrgr:rollup-nryyeyj, r=matthiaskrgrbors-58/+102
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-11better span for unexpected normalization failure in CTFE engineRalf Jung-2/+2
2021-12-12doc: fix typo in commentsjapm48-2/+2
dereferencable -> dereferenceable
2021-12-11Rollup merge of #91780 - cjgillot:localize, r=Mark-SimulacrumMatthias Krüger-28/+0
Remove hir::Node::hir_id. Small cleanup.
2021-12-11Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726Matthias Krüger-21/+6
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 #91643 - Amanieu:r9x18, r=joshtriplettMatthias Krüger-9/+72
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-11Rollup merge of #90081 - woppopo:const_write_bytes, r=oli-obkMatthias Krüger-0/+24
Make `intrinsics::write_bytes` const This is required to constify `MaybeUninit::zeroed` and `(*mut T)::write_bytes`. Tracking issue: #86302
2021-12-11Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obkbors-19/+117
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-85/+281
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-11Rollup merge of #89734 - estebank:issue-72312, r=nikomatsakisMatthias Krüger-83/+153
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-2/+128
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/+5
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 #91640 - cjgillot:in-band-collect, r=oli-obkMatthias Krüger-199/+200
Simplify collection of in-band lifetimes Split from https://github.com/rust-lang/rust/pull/91403 r? ````@oli-obk````
2021-12-11Rollup merge of #91617 - nnethercote:improve-List-readability, r=lcnrMatthias Krüger-51/+89
Improve the readability of `List<T>`. This commit does the following. - Expands on some of the things already mentioned in comments. - Describes the uniqueness assumption, which is critical but wasn't mentioned at all. - Rewrites `empty()` into a clearer form, as provided by Daniel Henry-Mantilla on Zulip. - Reorders things slightly so that more important things are higher up, and incidental things are lower down, which makes reading the code easier. r? ````@lcnr````
2021-12-11Do not ICE when suggesting elided lifetimes on non-existent spans.Camille GILLOT-0/+5
2021-12-11Remove useless variant.Camille GILLOT-21/+1
2021-12-11Rollup merge of #91426 - eggyal:idfunctor-panic-safety, r=lcnrMatthias Krüger-24/+30
Make IdFunctor::try_map_id panic-safe Addresses FIXME comment created in #78313 r? ```@lcnr```
2021-12-11Tweak assoc type obligation spansEsteban Kuber-19/+117
* 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-11Auto merge of #91715 - the8472:bump-rmeta-fromat-version, r=Mark-Simulacrumbors-1/+1
Bump rmeta version to fix rustc_serialize ICE #91407 changed the serialization format which leads to ICEs for nightly users such as #91663 and linked issues. The issue can be solved by running `cargo clean`. But bumping the metadata version should lead to the cached files being discarded, avoiding the issue entirely.
2021-12-11update accepted feature gateEllen-2/+2
2021-12-10Suggest using a temporary variable to fix borrowck errorsNoah Lev-2/+128
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 #91625 - est31:remove_indexes, r=oli-obkMatthias Krüger-127/+123
Remove redundant [..]s
2021-12-10Rollup merge of #91575 - compiler-errors:issue-91556, r=cjgillotMatthias Krüger-2/+3
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-2/+2
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-10Rollup merge of #90407 - pierwill:edit-rustc-incremental-docs, r=cjgillotMatthias Krüger-13/+63
Document all public items in `rustc_incremental` Also: - Review and edit current docs - Enforce documentation for the module.
2021-12-10remove feature gate and cleanup codeEllen-99/+18
2021-12-10Remove hir::Node::hir_id.Camille GILLOT-28/+0
2021-12-10fmtEsteban Kuber-16/+17
2021-12-10review commentEsteban Kuber-3/+3
2021-12-10Remove field from `ErrorValue`Esteban Kuber-12/+12
2021-12-10Review commentsEsteban Kuber-10/+12
2021-12-10Tweak wordingEsteban Kuber-3/+3
2021-12-10Use a more accurate `Span` for `'static` obligation from return typeEsteban Kuber-39/+45
2021-12-10Point at return type when it introduces `'static` obligationEsteban Kuber-0/+20
2021-12-10Add filtering based on involved required lifetimeEsteban Kuber-17/+20
More accurate filtering still needed.