Commit Graph

132571 Commits

Author SHA1 Message Date
bors
49720d2b9a Auto merge of #78512 - JohnTitor:rollup-a7qwjah, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #77213 (rustdoc options to set default theme (and other settings))
 - #78224 (min_const_generics: allow ty param in repeat expr)
 - #78428 (MinConstGenerics UI test for invalid values for bool & char)
 - #78460 (Adjust turbofish help message for const generics)
 - #78470 (Clean up intra-doc links in `std::path`)
 - #78475 (fix a comment in validity check)
 - #78478 (Add const generics tests for supertraits + dyn traits.)
 - #78487 (Fix typo "compiltest")
 - #78491 (Inline NonZeroN::from(n))
 - #78492 (Update books)
 - #78494 (Fix typos)

Failed merges:

r? `@ghost`
2020-10-29 03:57:54 +00:00
Jubilee Young
0e88db7db4 Dogfood {exclusive,half-open} ranges in compiler (nfc)
In particular, this allows us to write more explicit matches that
avoid the pitfalls of using a fully general fall-through case, yet
remain fairly ergonomic. Less logic is in guard cases, more is in
the actual exhaustive case analysis.

No functional changes.
2020-10-28 20:09:20 -07:00
Yuki Okushi
30d1d8f5da
Rollup merge of #78494 - bugadani:typo2, r=jonas-schievink
Fix typos
2020-10-29 12:09:03 +09:00
Yuki Okushi
218af6f714
Rollup merge of #78492 - ehuss:update-books, r=ehuss
Update books

## nomicon

