Commit Graph

4125 Commits

Author SHA1 Message Date
Erin Power 5f344a2883 Fix UI errors 2021-03-02 12:18:46 +01:00
Erin Power 79c5fa1f0c Revert non-power-of-two vector restriction 2021-03-02 09:41:41 +01:00
bors 4f20caa625 Auto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514
Rollup of 8 pull requests

Successful merges:

 - #81210 (BTreeMap: correct node size test case for choices of B)
 - #82360 (config.toml parsing error improvements)
 - #82428 (Update mdbook)
 - #82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant)
 - #82578 (Add some diagnostic items for Clippy)
 - #82620 (Apply lint restrictions from renamed lints)
 - #82635 (Fix typos in rustc_infer::infer::nll_relate)
 - #82645 (Clarify that SyncOnceCell::set blocks.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-01 20:52:47 +00:00
bors ccad218e7f Auto merge of #82587 - taiki-e:unaligned_references, r=oli-obk
Enable report_in_external_macro in unaligned_references

Fixes an issue where `unaligned_references` is not triggered in external macros, unlike `safe_packed_borrows`.
Also, given that this lint is planned to eventually change to hard error (#82525), it would make sense for this lint to be triggered for external macros as well.

See https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787038676 and https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787052874 for more.

r? `@RalfJung`
2021-03-01 18:10:38 +00:00
Joshua Nelson 6873831139
Rollup merge of #82635 - pierwill:edit-infer, r=oli-obk
Fix typos in rustc_infer::infer::nll_relate
2021-03-01 11:25:10 -05:00
Joshua Nelson 68088026ed
Rollup merge of #82620 - jyn514:apply-renamed-lints, r=Manishearth
Apply lint restrictions from renamed lints

Previously, if you denied the old name of a renamed lint, it would warn
about using the new name, but otherwise do nothing. Now, it will behave
the same as if you'd used the new name.

Fixes https://github.com/rust-lang/rust/issues/82615.

r? `@ehuss`
2021-03-01 11:25:08 -05:00
Joshua Nelson efb9ee2df5
Rollup merge of #82578 - camsteffen:diag-items, r=oli-obk
Add some diagnostic items for Clippy
2021-03-01 11:25:07 -05:00
Cameron Steffen 6a3b834b39 Use diagnostic items in into_iter_collections 2021-03-01 09:04:11 -06:00
Cameron Steffen eada4d1c45 Add diagnostic items 2021-03-01 09:04:11 -06:00
bors 5233edcf1c Auto merge of #82216 - kulikjak:fix-solaris-target, r=nagisa,Mark-Simulacrum
make x86_64-pc-solaris the default target for x86-64 Solaris

This change makes `x86_64-pc-solaris` the default compilation target for x86-64 Solaris/Illumos (based on [this exchange](https://github.com/rust-lang/rust/issues/68214#issuecomment-748042054) with `@varkor).`

I tried several ways of doing this (leveraging the alias support added with #61761 and improved/fixed with #80073) and found out that cross-compilation to the new one is by far the simplest way of doing this. It can be achieved by adding the following arguments: `--build x86_64-sun-solaris --host x86_64-pc-solaris --target x86_64-pc-solaris` and enabling the cross compilation with `PKG_CONFIG_ALLOW_CROSS=1` environment variable.

I also removed alias support altogether - `x86_64-pc-solaris` and `x86_64-sun-solaris` are now two separate targets. The problem with aliases is that even if rust internally knows that two are the same, other tools building with rust don't know that, resulting in build issues like the one with firefox mentioned [here](https://github.com/rust-lang/rust/issues/68214#issuecomment-746144229). I think that once the dust settles and `x86_64-pc-solaris` becomes the default, `x86_64-sun-solaris` can be removed.

If you agree with the above, I have two subsequent questions:
1. Is there a preferred way to display deprecation warnings when `x86_64-sun-solaris` is passed into the compiler as an argument? I am not sure whether target deprecation was done before.
2. Where would be the best way to document this change for those using rust on Solaris? Without the cross-compilation arguments (used once to build a new version), the build won't work. Should I add it into [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md)?

Thanks!
2021-03-01 14:34:19 +00:00
Jakub Kulik c615bed387 Change default Solaris x86 target to x86_64-pc-solaris 2021-03-01 15:05:31 +01:00
bors 09db05762b Auto merge of #78360 - tmiasko:storage-markers, r=wesleywiser,oli-obk
Remove storage markers if they won't be used during code generation

The storage markers constitute a substantial portion of all MIR
statements. At the same time, for builds without any optimizations,
the storage markers have no further use during and after MIR
optimization phase.

If storage markers are not necessary for code generation, remove them.
2021-03-01 11:53:24 +00:00
Yuki Okushi cebbcf1b09
Rollup merge of #82630 - JohnTitor:fix-typo-in-find-anon-type-doc, r=petrochenkov
Fix a typo in the `find_anon_type` doc
2021-03-01 15:07:39 +09:00
bors 43fc1b3e24 Auto merge of #82601 - terhechte:catalyst-support-m1-fix, r=petrochenkov
Fixed support for macOS Catalyst on ARM64

When I initially added Arm64 Catalyst support in https://github.com/rust-lang/rust/pull/77484 I had access to a DTK. However, while waiting to merge the PR some other changes were merged which caused conflicts in the branch. When fixing those conflicts I had no access to the DTK anymore and didn't try out if the resulting binaries did indeed work on Apple Silicon. I finally have a M1 and I realized that some small changes were necessary to support Apple Silicon. This PR adds the required changes. I've been running binaries generated with this branch for some time now and they work without issues.
2021-03-01 00:07:29 +00:00
pierwill ebe798e31e Fix typos in rustc_infer::infer::nll_relate 2021-02-28 10:10:58 -08:00
Yuki Okushi 5091209750 Fix a typo in the `find_anon_type` doc 2021-02-28 23:10:55 +09:00
Joshua Nelson df156c1958 Apply lint restrictions from renamed lints
Previously, if you denied the old name of a renamed lint, it would warn
about using the new name, but otherwise do nothing. Now, it will behave
the same as if you'd used the new name.
2021-02-28 01:04:34 -05:00
bors 6e2801c44e Auto merge of #82594 - nagisa:nagisa/remove-rumprun, r=petrochenkov
Remove the x86_64-rumprun-netbsd target

Herein we remove the target from the compiler and the code from libstd intended to support the now-defunct rumprun project.

Closes #81514
2021-02-28 03:56:16 +00:00
Tomasz Miąsko 8b184ff1b8 Remove storage markers if they won't be used during code generation
The storage markers constitute a substantial portion of all MIR
statements. At the same time, for builds without any optimizations,
the storage markers have no further use during and after MIR
optimization phase.

If storage markers are not necessary for code generation, remove them.
2021-02-28 20:10:44 +01:00
Dylan DPC 7847f690fd
Rollup merge of #82607 - bjorn3:frame_loc_getter, r=RalfJung
Add a getter for Frame.loc

This is necessary for Priroda.

For context see https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Frame.3A.3Aloc.20no.20longer.20public/near/228070266 and oli-obk/priroda#27.

cc `@DJMcNab`

r? `@RalfJung`
2021-02-27 21:56:25 +01:00
Dylan DPC 6d288c65df
Rollup merge of #82537 - wesleywiser:update_measureme, r=oli-obk
Update measureme dependency to the latest version

This version adds the ability to use `rdpmc` hardware-based performance
counters instead of wall-clock time for measuring duration. This also
introduces a dependency on the `perf-event-open-sys` crate on Linux
which is used when using hardware counters.

r? ```@oli-obk```
2021-02-27 21:56:20 +01:00
Dylan DPC a7f9aca0a6
Rollup merge of #82534 - nikic:musl-crtend, r=nagisa
Link crtbegin/crtend on musl to terminate .eh_frame

For some targets, rustc uses a "CRT fallback", where it links CRT
object files it ships instead of letting the host compiler link
them.

On musl, rustc currently links crt1, crti and crtn (provided by
libc), but does not link crtbegin and crtend (provided by libgcc).
In particular, crtend is responsible for terminating the .eh_frame
section. Lack of terminator may result in segfaults during
unwinding, as reported in #47551 and encountered by the LLVM 12
update in #81451.

This patch links crtbegin and crtend for musl as well, following
the table at the top of crt_objects.rs.

r? ``@nagisa``
2021-02-27 21:56:19 +01:00
Dylan DPC 13ea3fab5f
Rollup merge of #82498 - tmiasko:partitioning-debug, r=matthewjasper
Use log level to control partitioning debug output
2021-02-27 21:56:18 +01:00
Dylan DPC 840622910f
Rollup merge of #82401 - osa1:remove_redundant_macro, r=matthewjasper
Remove a redundant macro

Turn the macro into a function. Also remove unused 'span' argument.
2021-02-27 21:56:17 +01:00
Dylan DPC be3d1eb301
Rollup merge of #81856 - Smittyvb:utf16-warn, r=matthewjasper
Suggest character encoding is incorrect when encountering random null bytes

This adds a note whenever null bytes are seen at the start of a token unexpectedly, since those tend to come from UTF-16 encoded files without a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) (if a UTF-16 BOM appears it won't be valid UTF-8, but if there is no BOM it be both valid UTF-16 and valid but garbled UTF-8). This approach was suggested in https://github.com/rust-lang/rust/issues/73979#issuecomment-653976451.

Closes #73979.
2021-02-27 21:56:15 +01:00
bjorn3 632a89529a Add a getter for Frame.loc
This is necessary for Priroda.
2021-02-27 21:01:02 +01:00
bors 94736c434e Auto merge of #80454 - JulianKnodt:ob_forest_op, r=matthewjasper
Skip Ty w/o infer ty/const in trait select

Remove some allocations & also add `skip_current_subtree` to skip subtrees with no inferred items.

r? `@eddyb` since marked in the FIXME
2021-02-27 17:35:35 +00:00
Benedikt Terhechte a1670aa9f5 Fixed support for macOS Catalyst for Apple Silicon 2021-02-27 18:15:55 +01:00
Simonas Kazlauskas a757fae245 Remove the x86_64-rumprun-netbsd target
Closes #81514
2021-02-27 17:55:22 +02:00
Taiki Endo 62b4b8da83 Enable report_in_external_macro in unaligned_references 2021-02-27 21:25:06 +09:00
Aaron Hill fb5fec017b
Combine HasAttrs and HasTokens into AstLike
When token-based attribute handling is implemeneted in #80689,
we will need to access tokens from `HasAttrs` (to perform
cfg-stripping), and we will to access attributes from `HasTokens` (to
construct a `PreexpTokenStream`).

This PR merges the `HasAttrs` and `HasTokens` traits into a new
`AstLike` trait. The previous `HasAttrs` impls from `Vec<Attribute>` and `AttrVec`
are removed - they aren't attribute targets, so the impls never really
made sense.
2021-02-27 00:14:13 -05:00
Cameron Steffen 4a6e67ead7 Add missing diagnostic item Symbols 2021-02-26 22:12:36 -06:00
Dylan DPC 95b31cf949
Rollup merge of #82494 - estebank:issue-82455, r=petrochenkov
Substitute erased lifetimes on bad placeholder type

Fix #82455.
2021-02-27 02:34:35 +01:00
Dylan DPC 2942cf5a1f
Rollup merge of #82482 - tmiasko:small-cycles, r=varkor
Use small hash set in `mir_inliner_callees`

Use small hash set in `mir_inliner_callees` to avoid temporary
allocation when possible and quadratic behaviour for large number of
callees.
2021-02-27 02:34:32 +01:00
Dylan DPC 5c7b383e59
Rollup merge of #82442 - Aaron1011:fix/closure-mut-crash, r=matthewjasper
Skip emitting closure diagnostic when closure_kind_origins has no entry

Fixes #82438

This map is not guarnateed to have an entry for a closure.
2021-02-27 02:34:30 +01:00
Dylan DPC 76b40d27e2
Rollup merge of #82419 - petrochenkov:inertord, r=Aaron1011
expand: Preserve order of inert attributes during expansion

Fixes https://github.com/rust-lang/rust/issues/67839
Fixes https://github.com/rust-lang/rust/issues/81871
r? `````@Aaron1011`````
2021-02-27 02:34:26 +01:00
Dylan DPC f0c98b15cc
Rollup merge of #82370 - 0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank
Improve anonymous lifetime note to indicate the target span

Improvement for  #81650
Cc #81995

Message after this improvement:
(Improve note in the middle)

```
error[E0311]: the parameter type `T` may not live long enough
  --> src/main.rs:25:11
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |              -- help: consider adding an explicit lifetime bound...: `T: 'a +`
25 |     scope.spawn(move |_| {
   |           ^^^^^
   |
note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40...
  --> src/main.rs:24:40
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |                                        ^^^^^
note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds
  --> src/main.rs:25:11
   |
25 |     scope.spawn(move |_| {
   |           ^^^^^
```

r? ``````@estebank``````
2021-02-27 02:34:22 +01:00
Dylan DPC cabe97272d
Rollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiser
Replace const_cstr with cstr crate

This PR replaces the `const_cstr` macro inside `rustc_data_structures` with `cstr` macro from [cstr](https://crates.io/crates/cstr) crate.

The two macros basically serve the same purpose, which is to generate `&'static CStr` from a string literal. `cstr` is better because it validates the literal at compile time, while the existing `const_cstr` does it at runtime when `debug_assertions` is enabled. In addition, the value `cstr` generates can be used in constant context (which is seemingly not needed anywhere currently, though).
2021-02-27 02:34:21 +01:00
Dylan DPC db8ac16d00
Rollup merge of #81794 - lcnr:relaxed_adt_unsize-tracking-issue, r=camelid
update tracking issue for `relaxed_struct_unsize`

forgot to do this before #80726 got merged. The tracking issue is #81793
2021-02-27 02:34:20 +01:00
bors 3da2dd3eae Auto merge of #82559 - tmiasko:inlined, r=petrochenkov
Miscellaneous inlining improvements

Inline a few small and hot functions.
2021-02-26 21:58:58 +00:00
bors 9c09c1f7cf Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #81940 (Stabilize str_split_once)
 - #82165 (Reword labels on E0308 involving async fn return type)
 - #82456 (Replaced some unwrap_or and map_or with lazy variants)
 - #82491 (Consider inexpensive inlining criteria first)
 - #82506 (Properly account for non-shorthand pattern field in unused variable lint)
 - #82535 (Set codegen thread names)
 - #82545 (rustdoc: add optional woff2 versions of FiraSans.)
 - #82549 (Revert "Update normalize.css to 8.0.1")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-26 19:17:00 +00:00
Guillaume Gomez 6b5e141999
Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa
Set codegen thread names

Set names on threads spawned during codegen. Various debugging and profiling tools can take advantage of this to show a more useful identifier for threads.

For example, gdb will show thread names in `info threads`:

```
(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7fffefa7ec40 (LWP 2905) "rustc"           __pthread_clockjoin_ex (threadid=140737214134016, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>)
    at pthread_join_common.c:145
  2    Thread 0x7fffefa7b700 (LWP 2957) "rustc"           0x00007ffff125eaa8 in llvm::X86_MC::initLLVMToSEHAndCVRegMapping(llvm::MCRegisterInfo*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  3    Thread 0x7fffeef0f700 (LWP 3116) "rustc"           futex_wait_cancelable (private=0, expected=0, futex_word=0x7fffe8602ac8) at ../sysdeps/nptl/futex-internal.h:183
* 4    Thread 0x7fffeed0e700 (LWP 3123) "rustc"           rustc_codegen_ssa:🔙:write::spawn_work (cgcx=..., work=...) at /home/wesley/code/rust/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1573
  6    Thread 0x7fffe113b700 (LWP 3150) "opt foof.7rcbfp" 0x00007ffff2940e62 in llvm::CallGraph::populateCallGraphNode(llvm::CallGraphNode*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  8    Thread 0x7fffe0d39700 (LWP 3158) "opt foof.7rcbfp" 0x00007fffefe8998e in malloc_consolidate (av=av@entry=0x7ffe2c000020) at malloc.c:4492
  9    Thread 0x7fffe0f3a700 (LWP 3162) "opt foof.7rcbfp" 0x00007fffefef27c4 in __libc_open64 (file=0x7fffe0f38608 "foof.foof.7rcbfp3g-cgu.6.rcgu.o", oflag=524865) at ../sysdeps/unix/sysv/linux/open64.c:48
(gdb)
```

and Windows Performance Analyzer will also show this information when profiling:

![image](https://user-images.githubusercontent.com/831192/109231017-d311f780-7793-11eb-8072-ab836a830e90.png)
2021-02-26 15:52:35 +01:00
Guillaume Gomez 75959fb356
Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnr
Properly account for non-shorthand pattern field in unused variable lint

Fix #82488
2021-02-26 15:52:33 +01:00
Guillaume Gomez ee4129f70c
Rollup merge of #82491 - tmiasko:i, r=lcnr
Consider inexpensive inlining criteria first

Refactor inlining decisions so that inexpensive criteria are considered first:

1. Based on code generation attributes.
2. Based on MIR availability (examines call graph).
3. Based on MIR body.
2021-02-26 15:52:32 +01:00
Guillaume Gomez 039b1b62ac
Rollup merge of #82456 - klensy:or-else, r=estebank
Replaced some unwrap_or and map_or with lazy variants

Replaced some `unwrap_or` and `map_or` with `unwrap_or_else` and `map_or_else`.
2021-02-26 15:52:31 +01:00
Guillaume Gomez a56bbb134f
Rollup merge of #82165 - nellshamrell:nell/fix-80658-B, r=estebank
Reword labels on E0308 involving async fn return type

Fix for #80658.

When someone writes code like this:

```rust
fn foo() -> u8 {
    async fn async_fn() -> () {}

    async_fn()
}
```

And they try to compile it, they will see an error that looks like this:

```bash
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
2 |     async fn async_fn() -> () {}
  |                            -- checked the `Output` of this `async fn`, found opaque type
3 |
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found opaque type
  |
  = note: while checking the return type of this `async fn`
  = note:     expected type `u8`
          found opaque type `impl Future`
```
2021-02-26 15:52:30 +01:00
Guillaume Gomez 0db8349fff
Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se
Stabilize str_split_once

Closes #74773
2021-02-26 15:52:29 +01:00
bors cecdb181ad Auto merge of #81458 - estebank:match-stmt-remove-semi, r=oli-obk
Detect match statement intended to be tail expression

CC #24157
2021-02-26 12:03:38 +00:00
Nikita Popov c7091f5a07 Link crtbegin/crtend on musl to terminate .eh_frame
For some targets, rustc uses a "CRT fallback", where it links CRT
object files it ships instead of letting the host compiler link
them.

On musl, rustc currently links crt1, crti and crtn (provided by
libc), but does not link crtbegin and crtend (provided by libgcc).
In particular, crtend is responsible for terminating the .eh_frame
section. Lack of terminator may result in segfaults during
unwinding, as reported in #47551 and encountered by the LLVM 12
update in #81451.

This patch links crtbegin and crtend for musl as well, following
the table at the top of crt_objects.rs.
2021-02-26 11:02:51 +01:00
lcnr 67f17342ee update tracking issue for `relaxed_struct_unsize` 2021-02-26 08:32:38 +01:00