Commit graph

133658 commits

Author SHA1 Message Date
bors
5d5ff84130 Auto merge of #77872 - Xaeroxe:stabilize-clamp, r=scottmcm
Stabilize clamp

Tracking issue: https://github.com/rust-lang/rust/issues/44095

Clamp has been merged and unstable for about a year and a half now. How do we feel about stabilizing this?
2020-11-22 10:50:04 +00:00
bors
20328b5323 Auto merge of #79275 - integer32llc:doc-style, r=jonas-schievink
More consistently use spaces after commas in lists in docs

This PR changes instances of lists that didn't use spaces after commas, like `vec![1,2,3]`, to `vec![1, 2, 3]` to be more consistent with idiomatic Rust style (the way these were looks strange to me, especially because there are often lists that *do* use spaces after the commas later in the same code block 😬).

I noticed one of these in an example in the stdlib docs and went looking for more, but as far as I can see, I'm only changing those spots in user-facing documentation or rustc output, and the changes make no semantic difference.
2020-11-22 08:30:23 +00:00
bors
8ca930aa26 Auto merge of #79229 - sdroege:slice-fill-memset, r=dtolnay
Add "memset" as doc alias to slice::fill()

Similar to 53f969dfd1 and should make it easier for people coming from C to find this function.
2020-11-22 04:27:03 +00:00
bors
70090118c2 Auto merge of #78752 - jyn514:html-diff, r=GuillaumeGomez
Give a better error when rustdoc tests fail

- Run the default rustdoc against the current rustdoc
- Diff output recursively
- Colorize diff output

Closes https://github.com/rust-lang/rust/issues/78750.

## Resolved questions

- Should this be opt-in instead of on by default?
  + No
- Should this call through to `delta`? That's not a very common program to have installed, but I'm not sure how to do diffs after the fact. Maybe `compiletest` can take a `--syntax-highlighter` parameter or something?
  + I decided to use `delta` if available and `diff --color` otherwise. It prints a warning if delta isn't installed so you know you can get nicer diffs

## Open questions.

- What version of rustdoc would this compare against? Ideally it would compare against `$(git merge-base HEAD origin/master)` - maybe that's feasible if we install those artifacts from CI?
- Does it always make sense to compare the tests? Especially for new tests, I'm not sure how useful it would be ... but then again, one of the questions I want to know most as a reviewer is 'did it break before?'.

r? `@GuillaumeGomez`
cc `@Mark-Simulacrum`
2020-11-22 01:09:04 +00:00
bors
a1a13b2bc4 Auto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieu
Add support for custom allocators in `Vec`

This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections.

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873: Crater-test to solve rust-lang/wg-allocators#1
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate
2020-11-21 22:46:50 +00:00
bors
da38469480 Auto merge of #79273 - Dylan-DPC:rollup-zd10xlt, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #77844 (clarify rules for ZST Boxes)
 - #79067 (Refactor the abi handling code a bit)
 - #79182 (Fix links to extern types in rustdoc (fixes #78777))
 - #79231 (Exhaustively match in variant count instrinsic)
 - #79238 (Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.)
 - #79256 (Fix typos)
 - #79264 (Get rid of some doctree items)
 - #79272 (Support building clone shims for arrays with generic size)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-21 20:18:11 +00:00
Carol (Nichols || Goulding)
ae17d7d455
More consistently use spaces after commas in lists in docs 2020-11-21 14:43:34 -05:00
Dylan DPC
68c9caa6f6
Rollup merge of #79272 - tmiasko:array-clone, r=jonas-schievink
Support building clone shims for arrays with generic size

Fixes #79269.
2020-11-21 19:44:20 +01:00
Dylan DPC
c20657c1ec
Rollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomez
Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

Part of #78082 (the easiest part, I'm still debugging some other changes).
r? `@GuillaumeGomez`
2020-11-21 19:44:18 +01:00
Dylan DPC
96ec5d299b
Rollup merge of #79256 - bugadani:query-typo, r=jonas-schievink
Fix typos
2020-11-21 19:44:16 +01:00
Dylan DPC
3958ceccac
Rollup merge of #79238 - eddyb:rustc-log-stderr, r=jyn514
Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.

Looks like this got missed in the initial implementation, AFAIK the old behavior was to output on stderr.
(Hit this while trying to debug `rustc` running inside a build script which was only letting stderr through)

r? ``@oli-obk`` cc ``@davidbarsky`` ``@hawkw``
2020-11-21 19:44:15 +01:00
Dylan DPC
bb73ea6702
Rollup merge of #79231 - wusyong:issue-79137, r=lcnr
Exhaustively match in variant count instrinsic

