Commit graph

140788 commits

Author SHA1 Message Date
bors
2bd94f4aa9 Auto merge of #83398 - JohnTitor:rollup-om80krv, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #80705 (Update Source Code Pro and include italics)
 - #81917 (Update RELEASES.md for 1.51.0)
 - #82732 (Remove theme.js file)
 - #83356 (rustdoc: Replace pair of `Option`s with an enum)
 - #83384 (rename :pat2018 -> :pat2015)
 - #83385 (⬆️ rust-analyzer)
 - #83389 (add rust-analyzer rustc_private option in librustdoc Cargo.toml)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-23 02:01:14 +00:00
Camelid
72a180e134 rustdoc: Record crate name instead of using None 2021-03-22 18:18:57 -07:00
Yuki Okushi
263c85875c
Rollup merge of #83389 - njasm:test_rustdoc, r=jyn514
add rust-analyzer rustc_private option in librustdoc Cargo.toml

This addition will allow to have code completion while hacking rustdoc with rust-analyzer.

more info: https://rust-analyzer.github.io/manual.html#rust-analyzer.rustcSource

r? `@jyn514`
2021-03-23 10:15:45 +09:00
Yuki Okushi
2e14c1dc0c
Rollup merge of #83385 - lnicola:rust-analyzer-2021-03-22, r=jonas-schievink
⬆️ rust-analyzer
2021-03-23 10:15:44 +09:00
Yuki Okushi
50d048f142
Rollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplett
rename :pat2018 -> :pat2015

as requested by T-lang on zulip: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873

No functional changes here... just renaming.

r? `@nikomatsakis`
2021-03-23 10:15:43 +09:00
Yuki Okushi
20006b1891
Rollup merge of #83356 - camelid:rustdoc-option-to-enum, r=GuillaumeGomez
rustdoc: Replace pair of `Option`s with an enum

They are never both `None` or both `Some`, so it makes more sense to use
an enum so that we "make impossible states impossible".
2021-03-23 10:15:42 +09:00
Yuki Okushi
a34cc6bbab
Rollup merge of #82732 - GuillaumeGomez:remove-theme-file, r=Nemo157
Remove theme.js file

Fixes #82616.

The first commit moves the `theme.js` file into `main.js`, which requires to also run a small `.replace` on the `main.js` content.

The second commit is just a small cleanup to centralize DOM ids.

Since it removes a file from rustdoc output: cc `@rust-lang/docs-rs`

cc `@jsha`
r? `@jyn514`
2021-03-23 10:15:40 +09:00
Yuki Okushi
9cae1fb94a
Rollup merge of #81917 - rust-lang:relnotes-1.51.0, r=Mark-Simulacrum
Update RELEASES.md for 1.51.0

### [Rendered](https://github.com/rust-lang/rust/blob/relnotes-1.51.0/RELEASES.md)

r? `@Mark-Simulacrum`
cc `@rust-lang/release`
2021-03-23 10:15:39 +09:00
Yuki Okushi
0e96c62423
Rollup merge of #80705 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez
Update Source Code Pro and include italics

Fixes #65502.

#65665, a similar PR to this was merged but reverted because of https://github.com/rust-lang/rust/pull/65665#issuecomment-556860510.

The issue in that comment is the upstream issue https://github.com/adobe-fonts/source-code-pro/issues/217 which should now be fixed in the upstream since [2.032R-ro/1.052R-it/1.012R-VAR release](https://github.com/adobe-fonts/source-code-pro/releases/tag/2.032R-ro/1.052R-it/1.012R-VAR), so I think this can now be merged.

