]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agomacros: support adding warnings to diags
David Wood [Mon, 11 Jul 2022 17:46:24 +0000 (18:46 +0100)]
macros: support adding warnings to diags

Both diagnostic and subdiagnostic derives were missing the ability to
add warnings to diagnostics - this is made more difficult by the `warn`
attribute already existing, so this name being unavailable for the
derives to use. `#[warn_]` is used instead, which requires
special-casing so that `{span_,}warn` is called instead of
`{span_,}warn_`.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: support `MultiSpan` in diag derives
David Wood [Mon, 11 Jul 2022 16:15:31 +0000 (17:15 +0100)]
macros: support `MultiSpan` in diag derives

Add support for `MultiSpan` with any of the attributes that work on a
`Span` - requires that diagnostic logic generated for these attributes
are emitted in the by-move block rather than the by-ref block that they
would normally have been generated in.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoerrors: lint on `LintDiagnosticBuilder::build`
David Wood [Mon, 11 Jul 2022 15:29:24 +0000 (16:29 +0100)]
errors: lint on `LintDiagnosticBuilder::build`

Apply the `#[rustc_lint_diagnostics]` attribute to
`LintDiagnosticBuilder::build` so that diagnostic migration lints will
trigger for it.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoerrors: impl `IntoDiagnosticArg` for `char`
David Wood [Mon, 11 Jul 2022 15:28:38 +0000 (16:28 +0100)]
errors: impl `IntoDiagnosticArg` for `char`

Implements `IntoDiagnosticArg` for `char` using its `Debug`
implementation and introduces a macro for those types which just
delegate the implementation to `ToString`.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agohir typeck: `fulfillment_cx` ignore regions
lcnr [Fri, 8 Jul 2022 09:17:12 +0000 (11:17 +0200)]
hir typeck: `fulfillment_cx` ignore regions

2 years agoprovide `generic_param_scope` for region errors
lcnr [Fri, 8 Jul 2022 08:59:35 +0000 (10:59 +0200)]
provide `generic_param_scope` for region errors

2 years agodon't require `FnCtxt` to check global asm
lcnr [Thu, 7 Jul 2022 14:14:27 +0000 (16:14 +0200)]
don't require `FnCtxt` to check global asm

2 years agotry to avoid `FnCtxt` during wf
lcnr [Thu, 7 Jul 2022 13:12:32 +0000 (15:12 +0200)]
try to avoid `FnCtxt` during wf

2 years agoremove unnecessary `select_obligations_where_possible`
lcnr [Thu, 7 Jul 2022 11:43:01 +0000 (13:43 +0200)]
remove unnecessary `select_obligations_where_possible`

this was previously used for opaque types but became unnecessary
after #89024

2 years agoremove `impl_implied_bounds` from `FnCtxt`
lcnr [Thu, 7 Jul 2022 09:05:02 +0000 (11:05 +0200)]
remove `impl_implied_bounds` from `FnCtxt`

2 years ago`QueryNormalizer` bug on ambiguity
lcnr [Thu, 7 Jul 2022 09:04:36 +0000 (11:04 +0200)]
`QueryNormalizer` bug on ambiguity

2 years agoAuto merge of #99046 - nnethercote:final-derive-output-improvements, r=Mark-Simulacrum
bors [Fri, 15 Jul 2022 14:30:14 +0000 (14:30 +0000)]
Auto merge of #99046 - nnethercote:final-derive-output-improvements, r=Mark-Simulacrum

Final derive output improvements

With all these changes, the derive output in `deriving-all-codegen.stdout` is pretty close to optimal, i.e. very similar to what you'd write by hand.

r? `@ghost`

2 years agoAuto merge of #99278 - Dylan-DPC:rollup-fcln6st, r=Dylan-DPC
bors [Fri, 15 Jul 2022 11:44:20 +0000 (11:44 +0000)]
Auto merge of #99278 - Dylan-DPC:rollup-fcln6st, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #88991 (Add Nintendo Switch as tier 3 target)
 - #98869 (Remove some usages of `guess_head_span`)
 - #99119 (Refactor: remove a string matching about methods)
 - #99209 (Correctly handle crate level page on docs.rs as well)
 - #99246 (Update RLS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #99246 - Xanewok:update-rls, r=jyn514
