Commit graph

133747 commits

Author SHA1 Message Date
bors
52e3cf13aa Auto merge of #79306 - GuillaumeGomez:rollup-4cnudfj, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #78670 (Remove FIXME comment in some incremental test suite)
 - #79292 (Fix typo in doc comment for report_too_many_hashes)
 - #79300 (Prevent feature information to be hidden if it's on the impl directly)
 - #79302 (Add regression test for issue 73899)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-22 15:40:03 +00:00
Guillaume Gomez
749fe400c8
Rollup merge of #79302 - est31:issue_73899_test, r=lcnr
Add regression test for issue 73899

Closes #73899
2020-11-22 16:15:15 +01:00
Guillaume Gomez
70a839fd8f
Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Prevent feature information to be hidden if it's on the impl directly

Fixes #79279.

So when a `#[doc(cfg...)]` is used on a trait impl directly, it's not hidden by the toggle.

![Screenshot from 2020-11-22 14-40-11](https://user-images.githubusercontent.com/3050060/99905528-997fab00-2cd1-11eb-83be-ed06b0cb97df.png)

r? `@jyn514`
2020-11-22 16:15:13 +01:00
Guillaume Gomez
5c982b7ca2
Rollup merge of #79292 - nico-abram:master, r=jonas-schievink
Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"
2020-11-22 16:15:12 +01:00
Guillaume Gomez
876024dad5
Rollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514
Remove FIXME comment in some incremental test suite

Helps with #62277

I removed FIXME comment in some incremental tests with [rustc_partition_codegened](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_incremental/assert_module_sources/index.html). This seems using codegen process. So it uses intentionally `build-pass`
2020-11-22 16:15:10 +01:00
Guillaume Gomez
28a94a3ae5 Prevent feature information to be hidden if it's on the impl directly 2020-11-22 16:10:16 +01:00
Jonas Schievink
cb406848ec Add some more tests 2020-11-22 15:51:05 +01:00
est31
c2a1dfacb4 Add regression test for issue 73899
Adds regression test for https://github.com/rust-lang/rust/issues/73899
2020-11-22 15:36:37 +01:00
varkor
cf32afcf48 Stabilise then 2020-11-22 13:45:14 +00:00
bors
828461b4b2 Auto merge of #78816 - SkiFire13:fix-slice-pointer-provenance, r=RalfJung
<[T]>::reverse: Fix pointer provenance rules

Should fix #78749
2020-11-22 13:10:15 +00:00
Stein Somers
b04abc433e BTreeMap: swap the names of NodeRef::new and Root::new_leaf 2020-11-22 13:40:03 +01:00
Stein Somers
9186c073fc BTreeMap: fix minor testing mistakes in #78903 2020-11-22 13:37:39 +01:00
Havvy (Ryan Scheel)
b6f9705804 Add test for eval order for a+=b
Yes, the order of evaluation *does* change depending on the types of
the operands. Cursed, I know.

I've elected to place this test into `expr/compound-assignment` creating
both the `expr` directory and the `compound-assignment` directory. I
plan in a future PR to also move the `if` directory and the loose `if`
tests into `expr/if` and other similar cleanups of the `test/ui`
directory.

Future work: Test more than just `+=`, but all operators. I don't know
if using a macro to generate these tests cases would be okay or not,
but it'd be boilerplatey without it. I'm also confident you cannot
change the evaluation order of one operator without changing all of
them.

Future work: Additionally, test more than just `i32 += i32` for the
primitive version. I don't actually know the full set of primitive
implementations, but I imagine there's enough to cause a combinatorial
explosion with the previous future work item. Somewhere on the order of
one to two hundred individual functions.
2020-11-22 03:13:27 -08:00
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
Nicolas
7be6d67f82
Fix typo in doc comment for report_too_many_hashes
"to big" -> "too big"
2020-11-22 07:02:58 -03: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
Jonas Schievink
e69fcea609 const fn: allow use of trait impls from bounds 2020-11-22 04:19:46 +01:00
Jonas Schievink
71d350e33a winnow: drop non-const cand. in favor of const 2020-11-22 04:04:49 +01:00
Jonas Schievink
ee6f42ba94 Thread Constness through selection 2020-11-22 02:13:53 +01: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
Waffle
461265825b Remove multiline uses 2020-11-22 02:39:22 +03:00
Waffle
e0e906b517 Fix UI tests
Some UI tests started failing after moving iterator adapters to different modules.
2020-11-22 02:39:21 +03:00
Waffle
0dc187c787 Fix doc links in core::iter::sources 2020-11-22 02:39:21 +03:00
Waffle
b82a76ae3a Merge uses in core::iter 2020-11-22 02:39:21 +03:00
Waffle
66d6708c3d Split iterator sources into different modules 2020-11-22 02:39:21 +03:00
Waffle
773b73c66c Split iterator adaptors into individual modules
This commit also makes fields of `Take` private. I have no idea why they
were `pub(super)` before.
2020-11-22 02:39:16 +03: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
Stein Somers
0f005c2241 BTreeMap: address namespace conflicts 2020-11-21 16:07:24 +01:00