A couple of notes from the original PR:
* Since this PR changes the font set, I think docs.rs would have to be updated if this PR is merged.
* The fonts have a double extension (.ttf.woff); this is to keep the names consistent with the upstream font release which does that to distinguish these from the .otf.woff files (Source Code Pro otf renders poorly on older Windows system apps).
2021-03-23 10:15:38 +09:00
Erik Desjardins
6960bc9696 only run RemoveZsts at mir-opt-level 3 and above 2021-03-22 18:30:56 -04:00
Guillaume Gomez
6c80deb4a5 Add GUI test to enforce tooltip position 2021-03-22 22:35:19 +01:00
Guillaume Gomez
494e29deea Fix codeblock tooltip position 2021-03-22 22:17:21 +01:00
hyd-dev
f900ee331d
Allow not emitting uwtable on Android 2021-03-23 04:39:58 +08:00
Camille GILLOT
1aad7e738e Err if the debugging options are not passed. 2021-03-22 21:31:00 +01:00
Josh Stone
fcb37cb7d6 Fix asm! from AT&T to Intel syntax 2021-03-22 13:12:53 -07:00
Eric Huss
45583e56c0 Change -W help to display edition level. 2021-03-22 12:57:52 -07:00
bors
5d04957a4b Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177
2021-03-22 19:48:27 +00:00
Josh Stone
b97a33b1cb All supported LLVM versions have MSP430AsmPrinter 2021-03-22 12:44:48 -07:00
Nelson J Morais
34635ec10e missing newline at eof 2021-03-22 19:42:05 +00:00
Nelson J Morais
d3c749481f add key rustc_private for package metadata for rust-analyzer in librustdoc 2021-03-22 19:31:42 +00:00
Augie Fackler
9431e8577d cleanup: add some comments per review feedback 2021-03-22 14:37:49 -04:00
Josh Stone
7d872f538e Update the minimum external LLVM to 10 2021-03-22 11:33:43 -07:00
Laurențiu Nicola
0717326131 ⬆️ rust-analyzer 2021-03-22 20:30:36 +02:00
Camille GILLOT
219603a958 Only enable assert_dep_graph when query-dep-graph is enabled. 2021-03-22 19:22:06 +01:00
mark
8c4b3dbb50 rename :pat2018 -> :pat215 2021-03-22 12:40:23 -05:00
Aaron Hill
a23273e82c
Add debug-refcell feature to libcore
See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Attaching.20backtraces.20to.20RefCell/near/226273614
for some background discussion

This PR adds a new off-by-default feature `debug-refcell` to libcore.
When enabled, this feature stores additional debugging information in
`RefCell`. This information is included in the panic message when
`borrow()` or `borrow_mut()` panics, to make it easier to track down the
source of the issue.

Currently, we store the caller location for the earliest active borrow.
This has a number of advantages:
* There is only a constant amount of overhead per `RefCell`
* We don't need any heap memory, so it can easily be implemented in core
* Since we are storing the *earliest* active borrow, we don't need any
  extra logic in the `Drop` implementation for `Ref` and `RefMut`

Limitations:
* We only store the caller location, not a full `Backtrace`. Until
  we get support for `Backtrace` in libcore, this is the best tha we can
do.
* The captured location is only displayed when `borrow()` or
  `borrow_mut()` panics. If a crate calls `try_borrow().unwrap()`
  or `try_borrow_mut().unwrap()`, this extra information will be lost.

To make testing easier, I've enabled the `debug-refcell` feature by
default. I'm not sure how to write a test for this feature - we would
need to rebuild core from the test framework, and create a separate
sysroot.

Since this feature will be off-by-default, users will need to use
`xargo` or `cargo -Z build-std` to enable this feature. For users using
a prebuilt standard library, this feature will be disabled with zero
overhead.

I've created a simple test program:

```rust
use std::cell::RefCell;

fn main() {
    let _ = std::panic::catch_unwind(|| {
        let val = RefCell::new(true);
        let _first = val.borrow();
        let _second = val.borrow();
        let _third = val.borrow_mut();
    });

    let _ = std::panic::catch_unwind(|| {
        let val  = RefCell::new(true);
        let first = val.borrow_mut();
        drop(first);

        let _second = val.borrow_mut();

        let _thid = val.borrow();
    });
}
```

which produces the following output:

```
thread 'main' panicked at 'already borrowed: BorrowMutError { location: Location { file: "refcell_test.rs", line: 6, col: 26 } }', refcell_test.rs:8:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'already mutably borrowed: BorrowError { location: Location { file: "refcell_test.rs", line: 16, col: 27 } }', refcell_test.rs:18:25
```
2021-03-22 12:39:54 -04:00
bors
2287a8823d Auto merge of #83376 - Dylan-DPC:rollup-s2fsjwj, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #82374 (Add license metadata for std dependencies)
 - #82683 (Document panicking cases for integer division and remainder)
 - #83272 (Clarify non-exact length in the Iterator::take documentation)
 - #83338 (Fix test for #82270)
 - #83351 (post-drop-elab check-const: explain why we still check qualifs)
 - #83367 (Improve error message for unassigned query provider)
 - #83372 (SplitInclusive is public API)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-22 15:07:23 +00:00