Dylan DPC [Fri, 15 Jul 2022 10:23:40 +0000 (15:53 +0530)]
Rollup merge of #99246 - Xanewok:update-rls, r=jyn514

Update RLS

Fixes #99234

r? `@jyn514`
cc `@Mark-Simulacrum`

2 years agoRollup merge of #99209 - GuillaumeGomez:crate-level-sidebar, r=jsha
Dylan DPC [Fri, 15 Jul 2022 10:23:39 +0000 (15:53 +0530)]
Rollup merge of #99209 - GuillaumeGomez:crate-level-sidebar, r=jsha

Correctly handle crate level page on docs.rs as well

Fixes #99121.

On docs.rs, they move the `class` attribute into a child which still has `rustdoc`. So instead of using the `<body>`, we can simply use this one directly.

r? `@jsha`

2 years agoRollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 10:23:38 +0000 (15:53 +0530)]
Rollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, r=cjgillot

Refactor: remove a string matching about methods

This patch remove a string matching about methods and adds some rustfix tests.

2 years agoRollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 10:23:37 +0000 (15:53 +0530)]
Rollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillot

Remove some usages of `guess_head_span`

No need to pass things through `guess_head_span` if they already point to the head span.

Only major change is that we point to the head span of `enum`s on some errors now, which I prefer.

r? `@cjgillot`

2 years agoRollup merge of #88991 - libstd-switch:aarch64-nintendo-switch, r=wesleywiser
Dylan DPC [Fri, 15 Jul 2022 10:23:36 +0000 (15:53 +0530)]
Rollup merge of #88991 - libstd-switch:aarch64-nintendo-switch, r=wesleywiser

Add Nintendo Switch as tier 3 target

[Relevant Zulip Discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Upstreaming.20Nintendo.20Switch.20Support/near/253445503)

This is the first step towards working on incrementally adding support for the Nintendo Switch. After this lands `@leo60228` and I will work on ensuring further work is cleared from a legal perspective before continuing on to work on an allocator and porting libstd.

