Commit Graph

195848 Commits

Author SHA1 Message Date
Michael Goulet
90939e6bce Revert "Do not allow typeck children items to constrain outer RPITs"
This reverts commit e8d9f38141.
2022-07-26 07:46:30 +00:00
Michael Goulet
82ad5c95b6 Revert "use opaque_ty_origin_unchecked instead of destructuring HIR"
This reverts commit 5a4601fea5.
2022-07-26 07:46:30 +00:00
bors
b629c85bd7 Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #98211 (Implement `fs::get_path` for FreeBSD.)
 - #99353 (Slightly improve mismatched GAT where clause error)
 - #99593 (Suggest removing the tuple struct field for the unwrapped value)
 - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`)
 - #99711 (Remove reachable coverage without counters)
 - #99718 (Avoid `&str`/`Symbol` to `String` conversions)
 - #99720 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-26 04:28:41 +00:00
Yuki Okushi
a572f061c7
Rollup merge of #99720 - bjorn3:sync_cg_clif-2022-07-25, r=bjorn3
Sync rustc_codegen_cranelift

This time most of the changes are bugfixes. No exciting new features to report. Thanks `@matthiaskrgr` for reporting a bunch of crashes!

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2022-07-26 13:12:24 +09:00
Yuki Okushi
85afb90788
Rollup merge of #99718 - TaKO8Ki:avoid-&str-symbol-to-string-conversions, r=michaelwoerister
Avoid `&str`/`Symbol` to `String` conversions

follow-up to #99342 and #98668
2022-07-26 13:12:23 +09:00
Yuki Okushi
3c1eef2e91
Rollup merge of #99711 - tmiasko:coverage, r=wesleywiser
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;
    }

    ...
}
```

Which also makes the initial instrumentation quite suspect, although
this pull request doesn't attempt to address that aspect directly.

Fixes #98833.

