Commit Graph

196728 Commits

Author SHA1 Message Date
Lokathor a8b4454047
Create armv4t_none_eabi.rs 2022-08-07 12:40:41 -06:00
bors 5a9c3a2daa Auto merge of #99983 - RalfJung:more-layout-checks, r=eddyb
More layout sanity checks

r? `@eddyb`
2022-08-07 13:17:54 +00:00
bors 5651759746 Auto merge of #100091 - chenyukang:add-check-for-link-ordinal, r=michaelwoerister
Check link ordinal to make sure it is targetted  for foreign function

Fix #100009, when link ordinal is not target for foreign functions, emit an error.

cc `@dpaoliello`
2022-08-07 05:37:29 +00:00
bors 24cf45a591 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

r? `@Mark-Simulacrum`
2022-08-07 02:56:48 +00:00
bors cc71eef498 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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-06 23:38:28 +00:00
Matthias Krüger ee0b755fe6
Rollup merge of #100175 - fxn:patch-1, r=Mark-Simulacrum
ascii -> ASCII in code comment

Easy one I spotted while reading source code.
2022-08-07 01:19:35 +02:00
Matthias Krüger f0ff31fa09
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)).
2022-08-07 01:19:34 +02:00
Matthias Krüger 1a96f31f76
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.
2022-08-07 01:19:33 +02:00
Matthias Krüger 879c17f3f9
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).
2022-08-07 01:19:32 +02:00
Matthias Krüger aaa054e53c
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.

Looks like switching to that crate a bit stalled.
2022-08-07 01:19:32 +02:00
bors 2befdefdda Auto merge of #100117 - nicholasbishop:bishop-update-cc, r=Mark-Simulacrum
Bump cc version in bootstrap

Among other changes, the newer cc release pulls in this fix:
b2792e33ff

This fixes errors when building compiler_builtins for UEFI targets.
2022-08-06 21:10:52 +00:00
bors 44bd81da68 Auto merge of #99524 - cuviper:relnotes-1.63.0, r=Mark-Simulacrum
Add release notes for Rust 1.63.0
2022-08-06 17:50:41 +00:00
bors 5c54be35c6 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)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-06 15:09:59 +00:00
Matthias Krüger 811b0368aa
Rollup merge of #100193 - GuillaumeGomez:rm-clean-impls, r=notriddle
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-08-06 16:16:00 +02:00
Matthias Krüger 18ddb41184
Rollup merge of #100167 - chenyukang:require-suggestion, r=estebank
Recover `require`, `include` instead of `use` in item

Fix #100140
2022-08-06 16:15:59 +02:00
Matthias Krüger eabf1a2e8e
Rollup merge of #100132 - compiler-errors:issue-100103, r=tmiasko
Use (actually) dummy place for let-else divergence

Fixes #100103
2022-08-06 16:15:56 +02:00
Matthias Krüger b0b798e1e2
Rollup merge of #100094 - lyming2007:issue-98982, r=estebank
Detect type mismatch due to loop that might never iterate

When loop as tail expression causes a miss match type E0308 error, recursively get the return statement and add diagnostic information on it.
2022-08-06 16:15:56 +02:00
bors 76b0484740 Auto merge of #99893 - compiler-errors:issue-99387, r=davidtwco
Delay formatting trimmed path until lint/error is emitted

Fixes #99387

r? `@davidtwco`
2022-08-06 12:29:11 +00:00
Guillaume Gomez 71edb3168f remove Clean trait implementation for hir::PolyTraitRef 2022-08-06 11:54:54 +02:00
Guillaume Gomez ca70ed8c81 remove Clean trait implementation for hir::GenericBound 2022-08-06 11:52:27 +02:00
bors bb71929892 Auto merge of #100172 - Mark-Simulacrum:bump-165, r=Mark-Simulacrum
Bump to 1.65.0

r? `@Mark-Simulacrum`
2022-08-06 09:37:32 +00:00
bors bd04658eb6 Auto merge of #99743 - compiler-errors:fulfillment-context-cleanups, r=jackh726
Some `FulfillmentContext`-related cleanups

Use `ObligationCtxt` in some places, remove some `FulfillmentContext`s in others...

r? types
2022-08-06 06:48:15 +00:00
bors 55f46419af 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.