The plan is to keep these changes small and incremental enough so as to not cause unneeded burden on reviewers by submitting a single large patch, as was felt to be the case last attempt at upstreaming (#74567).

All this specific patch does is add the target itself without and std support, which has been tested on-device and is working as expected.

Designated Target Maintainers:
* `@leo60228`
* `@jam1garner`

2 years agoStabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends
Josh Triplett [Fri, 15 Jul 2022 10:10:35 +0000 (03:10 -0700)]
Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends

Stabilize the `core_c_str` and `alloc_c_string` feature gates.

Change `std::ffi` to re-export these types rather than creating type
aliases, since they now have matching stability.

2 years agoAuto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obk
bors [Fri, 15 Jul 2022 08:57:59 +0000 (08:57 +0000)]
Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obk

interpret: get rid of MemPlaceMeta::Poison

This is achieved by refactoring the projection code (`{mplace,place,operand}_{downcast,field,index,...}`) so that we no longer need to call `assert_mem_place` in the operand handling.

2 years agoadd `#[must_use]` to `Box::from_raw`
rhysd [Fri, 15 Jul 2022 08:05:50 +0000 (17:05 +0900)]
add `#[must_use]` to `Box::from_raw`

2 years agoAuto merge of #99267 - Dylan-DPC:rollup-d8l7y1o, r=Dylan-DPC
bors [Fri, 15 Jul 2022 06:14:51 +0000 (06:14 +0000)]
Auto merge of #99267 - Dylan-DPC:rollup-d8l7y1o, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #99113 (Simplify [a]rc code a little)
 - #99131 (Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`)
 - #99237 (removed unused CSS and unused HTML IDs)
 - #99239 (Add myself to the set of people notified when MIR changes.)
 - #99241 (Remove comment referring to constness.rs)
 - #99257 (Add regression test for #89436)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agosimplify `suggest_deref_ref_or_into`
Takayuki Maeda [Fri, 15 Jul 2022 05:29:15 +0000 (14:29 +0900)]
simplify `suggest_deref_ref_or_into`

2 years agoRemove some more usages of guess_head_span
Michael Goulet [Fri, 15 Jul 2022 05:23:47 +0000 (05:23 +0000)]
Remove some more usages of guess_head_span

2 years agoRollup merge of #99257 - Manishearth:regression, r=jackh726
Dylan DPC [Fri, 15 Jul 2022 05:09:47 +0000 (10:39 +0530)]
Rollup merge of #99257 - Manishearth:regression, r=jackh726

Add regression test for #89436

I never got around to adding such a test.

In general I think the `yoke` crate has a bunch of interesting testcases that exercise various edges of the algorithms here, it would be nice if we could simply depend on the crate and add some tests that exercise it, but I don't think that's possible. Do you or `@eddyb` think there's any use trying to upstream a bunch of common yoke minimal working example code to the testsuite and having a ton of yoke tests?

2 years agoRollup merge of #99241 - danbev:intrinsics-comment, r=fee1-dead
Dylan DPC [Fri, 15 Jul 2022 05:09:46 +0000 (10:39 +0530)]
Rollup merge of #99241 - danbev:intrinsics-comment, r=fee1-dead

Remove comment referring to constness.rs

This commit removes the comment in emulate_intrinsic, which is
currently referring to `src/librustc_middle/ty/constness.rs`.

2 years agoRollup merge of #99239 - vakaras:add-myself-to-mir-followers, r=tmiasko
Dylan DPC [Fri, 15 Jul 2022 05:09:45 +0000 (10:39 +0530)]
Rollup merge of #99239 - vakaras:add-myself-to-mir-followers, r=tmiasko

Add myself to the set of people notified when MIR changes.

I would like to be notified when changes to MIR are made.

2 years agoRollup merge of #99237 - GuillaumeGomez:rustdoc-css-cleanup, r=notriddle
Dylan DPC [Fri, 15 Jul 2022 05:09:44 +0000 (10:39 +0530)]
Rollup merge of #99237 - GuillaumeGomez:rustdoc-css-cleanup, r=notriddle

removed unused CSS and unused HTML IDs

I think that should cover most remaining unused CSS/HTML IDs.

r? `@notriddle`

2 years agoRollup merge of #99131 - compiler-errors:label-fn, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 05:09:43 +0000 (10:39 +0530)]
Rollup merge of #99131 - compiler-errors:label-fn, r=cjgillot

Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`

Fixes #98308

2 years agoRollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum
Dylan DPC [Fri, 15 Jul 2022 05:09:41 +0000 (10:39 +0530)]
Rollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum

Simplify [a]rc code a little

Nothing interesting, just make [a]rc code a little nicer by using `byte_sub` and `let`-`else`.

2 years agoFix typo in mod.rs
Ikko Ashimine [Fri, 15 Jul 2022 03:57:46 +0000 (12:57 +0900)]
Fix typo in mod.rs

constuct -> construct

2 years agoAuto merge of #97406 - aliemjay:verify-bounds-fix-master, r=oli-obk
bors [Fri, 15 Jul 2022 03:44:53 +0000 (03:44 +0000)]
Auto merge of #97406 - aliemjay:verify-bounds-fix-master, r=oli-obk

Make outlives::{components,verify} agree

fixes #97405

cc `@oli-obk` this is should fix https://github.com/rust-lang/rust/pull/95474#discussion_r880660075

r? `@oli-obk`

2 years agoRemove some span_of_impl+unwrap
Michael Goulet [Fri, 8 Jul 2022 02:41:41 +0000 (02:41 +0000)]
Remove some span_of_impl+unwrap

2 years agoMove item_span from check_item_type into each function
Michael Goulet [Fri, 8 Jul 2022 02:32:51 +0000 (02:32 +0000)]
Move item_span from check_item_type into each function

2 years agoremove tcx from ObligationCauseCode::span
Michael Goulet [Fri, 8 Jul 2022 02:02:08 +0000 (02:02 +0000)]
remove tcx from ObligationCauseCode::span

2 years agoRemove some more usages of guess_head_span
Michael Goulet [Fri, 8 Jul 2022 02:10:15 +0000 (02:10 +0000)]
Remove some more usages of guess_head_span

2 years agoRemove some usages of guess_head_span from typeck
Michael Goulet [Thu, 7 Jul 2022 06:52:27 +0000 (06:52 +0000)]
Remove some usages of guess_head_span from typeck

2 years agoMake item spans more consistent
Michael Goulet [Fri, 8 Jul 2022 01:50:10 +0000 (01:50 +0000)]
Make item spans more consistent

2 years agoImprove example of `downcast`
Jiahao XU [Fri, 15 Jul 2022 03:04:06 +0000 (13:04 +1000)]
Improve example of `downcast`

Co-authored-by: Jane Losare-Lusby <jlusby42@gmail.com>
2 years agoAuto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot
bors [Fri, 15 Jul 2022 01:03:55 +0000 (01:03 +0000)]
Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot

gather body owners

Issue #96341

2 years agoPoint out custom Fn-family trait impl
Michael Goulet [Wed, 13 Jul 2022 05:39:01 +0000 (05:39 +0000)]
Point out custom Fn-family trait impl

2 years agoAdd support for APIT and RPIT callables in label_fn_like
Michael Goulet [Sun, 10 Jul 2022 21:59:31 +0000 (21:59 +0000)]
Add support for APIT and RPIT callables in label_fn_like

2 years agointerpret/validity: improve some comments
Ralf Jung [Thu, 14 Jul 2022 23:19:15 +0000 (19:19 -0400)]
interpret/validity: improve some comments

2 years agoAdd regression test for #89436
Manish Goregaokar [Thu, 14 Jul 2022 22:40:46 +0000 (15:40 -0700)]
Add regression test for #89436

2 years agoUse constant eval to do strict validity checks
5225225 [Thu, 14 Jul 2022 21:42:47 +0000 (22:42 +0100)]
Use constant eval to do strict validity checks

2 years agoAuto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot
bors [Thu, 14 Jul 2022 21:50:14 +0000 (21:50 +0000)]
Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot

Stop keeping metadata in memory before writing it to disk

Fixes #96358

I created this PR according with the instruction given in the issue except for the following points:

- While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows.

<details>
<summary>List of failed tests</summary>
<pre>
<code>
failures:
    [ui] src/test/ui/json-multiple.rs
    [ui] src/test/ui/json-options.rs
    [ui] src/test/ui/rmeta/rmeta-rpass.rs
    [ui] src/test/ui/save-analysis/emit-notifications.rs
    [ui] src/test/ui/svh/changing-crates.rs
    [ui] src/test/ui/svh/svh-change-lit.rs
    [ui] src/test/ui/svh/svh-change-significant-cfg.rs
    [ui] src/test/ui/svh/svh-change-trait-bound.rs
    [ui] src/test/ui/svh/svh-change-type-arg.rs
    [ui] src/test/ui/svh/svh-change-type-ret.rs
    [ui] src/test/ui/svh/svh-change-type-static.rs
    [ui] src/test/ui/svh/svh-use-trait.rs

test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:01:58
</code>
</pre>
</details>

- I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.

2 years agoRemove FIXME from MIR `always_storage_live_locals`
pierwill [Thu, 14 Jul 2022 20:30:36 +0000 (15:30 -0500)]
Remove FIXME from MIR `always_storage_live_locals`

2 years agoRename aarch64-nintendo-switch to aarch64-nintendo-switch-freestanding
leo60228 [Fri, 17 Sep 2021 17:29:49 +0000 (13:29 -0400)]
Rename aarch64-nintendo-switch to aarch64-nintendo-switch-freestanding

2 years agoAdd aarch64-nintendo-switch.md to SUMMARY.md
leo60228 [Fri, 17 Sep 2021 14:44:59 +0000 (10:44 -0400)]
Add aarch64-nintendo-switch.md to SUMMARY.md

I can't think of any other reason CI might be failing, and I should've
done this anyway.

2 years agoAdd docs for Switch target
leo60228 [Fri, 17 Sep 2021 14:11:19 +0000 (10:11 -0400)]
Add docs for Switch target

2 years agoRemove obsolete crt0 references in linker script
leo60228 [Wed, 15 Sep 2021 22:21:34 +0000 (18:21 -0400)]
Remove obsolete crt0 references in linker script

2 years agoRemove unneeded options from Nintendo Switch target
jam1garner [Wed, 15 Sep 2021 21:57:43 +0000 (17:57 -0400)]
Remove unneeded options from Nintendo Switch target

2 years agoDon't build std for switch
leo60228 [Wed, 15 Sep 2021 19:30:00 +0000 (15:30 -0400)]
Don't build std for switch

2 years agoAdd linker script for switch
leo60228 [Wed, 15 Sep 2021 19:26:59 +0000 (15:26 -0400)]
Add linker script for switch

2 years agoRemove unnecessary linker args
leo60228 [Wed, 15 Sep 2021 19:19:00 +0000 (15:19 -0400)]
Remove unnecessary linker args

2 years agoDon't use host linker for switch
leo60228 [Wed, 15 Sep 2021 19:17:40 +0000 (15:17 -0400)]
Don't use host linker for switch

2 years agoAdd Nintendo Switch tier 3 target
jam1garner [Wed, 15 Sep 2021 17:56:20 +0000 (13:56 -0400)]
Add Nintendo Switch tier 3 target

2 years agoAuto merge of #99252 - lqd:win-dwarf5, r=eddyb
bors [Thu, 14 Jul 2022 19:03:58 +0000 (19:03 +0000)]
Auto merge of #99252 - lqd:win-dwarf5, r=eddyb

fix dwarf debuginfo being used in addition to CodeView on windows

Tackles the debuginfo size increase regression on windows to [unblock clippy](https://github.com/rust-lang/rust/issues/99143#issuecomment-1184638573) -- introduced by the DWARF5 support in #98350 cc `@pcwalton.`

r? `@eddyb`
Fixes #99143

2 years agofix dwarf debuginfo being used in addition to CodeView on windows
Rémy Rakic [Thu, 14 Jul 2022 18:41:55 +0000 (20:41 +0200)]
fix dwarf debuginfo being used in addition to CodeView on windows

Fixes the debuginfo size increase regression introduced by the DWARF5 support.

2 years agoCorrectly handle crate level page on docs.rs as well
Guillaume Gomez [Wed, 13 Jul 2022 12:43:52 +0000 (14:43 +0200)]
Correctly handle crate level page on docs.rs as well

2 years agoAuto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPC
bors [Thu, 14 Jul 2022 16:23:07 +0000 (16:23 +0000)]
Auto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #98072 (Add provider API to error trait)
 - #98580 (Emit warning when named arguments are used positionally in format)
 - #99000 (Move abstract const to middle)
 - #99192 (Fix spans for asm diagnostics)
 - #99222 (Better error message for generic_const_exprs inference failure)
 - #99236 (solaris: unbreak build on native platform)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agorename MPlaceTy::dangling to fake_alloc_zst
Ralf Jung [Thu, 14 Jul 2022 15:40:47 +0000 (11:40 -0400)]
rename MPlaceTy::dangling to fake_alloc_zst

2 years agoUpdate RLS
Igor Matuszewski [Thu, 14 Jul 2022 15:23:46 +0000 (17:23 +0200)]
Update RLS

2 years agoRemove comment referring to constness.rs
Daniel Bevenius [Thu, 14 Jul 2022 13:35:19 +0000 (15:35 +0200)]
Remove comment referring to constness.rs

This commit removes the comment in emulate_intrinsic, which is
currently referring to 'src/librustc_middle/ty/constness.rs'.

2 years agoRollup merge of #99236 - psumbera:Issue99208, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 13:54:08 +0000 (19:24 +0530)]
Rollup merge of #99236 - psumbera:Issue99208, r=Mark-Simulacrum

solaris: unbreak build on native platform

Fixes: #99208
2 years agoRollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr
Dylan DPC [Thu, 14 Jul 2022 13:54:06 +0000 (19:24 +0530)]
Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr

Better error message for generic_const_exprs inference failure

Fixes #90531

This code:
```rs
#![feature(generic_const_exprs)]

fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}

