Commit Graph

195896 Commits

Author SHA1 Message Date
Yuki Okushi
29892759f6
Rollup merge of #97077 - ouz-a:Optimize-backend, r=oli-obk
Simplify some code that depend on Deref

Now that we can assume #97025 works, it's safe to expect Deref is always in the first place of projections. With this, I was able to simplify some code that depended on Deref's place in projections. When we are able to move Derefer before `ElaborateDrops` successfully we will be able to optimize more places.

r? `@oli-obk`
2022-07-26 07:14:44 +09:00
Yuki Okushi
c1647e10ad
Rollup merge of #92390 - fee1-dead-contrib:const_cmp, r=oli-obk
Constify a few `(Partial)Ord` impls

Only a few `impl`s are constified for now, as #92257 has not landed in the bootstrap compiler yet and quite a few impls would need that fix.

This unblocks #92228, which unblocks marking iterator methods as `default_method_body_is_const`.
2022-07-26 07:14:43 +09:00
bors
6dbae3ad19 Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkov
Resolve function lifetime elision on the AST

~Based on https://github.com/rust-lang/rust/pull/97720~

Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST.
This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`.

This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR.

r? `@petrochenkov`
2022-07-25 20:02:55 +00:00
Camille GILLOT
9450f822fb Unused tuple fields in rustc_resolve. 2022-07-25 19:45:26 +02:00
Camille GILLOT
ec83476748 Unused tuple fields in rustc_infer. 2022-07-25 19:45:10 +02:00
Camille GILLOT
b9bd65e2ca Clippy fallout. 2022-07-25 19:19:23 +02:00
Camille GILLOT
3148ea31eb Update file description. 2022-07-25 19:19:23 +02:00
Camille GILLOT
3c5048d2ec Report elision failures on the AST. 2022-07-25 19:19:23 +02:00
Maybe Waffle
ed8c2c28f0 apply review suggestions 2022-07-25 21:12:56 +04:00
est31
5fcd2f72fe Add a clickable link to the layout section 2022-07-25 19:11:10 +02:00
bors
bdf520fd41 Auto merge of #99722 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/99664
r? `@ghost`
2022-07-25 16:48:01 +00:00
Eric Huss
91599b44dc Fix some broken link fragments. 2022-07-25 09:16:28 -07:00
Ralf Jung
606924d59b update Miri 2022-07-25 11:23:59 -04:00
bjorn3
9dc4ed8d90 Update list of allowed dependencies
Cranelift started depending on a couple of new crates
2022-07-25 17:08:20 +02:00
David Wood
76cf6bd03e passes: port more of check_attr module
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-25 15:11:22 +01:00
bjorn3
7a3ed235eb Merge commit 'c19edfd71a1d0ddef86c2c67fdb40718d40a72b4' into sync_cg_clif-2022-07-25 2022-07-25 16:07:57 +02:00
bjorn3
c19edfd71a Rustup to rustc 1.64.0-nightly (7fe022f5a 2022-07-24) 2022-07-25 16:06:39 +02:00
bors
dc2d232c74 Auto merge of #85673 - csmoe:export-exe-sym, r=bjorn3
RFC-2841: add codegen flag export symbols from executable

Closes #84161
r? `@nikomatsakis` `@Mark-Simulacrum`
2022-07-25 14:04:40 +00:00
bjorn3
4e1155fbf1 Sync from rust 2f320a224e 2022-07-25 16:00:44 +02:00
Aïssata
e6518296dc removed CanConstProp + Visitor 2022-07-25 13:54:49 +00:00
bjorn3
d7fc56323e Update Cranelift to 0.85.3
This fixes a couple of potential miscompilations. None affect cg_clif on
x86_64, but one may affect cg_clif on AArch64.
2022-07-25 13:50:43 +00:00
bjorn3
722733c0c6
Merge pull request #1247 from bjorn3/melt_some_ice
Melt some ICE
2022-07-25 15:46:04 +02:00
Takayuki Maeda
051e98b7bf avoid &str/Symbol to String conversions 2022-07-25 22:40:00 +09:00
Takayuki Maeda
bf1a5e72f4 remove is_local_span as it is no longer used 2022-07-25 22:37:14 +09:00
Aïssata
68b433a089 Lighten up const_prop_lint, reusing const_prop 2022-07-25 13:33:44 +00:00
bjorn3
fd2669d1e9 Fix -Zpolymorphize 2022-07-25 13:17:53 +00:00
bjorn3
7ef2ba8f7b Fix size_of_val and min_align_of_val for truly unsized types 2022-07-25 12:47:49 +00:00
Guillaume Gomez
8db7249f26 Add GUI test to prevent sidebar background regression 2022-07-25 14:35:06 +02:00
Guillaume Gomez
202e32a2ca Fix sidebar background-color on mobile 2022-07-25 14:19:26 +02:00
Tomasz Miąsko
5f40a4f7a0 Remove reachable coverage without counters
Remove reachable coverage without counters to maintain invariant that
either there is no coverage at all or there is a live coverage counter
left that provides the function source hash.

The motivating example would be a following closure:

```rust
    let f = |x: bool| {
        debug_assert!(x);
    };
