Commit graph

141929 commits

Author SHA1 Message Date
Dylan DPC
8cee7b7947
Rollup merge of #83902 - alexcrichton:update-llvm, r=nikic
Update LLVM to support more wasm simd ops

Adds a commit with support for i64 simd comparisons for the wasm target
2021-04-06 17:42:32 +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
Dylan DPC
c92ac875bf
Rollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomez
Move `SharedContext` to `context.rs`

It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.
2021-04-06 17:42:28 +02:00
bors
16143d1067 Auto merge of #83875 - jyn514:diag_info, r=bugadani
rustdoc: Use DiagnosticInfo in more parts of intra-doc links

This makes the code a lot less verbose.

This is separated into lots of tiny commits because it was easier for me that way, but the overall diff isn't that big if you want to read it at once.

r? `@bugadani`
2021-04-06 15:37:29 +00:00
bors
6ae0835df0 Auto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995
Fix all occurences `needless_borrow` internally

The bug that got 'needless_borrow' moved into the nursery was fixed two years ago in d4370f8b.

This did trigger over a thousand times internally, so that's all the other changes. I vetted most of them, but there's a lot The only interesting change is to the lint list. `declare_tool_lint` already makes a reference, so there's no need to take a reference to the lints.

changelog: None
2021-04-06 15:30:48 +00: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
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
bors
d2ba777159 Auto merge of #7036 - horacimacias:master, r=giraffate
consider mutability on useless_vec suggestions

fixes #7035

changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.
2021-04-06 13:38:08 +00:00
bors
5c897d430d Auto merge of #83922 - RalfJung:miri, r=RalfJung
update Miri

Also updates the lockfile, since Miri updated some dependencies.
Cc `@rust-lang/miri` r? `@ghost`
2021-04-06 12:20:48 +00:00
Amanieu d'Antras
879bfeca54 Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
Amanieu d'Antras
32be124e30 Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
Ralf Jung
bf11b12e39 update Miri 2021-04-06 13:20:48 +02: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
ortem
3d3a5ca79f Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0
The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566
after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.
2021-04-06 12:44:17 +03:00
Horaci Macias
8a50923da4 consider mutability on useless_vec suggestions
https://github.com/rust-lang/rust-clippy/issues/7035
2021-04-06 11:09:52 +02: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
525646a380 Move SharedContext to context.rs
It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.
2021-04-05 19:27:48 -07: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
Eric Huss
48c2cde39e Update cargo 2021-04-05 17:10:04 -07: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
bors
57406c93df Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth
Don't trigger `same_item_push` if the vec is used in the loop body

fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body
2021-04-05 22:57:33 +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
fb6eb4ad93
Rollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink
⬆️ rust-analyzer
2021-04-06 06:24:16 +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
12d007da0f
Rollup merge of #83835 - notriddle:sort-index, r=ollie27
rustdoc: sort search index items for compression

This should not affect the appearance of the docs pages themselves.

This makes the pre-compressed search index smaller, thanks to the
empty-string path duplication format, and also the gzipped version,
by giving the algorithm more structure to work with.

    rust$ wc -c search-index-old.js search-index-new.js
    2628334 search-index-old.js
    2586181 search-index-new.js
    5214515 total
    rust$ gzip search-index-*
    rust$ wc -c search-index-old.js.gz search-index-new.js.gz
    239486 search-index-old.js.gz
    237386 search-index-new.js.gz
    476872 total
2021-04-06 06:24:13 +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
Yuki Okushi
e5eddedb80
Rollup merge of #83370 - jyn514:setup-tools, r=Mark-Simulacrum
Add `x.py setup tools` which enables `download-rustc` by default

Helps with https://github.com/rust-lang/rust/issues/81930. I know I said in that issue that I should fix that rebasing rebuilds bootstrap, but the compile time improvement is so good I think it's ok to leave that fix for later (I still plan to work on it). I think all the outright bugs have been fixed :)

This builds on https://github.com/rust-lang/rust/pull/83368 so I can set the option to `if-unchanged`.