fn main() {
  let arr = [5; 5];
  foo(arr);
}
```

Will now emit the following error:
```rs
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> test.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error[E0284]: type annotations needed
 --> test.rs:8:7
  |
8 |       foo(arr);
  |       ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
  |
note: required by a bound in `foo`
 --> test.rs:3:56
  |
3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}
  |                                                        ^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
  |
8 |       foo::<N>(arr);
  |          +++++

error: aborting due to previous error; 1 warning emitted
```

cc: `@lcnr` thanks a lot again for the help on this

2 years agoRollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 13:54:05 +0000 (19:24 +0530)]
Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov

Fix spans for asm diagnostics

Line spans were incorrect if the first line of an asm statement was an
empty string.

2 years agoRollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr
Dylan DPC [Thu, 14 Jul 2022 13:54:04 +0000 (19:24 +0530)]
Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr

Move abstract const to middle

Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`.
This allows for const resolution in infer to use abstract consts to walk consts and check if
they are resolvable.

This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved.

r? `@lcnr`

2 years agoRollup merge of #98580 - PrestonFrom:issue_98466, r=estebank
Dylan DPC [Thu, 14 Jul 2022 13:54:03 +0000 (19:24 +0530)]
Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebank

Emit warning when named arguments are used positionally in format

Addresses Issue 98466 by emitting an error if a named argument
is used like a position argument (i.e. the name is not used in
the string to be formatted).

