]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agomove core::hint::black_box under its own feature gate
Ralf Jung [Thu, 15 Apr 2021 09:19:24 +0000 (11:19 +0200)]
move core::hint::black_box under its own feature gate

3 years agoAuto merge of #84115 - CDirkx:rt, r=m-ou-se
bors [Sun, 25 Apr 2021 04:45:39 +0000 (04:45 +0000)]
Auto merge of #84115 - CDirkx:rt, r=m-ou-se

Rework `init` and `cleanup`

This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`.

Full list of changes:
- new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros.
- `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`.
- <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>

3 years agoAuto merge of #80339 - jyn514:no-span, r=GuillaumeGomez
bors [Sun, 25 Apr 2021 01:57:10 +0000 (01:57 +0000)]
Auto merge of #80339 - jyn514:no-span, r=GuillaumeGomez

Calculate `span` info on-demand

- Add helper `attr_span` for common reused function
- Stop storing `Span`s on `Item` directly; calculate them on demand instead
- Special case modules, which have different spans depending on whether
  you use inner or outer attributes
- Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls)
- Use a fake ID for primitives instead of the ID of the crate; this lets
  `source()` know that it should use a dummy span instead of the span of
  the crate.

This shrinks `Item` from 48 to 40 bytes.

Helps with https://github.com/rust-lang/rust/issues/76382.

3 years agoFinally (finally) ((finally!!!!)) fix spans for the standard library
Joshua Nelson [Fri, 23 Apr 2021 04:26:29 +0000 (00:26 -0400)]
Finally (finally) ((finally!!!!)) fix spans for the standard library

3 years agoGet rid of `item.span`
Joshua Nelson [Wed, 24 Mar 2021 05:20:13 +0000 (01:20 -0400)]
Get rid of `item.span`

- Remove `span` field, adding `Item::span()` instead
- Special-case `Impl` and `Module` items
- Use dummy spans for primitive items

3 years agoDo the hard part first
Joshua Nelson [Wed, 24 Mar 2021 04:52:52 +0000 (00:52 -0400)]
Do the hard part first

The only bit failing was the module, so change that before removing the
`span` field.

3 years agoAuto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
bors [Sat, 24 Apr 2021 23:16:03 +0000 (23:16 +0000)]
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?

3 years agoAdd attr_span helper function
Joshua Nelson [Wed, 24 Mar 2021 05:49:12 +0000 (01:49 -0400)]
Add attr_span helper function

3 years agoupdate rustc-perf version that is used for PGO
Ralf Jung [Sat, 24 Apr 2021 21:17:06 +0000 (23:17 +0200)]
update rustc-perf version that is used for PGO

3 years agoAuto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomez
bors [Sat, 24 Apr 2021 20:35:12 +0000 (20:35 +0000)]
Auto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomez

Revert "rustdoc: Hide `#text` in doc-tests"

See discussion in #84502 - I'm worried that #84445 may cause a lot of breakages if this were to hit stable, so I think it's safer to revert and work on the known correct fix #84478.

3 years agoAuto merge of #84525 - JohnTitor:rollup-t2qigt3, r=JohnTitor
bors [Sat, 24 Apr 2021 17:44:46 +0000 (17:44 +0000)]
Auto merge of #84525 - JohnTitor:rollup-t2qigt3, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83519 (Implement a lint that highlights all moves larger than a configured limit)
 - #84105 (stabilize `core::array::{from_ref,from_mut}` in `1.53.0`)
 - #84179 (Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`)
 - #84427 (Update Clippy)
 - #84459 (rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`)
 - #84460 (rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module)
 - #84464 (rustdoc: Get rid of `clean::TypeKind`)
 - #84518 (Clean up DOM strings)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jsha
Yuki Okushi [Sat, 24 Apr 2021 16:53:16 +0000 (01:53 +0900)]
Rollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jsha

Clean up DOM strings

Follow-up of #84320.

r? ``@jsha``

3 years agoRollup merge of #84464 - jyn514:type-kind, r=CraftSpider
Yuki Okushi [Sat, 24 Apr 2021 16:53:15 +0000 (01:53 +0900)]
Rollup merge of #84464 - jyn514:type-kind, r=CraftSpider

rustdoc: Get rid of `clean::TypeKind`

It does exactly the same thing as ItemType.

3 years agoRollup merge of #84460 - jyn514:doctree-is-crate, r=camelid
Yuki Okushi [Sat, 24 Apr 2021 16:53:14 +0000 (01:53 +0900)]
Rollup merge of #84460 - jyn514:doctree-is-crate, r=camelid

rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module

It can be calculated on-demand even without a TyCtxt.

