Commit graph

142512 commits

Author SHA1 Message Date
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
Esteban Küber
fb1fb7d2ef Tweak suggestion output 2021-04-23 18:57:52 -07:00
Esteban Küber
64ee9cc28c Recover trait import suggestion 2021-04-23 18:12:54 -07:00
Esteban Küber
862901781d Add regression test 2021-04-23 18:08:51 -07: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
Jane Lusby
81e4d5f96c add special case for typeof fallback 2021-04-23 13:28:17 -07: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
Joshua Nelson
1481af9f59 Take ItemType instead of TypeKind in record_extern_fqn 2021-04-23 15:56:12 -04:00
Joshua Nelson
7c50b82ffe rustdoc: Remove unnecessary dummy span 2021-04-23 15:51:47 -04:00
Joshua Nelson
e29f46ce37 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.
2021-04-23 15:33:18 -04: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
Yuki Okushi
9ada731c65
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
2021-04-24 03:44:12 +09:00
Yuki Okushi
a50f502766
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````
2021-04-24 03:44:11 +09:00
Yuki Okushi
a050a49ca3
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.
2021-04-24 03:44:10 +09:00
Yuki Okushi
ace3bd4f8b
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.
2021-04-24 03:44:09 +09:00
Yuki Okushi
8de00b3cbf
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`
2021-04-24 03:44:08 +09:00
Yuki Okushi
05588067fa
Rollup merge of #84359 - lnicola:rust-analyzer-2021-04-20, r=jonas-schievink
⬆️ rust-analyzer
2021-04-24 03:44:06 +09:00
Yuki Okushi
d05e28df15
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.
2021-04-24 03:44:05 +09:00
Yuki Okushi
5b7c98676f
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.
2021-04-24 03:44:04 +09:00
Yuki Okushi
dcb4083ed9
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
2021-04-24 03:44:02 +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
Adrien Morison
21b3b27fe4 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).
2021-04-23 19:13:27 +01:00
Jane Lusby
a49b746da4 cyclesss 2021-04-23 11:07:15 -07:00
Jane Lusby
2ac171f94c try enabling typeof for fun error messages 2021-04-23 11:07:15 -07:00
Smitty
fc97ce6dae add tests for new behavior 2021-04-23 14:06:02 -04:00
Smitty
e4ce655cbf Handle pretty printing of else if let clauses
Closes #84434. Closes #82329.
2021-04-23 13:29:18 -04:00
marmeladema
3b96dfe1d4 Add test for issue #81193 2021-04-23 17:58:43 +01:00
marmeladema
8f41de595d Add test for issue #83017 2021-04-23 17:54:48 +01:00
Arpad Borsos
85879fe83d
improve wording 2021-04-23 18:13:06 +02:00
Alex Crichton
ed6dd40b28 Update wasm test assertions 2021-04-23 08:59:49 -07:00
bors
484c61943f 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
2021-04-23 15:45:52 +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
9a35232611 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.
2021-04-23 13:28:04 +00: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