Fixes rust-lang#98466

2 years agoRollup merge of #98072 - yaahc:generic-member-access, r=thomcc
Dylan DPC [Thu, 14 Jul 2022 13:54:02 +0000 (19:24 +0530)]
Rollup merge of #98072 - yaahc:generic-member-access, r=thomcc

Add provider API to error trait

Implements https://github.com/rust-lang/rfcs/pull/2895

2 years agoAuto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot
bors [Thu, 14 Jul 2022 13:42:09 +0000 (13:42 +0000)]
Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot

Support unstable moves via stable in unstable items

part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328.

The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge.

This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.

2 years agoRemoved unused HTML IDs
Guillaume Gomez [Thu, 14 Jul 2022 13:03:51 +0000 (15:03 +0200)]
Removed unused HTML IDs

2 years agoRemove unused CSS
Guillaume Gomez [Thu, 14 Jul 2022 12:59:25 +0000 (14:59 +0200)]
Remove unused CSS

2 years agoAdd vakaras to the set of people notified when MIR changes.
Vytautas Astrauskas [Thu, 14 Jul 2022 12:24:36 +0000 (14:24 +0200)]
Add vakaras to the set of people notified when MIR changes.

2 years agosolaris: unbreak build on native platform
Petr Sumbera [Thu, 14 Jul 2022 11:44:40 +0000 (13:44 +0200)]
solaris: unbreak build on native platform

