Commit graph

137757 commits

Author SHA1 Message Date
Tyson Nottingham
29711d8c96 rustc_codegen_ssa: tune codegen scheduling to reduce memory usage
For better throughput during parallel processing by LLVM, we used to sort
CGUs largest to smallest. This would lead to better thread utilization
by, for example, preventing a large CGU from being processed last and
having only one LLVM thread working while the rest remained idle.

However, this strategy would lead to high memory usage, as it meant the
LLVM-IR for all of the largest CGUs would be resident in memory at once.

Instead, we can compromise by ordering CGUs such that the largest and
smallest are first, second largest and smallest are next, etc. If there
are large size variations, this can reduce memory usage significantly.
2021-02-03 18:55:05 -08:00
RustyYato
d06384ac29
make Allocator object-safe
add test to ensure object-safety
This allows for runtime polymorphic allocators
2021-02-03 20:46:16 -05:00
Bastian Kauschke
031cce8cfc add relaxed_struct_unsize feature gate 2021-02-04 00:00:41 +01:00
Bastian Kauschke
50e394a05e relax adt unsizing requirements 2021-02-04 00:00:28 +01:00
Mara Bos
0870c154b6 Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call. 2021-02-03 23:15:51 +01:00
Mara Bos
3f3eb89547 Fix/allow non_fmt_panic in clippy tests. 2021-02-03 23:15:51 +01:00
Mara Bos
753b0b0b80 Update panic!() documentation about non-string panics. 2021-02-03 23:15:51 +01:00
Mara Bos
e9ad5be0f7 Allow/fix non_fmt_panic in tests. 2021-02-03 23:15:45 +01:00
Mara Bos
34d5ac25c5 Make panic/assert calls in rustc compatible with Rust 2021. 2021-02-03 22:42:53 +01:00
Mara Bos
a616f8267e Add lint for panic!(123) which is not accepted in Rust 2021.
This extends the `panic_fmt` lint to warn for all cases where the first
argument cannot be interpreted as a format string, as will happen in
Rust 2021.

It suggests to add `"{}", ` to format the message as a string. In the
case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming
guidelines.
2021-02-03 22:42:53 +01:00
Esteban Küber
3b5d018ebb Handle Spans for byte and raw strings and add more detail 2021-02-03 13:34:28 -08:00
Mara Bos
89882388d9 Revert stabilizing integer::BITS. 2021-02-03 22:23:58 +01:00
Felix S. Klock II
5ce6710668 Ignore broken test.
(Test was silently ignored on Linux CI prior to parent commit that switched to
using `# min-llvm-version`. But the switch made the ignoring stop, exposing
other brokenness in the form of bash-dependent syntax in the `$(shell ...)`
invocations.)
2021-02-03 16:02:41 -05:00
bors
e708cbd91c Auto merge of #81717 - Aaron1011:fix/closure-diag, r=estebank
Fix panic when emitting diagnostic for closure mutable binding error

Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.
2021-02-03 20:53:08 +00:00
mark
3719247f8f move test to be with the others 2021-02-03 14:38:34 -06:00
bors
120b2a704a Auto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-se
Rollup of 5 pull requests

Successful merges:

 - #80394 (make const_err a future incompat lint)
 - #81532 (Remove incorrect `delay_span_bug`)
 - #81692 (Update clippy)
 - #81715 (Reduce tab formatting assertions to debug only)
 - #81716 (Fix non-existent-field ICE for generic fields.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-03 18:01:37 +00:00
Mara Bos
46174188e8
Rollup merge of #81716 - m-ou-se:fix-ice, r=eddyb
Fix non-existent-field ICE for generic fields.

I mentioned this ICE in a chat and it took about 3 milliseconds before `@eddyb` found the problem and said this change would fix it. :)

This also changes one the field types in the related test to one that triggered the ICE.

Fixes #81627.
Fixes #81672.
Fixes #81709.

Cc https://github.com/rust-lang/rust/pull/81480 `@b-naber` `@estebank.`
2021-02-03 18:51:18 +01:00
Mara Bos
65b3c0caf0
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky.

Minimizes the impact of #81614
2021-02-03 18:51:17 +01:00
Mara Bos
508b4707ac
Rollup merge of #81692 - Manishearth:clippyup, r=tmandry
Update clippy

r? `@flip1995`
2021-02-03 18:51:15 +01:00
Mara Bos
66959448e6
Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix
Remove incorrect `delay_span_bug`

The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix (but not close) #80207.
2021-02-03 18:51:14 +01:00
Mara Bos
00dabfbd28
Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk
make const_err a future incompat lint

This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.

This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).

~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~