Fix #79137
2020-11-21 19:44:13 +01:00
Dylan DPC
5d428cae7d
Rollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514
Fix links to extern types in rustdoc (fixes #78777)

 r? `@jyn514`
 Fixes #78777.
The initial fix we tried was:
```diff
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 8be9482acff..c4b7086fdb1 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
`@@` -433,8 +433,9 `@@` impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
             Res::PrimTy(prim) => Some(
                 self.resolve_primitive_associated_item(prim, ns, module_id, item_name, item_str),
             ),
-            Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did) => {
+            Res::Def(kind, did) if kind.ns() == Some(Namespace::TypeNS) => {
                 debug!("looking for associated item named {} for item {:?}", item_name, did);
+
                 // Checks if item_name belongs to `impl SomeItem`
                 let assoc_item = cx
                     .tcx
```

However, this caused traits to be matched, resulting in a panic when `resolve_associated_trait_item` is called further down in this function.

This PR also adds an error message for that panic. Currently it will look something like:
```rust
thread 'rustc' panicked at 'Not a type: DefIndex(8624)', compiler/rustc_metadata/src/rmeta/decoder.rs:951:32
```
I wasn't sure how to get a better debug output than `DefIndex(...)`, and am open to suggestions.
2020-11-21 19:44:11 +01:00
Dylan DPC
426835762b
Rollup merge of #79067 - bjorn3:abi_refactor, r=nagisa
Refactor the abi handling code a bit

I am not quite sure if all changes are improvements.
2020-11-21 19:44:10 +01:00
Dylan DPC
6cd02a85f1
Rollup merge of #77844 - RalfJung:zst-box, r=nikomatsakis
clarify rules for ZST Boxes

LLVM's rules around `getelementptr inbounds` with offset 0 are a bit annoying, and as a consequence we have no choice but say that a `Box<()>` pointing to previously allocated memory that has since been freed is UB. Clarify the docs to reflect this.

This is based on conversations on the LLVM mailing list.
* Here's my initial mail: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130452.html
* The first email of the March part of that thread: https://lists.llvm.org/pipermail/llvm-dev/2019-March/130831.html
* First email of the April part: https://lists.llvm.org/pipermail/llvm-dev/2019-April/131693.html

The conclusion for me at least was that `getelementptr inbounds` with offset 0 is *not* the identity function, but can sometimes return `poison` even when the input is a regular pointer -- specifically, it returns `poison` when this pointer points into something that LLVM "knows has been deallocated", i.e., a former LLVM-managed allocation. It is however the identity function on pointers obtained by casting integers.

Note that there [are formal proposals](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf) for LLVM semantics where `getelementptr inbounds` with offset 0 isn't quite the identity function but never returns `poison` (it affects the provenance of the pointer but in a way that doesn't matter if this pointer is never used for memory accesses), and indeed this is likely necessary to consistently describe LLVM semantics. But with the informal LLVM LangRef that we have right now, and with LLVM devs insisting otherwise, it seems unwise to rely on this.
2020-11-21 19:44:07 +01:00
bjorn3
43968aa8b8 Replace sext() and zext() with single ext() method 2020-11-21 19:22:31 +01:00
bjorn3
6a5f537fb9 Rename prefix_chunk to prefix_chunk_size 2020-11-21 19:22:31 +01:00
bjorn3
39b8b2b623 Remove StructRet arg attr
It is applied exactly when the return value has an indirect pass mode.
Except for InReg on x86 fastcall, arg attrs are now only used for
optimization purposes and thus are fine to ignore.
2020-11-21 19:22:31 +01:00
bjorn3
42b0b8080d Replace ByVal attribute with on_stack field for Indirect
This makes it clearer that only PassMode::Indirect allows ByVal
2020-11-21 19:22:30 +01:00
bjorn3
967a228208 Replace ZExt and SExt flags with ArgExtension enum
Both flags are mutually exclusive
2020-11-21 19:07:38 +01:00
bors
3adedb8f4c Auto merge of #79237 - alexcrichton:update-backtrace, r=Mark-Simulacrum
std: Update the bactrace crate submodule

This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.
2020-11-21 18:05:07 +00:00
Joshua Nelson
e280ae862c x.py test --bless 2020-11-21 11:08:58 -05:00
bors
d806d65657 Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum
x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-21 15:43:09 +00:00
Joshua Nelson
788840612e Fix wrong names when inlining 2020-11-21 10:19:06 -05:00
Joshua Nelson
8c94f8be99 Add more tests for renamed items 2020-11-21 10:19:02 -05:00
Joshua Nelson
0459aca41a Get rid of some doctree items
They can be derived directly from the `hir::Item`, there's no special
logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct
2020-11-21 10:18:56 -05:00
bors
539402cb0b Auto merge of #77805 - JohnTitor:non-standard-char-sugg, r=Dylan-DPC
lint: Do not provide suggestions for non standard characters

Fixes #77273

Only provide suggestions if the case-fixed result is different than the original.
2020-11-21 13:11:35 +00:00
bors
822fa7cb0d Auto merge of #79250 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/79226
Cc `@rust-lang/miri` r? `@ghost`
2020-11-21 10:53:56 +00:00
bors
29a74e6285 Auto merge of #79222 - yoshuawuyts:slice-fill-with, r=m-ou-se
Add `core::slice::fill_with`

Tracking issue https://github.com/rust-lang/rust/issues/79221.