This also changed `json::conversions::from_item_kind` to take a whole item, which avoids
having to add more and more parameters.

Helps with https://github.com/rust-lang/rust/issues/76382.

r? ```@camelid```

3 years agoRollup merge of #84459 - jyn514:json-mod, r=aDotInTheVoid
Yuki Okushi [Sat, 24 Apr 2021 16:53:13 +0000 (01:53 +0900)]
Rollup merge of #84459 - jyn514:json-mod, r=aDotInTheVoid

rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`

The JSON renderer no longer gets called on modules (since https://github.com/rust-lang/rust/pull/83055).

r? ``@aDotInTheVoid``

3 years agoRollup merge of #84427 - flip1995:clippyup, r=Manishearth
Yuki Okushi [Sat, 24 Apr 2021 16:53:12 +0000 (01:53 +0900)]
Rollup merge of #84427 - flip1995:clippyup, r=Manishearth

Update Clippy

r? ```@Manishearth```

Biweekly Clippy update.

3 years agoRollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-se
Yuki Okushi [Sat, 24 Apr 2021 16:53:11 +0000 (01:53 +0900)]
Rollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-se

Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`

Remove the field `_dont_send_or_sync_me: PhantomData<*mut ()>` in favor of an explicit implementation of `!Send` and `!Sync`.

3 years agoRollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-se
Yuki Okushi [Sat, 24 Apr 2021 16:53:10 +0000 (01:53 +0900)]
Rollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-se

stabilize `core::array::{from_ref,from_mut}` in `1.53.0`

I didn't get any response in https://github.com/rust-lang/rust/issues/77101#issuecomment-761831104, so I figured out I can try opening stabilization pr.

---

This PR stabilizes following functions:
```rust
// core::array
pub fn from_ref<T>(s: &T) -> &[T; 1];
pub fn from_mut<T>(s: &mut T) -> &mut [T; 1];
```