```

Which, with span changes from #93967, with disabled debug assertions,
after the final CFG simplifications but before removal of dead blocks,
gives rise to MIR:

```rust
fn main::{closure#0}(_1: &[closure@a.rs:2:13: 2:22], _2: bool) -> () {
    debug x => _2;
    let mut _0: ();

    bb0: {
        Coverage::Expression(4294967295) = 1 - 2;
        return;
    }

    ...
}
```
2022-07-25 14:14:49 +02:00
bjorn3
39ee14d253 Error when trying to define variadic functions
They aren't yet supported by Cranelift
2022-07-25 11:18:34 +00:00
lcnr
0c6c69f2e2 Inherited always has TypeckResults available 2022-07-25 13:11:07 +02:00
bors
2fdbf075cf Auto merge of #99707 - JohnTitor:rollup-74rb8vq, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #95040 (protect `std::io::Take::limit` from overflow in `read`)
 - #95916 (kmc-solid: Use `libc::abort` to abort a program)
 - #99494 (Use non-relocatable code in nofile-limit.rs test)
 - #99581 (Improve error messages involving `derive` and `packed`.)
 - #99643 (Add `sign-ext` target feature to the WASM target)
 - #99659 (Use `VecMap::get` in `ConstraintLocator::check`)
 - #99690 (add miri-track-caller to more intrinsic-exposing methods)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-25 10:33:32 +00:00
Yuki Okushi
d1e4342d11
Rollup merge of #99690 - RalfJung:miri-track-caller, r=Mark-Simulacrum
add miri-track-caller to more intrinsic-exposing methods

Follow-up to https://github.com/rust-lang/rust/pull/98674: I went through the Miri test suite to find more functions that would benefit from Miri backtrace pruning, and this is what I found.

Basically anything that just exposes a potentially-UB intrinsic to the user should get this treatment.
2022-07-25 18:46:55 +09:00
Yuki Okushi
cb512888f3
Rollup merge of #99659 - compiler-errors:opaque-type-nit, r=oli-obk
Use `VecMap::get` in `ConstraintLocator::check`

Also rename the `def_id` param to `item_def_id` because that's easily confused with `self.def_id` (which is the opaque ty did).
2022-07-25 18:46:54 +09:00
Yuki Okushi
f4c25270d4
Rollup merge of #99643 - daxpedda:sign-ext-wasm, r=oli-obk
Add `sign-ext` target feature to the WASM target

Some target features are still missing from that list.
See #97808 for basically the same PR by `@alexcrichton.`

Related issue: #96472.
PR introducing this issue: #87402.
2022-07-25 18:46:52 +09:00
Yuki Okushi
921cfbe56f
Rollup merge of #99581 - nnethercote:improve-derive-packed-errors, r=estebank
Improve error messages involving `derive` and `packed`.

There are two errors involving `derive` and `packed`.

```
`#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters
`#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy
```
The second one overstates things. It is possible to use derive on a
repr(packed) struct that doesn't derive Copy in two cases.
- If all the fields within the struct meet the required alignment: 1 for
  `repr(packed)`, or `N` for `repr(packed(N))`.
- If `Default` is the only trait derived.

This commit improves things in a few ways.
- Changes the errors to say `this trait can't be derived on this ...`.
  This is more accurate, because it's just *this* trait and *this*
  packed struct that are a problem, not *all* derived traits on *all*
  packed structs.
- Adds more details to the "ERROR" lines in the test case, enough to
  distinguish between the two error messages.
- Adds more cases to the test case that don't cause errors, e.g. `Default`
  derives.
- Uses a wider variety of builtin traits in the test case, for better coverage.

r? `@estebank`
2022-07-25 18:46:51 +09:00
Yuki Okushi
65d2392225
Rollup merge of #99494 - tmiasko:no-pie, r=Mark-Simulacrum
Use non-relocatable code in nofile-limit.rs test