r? ```@Mark-Simulacrum```
2021-04-06 06:24:08 +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
Guillaume Gomez
f4a19ca851
Fix typo in TokenStream documentation 2021-04-05 22:58:07 +02:00
Alex Crichton
6c0b98724c Update LLVM to support more wasm simd ops
Adds a commit with support for i64 simd comparisons for the wasm target
2021-04-05 13:50:49 -07:00
Vadim Petrochenkov
e7e485cf51 rustc_target: Rely on defaults more in target specs 2021-04-05 23:12:56 +03:00
bors
25c1ed38aa Auto merge of #7029 - ABouttefeux:master, r=Manishearth
fix `missing_panics_doc` not detecting `assert_eq!` and `assert_ne!`

fixes #6997
changelog: `missing_panics_doc` detects `assert_eq!` and `assert_ne!`

---
searching for `assert_eq!` and `assert_ne!` in `FindPanicUnwrap`
2021-04-05 19:14:55 +00:00
bors
d91da405df Auto merge of #6463 - xFrednet:5234-shared-code-in-if-blocks, r=phansch
New Lint: `branches_sharing_code`

This lint checks if all `if`-blocks contain some statements that are the same and can be moved out of the blocks to prevent code duplication. Here is an example:

```rust
let _ = if ... {
    println!("Start"); // <-- Lint for code duplication
    let _a = 99;
    println!("End"); // <-- Lint for code duplication
    false
} else {
    println!("Start");
    let _b = 17;
    println!("End");
    false
};
```

This could be written as:

```rust
println!("Start");

let _ = if ... {
    let _a = 99;
    false
} else {
    let _b = 17;
    false
};

println!("End");
```

---

This lint will get masked by the `IF_SAME_THEN_ELSE` lint. I think it makes more sense to only emit one lint per if block. This means that the folloing example:

```rust
if ... {
    let _a = 17;
} else {
    let _a = 17;
}
```

Will only trigger the `IF_SAME_THEN_ELSE` lint and not the `SHARED_CODE_IN_IF_BLOCKS` lint.

---

closes: #5234

changelog: Added a new lint: `branches_sharing_code`

And hello to the one that is writing the changelog for this release :D
2021-04-05 19:00:41 +00:00
bors
d203fceeb1 Auto merge of #83406 - b-naber:issue-83510, r=lcnr
Prevent very long compilation runtimes in LateBoundRegionNameCollector

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

On recursive types such as in the example given in https://github.com/rust-lang/rust/issues/83150, the current implementation of `LateBoundRegionNameCollector` has very long compilation runtimes. To prevent those we store the types visited in the `middle::ty::Visitor` implementation of `LateBoundRegionNameCollector` in a `SsoHashSet`.
2021-04-05 18:50:42 +00:00
Joshua Nelson
a86a740def Use DiagnosticInfo for report_diagnostic 2021-04-05 14:32:13 -04:00
Joshua Nelson
661acbc8bc Take DiagnosticInfo in privacy_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
f4c87c58a8 Take DiagnosticInfo in ambiguity_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
58f9c5b74a Take DiagnosticInfo in disambiguator_error 2021-04-05 14:32:13 -04:00
Joshua Nelson
2ab1b7d8c3 Rename link_range -> disambiguator_range in disambiguator_error
It's not the range of the full link, it's only a partial range.
2021-04-05 14:32:13 -04:00
Joshua Nelson
8ed7d936f8 Take DiagnosticInfo in resolution_failure 2021-04-05 14:32:13 -04:00
Joshua Nelson
d4011e1270 Use DiagnosticInfo for anchor failure
This gets rid of a lot of parameters, as well as fixing a diagnostic
bug.
2021-04-05 14:32:05 -04:00
bors
1a45e437b8 Auto merge of #7026 - daxpedda:cargo-author, r=camsteffen
Remove author requirement for `cargo_common_metadata`

This PR follows https://github.com/rust-lang/cargo/pull/9282, I'm not fully informed about all of this, it would be great if somebody knowledgeable about this topic agrees.

changelog: Changed `cargo_common_metadata` to stop linting on the optional author field.
2021-04-05 18:02:32 +00:00