Dylan DPC
ce06787548
Rollup merge of #83372 - eggyal:split-inclusive, r=Mark-Simulacrum
SplitInclusive is public API
2021-03-22 15:21:31 +01:00
Dylan DPC
014a4ee9f5
Rollup merge of #83367 - richkadel:query-err-msg, r=jyn514
Improve error message for unassigned query provider

Fixes: #83122

r? `@jyn514`

This implements the change we agreed on. Thanks!
2021-03-22 15:21:30 +01:00
Dylan DPC
1fdf7d18ad
Rollup merge of #83351 - RalfJung:precise-const-drop, r=oli-obk
post-drop-elab check-const: explain why we still check qualifs

r? `@oli-obk`
2021-03-22 15:21:29 +01:00
Dylan DPC
b759044d3a
Rollup merge of #83338 - asquared31415:asm-syntax-test-fix, r=Dylan-DPC
Fix test for #82270

Fixes a test in #82270 to require the arm llvm component
2021-03-22 15:21:27 +01:00
Dylan DPC
f441c2a9a0
Rollup merge of #83272 - kornelski:takedocs, r=dtolnay
Clarify non-exact length in the Iterator::take documentation

There's an example which demonstrates incomplete length case, but it'd be best to explain it right from the start.
2021-03-22 15:21:26 +01:00
Dylan DPC
83faac9da4
Rollup merge of #82683 - jturner314:int-div-rem-doc-panic, r=nikomatsakis
Document panicking cases for integer division and remainder

This PR documents the cases when integer division and remainder operations panic. These operations panic in two cases: division by zero and overflow.

It's surprising that these operations always panic on overflow, unlike most other arithmetic operations, which panic on overflow only when `debug_assertions` is enabled. The panic on overflow for the remainder is also surprising because a return value of `0` would be reasonable in this case. ("Overflow" occurs only for `MIN % -1`.) Since the panics on overflow are somewhat surprising, they should be documented.

I guess it's worth asking: is panic on overflow (even when `debug_assertions` is disabled) the intended behavior? If not, what's the best way forward?
2021-03-22 15:21:24 +01:00
Dylan DPC
7bf8f82f72
Rollup merge of #82374 - clehner:licenses, r=joshtriplett
Add license metadata for std dependencies

These five crates are in the dependency tree of `std` but lack license metadata:
- `alloc`
- `core`
- `panic_abort`
- `panic_unwind`
- `unwind`

Querying the dependency tree of `std` is a useful thing to be able to do, since these crates will typically be linked into Rust binaries. Tools show the license fields missing, as seen in https://github.com/rust-lang/rust/issues/67014#issuecomment-782704534. This PR adds the license field for the five crates, based on the license of the `std` package and this repo as a whole. I also added the `repository` and `descriptions` fields, since those seem useful. For `description`, I copied text from top-level comments for the respective modules - except for `unwind` which has none.

I also note that https://github.com/rust-lang/rust/pull/73530 attempted to add license metadata for all crates in this repo, but was rejected because there was question about some of them. I hope that this smaller change, focusing only on the runtime dependencies, will be easier to review.

cc `@Mark-Simulacrum` `@Lokathor`
2021-03-22 15:21:23 +01:00
bors
d04c3aa865 Auto merge of #83273 - cjgillot:endecode, r=michaelwoerister
Simplify encoder and decoder

Extracted from https://github.com/rust-lang/rust/pull/83036 and https://github.com/rust-lang/rust/pull/82780.
2021-03-22 12:18:57 +00:00
bors
7f82ddb875 Auto merge of #82680 - jturner314:div_euclid-docs, r=JohnTitor
Fix inequality in docs for div_euclid

