Commit Graph

15847 Commits

Author SHA1 Message Date
Bryysen
bfd7535130 Fix wording on comment 2022-08-07 23:50:12 +02:00
Bryysen
399796d2b3 Add comments to obscure code, remove unnesecary parameter from closure 2022-08-07 22:28:16 +02:00
Matthias Krüger
0f7fe9f997
Rollup merge of #100244 - Lokathor:add-armv4t-none-eabi-take2, r=jackh726
Add armv4t-none-eabi take2

This is the same as the previous PR (https://github.com/rust-lang/rust/pull/99226) but i just made a fresh branch without a merge commit in it.

---

### armv4t-none-eabi target quiz

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target.

That's me!

> Targets must use naming consistent with any existing targets

We're using the existing name as recognized by LLVM and GCC

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

No legal issues here.

>> The target must not introduce license incompatibilities.

No license requirements here.

>> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

check

>> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy.

no new deps, we're just adding a rustc target description file for a target llvm already knows about.

>> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries.

bare-metal target, doesn't rely on any libs at all.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate

`core` only here. You could build `alloc` too, but you'd have to bring your own global allocator.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible.

LLVM knows how to do it, you just need the GNU Binutils linker because LLVM's linker doesn't work that far back. That's in the docs as part of this PR.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target.

No burdens, LLVM already knows how to do this. Further, because this is a cpu-feature variant of an existing tier3 target the `compiler-builtins` crate has already been updated as necessary to fix any missing builtin function gaps.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

check.
2022-08-07 21:10:27 +02:00
Matthias Krüger
5648add9ef
Rollup merge of #100230 - cjgillot:noice-multibyte-amp, r=compiler-errors
Use start_point instead of next_point to point to elided lifetime amp…

Using `next_point` creates a span which points inside the multibyte token, ICEing.

Fixes https://github.com/rust-lang/rust/issues/100224
2022-08-07 21:10:26 +02:00
Matthias Krüger
7be359e51b
Rollup merge of #100019 - TaKO8Ki:suggest-boxed-trait-objects-instead-of-impl-trait, r=compiler-errors
Revive suggestions for boxed trait objects instead of impl Trait

The suggestion implemented in #75608 was not working properly, so I fixed it.
2022-08-07 21:10:22 +02:00
Lokathor
a8b4454047
Create armv4t_none_eabi.rs 2022-08-07 12:40:41 -06:00
Camille GILLOT
aa031f9fbf Fail gracefully when const pattern is not structural match. 2022-08-07 19:12:33 +02:00
Bryysen
4ee2fe308b Further improve error message for E0081
Multiple duplicate assignments of the same discriminant are now reported
in the samme error. We now point out the incrementation start point for
discriminants that are not explicitly assigned that are also duplicates.
Removed old test related to E0081 that is now covered by error-codes/E0081.rs.
Also refactored parts of the `check_enum` function.
2022-08-07 17:43:52 +02:00
Ralf Jung
be6bb56ee0 add -Zextra-const-ub-checks to enable more UB checking in const-eval 2022-08-07 09:54:40 -04: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
Camille GILLOT
f6af4efec5 Use start_point instead of next_point to point to elided lifetime ampersand. 2022-08-07 14:35:11 +02:00
Camille GILLOT
db7ddc50b6 Do not manually craft a span pointing inside a multibyte character. 2022-08-07 13:12:54 +02:00
Luqman Aden
fc83a0cb57 Don't ICE while suggesting updating item path.
When an item isn't found, we may suggest an appropriate import to
`use`. Along with that, we also suggest updating the path to work
with the `use`. Unfortunately, if the code in question originates
from a macro, the span used to indicate which part of the path
needs updating may not be suitable and cause an ICE. Since, such
code is not adjustable directly by the user without modifying the
macro, just skip the suggestion in such cases.
2022-08-07 04:03:28 -07:00
Takayuki Maeda
82f2c08200 fix wrong suggestions for boxed trait objects instead of impl trait 2022-08-07 16:50:08 +09:00
Takayuki Maeda
fc43bd60c0 revive suggestions for boxed trait objects instead of impl Trait 2022-08-07 16:50:06 +09: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
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
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
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
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
Tomasz Miąsko
18a21e13b4 Remove duplicated temporaries creating during box derefs elaboration
Temporaries created with `MirPatch::new_temp` will be declared after
patch application. Remove manually created duplicate declarations.

Removing duplicates exposes another issue. Visitor elaborates
terminator twice and attempts to access new, but not yet available,
local declarations. Remove duplicated call to `visit_terminator`.
2022-08-06 11:14:57 +02: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
Ralf Jung
d5e9e94741 add method to get the mutability of an AllocId 2022-08-05 17:59:35 -04: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
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
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
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
Maybe Waffle
95bf0fb917 Move stability lookup after cross-crate check 2022-08-05 18:13:22 +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
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
Takayuki Maeda
f6d42aa336 remove an unnecessary str::rfind 2022-08-05 18:14:15 +09: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
Michael Goulet
5bb50ddc83 opt node type 2022-08-04 22:43:39 +00:00
Matthias Krüger
c2d7321a2d
Rollup merge of #100148 - durin42:llvm-16-pointertype, r=nikic
RustWrapper: update for TypedPointerType in LLVM

This is a result of https://reviews.llvm.org/D130592.

r? `@nikic`
2022-08-04 22:25:06 +02:00
Matthias Krüger
01ccde5ec8
Rollup merge of #100095 - jackh726:early-binder, r=lcnr
More EarlyBinder cleanups

Each commit is independent

r? types
2022-08-04 22:25:04 +02:00
Matthias Krüger
6b938c8491
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!
2022-08-04 22:25:02 +02:00
Matthias Krüger
d3aa757ff8
Rollup merge of #100058 - TaKO8Ki:suggest-positional-formatting-argument-instead-of-format-args-capture, r=estebank
Suggest a positional formatting argument instead of a captured argument

This patch fixes a part of #96999.

fixes #98241
fixes #97311

r? `@estebank`
2022-08-04 22:25:01 +02:00
Matthias Krüger
f6ea143f93
Rollup merge of #98796 - compiler-errors:no-semi-if-comma, r=estebank
Do not exclusively suggest `;` when `,` is also a choice

Fixes #96791
2022-08-04 22:24:59 +02:00
Daniel Paoliello
0a754b309c Add test for raw-dylib with an external variable 2022-08-04 12:47:13 -07:00
Santiago Pastorino
4170d7390b
Fix typo 2022-08-04 15:13:47 -03:00
Santiago Pastorino
065e497630
Improve opt_local_def_id docs 2022-08-04 15:13:44 -03:00
Santiago Pastorino
bf1c7da147
Improve record_def_id_remap docs 2022-08-04 12:47:19 -03:00
Santiago Pastorino
ece52451f6
Do not collect lifetimes with Infer resolution 2022-08-04 12:40:00 -03:00
Augie Fackler
cdbe956ec3 RustWrapper: update for TypedPointerType in LLVM
This is a result of https://reviews.llvm.org/D130592.
2022-08-04 11:31:57 -04:00
Santiago Pastorino
45991f9175
Use span_bug instead of panic 2022-08-04 12:07:03 -03:00
Santiago Pastorino
c0923c8934
Add docs to generics_def_id_map 2022-08-04 11:27:03 -03:00
Santiago Pastorino
5e71659983
Add docs to record_elided_anchor 2022-08-04 11:27:02 -03:00
Santiago Pastorino
f8b1b2bdfb
Extract record_elided_anchor 2022-08-04 11:27:02 -03:00
Santiago Pastorino
9f10f589a7
Move new_remapping inside with_hir_id_owner 2022-08-04 11:27:02 -03:00
Santiago Pastorino
1ece866cf1
Add documentation for create_lifetime_defs 2022-08-04 11:27:02 -03:00
Santiago Pastorino
2f353d1f72
Add more debug calls 2022-08-04 11:27:01 -03:00
Santiago Pastorino
cab67404a4
Add documentation about lifetime args 2022-08-04 11:27:01 -03:00
Santiago Pastorino
a3bfdc77a7
Add documentation about lifetime_defs 2022-08-04 11:27:01 -03:00
Santiago Pastorino
9c7de6fb3c
Move hir_bounds after lifetime_defs 2022-08-04 11:27:01 -03:00
Santiago Pastorino
3f7db370ef
captures -> collected_lifetimes 2022-08-04 11:27:00 -03:00
Santiago Pastorino
12fa3393a5
Move lifetimes_in_bounds call to outside with_hir_id_owner block in lower_async_fn_ret_ty 2022-08-04 11:27:00 -03:00
Santiago Pastorino
4b9b5838ac
Move lifetimes_in_bounds call to outside with_hir_id_owner block in lower_opaque_impl_trait 2022-08-04 11:27:00 -03:00
Santiago Pastorino
76b518fc83
Document what collected_lifetimes vec containts 2022-08-04 11:27:00 -03:00
Santiago Pastorino
d85720a083
Document lower_opaque_impl_trait 2022-08-04 11:26:59 -03:00
Santiago Pastorino
6289d0eb53
with_lifetime_binder is now lower_lifetime_binder and doesn't need a closure 2022-08-04 11:26:59 -03:00
Santiago Pastorino
11e00f502a
Add comments on with_remapping 2022-08-04 11:26:59 -03:00
Santiago Pastorino
c946cdceb4
Document opt_local_def_id 2022-08-04 11:26:59 -03:00
Santiago Pastorino
966269a464
Document generics_def_id_map field and record/get methods on it 2022-08-04 11:26:58 -03:00
Santiago Pastorino
78585098b5
Add comments about lifetime collect and create lifetime defs for RPITs 2022-08-04 11:26:58 -03:00
Santiago Pastorino
40bcbed3c7
Avoid explicitly handling res when is not needed 2022-08-04 11:26:58 -03:00
Santiago Pastorino
cd3c388418
create_and_capture_lifetime_defs -> create_lifetime_defs 2022-08-04 11:26:57 -03:00
Santiago Pastorino
13800624de
Remove captured_lifetimes and LifetimeCaptureContext and make create_lifetime_defs return the captures 2022-08-04 11:26:57 -03:00
Santiago Pastorino
1d6cebfd6b
Implement def_id based remapping 2022-08-04 11:26:57 -03:00
Santiago Pastorino
f0db1d68e6
Remove local_def_id from captured_lifetimes 2022-08-04 11:26:57 -03:00
Santiago Pastorino
2d826e27c4
Capture things as Lifetime object to simplify things 2022-08-04 11:26:57 -03:00
Santiago Pastorino
f6b4dd1541
Create new_mapping local structure and avoid checking def_ids on captures 2022-08-04 11:26:56 -03:00
Santiago Pastorino
6c6a81e48e
Remove binders_to_ignore from LifetimeCaptureContext 2022-08-04 11:26:56 -03:00
Santiago Pastorino
95158fdf3a
No need to store parent_def_id in LifetimeCaptureContext 2022-08-04 11:26:56 -03:00
Santiago Pastorino
552f6b0f81
No need to check binders to ignore on new_named_lifetime_with_res's LifetimeRes::Fresh 2022-08-04 11:26:56 -03:00
Santiago Pastorino
6041ed0775
No need to check binders to ignore on new_named_lifetime_with_res's LifetimeRes::Param 2022-08-04 11:26:55 -03:00
Santiago Pastorino
d9e6364755
new_named_lifetime_with_res's LifetimeRes::Fresh should have created def_id already 2022-08-04 11:26:55 -03:00
Santiago Pastorino
3030ab3074
new_named_lifetime_with_res's LifetimeRes::Param should have created def_id already 2022-08-04 11:26:55 -03:00
Santiago Pastorino
14ea17858d
Fail if LifetimeRes is Infer when creating def ids for lifetimes copies 2022-08-04 11:26:55 -03:00
Santiago Pastorino
c390bda356
Record RPITs elided lifetimes in Rptr Tys 2022-08-04 11:26:55 -03:00
Santiago Pastorino
1802d45b12
Record RPITs elided lifetimes in path segments 2022-08-04 11:26:54 -03:00
Santiago Pastorino
81c4d2371a
Restructure visit_ty in a more clear way 2022-08-04 11:26:54 -03:00
Santiago Pastorino
05b989e16e
Skip lifetimes in binders when visiting 2022-08-04 11:26:54 -03:00
Santiago Pastorino
4f334f2b97
Move LifetimeCollectVisitor to rustc_ast_lowering 2022-08-04 11:26:54 -03:00
Santiago Pastorino
9f77688d17
Completely remove captures flag 2022-08-04 11:26:53 -03:00
Santiago Pastorino
20c88a2a30
Do not execute captures code when lowering lifetimes as GenericArg 2022-08-04 11:26:53 -03:00
Santiago Pastorino
9c0d9babd1
Do not execute captures code for async fns 2022-08-04 11:26:53 -03:00
Santiago Pastorino
5a184acfc6
There's no need to check binders_to_ignore using the old code anymore 2022-08-04 11:26:53 -03:00
Santiago Pastorino
19dcbd151b
Explicitly gather lifetimes and definitions for bare async fns 2022-08-04 11:26:52 -03:00
Santiago Pastorino
25825cd4fa
Extract create_and_capture_lifetime_defs function 2022-08-04 11:26:52 -03:00
Santiago Pastorino
fac763168f
Remove NEW_COLLECT_LIFETIMES env var 2022-08-04 11:26:52 -03:00
Santiago Pastorino
399609e841
Add debug! calls 2022-08-04 11:26:52 -03:00
Santiago Pastorino
cda2c04592
Explicitly gather lifetimes and definitions in RPIT 2022-08-04 11:26:51 -03:00
Santiago Pastorino
84a24a1b3c
Unroll while_capturing_lifetimes into lower_opaque_impl_trait 2022-08-04 11:26:51 -03:00
Santiago Pastorino
0f11a0cd24
Add captures flag to capture or not while lowering 2022-08-04 11:26:51 -03:00
Santiago Pastorino
b14c9571fa
Make lower_generic_bound_predicate receive AST bounds instead of HIR bounds 2022-08-04 11:26:51 -03:00
Santiago Pastorino
5c23a2e5a6
Remove old docs on lower_async_fn_ret_ty 2022-08-04 11:26:50 -03:00
Michael Goulet
f5af266b6d Address nits 2022-08-04 13:59:25 +00:00
Michael Goulet
fe894756f8 Add traits::fully_solve_obligation that acts like traits::fully_normalize
It spawns up a trait engine, registers the single obligation, then fully
solves it
2022-08-04 13:50:56 +00:00
Michael Goulet
3e48434cc7 Use ObligationCtxt in impossible_predicates 2022-08-04 13:42:13 +00:00
Michael Goulet
61d9b1656d Remove unnecessary FulfillmentContext from need_migrate_deref_output_trait_object 2022-08-04 13:42:13 +00:00
Michael Goulet
37d412cff7 Remove FulfillmentContext param from fully_normalize 2022-08-04 13:42:13 +00:00
Michael Goulet
da59fa74f0 Use ObligationCtxt in main fn return type check 2022-08-04 13:42:12 +00:00
bors
3830ecaa8d Auto merge of #100087 - JakobDegen:mir-patch, r=tmiasko
Avoid invalidating the CFG in `MirPatch`

As a part of this change, we adjust `MirPatch` to not needlessly create unnecessary resume blocks.

r? `@tmiasko`
2022-08-04 13:24:57 +00:00
Takayuki Maeda
8c85c9936f add a comment about what we can parse now 2022-08-04 20:43:35 +09:00
wcampbell
8dd44f1af4 Enable unused_parens for match arms 2022-08-04 07:16:39 -04:00
bors
6f18f0a9d4 Auto merge of #99953 - cjgillot:in-path-always, r=petrochenkov
Always create elided lifetimes, even if inferred.

`PathSource` gives the context in which a path is encountered.  The same `PathSource` is used for the full path and the `QSelf` part.

Therefore, we can only rely on `PathSource` to know whether typechecking will be able to infer the lifetimes, not whether we need to insert them at all.

Fixes https://github.com/rust-lang/rust/issues/99949
2022-08-04 10:21:40 +00:00
bors
2f2243c9b6 Auto merge of #99843 - oli-obk:is_useful_perf, r=compiler-errors
Some `is_useful` cleanups

#98582 was reverted because it was a perf regression.

https://github.com/rust-lang/rust/pull/99806 reintroduces the changes, but this PR picks individual ones that have no regressions.
2022-08-04 07:35:33 +00:00
Michael Goulet
47a7a91c96 Use (actually) dummy place for let-else divergence 2022-08-04 05:08:09 +00:00
bors
caee496150 Auto merge of #100120 - matthiaskrgr:rollup-g6ycykq, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #98771 (Add support for link-flavor rust-lld for iOS, tvOS and watchOS)
 - #98835 (relate `closure_substs.parent_substs()` to parent fn in NLL)
 - #99746 (Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`)
 - #99786 (Recover from C++ style `enum struct`)
 - #99795 (Delay a bug when failed to normalize trait ref during specialization)
 - #100029 (Prevent ICE for `doc_alias` on match arm, statement, expression)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-04 03:52:29 +00:00
Michael Goulet
1f463ac407 Resolve vars before emitting coerce error 2022-08-04 03:05:57 +00:00
Michael Goulet
c62a8ea9df Don't point out return span on every E0308 2022-08-04 02:55:40 +00:00
Takayuki Maeda
dcd70c0995 return when captured argument is not a struct field 2022-08-04 11:51:25 +09:00
yukang
e614bbcd30 link_ordinal is available for foreign static 2022-08-04 09:28:59 +08:00
Matthias Krüger
d4bd4ae27a
Rollup merge of #100111 - estebank:missing-let, r=compiler-errors
Provide suggestion on missing `let` in binding statement

Fix #78907.

Fallout from the type ascription syntax.
2022-08-03 22:30:49 +02:00
Matthias Krüger
551224019b
Rollup merge of #100107 - klensy:tr-w, r=compiler-errors
fix trailing whitespace in error message
2022-08-03 22:30:49 +02:00
Matthias Krüger
6919a07eb8
Rollup merge of #100102 - b-naber:typo-higher-ranked-sub, r=Dylan-DPC
Fix typo

r? ```@jackh726```
2022-08-03 22:30:46 +02:00
Matthias Krüger
5a5f4993ad
Rollup merge of #100068 - dcsommer:master, r=petrochenkov
Fix backwards-compatibility check for tests with `+whole-archive`

Fixes #100066
2022-08-03 22:30:45 +02:00
Matthias Krüger
f8e6617239
Rollup merge of #100029 - hdelc:master, r=cjgillot
Prevent ICE for `doc_alias` on match arm, statement, expression

Fixes #99777.

This is a pretty minimal fix that should be safe, since rustdoc doesn't generate documentation for match arms, statements, or expressions. I mentioned in the linked issue that the `doc_alias` target checking should probably be improved to avoid future ICEs, but as a new contributor, I'm not confident enough with the HIR types to make a larger change.
2022-08-03 22:29:31 +02:00
Matthias Krüger
02fcec2ac8
Rollup merge of #99795 - compiler-errors:delay-specialization-normalize-error, r=spastorino
Delay a bug when failed to normalize trait ref during specialization

The error messages still kinda suck here but they don't ICE anymore...

Fixes #45814
Fixes #43037

r? types
2022-08-03 22:29:30 +02:00
Matthias Krüger
9c18fdc71f
Rollup merge of #99786 - obeis:issue-99625, r=compiler-errors
Recover from C++ style `enum struct`

Closes #99625
2022-08-03 22:29:29 +02:00
Matthias Krüger
0de7f756f0
Rollup merge of #99746 - compiler-errors:more-trait-engine, r=jackh726
Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`

Not sure if this change is worthwhile, but couldn't hurt re: chalkification

r? types
2022-08-03 22:29:27 +02:00
Matthias Krüger
88e9417156
Rollup merge of #98835 - aliemjay:relate_closure_substs, r=nikomatsakis
relate `closure_substs.parent_substs()` to parent fn in NLL

Fixes #98589

The discrepancy between early- and late-bound lifetimes is because we map early-bound lifetimes into those found in the `closure_substs` while late-bound lifetimes are mapped into liberated free regions:
5f98537eb7/compiler/rustc_borrowck/src/universal_regions.rs (L255-L261)

r? `@rust-lang/types`
2022-08-03 22:29:26 +02:00
Matthias Krüger
7b0360e516
Rollup merge of #98771 - Thog:rust-lld-apple-target, r=petrochenkov
Add support for link-flavor rust-lld for iOS, tvOS and watchOS

This adds support for rust-lld for Apple *OS targets.

This was tested against targets ``aarch64-apple-ios`` and ``aarch64-apple-ios-sim`` with [a simple test program](https://github.com/Thog/rust-lld-apple-target_test).

It currently doesn't work with targets ``armv7-apple-ios`` and ``armv7s-apple-ios`` because of ``symbols.o`` not being generated with the correct CPU subtype. This will require changes in the ``object`` crate to expose an API.

As ``ld64.lld`` requires ``-platform_version`` with the minimal version supported and an sdk version, I made ``rustc_target::apple_base`` public to get access to ``*os_deployment_target``  helper functions and also added ``tvos_deployment_target`` as it was missing.
2022-08-03 22:29:25 +02:00
Camille GILLOT
845009d071 Only fetch HIR for naked functions that have the attribute. 2022-08-03 19:14:29 +02:00
Esteban Küber
939c2b6313 Provide suggestion on missing let in binding statement
Fix #78907.
2022-08-03 09:29:29 -07:00
bors
d6b96b61e7 Auto merge of #100064 - RalfJung:disaligned, r=petrochenkov
fix is_disaligned logic for nested packed structs

https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.

Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03 16:09:56 +00:00
mary
78bbe57c88 Add support for link-flavor rust-lld for iOS, tvOS and watchOS
This adds support for rust-lld for Apple *OS targets.

This was tested against targets "aarch64-apple-ios" and "aarch64-apple-ios-sim".

For targets "armv7-apple-ios" and "armv7s-apple-ios", it doesn't link because of
"symbols.o" not being generated with the correct CPU subtype (changes in
the "object" crate needs to be done to support it).
2022-08-03 15:41:05 +00:00
Ralf Jung
9097ce9054 fix is_disaligned logic for nested packed structs 2022-08-03 09:59:08 -04:00
klensy
0548e8ed06 fix trailing whitespace in error message 2022-08-03 15:46:34 +03:00
Fabian Wolff
e3c7e04a44 Warn about dead tuple struct fields 2022-08-03 12:17:23 +02:00
Ali MJ Al-Nasrawy
78adc0139c cosmetic changes 2022-08-03 12:46:04 +03:00
b-naber
1405ce35ac fix typo 2022-08-03 11:04:10 +02:00
Michael Goulet
603ffebd37 Skip over structs with no private fields that impl Deref 2022-08-03 07:02:56 +00:00
Michael Goulet
2a3fd5053f Don't suggest field method if it's just missing some bounds 2022-08-03 07:01:49 +00:00
Michael Goulet
4df6cbe96f Consider privacy more carefully when suggesting accessing fields 2022-08-03 06:51:26 +00:00
Michael Goulet
9cf570995c Suggest expressions' fields even if they're not ADTs 2022-08-03 06:28:45 +00:00
Jack Huey
955fcad758 Add bound_impl_subject and bound_return_ty 2022-08-03 01:02:46 -04:00
bors
e141246cbb Auto merge of #100082 - matthiaskrgr:rollup-ywu4iux, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #99933 (parallelize HTML checking tool)
 - #99958 (Improve position named arguments lint underline and formatting names)
 - #100008 (Update all pre-cloned submodules on startup)
 - #100049 (⬆️ rust-analyzer)
 - #100070 (Clarify Cargo.toml comments)
 - #100074 (rustc-docs: Be less specific about the representation of `+bundle`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-03 04:50:42 +00:00
yukang
4a5e83c939 fix tidy 2022-08-03 12:19:21 +08:00
Jack Huey
96a69dce2c Change sized_constraints to return EarlyBinder 2022-08-03 00:14:24 -04:00
yukang
0d1b832667 check link ordinal make sure target is foreign function 2022-08-03 11:30:27 +08:00