As suggested by `@m-ou-se` in https://github.com/rust-lang/rust/issues/70758#issuecomment-726838099 this implements `slice::fill_with` as a counterpart to `slice::fill`. This mirrors `Vec::resize` and `Vec::resize_with`. Thanks!

r? `@m-ou-se`
2020-11-21 08:15:16 +00:00
Dániel Buga
db8b86b2df Fix typos 2020-11-21 09:06:45 +01:00
bors
502c477b34 Auto merge of #79003 - petrochenkov:innertest, r=estebank
rustc_expand: Mark inner `#![test]` attributes as soft-unstable

Custom inner attributes are feature gated (https://github.com/rust-lang/rust/issues/54726) except for attributes having name `test` literally, which are not gated for historical reasons.

`#![test]` is an inner proc macro attribute, so it has all the issues described in https://github.com/rust-lang/rust/issues/54726 too.
This PR gates it with the `soft_unstable` lint.
2020-11-21 05:52:16 +00:00
Ngo Iok Ui
bc43380297
Fix comments of toogeneris test 2020-11-21 13:47:09 +08:00
Ngo Iok Ui
ef34e06781
List all variants of TyKind 2020-11-21 13:45:59 +08:00
Joshua Nelson
25a3ffe5d4 Move from bash to rust 2020-11-20 23:00:56 -05:00
bors
8cfa7b4ec9 Auto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis
Reworks Sccc computation to iteration instead of recursion

Linear graphs, producing as many scc's as nodes, would recurse once for every node when entered from the start of the list. This adds a test that exhausted the stack at least on my machine with error:

```
thread 'graph::scc::tests::test_deep_linear' has overflowed its stack
fatal runtime error: stack overflow
```

This may or may not be connected to #78567. I was only reminded that I started this rework some time ago. It might be plausible as borrow checking a long function with many borrow regions around each other—((((((…))))))— may produce the linear list setup to trigger this stack overflow ? I don't know enough about borrow check to say for sure.

This is best read in two separate commits. The first addresses only `find_state` internally. This is classical union phase from union-find. There's also a common solution of using the parent pointers in the (virtual) linked list to track the backreferences while traversing upwards and then following them backwards in a second path compression phase.

The second is more involved as it rewrites the mutually recursive `walk_node` and `walk_unvisited_node`. Firstly, the caller is required to handle the unvisited case of `walk_node` so a new `start_walk_from` method is added to handle that by walking the unvisited node if necessary. Then `walk_unvisited_node`, where we would previously recurse into in the missing case, is rewritten to construct a manual stack of its frames. The state fields consist of the previous stack slots.
2020-11-21 01:30:26 +00:00
Tomasz Miąsko
fac8b4e21a Support building clone shims for arrays with generic size 2020-11-21 00:00:00 +00:00
Ralf Jung
0f61664bb1 update miri 2020-11-21 00:35:48 +01:00
bors
432d116a5c Auto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrum
Arena: use specialization to avoid copying data

In several cases, a `Vec` or `SmallVec` is passed to `Arena::alloc_from_iter` directly. This PR makes sure those cases don't copy their data unnecessarily, by specializing the `alloc_from_iter` implementation.
2020-11-20 23:21:34 +00:00
Dániel Buga
e93a4637c0 Use specialization to avoid copying 2020-11-20 21:02:09 +01:00
Alex Crichton
f99410bb4b std: Update the backtrace crate submodule
This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.
2020-11-20 11:56:07 -08:00
Jacob Kiesel
fb6ceac46b We missed 1.49.0, so bump version to 1.50.0 2020-11-20 10:37:22 -07:00
Eduard-Mihai Burtescu
5ed2d42334 Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout. 2020-11-20 19:34:44 +02:00
Vadim Petrochenkov
993bb072ff rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
bors
593fe977a7 Auto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrum
BTreeMap: replace Root with NodeRef<Owned, ...>

`NodeRef<marker::Owned, …>` already exists as a representation of root nodes, and it makes more sense to alias `Root` to that than to reuse the space-efficient `BoxedNode` that is oblivious to height, where height is required.

r? `@Mark-Simulacrum`
2020-11-20 16:12:35 +00:00
Ngo Iok Ui
459c83f980
Exhaustively match in variant count instrinsic 2020-11-20 21:49:49 +08:00
bors
c9c57fadc4 Auto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-se
Extend meta parameters to all generated code in compat_fn.

Fixes https://github.com/rust-lang/rust/issues/79203. This addresses a regression from 7e2032390c for UWP targets.
2020-11-20 13:42:44 +00:00
Sebastian Dröge
7a3b331587 Add "memset" as doc alias to slice::fill() 2020-11-20 15:19:47 +02:00
Yoshua Wuyts
a64d0d4774 Add core::slice::fill_with 2020-11-20 14:12:54 +01:00
bors
ae6aa22cf2 Auto merge of #78646 - tgnottingham:packed_fingerprints, r=nnethercote
Use PackedFingerprint in DepNode to reduce memory consumption
2020-11-20 11:11:19 +00:00
Ralf Jung
a7677f7714 reference NonNull::dangling 2020-11-20 11:09:49 +01:00