Fixes: #99208
2 years agoAuto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC
bors [Thu, 14 Jul 2022 11:00:30 +0000 (11:00 +0000)]
Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97720 (Always create elided lifetime parameters for functions)
 - #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`)
 - #98705 (Implement `for<>` lifetime binder for closures)
 - #99126 (remove allow(rustc::potential_query_instability) in rustc_span)
 - #99139 (Give a better error when `x dist` fails for an optional tool)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix spans for asm diagnostics
Amanieu d'Antras [Tue, 12 Jul 2022 20:54:47 +0000 (22:54 +0200)]
Fix spans for asm diagnostics

Line spans were incorrect if the first line of an asm statement was an
empty string.

2 years agoFix overlapping impls
kadmin [Tue, 12 Jul 2022 07:11:05 +0000 (07:11 +0000)]
Fix overlapping impls

2 years agoRollup merge of #99139 - jyn514:dist-tool-help, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 08:44:23 +0000 (14:14 +0530)]
Rollup merge of #99139 - jyn514:dist-tool-help, r=Mark-Simulacrum

Give a better error when `x dist` fails for an optional tool

Before:
```
thread 'main' panicked at 'Unable to build RLS', dist.rs:42:9
```

After:
```
thread 'main' panicked at 'Unable to build submodule tool RLS (use `missing-tools = true` to ignore this failure)
note: not all tools are available on all nightlies
help: see https://forge.rust-lang.org/infra/toolstate.html for more information', dist.rs:43:9
```

