Commit graph

5097 commits

Author SHA1 Message Date
Ralf Jung
1ecdaa29f9 remove now-unused 'is_min_const_fn' 2021-04-25 12:54:34 +02:00
Ralf Jung
9082078a26 unsafety checking: no longer care about is_min_const_fn
Rejecting the forbidden unsafe ops is done by const checking, not by unsafety checking
2021-04-25 12:53:05 +02:00
bors
b56b175c6c Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
further split up const_fn feature flag

This continues the work on splitting up `const_fn` into separate feature flags:
* `const_fn_trait_bound` for `const fn` with trait bounds
* `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here)

I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more.

`@oli-obk` are you currently able to do reviews?
2021-04-24 23:16:03 +00:00
Yuki Okushi
e109aa3613
Rollup merge of #83519 - oli-obk:assign_shrink_your_normal_code, r=pnkfelix
Implement a lint that highlights all moves larger than a configured limit

Tracking issue: #83518
[MCP 420](https://github.com/rust-lang/compiler-team/issues/420) still ~blazing~ in progress

r? ```@pnkfelix```

The main open issue I see with this minimal impl of the feature is that the lint is immediately "stable" (so it can be named on stable), even if it is never executed on stable. I don't think we have the concept of unstable lint names or hiding lint names without an active feature gate, so that would be a bigger change.
2021-04-25 01:53:09 +09:00
bors
e11a9fa52a Auto merge of #84501 - JohnTitor:rollup-wxu1thu, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #83990 (implement `TrustedRandomAccess` for `Take` iterator adapter)
 - #84250 (bootstrap: use bash on illumos to run install scripts)
 - #84320 (Use details tag for trait implementors.)
 - #84436 (Make a few functions private)
 - #84453 (Document From implementations for Waker and RawWaker)
 - #84458 (Remove unnecessary fields and parameters in rustdoc)
 - #84485 (Add some associated type bounds tests)
 - #84489 (Mention FusedIterator case in Iterator::fuse doc)
 - #84492 (rustdoc: Remove unnecessary dummy span)
 - #84496 (Add some specialization tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-24 04:54:10 +00:00
Yuki Okushi
570eed71ef
Rollup merge of #84436 - jyn514:private, r=petrochenkov
Make a few functions private

These were made public in 3105bcfdc1. This
is so long ago I doubt anyone remembers why they're public. No one outside rustc_session uses
them, including in-tree tools.
2021-04-24 12:17:04 +09:00
bors
a7aba58e96 Auto merge of #83722 - jyn514:stable-help, r=estebank
On stable, suggest removing `#![feature]` for features that have been stabilized

I don't know how to test this (https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Run.20tests.20without.20enabling.20nightly.20features.3F). I confirmed locally that this gives the
appropriate help with `channel = "beta"`:

```
error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:2:1
  |
2 | #![feature(min_const_generics)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the attribute
  |
  = help: the feature `min_const_generics` has been stable since 1.51.0 and no longer requires an attribute to enable

error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:3:1
  |
3 | #![feature(min_const_generics, min_specialization)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: the feature `min_const_generics` has been stable since 1.51.0 and no longer requires an attribute to enable

error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:4:1
  |
4 | #![feature(box_patterns)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
```

Closes https://github.com/rust-lang/rust/issues/83715.
2021-04-24 02:25:54 +00:00
bors
8ad0821b03 Auto merge of #83729 - JohnTitor:issue-43913, r=estebank
Add a suggestion when using a type alias instead of trait alias

Fixes #43913

r? `@estebank`
2021-04-23 23:44:49 +00:00
bors
bb491ed239 Auto merge of #84490 - JohnTitor:rollup-wrdj4ko, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #80805 (Improve `Iterator::by_ref` example)
 - #84248 (Remove duplicated fn(Box<[T]>) -> Vec<T>)
 - #84321 (rustdoc: Convert sub-variant toggle to HTML)
 - #84359 (⬆️ rust-analyzer)
 - #84374 (Clean up .gitignore)
 - #84387 (Move `sys_common::poison` to `sync::poison`)
 - #84430 (doc/platform-support: clarify UEFI support)
 - #84433 (Prevent control, shift and alt keys to make search input lose focus)
 - #84444 (doc: Get rid of "[+] show undocumented items" toggle on numeric From impls)
 - #84456 (Fix ICE if original_span(fn_sig) returns a span not in body sourcefile)
 - #84469 (Update comment on `PrimTy::name_str`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-23 21:03:57 +00:00
Yuki Okushi
62db03cd62
Rollup merge of #84469 - jyn514:dead-code, r=Mark-Simulacrum
Update comment on `PrimTy::name_str`