This commit fixes the statement of the inequality that the Euclidean remainder satisfies. (The remainder is guaranteed to be less than abs(rhs), not rhs.) It also rewords the documentation to make it a little easier to read.

(You might wonder why I've written `abs(rhs)` instead of `rhs.abs()`. Two reasons: first, the `rem_euclid` docs use `abs(rhs)` instead of `rhs.abs()`, and second, the absolute value here is the mathematical absolute value, not the the `.abs()` operation which may overflow.)
2021-03-22 09:37:50 +00:00
Alan Egerton
fe957350c7
SplitInclusive is public API 2021-03-22 09:07:52 +00:00
bors
2b8fbe6b0b Auto merge of #82855 - jyn514:no-temporaries, r=GuillaumeGomez
Avoid temporary allocations in `render_assoc_item`

`render_assoc_item` came up as very hot in a profile of rustdoc on
`bevy`.  This avoids some temporary allocations just to calculate the
length of the header.

This should be a strict improvement, since all string formatting was
done twice before.

cc #82845
2021-03-22 06:45:33 +00:00
Rich Kadel
688c857c56 Improve error message for unassigned query provider
Fixes: 83122
2021-03-21 23:04:07 -07:00
Aman Arora
74d7731c5b 2229 migration: Don't try resolve regions before writeback
In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176
2021-03-22 00:53:25 -04:00
bors
142c831861 Auto merge of #83360 - Dylan-DPC:rollup-17xulpv, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #80193 (stabilize `feature(osstring_ascii)`)
 - #80771 (Make NonNull::as_ref (and friends) return refs with unbound lifetimes)
 - #81607 (Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators)
 - #82554 (Fix invalid slice access in String::retain)
 - #82686 (Move `std::sys::unix::platform` to `std::sys::unix::ext`)
 - #82771 (slice: Stabilize IterMut::as_slice.)
 - #83329 (Cleanup LLVM debuginfo module docs)
 - #83336 (Fix ICE with `use clippy:🅰️:b;`)
 - #83350 (Download a more recent LLVM version if `src/version` is modified)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-22 04:03:53 +00:00
Camelid
99ff2767bf Update tests
These tests were added to master after I made my changes.
2021-03-21 19:48:51 -07:00
Camelid
bec7ab281f Remove redundant docs
...and add docs to the types instead of the fields that hold the types.
2021-03-21 19:47:12 -07:00
Camelid
9b9bb71c59 Bump rustdoc-json format version
The rustdoc-json-types renames are breaking changes.
2021-03-21 19:47:12 -07:00
Camelid
b0659f9b1b rustdoc-json: Rename Import.span to Import.source
* It is called `source` in rustc and the rest of rustdoc
* It is not a span, rather it is the source of the import
2021-03-21 19:47:12 -07:00
Camelid
e190983bd3 Rename rustdoc_json_types::Item.source to span 2021-03-21 19:47:12 -07:00
Camelid
7dd475e498 Rename clean::Span::span() to clean::Span::inner()
Otherwise you get a lot of instances of `item.span.span()`, which is
just plain confusing. `item.span.inner()` conveys the correct meaning of
"get the type that `clean::Span` wraps".
2021-03-21 19:47:11 -07:00
Camelid
8b9b106cdc Rename clean::Item.source to span
Its type is called `clean::Span`, and also the name in the rest of
rustdoc and rustc for this kind of field is `span`.
2021-03-21 19:47:11 -07:00
Dylan DPC
790c2ad46a
Rollup merge of #83350 - jyn514:llvm-version, r=Mark-Simulacrum
Download a more recent LLVM version if `src/version` is modified

When bumping the bootstrap version, the name of the generated LLVM
shared object file is changed, even though it's the same contents as
before. If bootstrap tries to use an older version, it will get linking
errors:

```
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
   Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" ... lots of args ...
  = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `rustdoc-tool`
```

Helps with https://github.com/rust-lang/rust/issues/81930.
2021-03-22 02:20:33 +01:00
Dylan DPC
ea5ba76d1c
Rollup merge of #83336 - camelid:tool-mod-ice, r=petrochenkov
Fix ICE with `use clippy:🅰️:b;`

Fixes #83317.
2021-03-22 02:20:32 +01:00