Closes https://github.com/rust-lang/rust/issues/85683 by explaining better why the error is expected.

2 years agoRollup merge of #99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 08:44:22 +0000 (14:14 +0530)]
Rollup merge of #99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov

remove allow(rustc::potential_query_instability) in rustc_span

Also, avoid sorting before debug output as iteration order can now be
relied upon.

Related #84447

2 years agoRollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Dylan DPC [Thu, 14 Jul 2022 08:44:21 +0000 (14:14 +0530)]
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot

Implement `for<>` lifetime binder for closures

This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:

```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
//       ^^^^^^^^^^^--- new!
```

cc ``@Aaron1011`` ``@cjgillot``

2 years agoRollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 08:44:20 +0000 (14:14 +0530)]
Rollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-Simulacrum

Stabilize `core::ffi:c_*` and rexport in `std::ffi`

This only stabilizes the base types, not the non-zero variants, since
those have their own separate tracking issue and have not gone through
FCP to stabilize.

2 years agoRollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 08:44:19 +0000 (14:14 +0530)]
Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov

Always create elided lifetime parameters for functions

Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters.

This difference of treatment makes it some downstream analyses more complicated to handle.  This step is a pre-requisite to perform lifetime elision resolution on AST.

There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns:
```rust
trait Foo<'a> {}
fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier
async fn async_foo(t: impl Foo<'_>) {} //~ OK
fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier
async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK
```

The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`.
This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter.
This change would be insta-stable, so let's ping t-lang.
Anonymous lifetimes in GAT bindings keep being forbidden:
```rust
fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {}
                         ^^        ^^
                       forbidden   ok