Cc `@rust-lang/wg-const-eval`
2021-02-03 18:51:12 +01:00
Mara Bos
68cc12ab71 Fix non-existent-field ICE for generic fields.
Co-authored-by: eddyb <eddyb@lyken.rs>
2021-02-03 18:36:48 +01:00
Aaron Hill
bc84e21107
Fix panic when emitting diagnostic for closure mutable binding error
Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.
2021-02-03 12:36:24 -05:00
J. Ryan Stinnett
18f6cc6c5d Reduce tab formatting assertions to debug only
The tab replacement for diagnostics added in #79757 included a few assertions to
ensure all tab characters are handled appropriately. We've started getting
reports of these assertions firing (#81614). Since it's only a cosmetic issue,
this downgrades the assertions to debug only, so we at least continue compiling
even if the diagnostics might be a tad wonky.

Fixes #81614
2021-02-03 17:17:15 +00:00
Esteban Küber
ede0a71b9e Remove incorrect delay_span_bug
The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix #80207.
2021-02-03 08:52:57 -08:00
Joshua Nelson
82914a5031 Add more information to the error code for 'crate not found'
This comes up a lot when bootstrapping.
2021-02-03 11:51:42 -05:00
Yoshua Wuyts
2c8bf1db54 Stabilize the Wake trait
Co-Authored-By: Ashley Mannix <kodraus@hey.com>
2021-02-03 16:54:29 +01:00
Ben Kimock
d3d0fb7b45 add #[inline] to all the public IpAddr functions 2021-02-03 10:53:25 -05:00
Ingvar Stepanyan
f4b1bef542
Restore comment as it was 2021-02-03 15:46:57 +00:00
Ingvar Stepanyan
1578f2e1e8
Keep old symlink; expose new symlink_path 2021-02-03 15:45:30 +00:00
Tyler Ruckinger
4d1efb751a
OsStr eq_ignore_ascii_case takes arg by value
Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference.

This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`.

Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example.

If this change should be made in some other PR (like #80193) then please just close this.
2021-02-03 10:28:51 -05:00
bors
186f7ae5b0 Auto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obk
Use ufcs in derive(Debug)

Cc #81211.

(Arguably this *is* the fix for it.)
2021-02-03 15:12:19 +00:00
Ralf Jung
8477d352ac make const_err a future incompat lint 2021-02-03 15:45:43 +01:00
bors
6ad11e2e25 Auto merge of #81699 - jethrogb:fix-81531, r=petrochenkov
Really fix early lints inside an async desugaring

Fixes #81531

cc `@Aaron1011`

r? `@petrochenkov`
2021-02-03 11:42:09 +00:00
Jethro Beekman
37cb9d30fa Really fix early lints inside an async desugaring 2021-02-03 10:05:58 +01:00
bors
d6a28a97e6 Auto merge of #81694 - GuillaumeGomez:rollup-odg6xqi, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #81144 (Fixed formatting typo in map_while docs)
 - #81573 (Add some links to the cell docs.)
 - #81679 (Bind all clean::Type variants and remove FIXME)
 - #81681 (Better styling of "Switch result tab" shortcut)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-03 08:59:27 +00:00
Guillaume Gomez
e57f1cfb4b
Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomez
Better styling of "Switch result tab" shortcut

Before:
![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png)
![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png)

After:
![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png)
![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)
2021-02-03 08:41:28 +01:00
Guillaume Gomez
de41c58c9f
Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, r=poliorcetics,CraftSpider
Bind all clean::Type variants and remove FIXME

This is simply a little cleanup.

cc `@CraftSpider`
r? `@poliorcetics`
2021-02-03 08:41:26 +01:00
Guillaume Gomez
b7501620d3
Rollup merge of #81573 - ehuss:cell-links, r=jackh726
Add some links to the cell docs.

This adds a few links to the cell module docs to make it a little easier to navigate to the types and functions it references.
2021-02-03 08:41:24 +01:00
Guillaume Gomez
7330a9ce32
Rollup merge of #81144 - nhwn:typo-map-while, r=jackh726
Fixed formatting typo in map_while docs

changes `` ` None` `` to ``[`None`]`` for consistency
2021-02-03 08:41:22 +01:00
bors
b593389edb Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink
Add a new ABI to support cmse_nonsecure_call

This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call.

See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928).

This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃
I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now).

On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-03 06:00:43 +00:00
Manish Goregaokar
588931209e Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy 2021-02-02 20:43:30 -08:00
bors
3e4179766b Auto merge of #6667 - Manishearth:rustup, r=Manishearth
Rustup

Pulling in AST changes

changelog: none
2021-02-03 04:09:03 +00:00
Manish Goregaokar
741259bece Merge branch 'sync-from-rust3' into rustup 2021-02-02 19:57:31 -08:00
Manish Goregaokar
a31e5f5f3b Run rustfmt 2021-02-02 19:57:08 -08:00
Manish Goregaokar
6fb10755c0 Rustup 2021-02-02 19:54:21 -08:00
Felix S. Klock II
1783c476fa bless the coverage-spanview output. Cc #81688. 2021-02-02 22:29:04 -05:00
bors
e6a0f3cdf3 Auto merge of #81535 - nikic:update-test-various, r=sanxiyn
Update test-various to Ubuntu 20.04

The test command-setgroups.rs is adjusted to skip on musl, where `sysconf(_SC_NGROUPS_MAX)` always returns a dummy value of 32, even though the actual value is 65536. I'm not sure why this only became a problem now, as the information I found indicates that this value changed in kernel version 2.6.4, which is ages ago.

I'm a bit unsure whether this one will go through, because I locally also saw a failure in std-backtrace.rs which went away on subsequent runs, and also had port assignment failures, but I think those might be on my side. I'm kind of curious how the code in b122908617/library/std/src/net/test.rs (L43-L56) is supposed to work, as the directory names it checks don't seem to appear anywhere else.

r? `@Mark-Simulacrum`
2021-02-03 03:03:08 +00:00
Felix S. Klock II
03c000eb20 Use # min-llvm-version: 11.0 to force a minimum LLVM version, rather than ad-hoc internal solution.
In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for
some reason, using `$(shell ...)` with bash-specific variable replacement code.
On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored,
and thus be treated as a "success" (in the sense that `--bless` would never do
anything).

This was causing me a lot of pain.
2021-02-02 21:53:30 -05:00
Manish Goregaokar
5c957b8a6f Merge remote-tracking branch 'origin/master' into rustup 2021-02-02 16:46:12 -08:00