Commit Graph

141790 Commits

Author SHA1 Message Date
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
Joshua Nelson
6e4ef54d79 Rename path_str -> ori_link in anchor_failure
ori_link contains anchors, path_str does not. It's important that
anchor_failure be passed a link with the anchors still present.
2021-04-05 13:52:58 -04:00
Joshua Nelson
f8653c9aca Add config file for tools enabling stage1 downloads by default
Otherwise no one will be able to find the setting.
2021-04-05 13:05:43 -04:00
bors
5a7a0ac51e Auto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #83368 (Add `download-rustc = "if-unchanged"`)
 - #83705 (Give a better error when --theme is not a CSS file)
 - #83853 (Disallow the use of high byte registes as operands on x86_64)
 - #83877 (Remove unnecessary exceptions to the platform-specific code check)
 - #83878 (Fix racing file access in tidy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-05 13:50:17 +00:00
Dylan DPC
d856a26770
Rollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum
Fix racing file access in tidy

That should fix the failure in https://github.com/rust-lang/rust/pull/83776#issuecomment-813311289

The file is only created for a brief moment during the bins checks in the source directories while other checks may also be visiting the same directory. By skipping it we avoid file not found errors.
2021-04-05 15:48:46 +02:00
Dylan DPC
770bf3169b
Rollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum
Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But in the meantime it seems
silly to ignore the check if it will pass anyway.
2021-04-05 15:48:44 +02:00
Dylan DPC
49b178e9ff
Rollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa
Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

r? `@nagisa`
2021-04-05 15:48:43 +02:00
Dylan DPC
a766d63b2d
Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez
Give a better error when --theme is not a CSS file

Before:

```
error: invalid argument: "bacon.toml"
```

After:
```
error: invalid argument: "bacon.toml"
  |
  = help: arguments to --theme must be CSS files
```

cc https://github.com/rust-lang/rust/pull/83478
2021-04-05 15:48:42 +02:00
Dylan DPC
335a3c4b7f
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum` cc `@camelid`
2021-04-05 15:48:40 +02:00
Joshua Nelson
580a740bdd Add download-rustc = "if-unchanged"
This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.
2021-04-05 09:46:43 -04:00
Joshua Nelson
ff245dab41
Apply suggestions from code review
Co-authored-by: Camelid <camelidcamel@gmail.com>
Co-authored-by: Nemo157 <github@nemo157.com>
2021-04-05 09:25:36 -04:00
Amanieu d'Antras
b1bcff0731 Disallow the use of high byte registes as operands on x86_64
They are still allowed on x86 though.

Fixes #83495
2021-04-05 13:38:24 +01:00
Joshua Nelson
0a351abf83 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-05 08:38:09 -04:00
Joshua Nelson
3b7e654fad Use more appropriate return type for resolve_associated_item
Previously, the types looked like this:

- None means this is not an associated item (but may be a variant field)
- Some(Err) means this is known to be an error. I think the only way that can happen is if it resolved and but you had your own anchor.
- Some(Ok(_, None)) was impossible.

Now, this returns a nested Option and does the error handling and
fiddling with the side channel in the caller. As a side-effect, it also
removes duplicate error handling.

This has one small change in behavior, which is that
`resolve_primitive_associated_item` now goes through `variant_field` if
it fails to resolve something.  This is not ideal, but since it will be
quickly rejected anyway, I think the performance hit is worth the
cleanup.

This also fixes a bug where struct fields would forget to set the side
channel, adds a test for the bug, and ignores `private_intra_doc_links`
in rustc_resolve (since it's always documented with
--document-private-items).
2021-04-05 08:34:17 -04:00
Joshua Nelson
ac04dbd056 Reduce indentation in resolve_associated_item 2021-04-05 08:03:27 -04:00
Joshua Nelson
d63b3f9bbb Remove duplicate unwrap_or_else 2021-04-05 08:03:27 -04:00
Laurențiu Nicola
6ce9a028a6 ⬆️ rust-analyzer 2021-04-05 14:40:58 +03:00
xFrednet
a6f54f5dfd Renaming the lint to branches_sharing_code and fixing typos 2021-04-05 13:35:51 +02:00
xFrednet
7c9e192e05 Test for empty blocks and update from master 2021-04-05 13:35:51 +02:00
xFrednet
8c0b4d7f65 Only running shared_code_in_if_blocks only for if statements 2021-04-05 13:35:51 +02:00
xFrednet
617c65baa9 Moving shared_code_in_if_blocks to clippy::complexity and running lintcheck 2021-04-05 13:35:51 +02:00
xFrednet
c74e49eab9 Adapted the lint to use the new SpanlessEq 2021-04-05 13:35:51 +02:00
xFrednet
65ed5a632f Updated code for dogfood 2021-04-05 13:33:45 +02:00
xFrednet
b1d26e544f Improved shared_code_in_if_blocks message and added test stderrs 2021-04-05 13:33:45 +02:00
xFrednet
8efc6acc05 Improved shared_code_in_if_blocks output readability and added tests 2021-04-05 13:33:45 +02:00
xFrednet
469ff96db3 The shared_code_in_if_blocks lint only operats on entire if expr not else ifs 2021-04-05 13:33:45 +02:00
xFrednet
d1df73228a A new lint for shared code in if blocks
* Added expression check for shared_code_in_if_blocks
* Finishing touches for the shared_code_in_if_blocks lint
* Applying PR suggestions
* Update lints yay
* Moved test into subfolder
2021-04-05 13:33:45 +02:00
xFrednet
232e2b79f2 Added documentation to the multispan_sugg method 2021-04-05 13:33:45 +02:00
bors
39eee173fb Auto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function)
 - #82483 (Use FromStr trait for number option parsing)
 - #82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set)
 - #83650 (Update Source Serif to release 4.004)
 - #83826 (List trait impls before deref methods in doc's sidebar)
 - #83831 (Add `#[inline]` to IpAddr methods)
 - #83863 (Render destructured struct function param names as underscore)
 - #83865 (Don't report disambiguator error if link would have been ignored)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-05 11:06:20 +00:00
Dylan DPC
3ca197e89c
Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514
Don't report disambiguator error if link would have been ignored

Fixes #83859.

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

r? ````@jyn514````
2021-04-05 13:03:44 +02:00
Dylan DPC
98e7a4e784
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514
Render destructured struct function param names as underscore

Fixes #83852

r? ````@GuillaumeGomez````
2021-04-05 13:03:43 +02:00
Dylan DPC
445aa40153
Rollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se
Add `#[inline]` to IpAddr methods

Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583
2021-04-05 13:03:42 +02:00
Dylan DPC
d60cf78fbe
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514
List trait impls before deref methods in doc's sidebar

This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.
2021-04-05 13:03:41 +02:00