```
I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606

r? ``@petrochenkov``

2 years agoAuto merge of #98975 - jyn514:unstable_opts, r=wesleywiser
bors [Thu, 14 Jul 2022 08:14:31 +0000 (08:14 +0000)]
Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser

Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options

r? `@Amanieu` cc `@nikic` `@joshtriplett`

2 years agoAuto merge of #99225 - ehuss:update-cargo, r=ehuss
bors [Thu, 14 Jul 2022 05:07:22 +0000 (05:07 +0000)]
Auto merge of #99225 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in b1dd22e668af5279e13a071ad4b17435bd6bfa4c..8827baaa781b37872134c1ba692a6f0aeb37890e
2022-07-09 14:48:50 +0000 to 2022-07-14 02:56:51 +0000
- Add a test for regressions in selecting the correct workspace root (rust-lang/cargo#10862)
- clarify profile used for 'cargo install --debug' (rust-lang/cargo#10861)
- servers should use 404 (rust-lang/cargo#10860)
- test(add): Ensure comments are preserved (rust-lang/cargo#10849)
- Fix nested workspace resolution (rust-lang/cargo#10846)
- Small tweaks to the future-incompat docs. (rust-lang/cargo#10856)
- Fixed extra period typo (rust-lang/cargo#10847)

2 years agoUpdate cargo
Eric Huss [Thu, 14 Jul 2022 04:25:48 +0000 (21:25 -0700)]
Update cargo

2 years agoStabilize `core::ffi:c_*` and rexport in `std::ffi`
Josh Triplett [Mon, 20 Jun 2022 20:59:58 +0000 (13:59 -0700)]
Stabilize `core::ffi:c_*` and rexport in `std::ffi`

This only stabilizes the base types, not the non-zero variants, since
those have their own separate tracking issue and have not gone through
FCP to stabilize.

2 years agoAuto merge of #98754 - jyn514:non-trivial-drop, r=compiler-errors
bors [Thu, 14 Jul 2022 02:22:48 +0000 (02:22 +0000)]
Auto merge of #98754 - jyn514:non-trivial-drop, r=compiler-errors

Fix drop-tracking ICE when a struct containing a field with a significant drop is used across an await

Previously, drop-tracking would incorrectly assume the struct would be dropped immediately, which was not true.

Fixes #98476. Also fixes https://github.com/rust-lang/rust/issues/98477, I think because the parent HIR node for type variables is the whole function instead of the expression where the variable is used.

r? `@eholk`

2 years agoRename `std::io::Error::try_downcast_inner` to `downcast`
Jiahao XU [Thu, 14 Jul 2022 01:24:44 +0000 (11:24 +1000)]
Rename `std::io::Error::try_downcast_inner` to `downcast`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2 years agoUpdate tests
Katherine Philip [Thu, 14 Jul 2022 00:28:11 +0000 (17:28 -0700)]
Update tests

2 years agobless tests
Ali MJ Al-Nasrawy [Thu, 14 Jul 2022 00:08:51 +0000 (03:08 +0300)]
bless tests

2 years agoMake outlives::{components,verify} agree
Ali MJ Al-Nasrawy [Wed, 25 May 2022 17:15:49 +0000 (20:15 +0300)]
Make outlives::{components,verify} agree

2 years agoAuto merge of #97995 - RalfJung:union-more-nodrop, r=Mark-Simulacrum
bors [Wed, 13 Jul 2022 23:42:05 +0000 (23:42 +0000)]
Auto merge of #97995 - RalfJung:union-more-nodrop, r=Mark-Simulacrum

allow unions with mutable references and tuples of allowed types

We currently allow shared references in unions, but not mutable references. That seems somewhat inconsistent. So let's allow all references, and while we are at it, let's make sure the set of allowed types is closed under tuples.

This will need T-lang FCP (at least).

Then remove the `tagged_unions` feature, since we do not plan to stabilize any more of it.
Closes https://github.com/rust-lang/rust/issues/55149

2 years agoRemove predicate note
Katherine Philip [Wed, 13 Jul 2022 17:27:19 +0000 (10:27 -0700)]
Remove predicate note

2 years agoAdd checks & fallback branch
Katherine Philip [Wed, 13 Jul 2022 17:25:58 +0000 (10:25 -0700)]
Add checks & fallback branch

2 years agoUse emit_inference_failure_err for ConstEvaluatable predicates
Katherine Philip [Wed, 13 Jul 2022 16:42:25 +0000 (09:42 -0700)]
Use emit_inference_failure_err for ConstEvaluatable predicates

2 years agoRename `debugging_opts` to `unstable_opts`
Joshua Nelson [Wed, 6 Jul 2022 12:44:47 +0000 (07:44 -0500)]
Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

2 years agoadd array tests, cleanup, tidy, and bless
Ralf Jung [Thu, 30 Jun 2022 14:17:49 +0000 (10:17 -0400)]
add array tests, cleanup, tidy, and bless

2 years agoassigning to a union field can never drop now
Ralf Jung [Thu, 30 Jun 2022 12:40:06 +0000 (08:40 -0400)]
assigning to a union field can never drop now

2 years agoremove untagged_union feature gate
Ralf Jung [Thu, 30 Jun 2022 02:33:18 +0000 (22:33 -0400)]
remove untagged_union feature gate