Yuki Okushi [Fri, 8 Jan 2021 02:11:34 +0000 (11:11 +0900)]
Rollup merge of #79675 - CraftSpider:79669, r=estebank
Make sure rust-call errors occur correctly for traits
Fixes #79669
Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.
Yuki Okushi [Thu, 7 Jan 2021 17:06:20 +0000 (02:06 +0900)]
Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011
rustc_parse: Better spans for synthesized token streams
I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`.
Yuki Okushi [Thu, 7 Jan 2021 17:06:16 +0000 (02:06 +0900)]
Rollup merge of #80769 - ejez:patch-1, r=jonas-schievink
Improve wording of parse doc
Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.
Yuki Okushi [Thu, 7 Jan 2021 17:06:11 +0000 (02:06 +0900)]
Rollup merge of #80738 - arusahni:master, r=GuillaumeGomez
Remove bottom margin from crate version when the docs sidebar is collapsed
This fixes a mobile UI bug where a vertical scrollbar would always be
rendered on the sidebar nav when the menu was closed. When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right.
bors [Thu, 7 Jan 2021 15:21:30 +0000 (15:21 +0000)]
Auto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu
Stabilize slice::strip_prefix and slice::strip_suffix
These two methods are useful. The corresponding methods on `str` are already stable.
I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns.
Tracking PR: #73413. I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: #75078
I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr). The part to do with `compiler/rustc_feature` did not seem applicable. I assume that's because these are just library features, so there is no corresponding machinery in rustc.
bors [Thu, 7 Jan 2021 11:22:42 +0000 (11:22 +0000)]
Auto merge of #79863 - JohnTitor:compiler-builtins, r=bjorn3
Update `compiler_builtins` to 0.1.39
This version contains the fixes of https://github.com/rust-lang/compiler-builtins/issues/390 and https://github.com/rust-lang/compiler-builtins/issues/391.
Also, rename features following https://github.com/rust-lang/compiler-builtins/pull/386.
Ejez [Thu, 7 Jan 2021 04:47:03 +0000 (07:47 +0300)]
Improve wording of parse doc
Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.
bors [Wed, 6 Jan 2021 21:48:06 +0000 (21:48 +0000)]
Auto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwco
Optimize away a `fs::metadata` call.
This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.
Camelid [Mon, 28 Dec 2020 00:54:47 +0000 (16:54 -0800)]
Rename to `nearest_parent_mod`
* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod`
`normal_ancestor_id` is a very confusing name if you don't already
understand what it means. Adding docs helps, but using a clearer and
more obvious name is also important.
* Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod`
Dan Gohman [Wed, 6 Jan 2021 16:20:58 +0000 (08:20 -0800)]
Optimize away a `fs::metadata` call.
This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.
bors [Tue, 5 Jan 2021 03:06:32 +0000 (03:06 +0000)]
Auto merge of #80708 - JohnTitor:rollup-6esk027, r=JohnTitor
Rollup of 12 pull requests
Successful merges:
- #80442 (Mention Arc::make_mut and Rc::make_mut in the documentation of Cow)
- #80533 (bootstrap: clippy fixes)
- #80538 (Add check for `[T;N]`/`usize` mismatch in astconv)
- #80612 (Remove reverted change from relnotes)
- #80627 (Builder: Warn if test file does not exist)
- #80637 (Use Option::filter instead of open-coding it)
- #80643 (Move variable into the only branch where it is relevant)
- #80656 (Fixed documentation error for `std::hint::spin_loop`)
- #80666 (Fix missing link for "fully qualified syntax")
- #80672 (./x.py clippy: allow the most noisy lints)
- #80677 (doc -- list edit for consistency)
- #80696 (make sure that promoteds which fail to evaluate in dead const code behave correctly)
Yuki Okushi [Tue, 5 Jan 2021 00:52:52 +0000 (09:52 +0900)]
Rollup merge of #80696 - RalfJung:failing-promoteds, r=oli-obk
make sure that promoteds which fail to evaluate in dead const code behave correctly
https://github.com/rust-lang/rust/pull/80243 showed that we'll have to live with these kinds of failing promoteds for a while, so let's make sure we have a test that covers them.
Yuki Okushi [Tue, 5 Jan 2021 00:52:49 +0000 (09:52 +0900)]
Rollup merge of #80672 - matthiaskrgr:xpy_clippy_less_noise, r=Mark-Simulacrum
./x.py clippy: allow the most noisy lints
This silences the following clippy lints in ./x.py clippy:
many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.
Just for clarification; this only changes the output of `x.py clippy` inside the rustc repo and does not change anything about clippy or how `cargo clippy` is run on peoples crates.
Yuki Okushi [Tue, 5 Jan 2021 00:52:44 +0000 (09:52 +0900)]
Rollup merge of #80643 - LingMan:unwrap, r=oli-obk
Move variable into the only branch where it is relevant
At the `if` branch `filter` (the `let` binding) is `None` iff `filter` (the parameter) was `None`.
We can branch on the parameter, move the binding into the `if`, and the complexity of handling
`Option<Option<_>` largely dissolves.
`@rustbot` modify labels +C-cleanup +T-compiler
Note: I have no idea how hot this code is. If this method frequently gets called with a `None` filter, there might be a small perf improvement.
Yuki Okushi [Tue, 5 Jan 2021 00:52:40 +0000 (09:52 +0900)]
Rollup merge of #80627 - bugadani:warn, r=Mark-Simulacrum
Builder: Warn if test file does not exist
Running `./x.py test` with a file that does not exists (but where the path belongs to a test suite) silently ignores the missing file and runs the whole test suite. This PR prints a warning to reduce the potential surprise factor.
bors [Tue, 5 Jan 2021 00:20:18 +0000 (00:20 +0000)]
Auto merge of #80426 - jyn514:bootstrap-caching, r=Mark-Simulacrum
Don't use `self.date` unconditionally for `program_out_of_date()`
This avoids unnecessary cache invalidations for programs not affected by
the stage0 version (which is everything except the stage0 compiler
itself).
The redundant invalidations weren't noticed until now because they only
showed up on stage0 bumps, at which point people are used to rebuilding
everything anyway. I noticed it in https://github.com/rust-lang/rust/pull/79540
because I wasn't adding `self.date` to the stamp file (because I didn't realize it was necessary). Rather than
adding self.date I thought it was better to remove it from the cache key.
bors [Mon, 4 Jan 2021 20:56:34 +0000 (20:56 +0000)]
Auto merge of #80624 - RalfJung:place-ref, r=oli-obk
use PlaceRef more consistently instead of loosely coupled local+projection
Instead of working directly with the `projections` array, use `iter_projections` and `last_projection`. This avoids having to construct new `PlaceRef` from the pieces everywhere.
I only did this for a few files, to see how people think about this. If y'all are happy with this, I'll open an E-mentor issue to complete this. I grepped for `Place::ty_from` to find the places that need adjusting -- this could miss some, but I am not sure what else to grep for.
bors [Mon, 4 Jan 2021 13:23:08 +0000 (13:23 +0000)]
Auto merge of #80651 - GroteGnoom:issue-78123-fix, r=Nadrieril
Add note to non-exhaustive match on reference to empty
Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.
I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.
Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.
This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.
bors [Mon, 4 Jan 2021 10:32:28 +0000 (10:32 +0000)]
Auto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomez
Cleanup rustdoc handling of associated types
This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing https://github.com/rust-lang/rust/pull/80653 and thinking about https://github.com/rust-lang/rust/issues/80379. The new test case worked before, it just wasn't tested.
bors [Mon, 4 Jan 2021 05:04:04 +0000 (05:04 +0000)]
Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514
More js cleanup
Part of #79052 (Same kind as #80515).
This one is about some small fixes:
* Replacing some loops with `onEachLazy`.
* Removing unused function arguments.
* Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again.
bors [Mon, 4 Jan 2021 02:15:57 +0000 (02:15 +0000)]
Auto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJung
Allow references to interior mutable data behind a feature gate
supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant
Matthias Krüger [Mon, 4 Jan 2021 01:20:42 +0000 (02:20 +0100)]
./x.py clippy: allow the most noisy lints
This silences the following clippy lints in ./x.py clippy:
many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.