It's no longer used by rustdoc.
2021-04-24 03:44:15 +09:00
Yuki Okushi
e07c7b5641
Rollup merge of #84456 - richkadel:issue-84421, r=tmandry
Fix ICE if original_span(fn_sig) returns a span not in body sourcefile

Fixes: #84421

r? ````@tmandry````

fyi: ````@wesleywiser```` ````@sdroege```` ````@rajivshah3````
2021-04-24 03:44:13 +09:00
bors
481ba16439 Auto merge of #84339 - alexcrichton:llvm-fptoint-sat, r=nagisa
rustc: Use LLVM's new saturating float-to-int intrinsics

This commit updates rustc, with an applicable LLVM version, to use
LLVM's new `llvm.fpto{u,s}i.sat.*.*` intrinsics to implement saturating
floating-point-to-int conversions. This results in a little bit tighter
codegen for x86/x86_64, but the main purpose of this is to prepare for
upcoming changes to the WebAssembly backend in LLVM where wasm's
saturating float-to-int instructions will now be implemented with these
intrinsics.

This change allows simplifying a good deal of surrounding code, namely
removing a lot of wasm-specific behavior. WebAssembly no longer has any
special-casing of saturating arithmetic instructions and the need for
`fptoint_may_trap` is gone and all handling code for that is now
removed. This means that the only wasm-specific logic is in the
`fpto{s,u}i` instructions which only get used for "out of bounds is
undefined behavior". This does mean that for the WebAssembly target
specifically the Rust compiler will no longer be 100% compatible with
pre-LLVM 12 versions, but it seems like that's unlikely to be relied on
by too many folks.

Note that this change does immediately regress the codegen of saturating
float-to-int casts on WebAssembly due to the specialization of the LLVM
intrinsic not being present in our LLVM fork just yet. I'll be following
up with an LLVM update to pull in those patches, but affects a few other
SIMD things in flight for WebAssembly so I wanted to separate this change.

Eventually the entire `cast_float_to_int` function can be removed when
LLVM 12 is the minimum version, but that will require sinking the
complexity of it into other backends such as Cranelfit.
2021-04-23 18:35:49 +00:00
Alex Crichton
35ae752231 Disable LLVM's new fptoint intrinsics on riscv64
Looks like this platform still isn't quite working yet due to
https://bugs.llvm.org/show_bug.cgi?id=50083
2021-04-23 07:45:23 -07:00
bors
236580bc5b Auto merge of #83425 - durin42:llvm-update, r=nagisa
RustWrapper: work around unification of diagnostic handlers

This lets me build against llvm/main as of March 23rd, 2021. I'm not
entirely sure this is _correct_, but it appears to be functionally
identical to what was done in LLVM: existing callsites of
setInlineAsmDiagnosticHandler were moved to SetDiagnosticHandler() on
the context object, which we already set up in both places that we
called setInlineAsmDiagnosticHandler().
2021-04-23 05:29:12 +00:00
Joshua Nelson
2b026782d8 Update comment on PrimTy::name_str 2021-04-22 23:32:48 -04:00
Rich Kadel
a07bf2e174 Fix ICE if original_span(fn_sig) returns a span not in body sourcefile
Fixes: #84421
2021-04-22 15:49:13 -07:00
bors
7f4afdf025 Auto merge of #84420 - workingjubilee:microvec, r=Mark-Simulacrum
Use arrayvec 0.7, drop smallvec 0.6

With the arrival of min const generics, many alt-vec libraries have
updated to use it in some way and arrayvec is no exception. Use the
latest with minor refactoring.

Also, rustc_workspace_hack is the only user of smallvec 0.6 in the
entire tree, so drop it.
2021-04-22 21:01:24 +00:00
Augie Fackler
fc2a74c640 RustWrapper: work around unification of diagnostic handlers
This lets me build against llvm/main as of March 23rd, 2021. I'm not
entirely sure this is _correct_, but it appears to be functionally
identical to what was done in LLVM: existing callsites of
setInlineAsmDiagnosticHandler were moved to SetDiagnosticHandler() on
the context object, which we already set up in both places that we
called setInlineAsmDiagnosticHandler().
2021-04-22 15:46:47 -04:00
Dylan DPC
f180c1e05d
Rollup merge of #84404 - tmiasko:intrinsics-in-coercion-lub, r=Mark-Simulacrum
Check for intrinsics before coercing to a function pointer

Return an error if coercing function items / non-capturing closures
to a common function pointer type would require reifying an intrinsic.

