bors [Sun, 7 Aug 2022 02:56:48 +0000 (02:56 +0000)]
Auto merge of #100004 - jyn514:exclude-single-test, r=Mark-Simulacrum
Move `x test --skip` to be part of `--exclude`
`--skip` is inconsistent with the rest of the interface and redundant with `--exclude`.
Fix --exclude to work properly for files and directories rather than having a separate flag.
Fixes https://github.com/rust-lang/rust/issues/96342. cc https://github.com/rust-lang/rust/pull/96493#issuecomment-1200521720
bors [Sat, 6 Aug 2022 23:38:28 +0000 (23:38 +0000)]
Auto merge of #100213 - matthiaskrgr:rollup-mqe7t1n, r=matthiaskrgr
Rollup of 5 pull requests
Successful merges:
- #100071 (deps: dedupe `annotate-snippets` crate versions)
- #100127 (Remove Windows function preloading)
- #100130 (Avoid pointing out `return` span if it has nothing to do with type error)
- #100169 (Optimize `pointer::as_aligned_to`)
- #100175 (ascii -> ASCII in code comment)
Matthias Krüger [Sat, 6 Aug 2022 23:19:34 +0000 (01:19 +0200)]
Rollup merge of #100169 - WaffleLapkin:optimize_is_aligned_to, r=workingjubilee
Optimize `pointer::as_aligned_to`
This PR replaces `addr % align` with `addr & align - 1`, which is correct due to `align` being a power of two.
Here is a proof that this makes things better: [[godbolt]](https://godbolt.org/z/Wbq3hx6YG).
This PR also removes `assume(align != 0)`, with the new impl it does not improve anything anymore ([[godbolt]](https://rust.godbolt.org/z/zcnrG4777), [[original concern]](https://github.com/rust-lang/rust/pull/95643#discussion_r843326903)).
Matthias Krüger [Sat, 6 Aug 2022 23:19:33 +0000 (01:19 +0200)]
Rollup merge of #100130 - compiler-errors:erroneous-return-span, r=lcnr
Avoid pointing out `return` span if it has nothing to do with type error
This code:
```rust
fn f(_: String) {}
fn main() {
let x = || {
if true {
return ();
}
f("");
};
}
```
Emits this:
```
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
--> src/main.rs:8:11
|
8 | f("");
| ^^- help: try using a conversion method: `.to_string()`
| |
| expected struct `String`, found `&str`
|
note: return type inferred to be `String` here
--> src/main.rs:6:20
|
6 | return ();
| ^^
```
Specifically, that note has nothing to do with the type error in question. This is because the change implemented in #84244 tries to point out the `return` span on _any_ type coercion error within a closure that happens after a `return` statement, regardless of if the error has anything to do with it.
This is really easy to trigger -- just needs a closure (or an `async`) and an early return (or any other form, e.g. `?` operator suffices) -- and super distracting in production codebases. I'm letting #84128 regress because that issue is much harder to fix correctly, and I can re-open that issue after this lands.
As a drive-by, I added a `resolve_vars_if_possible` to the coercion error logic, which leads to some error improvements. Unrelated to the issue above, though.
Matthias Krüger [Sat, 6 Aug 2022 23:19:32 +0000 (01:19 +0200)]
Rollup merge of #100127 - ChrisDenton:remove-init, r=thomcc
Remove Windows function preloading
After `@Mark-Simulacrum` asked me to provide guidance for when optionally imported functions should be preloaded, I realised my justifications were now quite weak. I think the strongest argument that can be made is that it avoids some degree of nondeterminism when calling these functions (in as far as system API calls can be said to be deterministic). However, I don't think that's particularly convincing unless there's a real world use case where it matters. Further discussion with `@thomcc` has strengthened my feeling that preloading isn't really needed.
Note that `WaitOnAddress` needed some adjustment to work without preloading. I opted not to use a macro for this special case as it seemed silly to do so for just one thing (and I don't like macros tbh).
Matthias Krüger [Sat, 6 Aug 2022 23:19:32 +0000 (01:19 +0200)]
Rollup merge of #100071 - klensy:annotate-snippets-bump, r=Mark-Simulacrum
deps: dedupe `annotate-snippets` crate versions
Dedupes `annotate-snippets` crate versions (https://github.com/rust-lang/annotate-snippets-rs/blob/0.9.1/CHANGELOG.md). Should work, but there is not a lot of tests.
bors [Sat, 6 Aug 2022 15:09:59 +0000 (15:09 +0000)]
Auto merge of #100195 - matthiaskrgr:rollup-ovzyyb0, r=matthiaskrgr
Rollup of 4 pull requests
Successful merges:
- #100094 (Detect type mismatch due to loop that might never iterate)
- #100132 (Use (actually) dummy place for let-else divergence)
- #100167 (Recover `require`, `include` instead of `use` in item)
- #100193 (Remove more Clean trait implementations)
bors [Fri, 5 Aug 2022 23:11:49 +0000 (23:11 +0000)]
Auto merge of #100035 - workingjubilee:merge-functions, r=nikic
Enable function merging when opt is for size
It is, of course, natural to want to merge aliasing functions when
optimizing for code size, since that can eliminate several bytes.
And an exhaustive match helps make the code less brittle.
Jubilee Young [Mon, 1 Aug 2022 21:04:14 +0000 (14:04 -0700)]
Enable function merging when opt is for size
It is, of course, natural to want to merge aliasing functions when
optimizing for code size, since that can eliminate several bytes.
And an exhaustive match helps make the code less brittle.
Yiming Lei [Wed, 3 Aug 2022 04:46:07 +0000 (21:46 -0700)]
implement #98982
when loop as tail expression for miss match type E0308 error, recursively get
the return statement and add diagnostic information on it
use rustc_hir::intravisit to collect the return expression
modified: compiler/rustc_typeck/src/check/coercion.rs
new file: src/test/ui/typeck/issue-98982.rs
new file: src/test/ui/typeck/issue-98982.stderr
bors [Fri, 5 Aug 2022 16:35:15 +0000 (16:35 +0000)]
Auto merge of #100174 - Dylan-DPC:rollup-wnskbk6, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #99835 (Suggest adding/removing `ref` for binding patterns)
- #100155 (Use `node_type_opt` to skip over generics that were not expected)
- #100157 (rustdoc: use `collect()` instead of repeatedly pushing)
- #100158 (kmc-solid: Add a stub implementation of #98246 (`File::set_times`))
- #100166 (Remove more Clean trait implementations)
- #100168 (Improve diagnostics for `const a: = expr;`)
Dylan DPC [Fri, 5 Aug 2022 16:24:37 +0000 (21:54 +0530)]
Rollup merge of #100168 - WaffleLapkin:improve_diagnostics_for_missing_type_in_a_const_item, r=compiler-errors
Improve diagnostics for `const a: = expr;`
Adds a suggestion to write a type when there is a colon, but the type is not present.
I've also shrunk spans a little, so the suggestions are a little nicer.
bors [Fri, 5 Aug 2022 09:32:26 +0000 (09:32 +0000)]
Auto merge of #95977 - FabianWolff:issue-92790-dead-tuple, r=estebank
Warn about dead tuple struct fields
Continuation of #92972. Fixes #92790.
The language team has already commented on this in https://github.com/rust-lang/rust/pull/92972#issuecomment-1021511970; I have incorporated their requests here. Specifically, there is now a new allow-by-default `unused_tuple_struct_fields` lint (name bikesheddable), and fields of unit type are ignored (https://github.com/rust-lang/rust/pull/92972#issuecomment-1021815408), so error messages look like this:
```
error: field is never read: `1`
--> $DIR/tuple-struct-field.rs:6:21
|
LL | struct Wrapper(i32, [u8; LEN], String);
| ^^^^^^^^^
|
help: change the field to unit type to suppress this warning while preserving the field numbering
|
LL | struct Wrapper(i32, (), String);
| ~~
```
r? `@joshtriplett`
bors [Fri, 5 Aug 2022 06:35:12 +0000 (06:35 +0000)]
Auto merge of #99867 - spastorino:refactor-remap-lifetimes, r=nikomatsakis
Split create_def and lowering of lifetimes for opaque types and bare async fns
r? `@cjgillot`
This work is kind of half-way, but I think it could be merged anyway.
I think we should be able to remove all the vacant arms in `new_named_lifetime_with_res`, if I'm not wrong that requires visiting more nodes. We can do that as a follow up.
In follow-up PRs, besides the thing mentioned previously, I'll be trying to remove `LifetimeCaptureContext`, `captured_lifetimes` as a global data structure, global `binders_to_ignore` and all their friends :).
Also try to remap in a more general way based on def-ids.
bors [Thu, 4 Aug 2022 23:56:07 +0000 (23:56 +0000)]
Auto merge of #95026 - cuviper:bump-linux-min, r=Mark-Simulacrum
Increase the minimum linux-gnu versions
This is implementing the MCP from rust-lang/compiler-team#493. It is
increasing the minimum requirements of a couple Tier 1 targets, and
others at lower tiers, so this should go through FCP sign-offs for both
`T-compiler` and `T-release`.
The new `linux-gnu` baseline is kernel 3.2 and glibc 2.17. We will also
take that kernel as the minimum floor for _all_ `*-linux-*` targets, so
it may be broadly assumed in the implementation of the standard library.
That does not preclude specific targets from having greater requirements
where it makes sense, like a new arch needing something newer, or a
platform like `linux-android` choosing a newer baseline.
bors [Thu, 4 Aug 2022 21:03:48 +0000 (21:03 +0000)]
Auto merge of #100151 - matthiaskrgr:rollup-irqwvj2, r=matthiaskrgr
Rollup of 7 pull requests
Successful merges:
- #98796 (Do not exclusively suggest `;` when `,` is also a choice)
- #99772 (Re-enable submodule archive downloads.)
- #100058 (Suggest a positional formatting argument instead of a captured argument)
- #100093 (Enable unused_parens for match arms)
- #100095 (More EarlyBinder cleanups)
- #100138 (Remove more Clean trait implementations)
- #100148 (RustWrapper: update for TypedPointerType in LLVM)
Matthias Krüger [Thu, 4 Aug 2022 20:25:02 +0000 (22:25 +0200)]
Rollup merge of #100093 - wcampbell0x2a:unused-parens-for-match-arms, r=petrochenkov
Enable unused_parens for match arms
Fixes: https://github.com/rust-lang/rust/issues/92751
Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
Matthias Krüger [Thu, 4 Aug 2022 20:25:00 +0000 (22:25 +0200)]
Rollup merge of #99772 - ehuss:reenable-submodule-archive, r=Mark-Simulacrum
Re-enable submodule archive downloads.
This is effectively a revert of #98423 (though it keeps the `--depth 1` flag since that is still helpful).
GitHub has indicated that they have been working on the original issue, and my testing shows that the llvm-project archive download now succeeds 100% of the time.
Josh Stone [Thu, 4 Aug 2022 17:16:19 +0000 (10:16 -0700)]
Downgrade dist-powerpc-linux binutils to 2.30
With binutils 2.32, we were getting errors like this:
relocation truncated to fit: R_PPC_PLTREL24 against symbol
`__cxa_atexit@@GLIBC_2.1.3' defined in .plt section in
/x-tools/powerpc-unknown-linux-gnu/powerpc-unknown-linux-gnu/sysroot/usr/lib/crt1.o