Commit graph

4939 commits

Author SHA1 Message Date
bors
69e1d22ddb Auto merge of #83981 - nagisa:nagisa/revert-cfg-wasm, r=Mark-Simulacrum
Remove the insta-stable `cfg(wasm)`

The addition of `cfg(wasm)` was an oversight on my end that turns out to have a number
of downsides:

* It was introduced as an insta-stable addition, forgoing the usual
  staging mechanism we use for potentially far-reaching changes;
* It is a breaking change for people who are using `--cfg wasm` either
  directly or via cargo for other purposes;
* It is not entirely clear if a bare `wasm` cfg is a right option or
  whether `wasm` family of targets are special enough to warrant
  special-casing these targets specifically.

As for the last point, there appears to be a fair amount of support for
reducing the boilerplate in specifying architectures from the same
family, while ignoring their pointer width. The suggested way forward
would be to propose such a change as a separate RFC as it is potentially
a quite contentious addition.

cc #83879 `@devsnek`
2021-04-08 07:23:04 +00:00
bors
0bbf473151 Auto merge of #82958 - camelid:res-docs, r=petrochenkov
Document `Res` and its friends

I noticed [this Zulip conversation][z] and thought it would be a good idea to
document `Res` and the other types near it.

[z]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2382516.20-.20Add.20inherent.20associated.20types/near/227914819
2021-04-08 02:43:31 +00:00
Camelid
8563a19384 Document Res and its friends 2021-04-07 18:03:38 -07:00
Dylan DPC
b14d54d013
Rollup merge of #83974 - pierwill:fix-callbacks-names, r=jyn514
Fix outdated crate names in `rustc_interface::callbacks`
2021-04-08 01:01:47 +02:00
Dylan DPC
1ab186aeed
Rollup merge of #83965 - rust-lang:debug-intravisit-fnkind, r=lqd
Add Debug implementation for hir::intravisit::FnKind
2021-04-08 01:01:46 +02:00
Dylan DPC
97c50d529b
Rollup merge of #83952 - estebank:issue-83943, r=petrochenkov
Account for `ExprKind::Block` when suggesting .into() and deref

Fix #83943.
2021-04-08 01:01:45 +02:00
Dylan DPC
a113240b91
Rollup merge of #83689 - estebank:cool-bears-hot-tip, r=davidtwco
Add more info for common trait resolution and async/await errors

* Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases
* Point at `impl` and type defs introducing requirements on E0277
2021-04-08 01:01:43 +02:00
Simonas Kazlauskas
54dc7cebce Remove the insta-stable cfg(wasm)
The addition of `cfg(wasm)` was an oversight on my end that has a number
of downsides:

* It was introduced as an insta-stable addition, forgoing the usual
  staging mechanism we use for potentially far-reaching changes;
* It is a breaking change for people who are using `--cfg wasm` either
  directly or via cargo for other purposes;
* It is not entirely clear if a bare `wasm` cfg is a right option or
  whether `wasm` family of targets are special enough to warrant
  special-casing these targets specifically.

As for the last point, there appears to be a fair amount of support for
reducing the boilerplate in specifying architectures from the same
family, while ignoring their pointer width. The suggested way forward
would be to propose such a change as a separate RFC as it is potentially
a quite contentious addition.
2021-04-07 23:09:56 +03:00
bors
ef2ef926a5 Auto merge of #81047 - glittershark:stabilize-cmp-min-max-by, r=kodraus
Stabilize cmp_min_max_by

I would like to propose cmp::{min_by, min_by_key, max_by, max_by_key}
for stabilization.

These are relatively simple and seemingly uncontroversial functions and
have been unchanged in unstable for a while now.

Closes: #64460
2021-04-07 18:02:21 +00:00
pierwill
934a30a8fd Fix outdated crate names in rustc_interface::callbacks 2021-04-07 11:45:27 -05:00
bors
e9cdcccfa8 Auto merge of #83964 - Dylan-DPC:rollup-9kinaiv, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #83476 (Add strong_count mutation methods to Rc)
 - #83634 (Do not emit the advanced diagnostics on macros)
 - #83816 (Trigger `unused_doc_comments` on macros at once)
 - #83916 (Use AnonConst for asm! constants)
 - #83935 (forbid `impl Trait` in generic param defaults)
 - #83936 (Disable using non-ascii identifiers in extern blocks.)
 - #83945 (Add suggestion to reborrow mutable references when they're moved in a for loop)
 - #83954 (Do not ICE when closure is involved in Trait Alias Impl Trait)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-07 15:33:46 +00:00
Griffin Smith
462f86da9a Stabilize cmp_min_max_by
I would like to propose cmp::{min_by, min_by_key, max_by, max_by_key}
for stabilization.