Turns ICE reported in #84297 into a proper error.
2021-04-22 18:14:42 +02:00
Dylan DPC
9b432e0234
Rollup merge of #84377 - jackh726:binder-refactor-fix, r=nikomatsakis
Followup to #83944

Some cleanups requested by ``@nikomatsakis``

r? ``@nikomatsakis``
2021-04-22 18:14:39 +02:00
Dylan DPC
2f438e31f5
Rollup merge of #84343 - camsteffen:closure-tree, r=varkor
Remove `ScopeTree::closure_tree`

Seems to be dead code since #50649.
2021-04-22 18:14:32 +02:00
Joshua Nelson
1a46b26422 Make a few functions private
These were made public in 3105bcfdc1. This
is so long ago I doubt anyone remembers why they're public. No one uses
them, including in-tree tools.
2021-04-22 09:22:30 -04:00
bors
25c15cdbe0 Auto merge of #71511 - hi-rustin:rustin-patch-rename-assoc, r=eddyb,varkor
Rename AssociatedItems to AssocItems

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

Part of https://github.com/rust-lang/rust/issues/60163#issuecomment-605308641
2021-04-22 11:32:50 +00:00
Jubilee Young
e8eb691c1f Use arrayvec 0.7, drop smallvec 0.6
With the arrival of min const generics, many alt-vec libraries have
updated to use it in some way and arrayvec is no exception. Use the
latest with minor refactoring.

Also, rustc_workspace_hack is the only user of smallvec 0.6 in the
entire tree, so drop it.
2021-04-21 22:39:08 -07:00
bors
71965ab4d0 Auto merge of #84411 - m-ou-se:rollup-9btsp2t, r=m-ou-se
Rollup of 12 pull requests

Successful merges:

 - #84013 (Replace all `fmt.pad` with `debug_struct`)
 - #84119 (Move `sys::vxworks` code to `sys::unix`)
 - #84212 (Replace `Void` in `sys` with never type)
 - #84251 (fix 'const-stable since' for NonZeroU*::new_unchecked)
 - #84301 (Document that `index` and `index_mut` can panic)
 - #84365 (Improve the docstrings of the `Lto` struct.)
 - #84378 (Fix broken doc link)
 - #84379 (Add GAT related tests)
 - #84380 (Write Rustdoc titles like "x in crate::mod - Rust")
 - #84390 (Format `Struct { .. }` on one line even with `{:#?}`.)
 - #84393 (Support `x.py doc std --open`)
 - #84406 (Remove `delete` alias from `mem::drop`.)

Failed merges:

 - #84387 (Move `sys_common::poison` to `sync::poison`)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-22 05:01:30 +00:00
Mara Bos
6967b68667
Rollup merge of #84365 - vext01:improve-lto-docstrings, r=petrochenkov
Improve the docstrings of the `Lto` struct.

This change is the result of [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Making.20sense.20of.20LTO.20modes.20in.20rustc).

Hopefully it makes things a little clearer. What do you think?
2021-04-21 23:06:17 +02:00
The8472
7f45cdb090 bump jobserver dependency
the newest jobserver version should slightly reduce context switches
in highly parallel build environments on linux kernels >= 5.6
2021-04-21 22:02:54 +02:00
Jack Huey
c78724f869 More review changes 2021-04-21 12:26:19 -04:00
Jack Huey
b78c0d8a4d Review comments 2021-04-21 11:49:59 -04:00
Alex Crichton
de2a4601ab rustc: Use LLVM's new saturating float-to-int intrinsics
This commit updates rustc, with an applicable LLVM version, to use
LLVM's new `llvm.fpto{u,s}i.sat.*.*` intrinsics to implement saturating
floating-point-to-int conversions. This results in a little bit tighter
codegen for x86/x86_64, but the main purpose of this is to prepare for
upcoming changes to the WebAssembly backend in LLVM where wasm's
saturating float-to-int instructions will now be implemented with these
intrinsics.

This change allows simplifying a good deal of surrounding code, namely
removing a lot of wasm-specific behavior. WebAssembly no longer has any
special-casing of saturating arithmetic instructions and the need for
`fptoint_may_trap` is gone and all handling code for that is now
removed. This means that the only wasm-specific logic is in the
`fpto{s,u}i` instructions which only get used for "out of bounds is
undefined behavior". This does mean that for the WebAssembly target
specifically the Rust compiler will no longer be 100% compatible with
pre-LLVM 12 versions, but it seems like that's unlikely to be relied on
by too many folks.

Note that this change does immediately regress the codegen of saturating
float-to-int casts on WebAssembly due to the specialization of the LLVM
intrinsic not being present in our LLVM fork just yet. I'll be following
up with an LLVM update to pull in those patches, but affects a few other
SIMD things in flight for WebAssembly so I wanted to separate this change.