To avoid using static-pie which is not essential to the test but which
was reported to cause problems on Void Linux where glibc is build
without support for static-pie.
2022-07-25 18:46:50 +09:00
Yuki Okushi
e726af8dd4
Rollup merge of #95916 - solid-rs:feat-kmc-solid-abort, r=Mark-Simulacrum
kmc-solid: Use `libc::abort` to abort a program

This PR updates the target-specific abort subroutine for the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

The current implementation uses a `hlt` instruction, which is the most direct way to notify a connected debugger but is not the most flexible way. This PR changes it to call the `abort` libc function, making it possible for a system designer to override its behavior as they see fit.
2022-07-25 18:46:48 +09:00
Yuki Okushi
0ecbcbb0ac
Rollup merge of #95040 - frank-king:fix/94981, r=Mark-Simulacrum
protect `std::io::Take::limit` from overflow in `read`

Resolves #94981
2022-07-25 18:46:47 +09:00
sourcelliu
7ada7c8de4 remove useless mut from examples 2022-07-25 17:04:51 +08:00
Takayuki Maeda
f85f37583d suggest removing the tuple struct field for the unwrapped value
add a test case for macro
2022-07-25 17:00:37 +09:00
bors
2f320a224e Auto merge of #99600 - tmiasko:subst-folder, r=petrochenkov
Tweak `SubstFolder` implementation
2022-07-25 07:52:41 +00:00
bors
7f93d4aa0d Auto merge of #98770 - klensy:no-string-dupes-ugly, r=cjgillot
rmeta: avoid embedding `StabilityLevel::Unstable` reason multiple times into .rmeta\.rlib files

Avoids bloating size of some rmeta\rlib files by not placing default string for `StabilityLevel::Unstable` reason multiple times, affects only stdlib\rustc artifacts. For stdlib cuts about 3% (diff of total size for patched\unpatched *.rmeta files of stage1-std) of file size, depending on crates.

fixes #88180
2022-07-25 05:27:17 +00:00
csmoe
6674c94d15 feat: impl export-executable-symbols 2022-07-25 05:20:23 +00:00
David Tolnay
63e74aba81
Expose size_hint() for TokenStream's iterator 2022-07-24 20:36:22 -07:00
bors
530c0a81d5 Auto merge of #99676 - thomcc:dont-overwrite, r=tmiasko
Don't overwrite CodegenFnAttrs when adding used compiler/linker

Pointed out by `@tmiasko` in https://github.com/rust-lang/rust/pull/93718#discussion_r928259163. Probably a better fix than https://github.com/rust-lang/rust/pull/99674 for https://github.com/rust-lang/rust/issues/99596, assuming it does fix the latter.

I don't have the ability to write a regression test for this at the moment, and am quite surprised this didn't cause other failures. The old code is clearly wrong though, but I'm not picky as to which of these is better to go with.
2022-07-25 02:46:36 +00:00
Nicholas Nethercote
168c5b1839 Improve error messages involving derive and packed.
There are two errors involving `derive` and `packed`.

```
`#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters
`#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy
```
The second one overstates things. It is possible to use derive on a
repr(packed) struct that doesn't derive Copy in two cases.
- If all the fields within the struct meet the required alignment: 1 for
  `repr(packed)`, or `N` for `repr(packed(N))`.
- If `Default` is the only trait derived.

This commit improves things in a few ways.
- Changes the errors to say `$TRAIT can't be derived on this ...`.
  This is more accurate, because it's just $TRAIT and *this* packed
  struct that are a problem, not *all* derived traits on *all* packed
  structs.
- Adds more details to the "ERROR" lines in the test case, enough to
  distinguish between the two error messages.
- Adds more cases to the test case that don't cause errors, e.g. `Default`
  derives.
- Uses a wider variety of builtin traits in the test case, for better coverage.
2022-07-25 10:30:43 +10:00
bors
babff2211e Auto merge of #97581 - AngelicosPhosphoros:improve_calloc_check_in_vec_macro_for_tuples, r=Mark-Simulacrum
Support vec zero-alloc optimization for tuples and byte arrays

* Implement IsZero trait for tuples up to 8 IsZero elements;
* Implement IsZero for u8/i8, leading to implementation of it for arrays of them too;
* Add more codegen tests for this optimization.
* Lower size of array for IsZero trait because it fails to inline checks
2022-07-25 00:20:43 +00:00
Ralf Jung
58f2ede15f interpret, ptr_offset_from: refactor and test too-far-apart check 2022-07-24 19:35:40 -04:00