These are relatively simple and seemingly uncontroversial functions and
have been unchanged in unstable for a while now.
2021-04-07 10:29:04 -04:00
bors
b01026de46 Auto merge of #83932 - lcnr:probe-perf, r=estebank
use a `SmallVec` in `impl_or_trait_item`

#83293 showed that this is fairly hot, slightly improves max-rss and cpu cycles, does not noticeably improve instruction counts
2021-04-07 12:52:33 +00:00
Guillaume Gomez
6e77bcbbcd
Add Debug implementation for hir::intravisit::FnKind 2021-04-07 13:30:37 +02:00
Dylan DPC
d82419b406
Rollup merge of #83954 - estebank:issue-83613, r=varkor
Do not ICE when closure is involved in Trait Alias Impl Trait

Fix #83613.
2021-04-07 13:07:18 +02:00
Dylan DPC
d7d42ccfd2
Rollup merge of #83945 - SkiFire13:fix-83924, r=estebank
Add suggestion to reborrow mutable references when they're moved in a for loop

Address #83924
2021-04-07 13:07:17 +02:00
Dylan DPC
9c688cd2a2
Rollup merge of #83936 - crlf0710:disallow_extern_block_non_ascii, r=Manishearth
Disable using non-ascii identifiers in extern blocks.

Fixes #83923.
2021-04-07 13:07:16 +02:00
Dylan DPC
d554385bbf
Rollup merge of #83935 - SNCPlay42:param-default-impl-trait, r=varkor
forbid `impl Trait` in generic param defaults

Fixes #83929

Forbid using `impl Trait` in the default types of generic parameters, e.g. `struct Foo<T = impl Trait>`. I assume this was never supposed to be allowed - it seems no UI test used it.

Note that using `impl Trait` in this position did not hit a feature gate error; however, this *shouldn't* be a breaking change as any attempt to use it should have hit the ICE in #83929 and/or failed to provide a defining use of the `impl Trait`.
2021-04-07 13:07:15 +02:00
Dylan DPC
b81c6cdb57
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
2021-04-07 13:07:14 +02:00
Dylan DPC
4d5bb1ca22
Rollup merge of #83816 - JohnTitor:unused-doc-comments-on-macros, r=varkor
Trigger `unused_doc_comments` on macros at once

Fixes #83768
2021-04-07 13:07:12 +02:00
Dylan DPC
2c55bacfbf
Rollup merge of #83634 - JohnTitor:proc-macro-ice, r=varkor
Do not emit the advanced diagnostics on macros

Fixes #83510
2021-04-07 13:07:11 +02:00
Esteban Küber
60c7f37f7c Add spans to E0277 for impl/trait type/fn obligation disparity 2021-04-06 19:55:45 -07:00
Esteban Küber
2375b8ae7e review comments 2021-04-06 19:55:45 -07:00
Esteban Küber
8bc5581978 Point at impl and type defs introducing requirements on E0277 2021-04-06 19:55:44 -07:00
Esteban Küber
d326c218ef Suggest Pin/Box/Arc for more cases 2021-04-06 19:55:44 -07:00
Charles Lew
4752a54ad0 Disable using non-ascii identifiers in extern blocks. 2021-04-07 09:56:50 +08:00
Esteban Küber
18cf44b61b Do not ICE when closure is involved in TAIT
Fix #83613.
2021-04-06 18:17:50 -07:00
Esteban Küber
b8dda53e69 Remove trailing : from E0119 message 2021-04-06 18:16:11 -07:00
Esteban Küber
e1efa17faa Account for ExprKind::Block when suggesting .into() and deref
Fix #83943.
2021-04-06 17:23:48 -07:00
Giacomo Stevanato
7f823e5bbd Add reborrow suggestion when mutable reference is moved in a for loop 2021-04-06 21:39:44 +02:00
Dylan DPC
38a8fa8421
Rollup merge of #83903 - rust-lang:GuillaumeGomez-patch-1, r=lcnr
Fix typo in TokenStream documentation
2021-04-06 17:42:33 +02:00
Dylan DPC
e00893b715
Rollup merge of #83895 - eggyal:issue-83883, r=jyn514
Add listing of lints (eg via `-W help`) to rustdoc

Fixes #83883

r? `@jyn514`
2021-04-06 17:42:31 +02:00
Dylan DPC
93b506c6fa
Rollup merge of #83829 - petrochenkov:minclean, r=nagisa
rustc_target: Rely on defaults more in target specs
2021-04-06 17:42:29 +02:00
SNCPlay42
ee79f83129 forbid impl Trait in generic param defaults 2021-04-06 16:21:08 +01:00
lcnr
b729815fc7 use a SmallVec in impl_or_trait_item 2021-04-06 17:06:44 +02:00
Amanieu d'Antras
32be124e30 Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
bors
e1d49aaad4 Auto merge of #83821 - camelid:improve-thinvec, r=petrochenkov
Add `FromIterator` and `IntoIterator` impls for `ThinVec`