Eventually the entire `cast_float_to_int` function can be removed when
LLVM 12 is the minimum version, but that will require sinking the
complexity of it into other backends such as Cranelfit.
2021-04-21 07:15:53 -07:00
Jack Huey
4568e7d62e Move nested quantification check to ast_validation 2021-04-21 03:12:04 -04:00
Tomasz Miąsko
75732dd00e Check for intrinsics before coercing to a function pointer
Return an error if coercing function items / non-capturing closures
to a common function pointer type would require reifying an intrinsic.
2021-04-21 00:00:00 +00:00
Jack Huey
9891582897 Remove TraitRefHackInner and use the concatenating functionality instead of trait_ref_hack 2021-04-20 16:43:04 -04:00
Jack Huey
457c4c133a Add BinderScopeType to replace binder_depth and from_poly_trait_ref 2021-04-20 16:42:46 -04:00
Jack Huey
32942ab807 A non-minimal set of TraitRefBoundarys to work on removing from_poly_trait_ref 2021-04-20 16:41:54 -04:00
Jack Huey
ba3d22ed66 Precompute inverse binder depth 2021-04-20 16:41:54 -04:00
bors
6df26f897c Auto merge of #84353 - estebank:as-ref-mir, r=davidtwco
Suggest `.as_ref()` on borrow error involving `Option`/`Result`

When encountering a E0382 borrow error involving an `Option` or `Result`
provide a suggestion to use `.as_ref()` on the prior move location to
avoid the move.

Fix #84165.
2021-04-20 14:05:12 +00:00
Oli Scherer
6e988c0613 Typo 2021-04-20 09:30:28 -04:00
Oli Scherer
a46bc5664a Tidy 2021-04-20 09:30:28 -04:00
Oli Scherer
a2f2179026 Add an attribute to be able to configure the limit 2021-04-20 09:30:28 -04:00
Oli Scherer
e9696c8b62 Implement a lint that highlights all moves larger than 1000 bytes 2021-04-20 09:30:21 -04:00
Edd Barrett
8cc918a3dc Improve the docstrings of the Lto struct. 2021-04-20 10:28:17 +01:00
bors
6af1e632a9 Auto merge of #84323 - richkadel:uncovered-functions, r=tmandry
coverage of async function bodies should match non-async

This fixes some missing coverage within async function bodies.

Commit 1 demonstrates the problem in the fixed issue, and commit 2 corrects it.

Fixes: #83985
2021-04-20 08:33:51 +00:00
bors
b2c20b51ed Auto merge of #84295 - richkadel:continue-coverage, r=tmandry
Add coverage to continue statements

`continue` statements were missing coverage. This was particularly
noticeable in a match pattern that contained only a `continue`
statement, leaving the branch appear uncounted. This PR addresses the
problem and adds tests to prove it.

r? `@tmandry`
cc: `@wesleywiser`
2021-04-20 03:08:24 +00:00
bors
e888a57da8 Auto merge of #84334 - klensy:typo-compiler, r=jyn514
fix few typos in comments
2021-04-20 00:16:45 +00:00
Esteban Küber
2763a0541c Suggest .as_ref() on borrow error involving Option/Result
When encountering a E0382 borrow error involving an `Option` or `Result`
provide a suggestion to use `.as_ref()` on the prior move location to
avoid the move.

Fix #84165.
2021-04-19 17:14:37 -07:00
bors
9d9c2c92b8 Auto merge of #84342 - Dylan-DPC:rollup-5b40142, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #84123 (Introduce CompileMonoItem DepNode)
 - #84126 (Enable sanitizers for x86_64-unknown-linux-musl)
 - #84168 (Lower async fn in traits.)
 - #84256 (doc: use U+2212 for minus sign in floating-point -0.0 remarks)
 - #84291 (fix aliasing violations in thread_local_const_init)
 - #84313 (fix suggestion for unsized function parameters)
 - #84330 (Remove unused footer section)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-19 20:49:27 +00:00
Cameron Steffen
c9c14d0c1f Small refactor 2021-04-19 15:40:21 -05:00
Cameron Steffen
98a11e01e5 Remove closure_tree 2021-04-19 15:40:20 -05:00
Dylan DPC
349fae3a32
Rollup merge of #84313 - lcnr:sized-err-msg, r=petrochenkov
fix suggestion for unsized function parameters

taken from `@fasterthanlime's` article https://fasterthanli.me/articles/whats-in-the-box
2021-04-19 22:00:10 +02:00