7 commits in 6e57e64501f61873ab80cb78a07180a22751a5d6..69333eddb1de92fd17e272ce4677cc983d3bd71d
2020-09-14 11:40:23 -0400 to 2020-10-17 15:44:12 -0700
- Tweak GHA config (rust-lang-nursery/nomicon#240)
- Fix link for `[T]` (rust-lang-nursery/nomicon#239)
- Update casts.md (rust-lang-nursery/nomicon#232)
- [WIP] Add more links (rust-lang-nursery/nomicon#180)
- Data Race definition should be more precise (rust-lang-nursery/nomicon#219)
- Update the diagnostic of `error[E0597]` in dropck.md (rust-lang-nursery/nomicon#157)
- fix typo in Lifetimes mutable reference aliasing section (rust-lang-nursery/nomicon#225)

## reference

3 commits in 1b78182e71709169dc0f1c3acdc4541b6860e1c4..10c16caebe475d0d11bec0531b95d7697856c13c
2020-10-11 13:53:47 -0700 to 2020-10-25 20:51:26 -0700
- Add `unsafe` for `mod` and `extern`. (rust-lang-nursery/reference#898)
- mention how unions interact with dropping (rust-lang-nursery/reference#897)
- Add `move_ref_pattern` docs (rust-lang-nursery/reference#881)

## book

2 commits in 451a1e30f2dd137aa04e142414eafb8d05f87f84..13e1c05420bca86ecc79e4ba5b6d02de9bd53c62
2020-10-05 09:11:18 -0500 to 2020-10-20 14:57:32 -0500
- Referencing to Appendix B (rust-lang/book#2481)
- Use GITHUB_PATH instead of add-path (rust-lang/book#2477)

## rust-by-example

2 commits in 152475937a8d8a1f508d8eeb57db79139bc803d9..99eafee0cb14e6ec641bf02a69d7b30f6058349a
2020-10-09 09:29:50 -0300 to 2020-10-21 14:21:55 -0300
- Formatting footer items. (rust-lang/rust-by-example#1385)
- Add partial moves example for `move_ref_pattern` stabilization (rust-lang/rust-by-example#1377)

## edition-guide

3 commits in 81f16863014de60b53de401d71ff904d163ee030..7bc9b7a5e800f79df62947cb7d566fd2fbaf19fe
2020-08-27 13:56:31 -0700 to 2020-10-23 18:31:23 -0500
- A few small updates. (rust-lang/edition-guide#221)
- Clarify the limitation of ? in main and tests (rust-lang/edition-guide#219)
- Update deprecated GitHub Actions commands. (rust-lang/edition-guide#220)
2020-10-29 12:09:01 +09:00
Yuki Okushi
c7792230c0
Rollup merge of #78491 - petertodd:2020-inline-from-nonzero, r=sfackler
Inline NonZeroN::from(n)

Currently this results in the generated assembly having a function call for this trivial conversion.
2020-10-29 12:08:59 +09:00
Yuki Okushi
ad1012834c
Rollup merge of #78487 - rust-lang:GuillaumeGomez-patch-1, r=steveklabnik
Fix typo "compiltest"

Part of #70898.
2020-10-29 12:08:58 +09:00
Yuki Okushi
572ea25e01
Rollup merge of #78478 - hameerabbasi:const-generics-supertraits, r=lcnr
Add const generics tests for supertraits + dyn traits.

Partially addresses #78433
2020-10-29 12:08:56 +09:00
Yuki Okushi
5e3cc6e913
Rollup merge of #78475 - RalfJung:validity-comment, r=oli-obk
fix a comment in validity check

A few things changed since that comment was written; update it to the current reality.

r? @oli-obk
2020-10-29 12:08:55 +09:00
Yuki Okushi
7eb7b5a4af
Rollup merge of #78470 - camelid:fixup-std-path-intra-doc, r=jyn514
Clean up intra-doc links in `std::path`
2020-10-29 12:08:53 +09:00
Yuki Okushi
a7a0538802
Rollup merge of #78460 - varkor:turbofish-string-generic, r=lcnr
Adjust turbofish help message for const generics

Types are no longer special. (This message arguably only makes sense with `min_const_generics` or more, but we'll be there soon.)

r? @lcnr
2020-10-29 12:08:50 +09:00
Yuki Okushi
2555e07be1
Rollup merge of #78428 - JulianKnodt:invalid_patterns, r=lcnr
MinConstGenerics UI test for invalid values for bool & char

This adds a test for `feature(min_const_generics)` with some invalid values for bools and chars and ensures that they do not ICE and error with understandable messages.

r? @lcnr
2020-10-29 12:08:48 +09:00
Yuki Okushi
270d2e0c2e
Rollup merge of #78224 - lcnr:repeat-expr, r=varkor
min_const_generics: allow ty param in repeat expr

implements https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/repeat.20expressions

Even with `min_const_generics` active, now keeps resulting in future compat warnings instead of hard errors.
Const parameters, for example `[0; N + 1]`, still result in hard errors during resolve.
```rust
#![allow(dead_code)]

fn foo<T>() {
    [0; std::mem::size_of::<*mut T>()];
}

struct Foo<T>(T);

impl<T> Foo<T> {
    const ASSOC: usize = 4;

    fn test() {
        [0; Self::ASSOC];
    }
}
```

r? @varkor cc @petrochenkov
2020-10-29 12:08:40 +09:00
Yuki Okushi
2008d1bb0b
Rollup merge of #77213 - ijackson:wip-rustdoc-settings, r=jyn514,GuillaumeGomez
rustdoc options to set default theme (and other settings)

Hi.  This is the MR I promised in #77024

It is a little more general than I envisaged there.  Once I had found the settings-handling machinery it seemed foolish to add this feature just for the theme.

Closes #77024
2020-10-29 12:08:38 +09:00
Wesley Wiser
1c1c591c81 [resolve] Use unwrap_or_else instead of unwrap_or in a hot path
This improves the performance of the `resolve_crate` function by 30% for
a very large single file crate with auto-generated C bindings.
2020-10-28 21:53:25 -04:00
bors
f9187adaef Auto merge of #78430 - Nadrieril:taking-constructors-seriously2, r=varkor
Clarify main code paths in exhaustiveness checking

This PR massively clarifies the main code paths of exhaustiveness checking, by using the `Constructor` enum to a fuller extent. I've been itching to write it for more than a year, but the complexity of matching consts had prevented me. Behold a massive simplification :D.
This in particular removes a fair amount of duplication between various parts, localizes code into methods of relevant types when applicable, makes some implicit assumptions explicit, and overall improves legibility a lot (or so I hope). Additionally, after my changes undoing #76918 turned out to be a noticeable perf gain.

As usual I tried my best to make the commits self-contained and easy to follow. I've also tried to keep the code well-commented, but I tend to forget how complex this file is; I'm happy to clarify things as needed.
My measurements show good perf improvements on the two match-heavy benchmarks (-18.0% on `unicode_normalization-check`! :D); I'd like a perf run to check the overall impact.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-10-29 01:37:49 +00:00
Josh Stone
d9cbd192eb ci: update x86_64-gnu and x86_64-gnu-debug to ubuntu:20.04
The former `ubuntu:19.10` reached EOL in July, 2020, whereas
`ubuntu:20.04` is an LTS release supported until 2025.

These are non-dist CI images, so the impact should be low.
2020-10-28 17:26:03 -07:00
Tomasz Miąsko
a15e0dc499 Test building of libraries with rustc logging enabled 2020-10-29 00:00:00 +00:00
Tomasz Miąsko
4fc21689d8 Add support for rustc-env and unset-rustc-env for aux-builds 2020-10-29 18:09:53 +01:00
Tomasz Miąsko
79cc5099b1 Use RwLock instead of Lock for SourceMap::files 2020-10-29 18:09:53 +01:00
Tomasz Miąsko
2661a4edb9 Avoid BorrowMutError with RUSTC_LOG=debug
$ touch empty.rs
$ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs

Fails with a `BorrowMutError` because source map files are already
borrowed while `features_query` attempts to format a log message
containing a span.

Release the borrow before the query to avoid the issue.
2020-10-29 18:09:53 +01:00
Camelid
4e30e10f25 Don't say you "should" use fully qualified syntax
That recommendation was removed last year; there isn't a particular
style that is officially recommended anymore.
2020-10-28 16:49:30 -07:00
Camelid
e0eed3c558 Fix broken intra-doc link 2020-10-28 16:31:45 -07:00
Camelid
bd7cbaecd3 Explain fully qualified syntax for Rc and Arc 2020-10-28 16:31:44 -07:00
Eduardo Broto
77da566cc6 Merge commit '645ef505da378b6f810b1567806d1bcc2856395f' into clippyup 2020-10-28 23:36:07 +01:00
bors
645ef505da Auto merge of #6257 - giraffate:sync-from-rust, r=ebroto
Rustup

changelog: none
2020-10-28 21:53:23 +00:00
Eduardo Broto
e83e79f1c2 Reinstate link to temporary_cstr_as_ptr 2020-10-28 22:36:22 +01:00
Eduardo Broto
a50d9e7af6 Deprecate temporary_cstr_as_ptr 2020-10-28 22:34:45 +01:00
Ian Jackson
776e204609 rustdoc: Use Vec::into_iter() rather than drain()
This allows removing a `mut` which is nicer.

Suggested-by: @jyn514
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 21:29:21 +00:00
Ian Jackson
1d6c860277
Add a comment about non-panicking of splitn().next().unwrap()
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-28 21:25:47 +00:00
bjorn3
4cc6b4f9bf Fix many clippy warnings 2020-10-28 21:47:25 +01:00
Mara Bos
b48fee010c Add tracking issue number for panic_any. 2020-10-28 21:23:45 +01:00
Mara Bos
a9d334d386
Update panic_any feature name.
Co-authored-by: Camelid <camelidcamel@gmail.com>
2020-10-28 21:21:41 +01:00
Ian Jackson
39b80cb7c0 rustdoc: Fix some nits
* Remove a needless comma in the Rust code
* Replace double spaces after full stops with single spaces

Requested-by: @GuillaumeGomez
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 20:13:31 +00:00
bors
31ee872db5 Auto merge of #78415 - tgnottingham:expn_id_tag_hash, r=Aaron1011
rustc_span: avoid hashing ExpnId tag when using cached hash
2020-10-28 20:03:55 +00:00
Nadrieril
41a74ace4a Apply suggestions from code review
Co-authored-by: Who? Me?! <mark-i-m@users.noreply.github.com>
Co-authored-by: varkor <github@varkor.com>
2020-10-28 19:08:01 +00:00
Dániel Buga
0fabbf9713 Fix typos 2020-10-28 19:32:28 +01:00
Eric Huss
72016f4ceb Update cargo 2020-10-28 11:14:47 -07:00
Ian Jackson
709efd9df6 rustdoc: Provide a --default-theme THEME option
This is a fairly simple special case of --default-eetting.  We must
set both "theme" and "use-system-theme".

Providing it separately enables us to document a way to set the theme
without expoosing the individual settings keywords, which are quite
complex.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 18:01:06 +00:00
Ian Jackson
d8a4497561 rustdoc: Provide a general --default-setting SETTING[=VALUE] option
We just plumb through what the user tells us.

This is flagged as unstable, mostly because I don't understand the
compatibility rules that rustdoc obeys for local storage data, and how
error handling of invalid data works.

We collect() the needed HashMap from Vec of Vecs of (key, value)
pairs, so that there is a nice place to add new more-specific options.
It would have been possible to use Extend::extend but doing it this
way ensures that all the used inputs are (and will stay) right next to
each other.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 17:54:07 +00:00
Ian Jackson
5cd96d638c rustdoc: Provide a way to set the default settings from Rust code
rustdoc has various user-configurable preferences.  These are recorded
in web Local Storage (where available).  But we want to provide a way
to configure the default default, including for when web storage is
not available.

getSettingValue is the function responsible for looking up these
settings.  Here we make it fall back some in-DOM data, which
ultimately comes from RenderOptions.default_settings.

Using HTML data atrtributes is fairly convenient here, dsspite the
need to transform between snake and kebab case to avoid the DOM
converting kebab case to camel case (!)

We cache the element and dataset lookup in a global variable, to
ensure that getSettingValue remains fast.

The DOM representation has to be in an element which precedes the
inclusion of storage.js.  That means it has to be in the <head> and we
should not use an empty <div> as the container (although most browsers
will accept that).  An empty <script> element provides a convenient
and harmless container object.  <meta> would be another possibility
but runs a greater risk of having unwanted behaviours on weird
browsers.

We trust the RenderOptions not to contain unhelpful setting names,
which don't fit nicely into an HTML attribute.  It's awkward to quote
dataset keys.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 17:54:06 +00:00
Eric Huss
23167cbfe9 Update books 2020-10-28 10:53:15 -07:00
bors
3dddf6ac1e Auto merge of #78414 - nox:function-sections, r=nagisa,bjorn3
Implement -Z function-sections=yes|no

This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing.

I'm having fun experimenting with musl libc and trying to implement the start symbol in Rust, that means avoiding code that requires relocations, and AFAIK putting everything in its own section makes the toolchain generate `GOTPCREL` relocations for symbols that could use plain old PC-relative addressing (at least on `x86_64`) if they were all in the same section.
2020-10-28 17:47:36 +00:00
Peter Todd
061715604a
Inline NonZeroN::from(n) 2020-10-28 13:26:44 -04:00
Dániel Buga
a8803d3c04 Delete files immediately, instead of collecting into vector 2020-10-28 17:22:10 +01:00
Dániel Buga
2fa359814a Avoid reallocating cgu_path_components 2020-10-28 17:22:10 +01:00
Dániel Buga
5248b20d9a Reuse memory 2020-10-28 17:22:10 +01:00
Dániel Buga
a21f3a76a9 Clean up encode_dep_graph 2020-10-28 17:22:05 +01:00
Takayuki Nakata
c42a22d2dc Use double_neg.stderr 2020-10-29 01:02:09 +09:00
Ian Jackson
2e10475fdd rustdoc: js: Use getSettingValue for all rustdoc-* values
Currently, storage.js and main.js have many open-coded calls to
getCurrentValue for "rustdoc-" values, but these are settings and
should be handled by getSettingValue.

So make getSettingValue part of storage.js (where everyone can call
it) and use it everywhere.

No functional change yet.  We are going to make getSettingValue do
something more sophisticated in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 15:44:59 +00:00
Dániel Buga
f3e6d882fe Fix typos and replace static vector with slice 2020-10-28 16:42:28 +01:00