r? ``@wesleywiser`` ``@richkadel``
2022-07-26 13:12:22 +09:00
Yuki Okushi
2744c0ef18
Rollup merge of #99615 - compiler-errors:remove-some-explicit-infcx, r=lcnr
Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`

The use of `self.infcx.method_on_infcx` vs `self.method_on_infcx` when `self` is a `FnCtxt` is a bit inconsistent, so I'm moving some `self.infcx` usages I found to just use autoderef
2022-07-26 13:12:21 +09:00
Yuki Okushi
d89e99a805
Rollup merge of #99593 - TaKO8Ki:suggest-removing-tuple-struct-field, r=compiler-errors
Suggest removing the tuple struct field for the unwrapped value

fixes #99416
2022-07-26 13:12:20 +09:00
Yuki Okushi
2944454540
Rollup merge of #99353 - compiler-errors:gat-where-clause-mismatch, r=cjgillot
Slightly improve mismatched GAT where clause error

This makes the error reporting a bit more standardized between `where` on GATs and functions.

cc #99206 (`@BoxyUwU),` don't want to mark this as as "fixed" because they're still not perfect, but this is still an improvement IMO so I want to land it incrementally.

regarding "consider adding where clause to trait definition", we don't actually do that for methods as far as i can tell? i could file an issue to look into that maybe.
2022-07-26 13:12:19 +09:00
Yuki Okushi
d3acd0069d
Rollup merge of #98211 - devnexen:get_path_freebsd, r=Mark-Simulacrum
Implement `fs::get_path` for FreeBSD.

Using `F_KINFO` fcntl flag, the kf_structsize field
needs to be set beforehand for that effect.
2022-07-26 13:12:18 +09:00
bors
daaae25022 Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister
Enable raw-dylib for bin crates

Fixes #93842

When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line.

I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
2022-07-26 01:47:34 +00:00
Michael Goulet
aaa9989c2f Remove some explicit self.infcx for fcx, which derefs into infcx 2022-07-26 00:40:22 +00:00
bors
a86705942c Auto merge of #99735 - JohnTitor:rollup-d93jyr2, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #92390 (Constify a few `(Partial)Ord` impls)
 - #97077 (Simplify some code that depend on Deref)
 - #98710 (correct the output of a `capacity` method example)
 - #99084 (clarify how write_bytes can lead to UB due to invalid values)
 - #99178 (Lighten up const_prop_lint, reusing const_prop)
 - #99673 (don't ICE on invalid dyn calls)
 - #99703 (Expose size_hint() for TokenStream's iterator)
 - #99709 (`Inherited` always has `TypeckResults` available)
 - #99713 (Fix sidebar background)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-25 22:57:23 +00:00
David CARLIER
e39b44a076 Implement fs::get_path for FreeBSD.
Using `F_KINFO` fcntl flag, the kf_structsize field
needs to be set beforehand for that effect.
2022-07-25 23:25:15 +01:00
Yuki Okushi
e58bfacd90
Rollup merge of #99713 - GuillaumeGomez:fix-sidebar-background, r=notriddle
Fix sidebar background

Fixes #99691.

cc `@jsha`
r? `@notriddle`
2022-07-26 07:14:52 +09:00
Yuki Okushi
b37b39db82
Rollup merge of #99709 - lcnr:rm-MaybeTypeckResults, r=compiler-errors
`Inherited` always has `TypeckResults` available
2022-07-26 07:14:51 +09:00
Yuki Okushi
5bbdf65996
Rollup merge of #99703 - dtolnay:tokenstreamsizehint, r=petrochenkov
Expose size_hint() for TokenStream's iterator

The iterator for `proc_macro::TokenStream` is a wrapper around a `Vec` iterator:

babff2211e/library/proc_macro/src/lib.rs (L363-L371)

so it can cheaply provide a perfectly precise size hint, with just a pointer subtraction:

babff2211e/library/alloc/src/vec/into_iter.rs (L170-L177)

I need the size hint in syn (https://github.com/dtolnay/syn/blob/1.0.98/src/buffer.rs) to reduce allocations when converting TokenStream into syn's internal TokenBuffer representation.

Aside from `size_hint`, the other non-default methods in `std::vec::IntoIter`'s `Iterator` impl are `advance_by`, `count`, and `__iterator_get_unchecked`. I've included `count` in this PR since it is trivial. I did not include `__iterator_get_unchecked` because it is spoopy and I did not feel like dealing with that. Lastly, I did not include `advance_by` because that requires `feature(iter_advance_by)` (https://github.com/rust-lang/rust/issues/77404) and I noticed this comment at the top of libproc_macro:

babff2211e/library/proc_macro/src/lib.rs (L20-L22)
2022-07-26 07:14:50 +09:00
Yuki Okushi
2973b00ca6
Rollup merge of #99673 - RalfJung:interpret-invalid-dyn, r=oli-obk
don't ICE on invalid dyn calls

Due to https://github.com/rust-lang/rust/issues/50781 this is actually reachable.
Fixes https://github.com/rust-lang/miri/issues/2432

r? ``@oli-obk``
2022-07-26 07:14:49 +09:00
Yuki Okushi
74be487ca0
Rollup merge of #99178 - Dajamante:clean_up, r=oli-obk
Lighten up const_prop_lint, reusing const_prop

r? `@oli-obk`
2022-07-26 07:14:48 +09:00
Yuki Okushi
aeca079d7e
Rollup merge of #99084 - RalfJung:write_bytes, r=thomcc
clarify how write_bytes can lead to UB due to invalid values

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/330

Cc ``@5225225``
2022-07-26 07:14:46 +09:00
Yuki Okushi
b8aab9781a
Rollup merge of #98710 - mojave2:string, r=JohnTitor
correct the output of a `capacity` method example

The output of this example in std::alloc is different from which shown in the comment. I have tested it on both Linux and Windows.
2022-07-26 07:14:45 +09:00
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
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
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
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
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