Commit Graph

133472 Commits

Author SHA1 Message Date
Vadim Petrochenkov
68f94e94ed resolve: Centralize some error reporting for unexpected macro resolutions 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
69894ce9ac resolve: Introduce a separate NonMacroAttrKind for legacy derive helpers 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
e7ee4d66ce expand: Move fully_configure to config.rs 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
b49fbc9432 expand: Tell built-in macros whether we are currently in forced expansion mode 2020-11-19 19:25:20 +03:00
bors
7e2032390c Auto merge of #78449 - Aaron1011:fix/libstd-semi, r=dtolnay
Remove semicolon from internal `err` macro

This macro is used in expression position (a match arm), and only
compiles because of #33953

Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.
2020-11-19 10:52:19 +00:00
bors
5a549d36ee Auto merge of #79068 - DevJPM:ci-llvm-9-fix, r=pietroalbini
Remove Hacks and Fixmes from PR CI's LLVM-9 Container

Now with LLVM 9 being the minimum supported version (thanks to #78848 ), we can
finally remove the hacks in the dockerfile.

This wasn't in the main PR bumping the version as I didn't quite
understand what's going on and needed here.

Relevant issues and PRs:

- Issue #69823
- PR #70989

I hope I actually adressed things correctly here?
2020-11-19 08:10:15 +00:00
bors
bf469eb6c2 Auto merge of #79002 - est31:backtrace_colno, r=dtolnay
Add column number support to Backtrace

Backtrace frames might include column numbers.
Print them if they are included.
2020-11-19 06:00:49 +00:00
Aaron Hill
b03d4b0ee9
Bump stage0 rustfmt to nightly-2020-11-19
This pulls in https://github.com/rust-lang/rustfmt/pull/4507,
allowing us to remove a semicolon in an internal libstd macro
2020-11-18 23:11:38 -05:00
Aaron Hill
5d26145dee
Remove semicolon from internal err macro
This macro is used in expression position (a match arm), and only
compiles because of #33953

Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.
2020-11-18 23:10:35 -05:00
bors
675f114d95 Auto merge of #79106 - tmiasko:inline-hint, r=nagisa,eddyb
Fix setting inline hint based on `InstanceDef::requires_inline`

For instances where `InstanceDef::requires_inline` is true, an attempt
is made to set an inline hint though a call to the `inline` function.
The attempt is ineffective, since all attributes will be usually removed
by the second call.

Fix the issue by applying the attributes only once, with user provided
attributes having a priority when provided.

Closes #79108.
2020-11-18 23:44:54 +00:00
bors
8256379832 Auto merge of #78995 - Nadrieril:clean-empty-match, r=varkor
Handle empty matches cleanly in exhaustiveness checking

This removes the special-casing of empty matches that was done in `check_match`. This fixes most of https://github.com/rust-lang/rust/issues/55123.
Somewhat unrelatedly, I also made `_match.rs` more self-contained, because I think it's cleaner.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-11-18 21:24:40 +00:00
bors
8d2d001492 Auto merge of #79167 - m-ou-se:rollup-4g15apk, r=m-ou-se
Rollup of 11 pull requests

Successful merges:

 - #78361 (Updated the list of white-listed target features for x86)
 - #78785 (linux: try to use libc getrandom to allow interposition)
 - #78999 (stability: More precise location for deprecation lint on macros)
 - #79039 (Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak)
 - #79079 (Turn top-level comments into module docs in MIR visitor)
 - #79114 (add trailing_zeros and leading_zeros to non zero types)
 - #79131 (Enable AVX512 *epi64 variants by updating stdarch)
 - #79133 (bootstrap: use the same version number for rustc and cargo)
 - #79145 (Fix handling of panic calls)
 - #79151 (Fix typo in `std::io::Write` docs)
 - #79158 (type is too big -> values of the type are too big)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-18 18:16:31 +00:00
Mara Bos
43d13e2d58
Rollup merge of #79158 - lcnr:lazy-norm-coerce, r=oli-obk
type is too big -> values of the type are too big

strictly speaking, `[u8; usize::MAX]` or even `[[[u128; usize::MAX]; usize::MAX]; usize::MAX]` are absolutely fine types as long as you don't try to deal with any values of it.

This error message seems to cause some confusion imo, for example in https://github.com/rust-lang/rust/pull/79135#issuecomment-729361380 so I would prefer us to be more precise here.

See the added test case which uses one of these types without causing an error.

r? ``@oli-obk``
2020-11-18 15:46:40 +01:00
Mara Bos
5a9104fcdd
Rollup merge of #79151 - wchargin:wchargin-io-write-docs, r=jyn514
Fix typo in `std::io::Write` docs

These referred to a “`Write`er”—extra *e*. Presumably a copy-paste
holdover from “`Read`er”.

Test Plan:
Running ``git grep '`\?[Ww]rite`\?er'`` no longer finds any results.

wchargin-branch: io-write-docs
2020-11-18 15:46:38 +01:00
Mara Bos
20fbe22a64
Rollup merge of #79145 - camelid:clippy-fix-panics, r=flip1995
Fix handling of panic calls

This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at ``@flip1995's`` suggestion in rust-lang/rust-clippy#6310.

r? ``@flip1995``
cc ``@m-ou-se``
2020-11-18 15:46:36 +01:00
Mara Bos
83fcbd576d
Rollup merge of #79133 - pietroalbini:simplify-stage0, r=Mark-Simulacrum
bootstrap: use the same version number for rustc and cargo

Historically the stable tarballs were named after the version number ofthe specific tool, instead of the version number of Rust. For example, both of the following tarballs were part of the same release:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz

PR #77336 changed the dist code to instead use Rust's version number for all the tarballs, regardless of the tool they contain:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz

Because of that there is no need anymore to have a separate `cargo` field in `src/stage0.txt`, as the Cargo version will always be the same as the rustc version. This PR removes the field, simplifying the code and the maintenance work required while producing releases.

r? ``@Mark-Simulacrum``
2020-11-18 15:46:34 +01:00
Mara Bos
e2addb4329
Rollup merge of #79131 - vertexclique:stdarch-update, r=Amanieu
Enable AVX512 *epi64 variants by updating stdarch
2020-11-18 15:46:32 +01:00
Mara Bos
126d88bd12
Rollup merge of #79114 - andjo403:nonzero_leading_trailing_zeros, r=m-ou-se
add trailing_zeros and leading_zeros to non zero types

as a way towards being able to use the optimized intrinsics ctlz_nonzero and cttz_nonzero from stable.

have not crated any tracking issue if this is not a solution that is wanted
2020-11-18 15:46:31 +01:00
Mara Bos
f85c3f72a4
Rollup merge of #79079 - camelid:mir-visit-docs, r=matthewjasper
Turn top-level comments into module docs in MIR visitor
2020-11-18 15:46:29 +01:00
Mara Bos
ad6fd9b037
Rollup merge of #79039 - thomcc:weakly-relaxing, r=Amanieu
Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak

This moves reading this from multiple SeqCst reads to Relaxed read + Acquire fence if we are actually going to use the data.

Would love to avoid the Acquire fence, but doing so would need Ordering::Consume, which neither Rust, nor LLVM supports (a shame, since this fence is hardly free on ARM, which is what I was hoping to improve).

r? ``@Amanieu`` (Sorry for always picking you, but I know a lot of people wouldn't feel comfortable reviewing atomic ordering changes)
2020-11-18 15:46:27 +01:00
Mara Bos
92dcf6d733
Rollup merge of #78999 - petrochenkov:deprid, r=eddyb
stability: More precise location for deprecation lint on macros

One missing piece of https://github.com/rust-lang/rust/pull/73178.
2020-11-18 15:46:25 +01:00
Mara Bos
61134aa54c
Rollup merge of #78785 - cuviper:weak-getrandom, r=m-ou-se
linux: try to use libc getrandom to allow interposition

We'll try to use a weak `getrandom` symbol first, because that allows
things like `LD_PRELOAD` interposition. For example, perf measurements
might want to disable randomness to get reproducible results. If the
weak symbol is not found, we fall back to a raw `SYS_getrandom` call.
2020-11-18 15:46:23 +01:00
Mara Bos
c7e9029b80
Rollup merge of #78361 - DevJPM:master, r=workingjubilee
Updated the list of white-listed target features for x86

This PR both adds in-source documentation on what to look out for when adding a new (X86) feature set and [adds all that are detectable at run-time in Rust stable as of 1.27.0](https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/src/detect/arch/x86.rs).

This should only enable the use of the corresponding LLVM intrinsics.
Actual intrinsics need to be added separately in rust-lang/stdarch.

It also re-orders the run-time-detect test statements to be more consistent
with the actual list of intrinsics whitelisted and removes underscores not present
in the actual names (which might be mistaken as being part of the name)

The reference for LLVM's feature names used is [this file](https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/X86TargetParser.def).

This PR was motivated as the compiler end's part for allowing #67329 to be adressed over on rust-lang/stdarch
2020-11-18 15:46:19 +01:00
bors
7d747db0d5 Auto merge of #79159 - pietroalbini:woops, r=pietroalbini
Revert #79132

The beta promotion release was mistakenly landed on master instead of beta. Ugh.

r? `@ghost`
cc `@rust-lang/release`
2020-11-18 10:39:02 +00:00
Bastian Kauschke
88584d5800 change error for LayoutErr::SizeOverflow 2020-11-18 11:38:30 +01:00
Pietro Albini
3853c0c9fc
Revert "Auto merge of #79132 - pietroalbini:beta-next, r=Mark-Simulacrum"
This was landed on master instead of beta!
2020-11-18 11:18:40 +01:00
bors
c4f836ad1a Auto merge of #77820 - jyn514:from-inner, r=petrochenkov
Add `Item::from_def_id_and_kind` to reduce duplication in rustdoc

This makes it harder to make typos, and also makes it much more clear what's intentionally different rather than a typo (look for `what_rustc_thinks`).

Found this while working on https://github.com/rust-lang/rust/issues/76998, I really didn't want to add `const_visibility` in 20 different places.

r? `@GuillaumeGomez`
2020-11-18 03:56:18 +00:00
bors
87776d7d53 Auto merge of #79132 - pietroalbini:beta-next, r=Mark-Simulacrum
Prepare beta 1.49.0

This PR sets everything up for beta 1.49.0, and backports the following PRs to it:

* #79107 - build-manifest: strip newline from rustc version
* #78986 - Avoid installing external LLVM dylibs
* #79074 - Install CI llvm into the library directory
* #78364 - Update RELEASES.md for 1.48.0
* #77939 - Ensure that the source code display is working with DOS backline

r? `@ghost`
cc `@rust-lang/release`
2020-11-18 01:34:32 +00:00
William Chargin
bdaa76cfde Fix typo in std::io::Write docs
These referred to a “`Write`er”—extra *e*. Presumably a copy-paste
holdover from “`Read`er”.

Test Plan:
Running ``git grep '`\?[Ww]rite`\?er'`` no longer finds any results.

wchargin-branch: io-write-docs
2020-11-17 15:32:23 -08:00
Mark Rousskov
7477867b01 Ignore failures of RLS on aarch64 Windows 2020-11-17 16:00:41 -05:00
Camelid
95eff66426 Fix handling of panic calls
This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at @flip1995's suggestion in rust-lang/rust-clippy#6310.
2020-11-17 12:16:15 -08:00
Joshua Nelson
0e1a302f59 Remove dead code in rustdoc::doctree
It was completely unused.
2020-11-17 15:16:05 -05:00
Joshua Nelson
fc4ca55291 Add from_def_id_and_kind reducing duplication in rustdoc
- Add `Item::from_hir_id_and_kind` convenience wrapper
- Make name parameter mandatory

  `tcx.opt_item_name` doesn't handle renames, so this is necessary
  for any item that could be renamed, which is almost all of them.

- Override visibilities to be `Inherited` for enum variants

  `tcx.visibility` returns the effective visibility, not the visibility
  that was written in the source code. `pub enum E { A, B }` always has
  public variants `A` and `B`, so there's no sense printing `pub` again.

- Don't duplicate handling of `Visibility::Crate`

  Instead, represent it as just another `Restricted` path.
2020-11-17 15:16:03 -05:00
Joshua Nelson
c9a17b1d3f Fix broken handling of MacroDef in Map::attrs
This also uses an exhaustive match to avoid future similar bugs.
2020-11-17 15:13:25 -05:00
Joshua Nelson
6c28ffbef3 Use DefPath for clean::Visibility, not clean::Path
Visibility needs much less information than a full path, since modules
can never have generics. This allows constructing a Visibility from only
a DefId.

Note that this means that paths are now normalized to their DefPath.
In other words, `pub(self)` or `pub(super)` now always shows `pub(in
path)` instead of preserving the original text.
2020-11-17 15:13:25 -05:00
Andreas Jonson
9bbc4c16d3 add trailing_zeros and leading_zeros to non zero types 2020-11-17 19:54:29 +01:00
Mark Rousskov
6142bf6bd9
Update fulldeps test 2020-11-17 16:43:38 +01:00
bors
c919f490bb Auto merge of #79138 - m-ou-se:rollup-owel5ld, r=m-ou-se
Rollup of 8 pull requests

Successful merges:

 - #74293 (Rustdoc test compiler output color)
 - #78702 ([self-profiling] Include the estimated size of each cgu in the profile)
 - #79069 (Get rid of `highlight::Class::None`)
 - #79072 (Fix exhaustiveness in case a byte string literal is used at slice type)
 - #79120 (update rustfmt to v1.4.27)
 - #79125 (Get rid of clean::{Method, TyMethod})
 - #79126 (Remove duplicate `Trait::auto` field)
 - #79130 (extend macro braces test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-17 15:27:29 +00:00
Mara Bos
f698505177
Rollup merge of #79130 - lcnr:extend-tes, r=varkor
extend macro braces test

r? `@varkor`
2020-11-17 16:14:00 +01:00
Mara Bos
ca38bd4230
Rollup merge of #79126 - jyn514:auto, r=GuillaumeGomez
Remove duplicate `Trait::auto` field

It was exactly the same as `is_auto`.

I found this while working on #78082, but it's not required for that PR.

r? `@GuillaumeGomez`
2020-11-17 16:13:58 +01:00
Mara Bos
3d63f25edf
Rollup merge of #79125 - jyn514:fewer-types, r=GuillaumeGomez
Get rid of clean::{Method, TyMethod}

They're redundant and almost the same as `clean::Function`.

I needed this for https://github.com/rust-lang/rust/pull/78082, although I forget why.

r? `@GuillaumeGomez`
2020-11-17 16:13:57 +01:00
Mara Bos
53ddb73fd3
Rollup merge of #79120 - calebcartwright:update-rustfmt, r=Mark-Simulacrum
update rustfmt to v1.4.27

Fixes https://github.com/rust-lang/rustfmt/issues/4528
2020-11-17 16:13:55 +01:00
Mara Bos
b6f52410bb
Rollup merge of #79072 - oli-obk:byte_str_pat, r=estebank
Fix exhaustiveness in case a byte string literal is used at slice type

fixes #79048
2020-11-17 16:13:53 +01:00
Mara Bos
dda479815a
Rollup merge of #79069 - jyn514:class-none, r=GuillaumeGomez
Get rid of `highlight::Class::None`

This is mostly me learning the codebase for https://github.com/rust-lang/rust/pull/77939, so feel free to close the PR.
It does have the small benefit that we statically know rustdoc isn't generating useless `span`s, though.

r? `@GuillaumeGomez`
cc `@matklad`
2020-11-17 16:13:51 +01:00
Mara Bos
fa45fce0d3
Rollup merge of #78702 - wesleywiser:self_profile_cgu_sizes, r=Mark-Simulacrum
[self-profiling] Include the estimated size of each cgu in the profile

This is helpful when looking for CGUs where the size estimate isn't a
good indicator of compilation time.

I verified that moving the profiling timer call doesn't affect the
results.

Results:

<img width="297" alt="Screen Shot 2020-11-03 at 7 25 04 AM" src="https://user-images.githubusercontent.com/831192/97985503-5901d100-1da6-11eb-9f10-f3e399702952.png">

`measureme` doesn't have support for custom arg names yet so `arg0` is the CGU name and `arg1` is the estimated size.
2020-11-17 16:13:49 +01:00
Mara Bos
81f9feba97
Rollup merge of #74293 - GuillaumeGomez:rustdoc-test-compiler-output-color, r=jyn514
Rustdoc test compiler output color

Fixes #72915

We just need to be sure it doesn't break rustdoc doctests' compilation checks. Maybe some other unforeseen consequences too?

r? `@ehuss`
cc `@rust-lang/rustdoc`
2020-11-17 16:13:46 +01:00
Pietro Albini
d17874ff60 bootstrap: use the same version number for rustc and cargo
Historically the stable tarballs were named after the version number of
the specific tool, instead of the version number of Rust. For example,
both of the following tarballs were part of the same release:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz

PR #77336 changed the dist code to instead use Rust's version number for
all the tarballs, regardless of the tool they contain:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz

Because of that there is no need anymore to have a separate `cargo`
field in src/stage0.txt, as the Cargo version will always be the same as
the rustc version. This PR removes the field, simplifying the code and
the maintenance work required while producing releases.
2020-11-17 09:14:02 -05:00
bors
e0ef0fc392 Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk
Introduce `TypeVisitor::BreakTy`

Implements MCP rust-lang/compiler-team#383.
r? `@ghost`
cc `@lcnr` `@oli-obk`

~~Blocked on FCP in rust-lang/compiler-team#383.~~
2020-11-17 12:24:34 +00:00
Guillaume Gomez
d2df22268c
Add test to ensure that no DOS backline (\r\n) doesn't create extra backline in source rendering 2020-11-17 12:42:51 +01:00
Guillaume Gomez
f7886a6277
Ensure that the source code display is working with DOS backline 2020-11-17 12:42:47 +01:00