These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.
2021-04-06 09:57:12 +00:00
Alan Egerton
4d23c8e9a1
Add listing of lints (eg via -W help) to rustdoc 2021-04-06 09:54:56 +01:00
bors
354cc751b7 Auto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco
Find codegen backends in more locations

* Search in the sysroot passed using `--sysroot` in addition to the default sysroot.
* Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`.

This combined would allow putting `librustc_codegen_cranelift.so` in the right location of a sysroot passed using `--sysroot`.
2021-04-06 07:16:19 +00:00
bors
a6e7a5aa5d Auto merge of #81234 - repnop:fn-alignment, r=lcnr
Allow specifying alignment for functions

Fixes #75072

This allows the user to specify alignment for functions, which can be useful for low level work where functions need to necessarily be aligned to a specific value.

I believe the error cases not covered in the match are caught earlier based on my testing so I had them just return `None`.
2021-04-06 04:35:26 +00:00
Camelid
09ff88b600 Add FromIterator and IntoIterator impls for ThinVec
These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.
2021-04-05 19:09:51 -07:00
bors
0c7d4effd7 Auto merge of #83592 - nagisa:nagisa/dso_local, r=davidtwco
Set dso_local for hidden, private and local items

This should probably have no real effect in most cases, as e.g. `hidden`
visibility already implies `dso_local` (or at least LLVM IR does not
preserve the `dso_local` setting if the item is already `hidden`), but
it should fix `-Crelocation-model=static` and improve codegen in
executables.

Note that this PR does not exhaustively port the logic in [clang], only the
portion that is necessary to fix a regression from LLVM 12 that relates to
`-Crelocation_model=static`.

Fixes #83335

[clang]: 3001d080c8/clang/lib/CodeGen/CodeGenModule.cpp (L945-L1039)
2021-04-06 02:09:01 +00:00
bors
8e6b478a5a Auto merge of #83905 - JohnTitor:rollup-pa1la80, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #83370 (Add `x.py setup tools` which enables `download-rustc` by default)
 - #83489 (Properly suggest deref in else block)
 - #83734 (Catch a bad placeholder type error for statics in `extern`s)
 - #83814 (expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression)
 - #83835 (rustdoc: sort search index items for compression)
 - #83849 (rustdoc: Cleanup handling of associated items for intra-doc links)
 - #83881 (⬆️ rust-analyzer)
 - #83885 (Document compiler/ with -Aprivate-intra-doc-links)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-05 23:40:18 +00:00
Wesley Norris
448d07683a Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
Yuki Okushi
d8c04b13a2
Rollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum
Document compiler/ with -Aprivate-intra-doc-links

Since compiler/ always passes --document-private-items, it's ok to link to items that are private.
2021-04-06 06:24:17 +09:00
Yuki Okushi
f93412fb53
Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani
rustdoc: Cleanup handling of associated items for intra-doc links

Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time.

r? ```@bugadani``` maybe? Feel free to reassign :)
2021-04-06 06:24:15 +09:00
Yuki Okushi
67ffbedada
Rollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwco
expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression

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

The reported error is the same as for `let _ = #[cfg(FALSE)] EXPR;`
2021-04-06 06:24:12 +09:00
Yuki Okushi
76be7e2082
Rollup merge of #83734 - JohnTitor:issue-83621, r=davidtwco
Catch a bad placeholder type error for statics in `extern`s

Fixes #83621
2021-04-06 06:24:11 +09:00
Yuki Okushi
d9f123a5ae
Rollup merge of #83489 - LeSeulArtichaut:deref-else, r=davidtwco
Properly suggest deref in else block

Continues #79755, fixes #79736
r? `@davidtwco`
2021-04-06 06:24:09 +09:00
bors
d322385321 Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
Use tikv-jemallocator in rustc/rustdoc in addition to jemalloc-sys when enabled.

In https://github.com/rust-lang/rust/pull/81782 it was mentioned that one reason rustc may benefit from minimalloc is it doesn't use the `sdallocx` api from jemalloc.

Currently, on unix, rust uses jemalloc by importing its symbols to use them with the default, System (libc) global allocator.
This PR switches its global alloc to `tikv-jemallocator`, which correctly uses sized deallocation (https://docs.rs/tikv-jemallocator/0.4.1/src/tikv_jemallocator/lib.rs.html#121-126). `tikv-jemallocator`, as far as I can tell, is a more up-to-date set of bindings to jemalloc than `jemallocator`

The perf results of this pr are in large part due to the version upgrade of jemalloc, but sized deallocation has a non-trivial improvement, particularly to rustdoc.

This pr also includes changes to bootstrap to correctly pass the jemalloc feature through to the rustdoc build
2021-04-05 21:14:27 +00:00