Closes #98215.
2022-08-05 23:11:49 +00:00
Jubilee Young 80c9012e42 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.
2022-08-05 14:59:32 -07:00
Yiming Lei 9815667b8b 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
2022-08-05 10:28:00 -07:00
Josh Stone 99793d97e1
Update RELEASES.md
Co-authored-by: Trevor Spiteri <tspiteri@ieee.org>
2022-08-05 10:02:46 -07:00
Josh Stone 5247a33f83
Update RELEASES.md
Co-authored-by: Trevor Spiteri <tspiteri@ieee.org>
2022-08-05 10:02:38 -07:00
Xavier Noria 64d1c91a31
ascii -> ASCII in code comment 2022-08-05 18:45:42 +02:00
Michael Goulet 694a010a5c move DiagnosticArgFromDisplay into rustc_errors 2022-08-05 16:44:01 +00:00
Michael Goulet 0ad57d8502 Delay formatting trimmed path until lint/error is emitted 2022-08-05 16:44:01 +00:00
bors affe0d3a00 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;`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-05 16:35:15 +00:00
Dylan DPC e7ed8443ea
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.

Resolves #100146

r? `@compiler-errors`
2022-08-05 21:54:37 +05:30
Dylan DPC 404782dffe
Rollup merge of #100166 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-08-05 21:54:36 +05:30
Dylan DPC 823ef905ed
Rollup merge of #100158 - solid-rs:patch/kmc-solid/follow-up-98246, r=joshtriplett
kmc-solid: Add a stub implementation of #98246 (`File::set_times`)

 Fixes the build failure of the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets after #98246.

This target does not support setting a modification time and access time separately, hence stubbing out the implementation.
2022-08-05 21:54:35 +05:30
Dylan DPC 97440b5899
Rollup merge of #100157 - rust-lang:notriddle/use-map-instead-of-repeated-push, r=Dylan-DPC
rustdoc: use `collect()` instead of repeatedly pushing
2022-08-05 21:54:34 +05:30
Dylan DPC 721af40dcb
Rollup merge of #100155 - compiler-errors:issue-100154, r=jackh726
Use `node_type_opt` to skip over generics that were not expected

Fixes #100154
2022-08-05 21:54:33 +05:30
Dylan DPC 9e4feff46a
Rollup merge of #99835 - TaKO8Ki:suggest-adding-or-removing-ref-for-binding-pattern, r=estebank
Suggest adding/removing `ref` for binding patterns

This fixes what a fixme comment says.

r? `@estebank`
2022-08-05 21:54:32 +05:30
Mark Rousskov b560dd64d7 Bump to 1.65.0 2022-08-05 11:32:46 -04:00
Maybe Waffle c195f7c0a4 Optimize `pointer::as_aligned_to` 2022-08-05 17:14:32 +04:00
bors d77da9da84 Auto merge of #100073 - dpaoliello:externvar, r=michaelwoerister
Add test for raw-dylib with an external variable

All existing tests of link kind `raw-dylib` only validate the ability to link against functions, but it is also possible to link against variables.

This adds tests for linking against a variable using `raw-dylib` both by-name and by-ordinal.
2022-08-05 13:05:34 +00:00
Maybe Waffle 743ad07c4b Improve diagnostics for `const a: = expr;` 2022-08-05 16:19:28 +04:00
yukang 2b15fc6d9a recover require,include instead of use in item 2022-08-05 19:20:03 +08:00
Guillaume Gomez 46d17d6aaa remove Clean trait implementation for hir::TraitItem 2022-08-05 12:08:32 +02:00
Guillaume Gomez 38083acde2 remove Clean trait implementation for hir::PolyTraitRef 2022-08-05 12:01:30 +02:00
bors 9bbbf60b04 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`
2022-08-05 09:32:26 +00:00
bors cdfd675a63 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.
2022-08-05 06:35:12 +00:00
bors 6bcf01afdb Auto merge of #97085 - rylev:test-issue-33172, r=wesleywiser
Add a test for issue #33172

Adds a test confirming that #33172 has been fixed.

CDB has some surprising results as it looks like the supposedly unmangled static's symbol name is prefixed when it shouldn't be.

r? `@wesleywiser`

Closes #33172
2022-08-05 03:26:47 +00:00
Michael Howell 70a6ae6709 rustdoc: use `collect()` instead of repeatedly pushing to bounds 2022-08-04 18:13:53 -07:00
Michael Howell 7ba51fa05b rustdoc: use `collect()` instead of repeatedly pushing to bindings 2022-08-04 18:13:46 -07:00
bors 2da8820470 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.
2022-08-04 23:56:07 +00:00