Commit Graph

128311 Commits

Author SHA1 Message Date
bors 5562bb6d74 Auto merge of #76748 - tmiasko:no-op-jumps, r=matthewjasper
Fix underflow when calculating the number of no-op jumps folded

When removing unwinds to no-op blocks and folding jumps to no-op blocks,
remove the unwind target first. Otherwise we cannot determine if target
has been already folded or not.

Previous implementation incorrectly assumed that all resume targets had
been folded already, occasionally resulting in an underflow:

```
remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads
```
2020-09-24 05:57:06 +00:00
Dylan MacKenzie e5e5e64ff1 Bless tests 2020-09-23 21:05:59 -07:00
Dylan MacKenzie a320ef751b Suggest `const_mut_refs` for mutable references in const fn 2020-09-23 21:04:07 -07:00
bors 78a089487b Auto merge of #74430 - Manishearth:stabilize-intra-doc, r=Manishearth
Stabilize intra-doc links

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

Thanks to the great work of `@jyn514` in getting the [cross-crate reexport issue](https://github.com/rust-lang/rust/issues/65983) in intra-rustdoc links fixed, I think we're now in a position to stabilize this feature.

The tracking issue currently has two unresolved issues:

 - <s>behavior around doc(hidden): This is fixed in https://github.com/rust-lang/rust/pull/73365, which is just waiting for CI and should land tomorrow. It's also a pretty niche bug so while I expect it to land soon I don't think we need to block stabilization on it anyway.</s>
 - Non-identifier primitive types like slices: This was not a part of the original RFC anyway, and is a pretty niche use case

The feature itself, sans https://github.com/rust-lang/rust/issues/65983, has been shipped on nightly for three years now, with people using it on docs.rs. https://github.com/rust-lang/rust/issues/65983 itself is not an overwhelmingly central bit of functionality; the reason we elected to block stabilization on it was that back in 2017 it was not possible to fix the issue without some major refactorings of resolve, and we did not want to stabilize something that had such a potentially unfixable bug.

Given that we've fixed it, I see no reason to delay stabilization on this long awaited feature. It's possible that the latest patches have problems, however we _have_ done crater runs of some of the crucial parts. Furthermore, that's what the release trains are for, we will have a solid three months to let it ride the trains before it actually hits the stable compiler.

r? `@rust-lang/rustdoc`
2020-09-24 03:42:53 +00:00
Jarek Samic 085679c841 Use theme-adaptive SVG favicon from other Rust sites 2020-09-23 21:31:27 -04:00
Joshua Nelson 049d29bac5 Unify primitive errors with other intra-link errors
Now that `PrimTy::name()` exists, there's no need to carry around the
name of the primitive that failed to resolve. This removes the variants
special-casing primitives in favor of `NotResolved`.

- Remove `NoPrimitiveImpl` and `NoPrimitiveAssocItem`
- Remove hacky `has_primitive` check in `resolution_failure()`
- Fixup a couple tests that I forgot to `--bless` before
2020-09-23 21:04:50 -04:00
Joshua Nelson 472e52e5a0 Fix intra-doc links for primitives
- Add `PrimTy::name` and `PrimTy::name_str`
- Use those new functions to distinguish between the name in scope and
the canonical name
- Fix diagnostics for primitive types
- Add tests for primitives
2020-09-23 21:04:22 -04:00
Joshua Nelson dd7b8c85a6 Perform most diagnostic lookups in `resolution_failure`
Previously, these were spread throughout the codebase. This had two
drawbacks:

1. It caused the fast path to be slower: even if a link resolved,
rustdoc would still perform various lookups for the error diagnostic.
2. It was inconsistent and didn't always give all diagnostics (https://github.com/rust-lang/rust/issues/76925)

Now, diagnostics only perform expensive lookups in the error case.
Additionally, the error handling is much more consistent, both in
wording and behavior.

- Remove `CannotHaveAssociatedItems`, `NotInScope`, `NoAssocItem`, and `NotAVariant`
  in favor of the more general `NotResolved`

  `resolution_failure` will now look up which of the four above
  categories is relevant, instead of requiring the rest of the code to
  be consistent and accurate in which it picked.

- Remove unnecessary lookups throughout the intra-doc link pass. These
are now done by `resolution_failure`.
  + Remove unnecessary `extra_fragment` argument to `variant_field()`;
    it was only used to do lookups on failure.
  + Remove various lookups related to associated items
  + Remove distinction between 'not in scope' and 'no associated item'

- Don't perform unnecessary copies
- Remove unused variables and code
- Update tests
- Note why looking at other namespaces is still necessary
- 'has no inner item' -> 'contains no item'

bless tests
2020-09-23 21:04:20 -04:00
bors 7b240a1262 Auto merge of #77083 - KodrAus:revert/const-type-id, r=RalfJung
revert const_type_id stabilization

This reverts #72488, which is currently on beta and scheduled to stabilize in `1.47.0`, based on https://github.com/rust-lang/rust/pull/75923#issuecomment-696676511

It turns out we might not be quite ready to stabilize `TypeId` in const contexts before having a chance to rework its internals. Since `TypeId` is a bit of an oddity we want to be careful about how those internals are currently being relied on while making changes. That will be easier to do without having to also consider compile-time contexts.

r? `@eddyb`
2020-09-24 00:43:09 +00:00
Eric Huss 50d9663587 Update cargo 2020-09-23 17:06:56 -07:00
Tomasz Miąsko a09d607844 Remove duplicated SimplifyCfg pass 2020-09-24 00:00:00 +00:00
Dylan MacKenzie 16769eb19e Add entry to CHANGELOG for `--keep-stage-std` 2020-09-23 16:22:59 -07:00
Camelid 945a732dd6 Update mdBook
0.4.2 -> 0.4.3
2020-09-23 16:18:59 -07:00
Dylan MacKenzie c0ddaed2bf Remove warning about possible future deprecation 2020-09-23 16:17:11 -07:00
Mark Rousskov ef95430b9b Adjust support expectations for downloaded LLVMs 2020-09-23 19:05:11 -04:00
Mark Rousskov df004df3a7 Re-download LLVM on submodule updates only 2020-09-23 19:03:52 -04:00
Ashley Mannix 0e2db57754 update tracking issue for const_type_id 2020-09-24 09:00:04 +10:00
bors c35177582b Auto merge of #77102 - Dylan-DPC:rollup-2jfrg3u, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata)
 - #76939 (emit errors during AbstractConst building)
 - #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.)
 - #76993 (Changing the alloc() to accept &self instead of &mut self)
 - #76994 (fix small typo in docs and comments)
 - #77017 (Add missing examples on Vec iter types)
 - #77042 (Improve documentation for ToSocketAddrs)
 - #77047 (Miri: more informative deallocation error messages)
 - #77055 (Add #[track_caller] to more panicking Cell functions)

Failed merges:

r? `@ghost`
2020-09-23 22:34:44 +00:00
Dylan MacKenzie bcbd2ccc8d Add `keep-stage-std` to `x.py`
This keeps only the `std` artifacts compiled by the given stage, not the
compiler. This is useful when working on the latter stages of the
compiler in tandem with the standard library, since you don't have to
rebuild the *entire* compiler when the standard library changes.
2020-09-23 14:25:23 -07:00
bors 8b4085359a Auto merge of #76673 - simonvandel:remove-unneeded-drops, r=oli-obk
MIR pass to remove unneeded drops on types not needing drop

This is heavily dependent on MIR inlining running to actually see the drop statement.

Do we want to special case replacing a call to std::mem::drop with a goto aswell?
2020-09-23 20:13:47 +00:00
Erik Hofmayer 764967a7e5 tidy 2020-09-23 22:08:30 +02:00
Bastian Kauschke 5b3016134f use array::from_ref for slices 2020-09-23 21:56:23 +02:00
Erik Hofmayer 138a2e5eaa /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
Christiaan Dirkx 947536fca0 Make delegation methods of `std::net::IpAddr` unstable const
Make the following methods of `std::net::IpAddr` unstable const under the `const_ip` feature:
- `is_unspecified`
- `is_loopback`
- `is_global`
- `is_multicast`

Also adds a test for these methods in a const context.

Possible because these methods delegate to the inner `Ipv4Addr` or `Ipv6Addr`, which were made const, and the recent stabilization of const control flow.

Part of #76205
2020-09-23 21:33:39 +02:00
Erik Hofmayer dd66ea2d3d Updated html_root_url for compiler crates 2020-09-23 21:14:43 +02:00
bors e636b88aa1 Auto merge of #6044 - rschoon:rc-buffer, r=yaahc
Add `rc_buffer` lint for checking Rc<String> and friends

Fixes #2623

This is a bit different from the original PR attempting to implement this type of lint.   Rather than linting against converting into the unwanted types, this PR lints against declaring the unwanted type in a struct or function definition.

I'm reasonably happy with what I have here, although I used the fully qualified type names for the Path and OsString suggestions, and I'm not sure if I should have just used the short versions instead, even if they might not have been declared via use.

Also, I don't know if "buffer type" is the best way to put it or not.  Alternatively I could call it a "growable type" or "growable buffer type", but I was thinking of PathBuf when I started making the lint.

changelog: Add `rc_buffer` lint
2020-09-23 18:35:08 +00:00
Dániel Buga 90c7731f6c Enable const prop into operands at mir_opt_level=2 2020-09-23 19:03:10 +02:00
Oliver Scherer 9aa1c0934c Update documentation tests 2020-09-23 18:55:27 +02:00
Oliver Scherer da217644a1 Make sure we keep emitting a hard error 2020-09-23 18:36:53 +02:00
Simon Vandel Sillesen 05f84c67a4 Ignore test on wasm as it does not unwind 2020-09-23 18:25:55 +02:00
Oliver Scherer 017423179a Make sure we report a future incompat error in all cases 2020-09-23 18:04:44 +02:00
Oliver Scherer 6a33de0170 Name function correctly 2020-09-23 17:55:14 +02:00
Oliver Scherer 9a7e66aeaf Make sure we don't hide errors just because a lint has been emitted 2020-09-23 17:52:37 +02:00
Oliver Scherer 177d0cef48 Deduplicate errors in const to pat conversion 2020-09-23 17:03:31 +02:00
Oliver Scherer d486486afd Talk about unpredictable instead of "not deterministic" 2020-09-23 16:38:30 +02:00
Oliver Scherer 1b1b6eabaa Remove the "lift constant to reference" logic 2020-09-23 16:28:45 +02:00
Matthias Krüger b5d47bfa3a clarify that `changelog-seen = 1` goes to the beginning of config.toml
Fixes #77105
2020-09-23 15:45:35 +02:00
bors a6008fac97 Auto merge of #77090 - rust-lang:revert-76110-convert-openoptions-cint, r=dtolnay
Revert "Function to convert OpenOptions to c_int"

Reverts rust-lang/rust#76110. This broke Rust's stability guarantees.

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

r? `@joshtriplett`
2020-09-23 13:19:18 +00:00
Dylan DPC c3c03f2f05
Rollup merge of #77055 - est31:more_track_caller, r=Mark-Simulacrum
Add #[track_caller] to more panicking Cell functions

Continuation of #74526

Adds the #[track_caller] attribute to almost all panicking Cell
functions. The ones that borrow two Cells in their function
body are spared, because the panic location helps pinpoint
which of the two borrows failed. You'd need to have
full debuginfo and backtraces enabled together with column
info in order to be able to discern the cases.
Column info in debuginfo is only available on non-Windows platforms.
2020-09-23 14:54:15 +02:00
Dylan DPC f8dec3d054
Rollup merge of #77047 - RalfJung:miri-dealloc, r=oli-obk
Miri: more informative deallocation error messages

Make sure we show the affected AllocId.

r? @oli-obk
2020-09-23 14:54:13 +02:00
Dylan DPC 049ba0c6f0
Rollup merge of #77042 - imbolc:patch-2, r=kennytm
Improve documentation for ToSocketAddrs

I little clarification
2020-09-23 14:54:11 +02:00
Dylan DPC b76343643d
Rollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPC
Add missing examples on Vec iter types

r? @Dylan-DPC
2020-09-23 14:54:10 +02:00
Dylan DPC bcdbe79f0c
Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank
fix small typo in docs and comments

Fixed `the the` to `the`, as far as I found.
2020-09-23 14:54:07 +02:00
Dylan DPC a40d79c9fb
Rollup merge of #76993 - blitzerr:alloc-ref, r=Amanieu
Changing the alloc() to accept &self instead of &mut self

Fixes: [#55](https://github.com/rust-lang/wg-allocators/issues/55)

This is the first cut. It only makes the change for `alloc` method.
2020-09-23 14:54:06 +02:00
Dylan DPC eaaf5d7e38
Rollup merge of #76965 - fusion-engineering-forks:fix-atomic-from-mut, r=Amanieu
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s.

r? @RalfJung
2020-09-23 14:54:04 +02:00
Dylan DPC 98e5ee7df0
Rollup merge of #76939 - lcnr:const-evaluatable-cont, r=oli-obk
emit errors during AbstractConst building

There changes are currently still untested, so I don't expect this to pass CI 😆

It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.

r? @oli-obk
2020-09-23 14:54:02 +02:00
Dylan DPC a22eb31668
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Record `tcx.def_span` instead of `item.span` in crate metadata

This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.
2020-09-23 14:54:00 +02:00
Bastian Kauschke ed97b42105 add tracking issue 2020-09-23 13:48:21 +02:00
bors 33aa8be8b5 Auto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum
Don't download/sync llvm-project submodule if download-ci-llvm is set

llvm-project takes > 1GB storage space and a long time to download.
It's better to not download it unless needed.
2020-09-23 10:38:18 +00:00
Mara Bos 631c688350 Make [].as_[mut_]ptr_range() (unstably) const. 2020-09-23 11:09:10 +02:00