Commit graph

142413 commits

Author SHA1 Message Date
Ralf Jung
588530d096
fix typography 2021-04-25 18:41:14 +02:00
Ralf Jung
421d54e4aa fix clippy 2021-04-25 17:05:48 +02:00
Ralf Jung
b1ad1fbc03 make sure raw ptr casts in 'const' context are unsafe 2021-04-25 16:34:38 +02:00
Ralf Jung
43126f3573 get rid of min_const_fn references in library/ and rustdoc 2021-04-25 14:14:19 +02:00
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
5da10c0121 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>
2021-04-25 04:45:39 +00:00
bors
f7c468fe9a 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.
2021-04-25 01:57:10 +00:00
Joshua Nelson
ba36142850 Finally (finally) ((finally!!!!)) fix spans for the standard library 2021-04-24 19:21:48 -04:00
Joshua Nelson
c44c64df71 Get rid of item.span
- Remove `span` field, adding `Item::span()` instead
- Special-case `Impl` and `Module` items
- Use dummy spans for primitive items
2021-04-24 19:21:48 -04:00
Joshua Nelson
b412b46cf7 Do the hard part first
The only bit failing was the module, so change that before removing the
`span` field.
2021-04-24 19:20:46 -04: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
Joshua Nelson
a4b6214279 Add attr_span helper function 2021-04-24 19:14:27 -04:00
Ralf Jung
49054c3617 update rustc-perf version that is used for PGO 2021-04-24 23:17:06 +02:00
bors
42816d61ea 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.
2021-04-24 20:35:12 +00:00
bors
7e11f3a8f3 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
2021-04-24 17:44:46 +00:00
Yuki Okushi
5716bab1ab
Rollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jsha
Clean up DOM strings

Follow-up of #84320.

r? ``@jsha``
2021-04-25 01:53:16 +09:00
Yuki Okushi
e25c5e2c25
Rollup merge of #84464 - jyn514:type-kind, r=CraftSpider
rustdoc: Get rid of `clean::TypeKind`

It does exactly the same thing as ItemType.
2021-04-25 01:53:15 +09:00
Yuki Okushi
b566d0ae12
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```
2021-04-25 01:53:14 +09:00
Yuki Okushi
46c517b7c4
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``
2021-04-25 01:53:13 +09:00
Yuki Okushi
277b88be30
Rollup merge of #84427 - flip1995:clippyup, r=Manishearth
Update Clippy

r? ```@Manishearth```

Biweekly Clippy update.
2021-04-25 01:53:12 +09:00
Yuki Okushi
78306f03ef
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`.
2021-04-25 01:53:11 +09:00
Yuki Okushi
46b67ab0f9
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
2021-04-25 01:53:10 +09: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
Joshua Nelson
03ace761fb rustdoc: Turn JsonRenderer::mod_item_in into unreachable!()
The JSON renderer no longer gets called on modules.
2021-04-24 11:03:02 -04:00
bors
2b68027841 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)
2021-04-24 14:49:26 +00:00
Guillaume Gomez
9c30382fd0 Clean up DOM strings 2021-04-24 14:44:43 +02:00
David Hewitt
5b05f687db Revert "rustdoc: Hide #text in doc-tests"
This reverts commit af6c3201fc.
2021-04-24 11:54:44 +01: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
ec61abf9a9
Rollup merge of #84496 - marmeladema:specialization-test, r=JohnTitor
Add some specialization tests

Closes #33017
Closes #51892

r? `@JohnTitor`
2021-04-24 12:17:11 +09:00
Yuki Okushi
aae871d6e3
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`
2021-04-24 12:17:10 +09:00
Yuki Okushi
ed991a36b0
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
2021-04-24 12:17:09 +09:00
Yuki Okushi
740e1f4e04
Rollup merge of #84485 - marmeladema:trait-tests, r=jackh726
Add some associated type bounds tests

Closes #83017
Closes #81193

r? `@jackh726`
2021-04-24 12:17:08 +09:00
Yuki Okushi
8d75898dbb
Rollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomez
Remove unnecessary fields and parameters in rustdoc

r? `@GuillaumeGomez`
2021-04-24 12:17:07 +09:00
Yuki Okushi
ed5646bfee
Rollup merge of #84453 - notriddle:waker-from-docs, r=cramertj
Document From implementations for Waker and RawWaker

CC #51430
2021-04-24 12:17:06 +09: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
Yuki Okushi
b4544698d3
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.
2021-04-24 12:17:03 +09:00
Yuki Okushi
5321f9559b
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.
2021-04-24 12:17:02 +09:00
Yuki Okushi
c00439f682
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
2021-04-24 12:17:01 +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
Eric Huss
893ca665f5 Update cargo, rls 2021-04-23 15:46:51 -07:00
marmeladema
9b430df4dc Add test for issue #51892 2021-04-23 23:12:21 +01:00
marmeladema
a657e17a7f Add test for issue #33017 2021-04-23 23:09:26 +01: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
Joshua Nelson
ab54197a46 Fix macro bug in impl From<DefKind> for ItemType
This was missed a while ago when support for proc-macro attributes was
first added.
2021-04-23 15:56:50 -04:00
Joshua Nelson
18ee323b93 Don't repeat hir::def::DefKind so much 2021-04-23 15:56:41 -04:00
Joshua Nelson
8fd29bf6a1 Remove unused impl Clean<ItemType> for DefKind 2021-04-23 15:56:32 -04:00
Joshua Nelson
0a9b2cae5d Remove TypeKind 2021-04-23 15:56:23 -04:00
Joshua Nelson
f3ef4b2cef Use ItemType in cache 2021-04-23 15:56:14 -04:00