Functions are similar to already stabilized `core::slice::{`[`from_ref`](https://doc.rust-lang.org/std/slice/fn.from_ref.html),[`from_mut`](https://doc.rust-lang.org/std/slice/fn.from_mut.html)`}` and were unstable without any problems/questions for a while now.

---

resolves #77101

``@rustbot`` modify labels: +T-libs

3 years agoRollup merge of #83519 - oli-obk:assign_shrink_your_normal_code, r=pnkfelix
Yuki Okushi [Sat, 24 Apr 2021 16:53:09 +0000 (01:53 +0900)]
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.

3 years agorustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`
Joshua Nelson [Thu, 22 Apr 2021 23:47:58 +0000 (19:47 -0400)]
rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`

The JSON renderer no longer gets called on modules.

3 years agoAuto merge of #84412 - ehuss:update-cargo, r=ehuss
bors [Sat, 24 Apr 2021 14:49:26 +0000 (14:49 +0000)]
Auto merge of #84412 - ehuss:update-cargo, r=ehuss

Update cargo, rls

## cargo

18 commits in 65d57e6f384c2317f76626eac116f683e2b63665..0ed318d182e465cd66071b91ac3d265af63ef8a1
2021-04-04 15:07:52 +0000 to 2021-04-23 20:54:54 +0000
- Restore crates.io's `SourceId` hash value to before (rust-lang/cargo#9397)
- Fix loading `branch=master` patches in the v3 lock transition (rust-lang/cargo#9392)
- Update changelog for 1.52 beta changes. (rust-lang/cargo#9396)
- Fix build-std updating the index on every build. (rust-lang/cargo#9393)
- Fix typo in profile docs (rust-lang/cargo#9386)
- Fix disagreement about lockfile ordering on stable/nightly (rust-lang/cargo#9384)
- Don't give a hard error when the end-user specifies RUSTC_BOOTSTRAP=crate_name (rust-lang/cargo#9365)
- Fix rust-lang/cargo#9350 (cargo build -Z help is missing options) (rust-lang/cargo#9369)
- an struct -&gt; a struct (rust-lang/cargo#9379)
- Handle man pages better on Windows. (rust-lang/cargo#9378)
- fix: better error message when dependency/workspace member missing (rust-lang/cargo#9368)
- Fix typo in book (rust-lang/cargo#9376)
- Don't re-use rustc cache when RUSTC_WRAPPER changes (rust-lang/cargo#9348)
- doc: add split-debuginfo doc in config chapter (rust-lang/cargo#9372)
- refactor: remove `CargoResultExt` (rust-lang/cargo#9367)
- Track "CARGO" in environment fingerprint. (rust-lang/cargo#9363)
- Update clippy lint allow set. (rust-lang/cargo#9356)
- Fix 'suport' typo in documentation (rust-lang/cargo#9338)

## rls

3 commits in 32c0fe006dcdc13e1ca0ca31de543e4436c1299e..74d1800c25498689c5b5120a1e8495fce0cd0d0d
2021-04-12 11:21:12 +0000 to 2021-04-22 21:29:51 +0000
- Bump default integration test message timeout to 30s (rust-lang-nursery/rls#1731)
- itertools = 0.9, fst = 0.4 (rust-lang-nursery/rls#1729)
- Update cargo (rust-lang-nursery/rls#1728)

3 years agoClean up DOM strings
Guillaume Gomez [Sat, 24 Apr 2021 12:44:43 +0000 (14:44 +0200)]
Clean up DOM strings

3 years agoRevert "rustdoc: Hide `#text` in doc-tests"
David Hewitt [Sat, 24 Apr 2021 10:54:44 +0000 (11:54 +0100)]
Revert "rustdoc: Hide `#text` in doc-tests"

This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.

3 years agoAuto merge of #84501 - JohnTitor:rollup-wxu1thu, r=JohnTitor
bors [Sat, 24 Apr 2021 04:54:10 +0000 (04:54 +0000)]
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

3 years agoRollup merge of #84496 - marmeladema:specialization-test, r=JohnTitor
Yuki Okushi [Sat, 24 Apr 2021 03:17:11 +0000 (12:17 +0900)]
Rollup merge of #84496 - marmeladema:specialization-test, r=JohnTitor

Add some specialization tests

Closes #33017
Closes #51892

r? `@JohnTitor`

3 years agoRollup merge of #84492 - jyn514:span, r=camelid
Yuki Okushi [Sat, 24 Apr 2021 03:17:10 +0000 (12:17 +0900)]
Rollup merge of #84492 - jyn514:span, r=camelid

rustdoc: Remove unnecessary dummy span

Follow-up to https://github.com/rust-lang/rust/pull/84460#discussion_r619447655.

r? `@camelid`

3 years agoRollup merge of #84489 - amorison:issue-83969-fix, r=yaahc
Yuki Okushi [Sat, 24 Apr 2021 03:17:09 +0000 (12:17 +0900)]
Rollup merge of #84489 - amorison:issue-83969-fix, r=yaahc

Mention FusedIterator case in Iterator::fuse doc

Using `fuse` on an iterator that incorrectly implements
`FusedIterator` does not fuse the iterator. This commit adds a
note about this in the documentation of this method to increase
awareness about this potential issue (esp. when relying on fuse
in unsafe code).

Closes #83969

3 years agoRollup merge of #84485 - marmeladema:trait-tests, r=jackh726
Yuki Okushi [Sat, 24 Apr 2021 03:17:08 +0000 (12:17 +0900)]
Rollup merge of #84485 - marmeladema:trait-tests, r=jackh726

Add some associated type bounds tests

Closes #83017
Closes #81193

r? `@jackh726`

3 years agoRollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomez
Yuki Okushi [Sat, 24 Apr 2021 03:17:07 +0000 (12:17 +0900)]
Rollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomez

Remove unnecessary fields and parameters in rustdoc

r? `@GuillaumeGomez`

3 years agoRollup merge of #84453 - notriddle:waker-from-docs, r=cramertj
Yuki Okushi [Sat, 24 Apr 2021 03:17:06 +0000 (12:17 +0900)]
Rollup merge of #84453 - notriddle:waker-from-docs, r=cramertj

Document From implementations for Waker and RawWaker

CC #51430

3 years agoRollup merge of #84436 - jyn514:private, r=petrochenkov
Yuki Okushi [Sat, 24 Apr 2021 03:17:04 +0000 (12:17 +0900)]
Rollup merge of #84436 - jyn514:private, r=petrochenkov

Make a few functions private

These were made public in 3105bcfdc11030abf9855af7a693cbf904460813. This
is so long ago I doubt anyone remembers why they're public. No one outside rustc_session uses
them, including in-tree tools.

3 years agoRollup merge of #84320 - jsha:details-implementors, r=Manishearth,Nemo157,GuillaumeGomez
Yuki Okushi [Sat, 24 Apr 2021 03:17:03 +0000 (12:17 +0900)]
Rollup merge of #84320 - jsha:details-implementors, r=Manishearth,Nemo157,GuillaumeGomez

Use details tag for trait implementors.

Part of #83332 and following on from #83337 and #83355.

This removes one category of JS-generated toggles (implementors), and replaces them with a `<details>` tag. This simplifies the JS, and fixes some bugs where things that were supposed to be hidden by the toggle were not hidden. Compare https://hoffman-andrews.com/rust/details-implementors/std/io/trait.Read.html#impl-Read vs https://doc.rust-lang.org/nightly/std/io/trait.Read.html#implementors.

This introduces a `left: -23px` to put the toggle in the correct place, matching the current style for `.collapse-toggle`.

It's worth noting this introduces a slight behavior change: since the entire line is now a `<summary>`, any part of the line is clickable. So for instance, in `impl Read for File`, clicking `impl` or `for` will collapse / expand the docs. Clicking `Read` or `File` still links to the appropriate documentation as before.

3 years agoRollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simulacrum
Yuki Okushi [Sat, 24 Apr 2021 03:17:02 +0000 (12:17 +0900)]
Rollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simulacrum

bootstrap: use bash on illumos to run install scripts

The default illumos shell ("sh" in the default PATH) is ksh93, rather
than bash, and does not support constructs like "local" that came from
bash.  The bootstrap function for invoking "install.sh" scripts should
use "bash" explicitly there to avoid issues.

3 years agoRollup merge of #83990 - the8472:take-trusted-len, r=dtolnay
Yuki Okushi [Sat, 24 Apr 2021 03:17:01 +0000 (12:17 +0900)]
Rollup merge of #83990 - the8472:take-trusted-len, r=dtolnay

implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

```````@rustbot``````` label T-libs-impl

3 years agoAuto merge of #83722 - jyn514:stable-help, r=estebank
bors [Sat, 24 Apr 2021 02:25:54 +0000 (02:25 +0000)]
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.

3 years agoAuto merge of #83729 - JohnTitor:issue-43913, r=estebank
bors [Fri, 23 Apr 2021 23:44:49 +0000 (23:44 +0000)]
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`

3 years agoUpdate cargo, rls
Eric Huss [Thu, 22 Apr 2021 22:47:10 +0000 (15:47 -0700)]
Update cargo, rls

3 years agoAdd test for issue #51892
marmeladema [Fri, 23 Apr 2021 22:12:21 +0000 (23:12 +0100)]
Add test for issue #51892

3 years agoAdd test for issue #33017
marmeladema [Fri, 23 Apr 2021 22:09:26 +0000 (23:09 +0100)]
Add test for issue #33017

3 years agoAuto merge of #84490 - JohnTitor:rollup-wrdj4ko, r=JohnTitor
bors [Fri, 23 Apr 2021 21:03:57 +0000 (21:03 +0000)]
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 (:arrow_up: 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

3 years agoFix macro bug in `impl From<DefKind> for ItemType`
Joshua Nelson [Fri, 23 Apr 2021 01:42:50 +0000 (21:42 -0400)]
Fix macro bug in `impl From<DefKind> for ItemType`

This was missed a while ago when support for proc-macro attributes was
first added.

3 years agoDon't repeat `hir::def::DefKind` so much
Joshua Nelson [Fri, 23 Apr 2021 01:41:43 +0000 (21:41 -0400)]
Don't repeat `hir::def::DefKind` so much

3 years agoRemove unused `impl Clean<ItemType> for DefKind`
Joshua Nelson [Fri, 23 Apr 2021 01:37:22 +0000 (21:37 -0400)]
Remove unused `impl Clean<ItemType> for DefKind`

3 years agoRemove `TypeKind`
Joshua Nelson [Fri, 23 Apr 2021 01:28:11 +0000 (21:28 -0400)]
Remove `TypeKind`

3 years agoUse ItemType in cache
Joshua Nelson [Fri, 23 Apr 2021 01:27:19 +0000 (21:27 -0400)]
Use ItemType in cache

3 years agoTake ItemType instead of TypeKind in record_extern_fqn
Joshua Nelson [Fri, 23 Apr 2021 01:23:11 +0000 (21:23 -0400)]
Take ItemType instead of TypeKind in record_extern_fqn

3 years agorustdoc: Remove unnecessary dummy span
Joshua Nelson [Fri, 23 Apr 2021 19:51:47 +0000 (15:51 -0400)]
rustdoc: Remove unnecessary dummy span

3 years agorustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module
Joshua Nelson [Fri, 23 Apr 2021 00:14:24 +0000 (20:14 -0400)]
rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module

It can be calculated on-demand even without a TyCtxt.

This also changed `from_item_kind` to take a whole item, which avoids
having to add more and more parameters.

3 years agoRollup merge of #84469 - jyn514:dead-code, r=Mark-Simulacrum
Yuki Okushi [Fri, 23 Apr 2021 18:44:15 +0000 (03:44 +0900)]
Rollup merge of #84469 - jyn514:dead-code, r=Mark-Simulacrum

Update comment on `PrimTy::name_str`

It's no longer used by rustdoc.

3 years agoRollup merge of #84456 - richkadel:issue-84421, r=tmandry
Yuki Okushi [Fri, 23 Apr 2021 18:44:13 +0000 (03:44 +0900)]
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````

3 years agoRollup merge of #84444 - notriddle:num-docs-from-undocumented-items-toggle, r=yaahc
Yuki Okushi [Fri, 23 Apr 2021 18:44:12 +0000 (03:44 +0900)]
Rollup merge of #84444 - notriddle:num-docs-from-undocumented-items-toggle, r=yaahc

doc: Get rid of "[+] show undocumented items" toggle on numeric From impls

On most From implementations, the docstring is attached to the function. This is also how people have been [recommended] to do it.

Screenshots:

* [before](https://user-images.githubusercontent.com/1593513/115767662-323c5480-a35e-11eb-9918-98aba83e9183.png)
* [after](https://user-images.githubusercontent.com/1593513/115767675-35374500-a35e-11eb-964f-c28eeb6c807a.png)

[recommended]: https://github.com/rust-lang/rust/issues/51430#issuecomment-398322434

3 years agoRollup merge of #84433 - GuillaumeGomez:search-input-blur, r=jsha
Yuki Okushi [Fri, 23 Apr 2021 18:44:11 +0000 (03:44 +0900)]
Rollup merge of #84433 - GuillaumeGomez:search-input-blur, r=jsha

Prevent control, shift and alt keys to make search input lose focus

Part of #84384.

r? ````@jsha````

3 years agoRollup merge of #84430 - dvdhrm:rw/uefidoc, r=Amanieu
Yuki Okushi [Fri, 23 Apr 2021 18:44:10 +0000 (03:44 +0900)]
Rollup merge of #84430 - dvdhrm:rw/uefidoc, r=Amanieu

doc/platform-support: clarify UEFI support

Add missing information on what standard-library features are supported by the UEFI targets.

All current UEFI targets (which is i686 and x86_64) only support no_std cross-compilations. `std` support has not been worked on and is unlikely to emerge anytime soon, due to the much restricted environment that UEFI provides.

3 years agoRollup merge of #84387 - CDirkx:poison, r=m-ou-se
Yuki Okushi [Fri, 23 Apr 2021 18:44:09 +0000 (03:44 +0900)]
Rollup merge of #84387 - CDirkx:poison, r=m-ou-se

Move `sys_common::poison` to `sync::poison`

`sys_common` should not contain publicly exported types, only platform-independent abstractions on top of `sys`, which `sys_common::poison` is not. There is thus no reason for the module to not live under `sync`.

Part of #84187.

3 years agoRollup merge of #84374 - CDirkx:gitignore, r=Mark-Simulacrum
Yuki Okushi [Fri, 23 Apr 2021 18:44:08 +0000 (03:44 +0900)]
Rollup merge of #84374 - CDirkx:gitignore, r=Mark-Simulacrum

Clean up .gitignore

Categorizes entries in the `.gitignore` file.

Other changes:
- added `desktop.ini` (Windows equivalent of `.DS_Store`)
- removed `.hg/` and `.hgignore`

3 years agoRollup merge of #84359 - lnicola:rust-analyzer-2021-04-20, r=jonas-schievink
Yuki Okushi [Fri, 23 Apr 2021 18:44:06 +0000 (03:44 +0900)]
Rollup merge of #84359 - lnicola:rust-analyzer-2021-04-20, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #84321 - Swatinem:subvariant-details, r=GuillaumeGomez
Yuki Okushi [Fri, 23 Apr 2021 18:44:05 +0000 (03:44 +0900)]
Rollup merge of #84321 - Swatinem:subvariant-details, r=GuillaumeGomez

rustdoc: Convert sub-variant toggle to HTML

Instead of creating a JS toggle, this injects details/summary for
sub-variants of enums. This also fixes the CSS so that the toggle button
does not jump when expanding/collapsing.

Takes inspiration from #83337 and should be considered part of #83332. Not quite sure if the `.sub-variant` selectors could be further simplified? AFAICS it is only used in that place, and that does not seem to allow any recursion.

3 years agoRollup merge of #84248 - calebsander:refactor/vec-functions, r=Amanieu
Yuki Okushi [Fri, 23 Apr 2021 18:44:04 +0000 (03:44 +0900)]
Rollup merge of #84248 - calebsander:refactor/vec-functions, r=Amanieu

Remove duplicated fn(Box<[T]>) -> Vec<T>

`<[T]>::into_vec()` does the same thing as `Vec::from::<Box<[T]>>()`, so they can be implemented in terms of each other. This was the previous implementation of `Vec::from()`, but was changed in #78461. I'm not sure what the rationale was for that change, but it seems preferable to maintain a single implementation.

3 years agoRollup merge of #80805 - camelid:iter-by_ref-example, r=steveklabnik
Yuki Okushi [Fri, 23 Apr 2021 18:44:02 +0000 (03:44 +0900)]
Rollup merge of #80805 - camelid:iter-by_ref-example, r=steveklabnik

Improve `Iterator::by_ref` example

I split the example into two: one that fails to compile, and one that
works. I also made them identical except for the addition of `by_ref`
so we don't confuse readers with random differences.

cc `@steveklabnik,` who is the one that added the previous version of this example

3 years agoAuto merge of #84339 - alexcrichton:llvm-fptoint-sat, r=nagisa
bors [Fri, 23 Apr 2021 18:35:49 +0000 (18:35 +0000)]
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.

3 years agoMention FusedIterator case in Iterator::fuse doc
Adrien Morison [Fri, 23 Apr 2021 17:59:10 +0000 (18:59 +0100)]
Mention FusedIterator case in Iterator::fuse doc

Using `fuse` on an iterator that incorrectly implements
`FusedIterator` does not fuse the iterator. This commit adds a
note about this in the documentation of this method to increase
awareness about this potential issue (esp. when relying on fuse
in unsafe code).

3 years agoAdd test for issue #81193
marmeladema [Fri, 23 Apr 2021 16:58:43 +0000 (17:58 +0100)]
Add test for issue #81193

3 years agoAdd test for issue #83017
marmeladema [Fri, 23 Apr 2021 16:01:27 +0000 (17:01 +0100)]
Add test for issue #83017

3 years agoimprove wording
Arpad Borsos [Mon, 19 Apr 2021 20:59:23 +0000 (22:59 +0200)]
improve wording

3 years agoUpdate wasm test assertions
Alex Crichton [Fri, 23 Apr 2021 15:59:49 +0000 (08:59 -0700)]
Update wasm test assertions

3 years agoAuto merge of #84457 - jyn514:cleanup-crate, r=GuillaumeGomez
bors [Fri, 23 Apr 2021 15:45:52 +0000 (15:45 +0000)]
Auto merge of #84457 - jyn514:cleanup-crate, r=GuillaumeGomez

rustdoc: Remove most fields from ExternalCrate

Once https://github.com/rust-lang/rust/issues/84304 is fixed, I can get rid of ExternCrate altogether in favor of CrateNum, but in the meantime, this shrinks ExternalCrate quite a lot.

This might hurt compile-times; if it does, I can add `primitive` and `keyword` queries. I expect this to improve compilemem.

Helps with https://github.com/rust-lang/rust/issues/76382.

r? GuillaumeGomez

3 years agoDisable LLVM's new fptoint intrinsics on riscv64
Alex Crichton [Thu, 22 Apr 2021 21:33:45 +0000 (14:33 -0700)]
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

3 years agoAuto merge of #84445 - jyn514:hidden, r=<try>
bors [Fri, 23 Apr 2021 13:28:04 +0000 (13:28 +0000)]
Auto merge of #84445 - jyn514:hidden, r=<try>

rustdoc: Hide `#text` in doc-tests

Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.

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

3 years agoAuto merge of #83425 - durin42:llvm-update, r=nagisa
bors [Fri, 23 Apr 2021 05:29:12 +0000 (05:29 +0000)]
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().

3 years agoUpdate comment on `PrimTy::name_str`
Joshua Nelson [Fri, 23 Apr 2021 03:19:46 +0000 (23:19 -0400)]
Update comment on `PrimTy::name_str`

3 years agoAuto merge of #82585 - TrolledWoods:master, r=dtolnay
bors [Fri, 23 Apr 2021 02:48:13 +0000 (02:48 +0000)]
Auto merge of #82585 - TrolledWoods:master, r=dtolnay

Added CharIndices::offset function

The CharIndices iterator has a field internally called front_offset, that I think would be very useful to have access to.

You can already do something like ``char_indices.next().map(|(offset, _)| offset)``, but that is wordy, in addition to not handling the case where the iterator has ended, where you'd want the offset to be equal to the length.

I'm very new to the open source world and the rust repository, so I'm sorry if I missed a step or did something weird.

3 years agoAuto merge of #78681 - m-ou-se:binary-heap-retain, r=Amanieu
bors [Fri, 23 Apr 2021 00:07:19 +0000 (00:07 +0000)]
Auto merge of #78681 - m-ou-se:binary-heap-retain, r=Amanieu

Improve rebuilding behaviour of BinaryHeap::retain.

This changes `BinaryHeap::retain` such that it doesn't always fully rebuild the heap, but only rebuilds the parts for which that's necessary.

This makes use of the fact that retain gives out `&T`s and not `&mut T`s.

Retaining every element or removing only elements at the end results in no rebuilding at all. Retaining most elements results in only reordering the elements that got moved (those after the first removed element), using the same logic as was already used for `append`.

cc `@KodrAus` `@sfackler` - We briefly discussed this possibility in the meeting last week while we talked about stabilization of this function (#71503).

3 years agoRemove unnecessary item_name parameter to `mod_item_in`
Joshua Nelson [Thu, 22 Apr 2021 23:53:38 +0000 (19:53 -0400)]
Remove unnecessary item_name parameter to `mod_item_in`

3 years agoRemove unnecessary `item_name` parameter to `mod_item_out`
Joshua Nelson [Thu, 22 Apr 2021 23:46:53 +0000 (19:46 -0400)]
Remove unnecessary `item_name` parameter to `mod_item_out`

3 years agoRemove unnecessary `edition` field on SharedContext
Joshua Nelson [Thu, 22 Apr 2021 23:38:20 +0000 (19:38 -0400)]
Remove unnecessary `edition` field on SharedContext

3 years agoRemove unnecessary `edition` parameter to renderer
Joshua Nelson [Thu, 22 Apr 2021 23:35:20 +0000 (19:35 -0400)]
Remove unnecessary `edition` parameter to renderer

3 years agoRemove unnecessary `diag` parameter to `after_krate`
Joshua Nelson [Thu, 22 Apr 2021 23:32:24 +0000 (19:32 -0400)]
Remove unnecessary `diag` parameter to `after_krate`

3 years agoRemove unnecessary `crate_name` parameter to `after_krate`
Joshua Nelson [Thu, 22 Apr 2021 23:27:37 +0000 (19:27 -0400)]
Remove unnecessary `crate_name` parameter to `after_krate`

It's always `tcx.crate_name(LOCAL_CRATE)`, it doesn't need to be passed
in separately.

3 years agoRemove `keywords` from ExternCrate
Joshua Nelson [Thu, 22 Apr 2021 23:16:41 +0000 (19:16 -0400)]
Remove `keywords` from ExternCrate

3 years agoGet rid of ExternCrate::primitives
Joshua Nelson [Thu, 22 Apr 2021 23:10:22 +0000 (19:10 -0400)]
Get rid of ExternCrate::primitives

3 years agoRemove `name` field from ExternalCrate
Joshua Nelson [Thu, 22 Apr 2021 23:02:09 +0000 (19:02 -0400)]
Remove `name` field from ExternalCrate

3 years agoRemove src field from ExternCrate
Joshua Nelson [Thu, 22 Apr 2021 22:54:48 +0000 (18:54 -0400)]
Remove src field from ExternCrate

3 years agoFix ICE if original_span(fn_sig) returns a span not in body sourcefile
Rich Kadel [Thu, 22 Apr 2021 22:49:13 +0000 (15:49 -0700)]
Fix ICE if original_span(fn_sig) returns a span not in body sourcefile

Fixes: #84421
3 years agorustdoc: Hide `#text` in doc-tests
Joshua Nelson [Thu, 22 Apr 2021 18:50:56 +0000 (14:50 -0400)]
rustdoc: Hide `#text` in doc-tests

Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.

3 years agoExplicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`
Christiaan Dirkx [Wed, 14 Apr 2021 02:04:27 +0000 (04:04 +0200)]
Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`

3 years agoDocument From implementations for Waker and RawWaker
Michael Howell [Thu, 22 Apr 2021 21:16:33 +0000 (14:16 -0700)]
Document From implementations for Waker and RawWaker

3 years agoAuto merge of #84420 - workingjubilee:microvec, r=Mark-Simulacrum
bors [Thu, 22 Apr 2021 21:01:24 +0000 (21:01 +0000)]
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.

3 years agoRustWrapper: work around unification of diagnostic handlers
Augie Fackler [Tue, 23 Mar 2021 22:23:28 +0000 (18:23 -0400)]
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().

3 years agoGet rid of "[+] show undocumented items" toggle on numeric From impls
Michael Howell [Thu, 22 Apr 2021 18:24:36 +0000 (11:24 -0700)]
Get rid of "[+] show undocumented items" toggle on numeric From impls

On most From implementations, the docstring is attached to the
function. This is also how people have been [recommended] to do it.

Screenshots:

* [before](https://user-images.githubusercontent.com/1593513/115767662-323c5480-a35e-11eb-9918-98aba83e9183.png)
* [after](https://user-images.githubusercontent.com/1593513/115767675-35374500-a35e-11eb-964f-c28eeb6c807a.png)

[recommended]: https://github.com/rust-lang/rust/issues/51430#issuecomment-398322434

3 years agoAuto merge of #84440 - Dylan-DPC:rollup-0xjb8oi, r=Dylan-DPC
bors [Thu, 22 Apr 2021 18:17:23 +0000 (18:17 +0000)]
Auto merge of #84440 - Dylan-DPC:rollup-0xjb8oi, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #84343 (Remove `ScopeTree::closure_tree`)
 - #84376 (Uses flex to fix formatting of h1 at any width)
 - #84377 (Followup to #83944)
 - #84396 (Update LLVM submodule)
 - #84402 (Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`)
 - #84404 (Check for intrinsics before coercing to a function pointer)
 - #84413 (Remove `sys::args::Args::inner_debug` and use `Debug` instead)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #84413 - CDirkx:args_inner_debug, r=m-ou-se
Dylan DPC [Thu, 22 Apr 2021 16:14:43 +0000 (18:14 +0200)]
Rollup merge of #84413 - CDirkx:args_inner_debug, r=m-ou-se

Remove `sys::args::Args::inner_debug` and use `Debug` instead

This removes the method `sys::args::Args::inner_debug` on all platforms and implements `Debug` for `Args` instead.

I believe this creates a more natural API for the different platforms under `sys`: export a type `Args: Debug + Iterator + ...` vs. `Args: Iterator + ...` and with a method `inner_debug`.

3 years agoRollup merge of #84404 - tmiasko:intrinsics-in-coercion-lub, r=Mark-Simulacrum
Dylan DPC [Thu, 22 Apr 2021 16:14:42 +0000 (18:14 +0200)]
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.

3 years agoRollup merge of #84402 - CDirkx:rwlock, r=dtolnay
Dylan DPC [Thu, 22 Apr 2021 16:14:41 +0000 (18:14 +0200)]
Rollup merge of #84402 - CDirkx:rwlock, r=dtolnay

Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`

This moves `sys_common::rwlock::StaticRwLock`, `RWLockReadGuard` and `RWLockWriteGuard` to `sys::unix::rwlock`. They are already `#[cfg(unix)]` and don't need to be in `sys_common`.

3 years agoRollup merge of #84396 - Amanieu:fix_compiler_builtins_llvm, r=cuviper
Dylan DPC [Thu, 22 Apr 2021 16:14:40 +0000 (18:14 +0200)]
Rollup merge of #84396 - Amanieu:fix_compiler_builtins_llvm, r=cuviper

Update LLVM submodule

Fixes #83467

3 years agoRollup merge of #84377 - jackh726:binder-refactor-fix, r=nikomatsakis
Dylan DPC [Thu, 22 Apr 2021 16:14:39 +0000 (18:14 +0200)]
Rollup merge of #84377 - jackh726:binder-refactor-fix, r=nikomatsakis

Followup to #83944

Some cleanups requested by ``@nikomatsakis``

r? ``@nikomatsakis``

3 years agoRollup merge of #84376 - torhovland:issue-84534, r=GuillaumeGomez
Dylan DPC [Thu, 22 Apr 2021 16:14:37 +0000 (18:14 +0200)]
Rollup merge of #84376 - torhovland:issue-84534, r=GuillaumeGomez

Uses flex to fix formatting of h1 at any width

Fixes #84354.

3 years agoRollup merge of #84343 - camsteffen:closure-tree, r=varkor
Dylan DPC [Thu, 22 Apr 2021 16:14:32 +0000 (18:14 +0200)]
Rollup merge of #84343 - camsteffen:closure-tree, r=varkor

Remove `ScopeTree::closure_tree`

Seems to be dead code since #50649.

3 years agoRemove `Once` from `init`
Christiaan Dirkx [Wed, 21 Apr 2021 14:21:10 +0000 (16:21 +0200)]
Remove `Once` from `init`

3 years agoDocument that `init` and `cleanup` are not guaranteed to run
Christiaan Dirkx [Sun, 18 Apr 2021 05:19:39 +0000 (07:19 +0200)]
Document that `init` and `cleanup` are not guaranteed to run

3 years agoApply suggestions from review
Christiaan Dirkx [Sun, 18 Apr 2021 03:13:53 +0000 (05:13 +0200)]
Apply suggestions from review