Commit Graph

171957 Commits

Author SHA1 Message Date
Jane Lusby
b55453dbad add opt in attribute for stable-in-unstable items 2022-07-08 21:18:15 +00:00
Jane Lusby
a13f30036a clarify comment 2022-07-08 21:18:15 +00:00
Jane Lusby
67fe8423a3 update comment 2022-07-08 21:18:15 +00:00
Jane Losare-Lusby
d68cb1f9a3 revert changes to unicode stability 2022-07-08 21:18:15 +00:00
Jane Lusby
e7fe5456c5 Support unstable moves via stable in unstable items 2022-07-08 21:18:13 +00:00
bors
052495d001 Auto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiser
don't succeed `evaluate_obligation` query if new opaque types were registered

fixes #98608
fixes #98604

The root cause of all this is that in type flag computation we entirely ignore nongeneric things like struct fields and the signature of function items. So if a flag had to be set for a struct if it is set for a field, that will only happen if the field is generic, as only the generic parameters are checked.

I now believe we cannot use type flags to handle opaque types. They seem like the wrong tool for this.

Instead, this PR replaces the previous logic by adding a new variant of `EvaluatedToOk`: `EvaluatedToOkModuloOpaqueTypes`, which says that there were some opaque types that got hidden types bound, but that binding may not have been legal (because we don't know if the opaque type was in its defining scope or not).
2022-07-08 17:55:26 +00:00
bors
45263fc66d Auto merge of #99054 - Dylan-DPC:rollup-0zuhhds, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #98533 (Add a `-Zdump-drop-tracking-cfg` debugging flag)
 - #98654 (An optimization for `pest-2.1.3`)
 - #98657 (Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`)
 - #98794 (Highlight conflicting param-env candidates)

Failed merges:

 - #98957 ( don't allow ZST in ScalarInt )

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-08 15:24:57 +00:00
Oli Scherer
d6b93eb793 Only register hidden types for opaque types from the current crate, nothing else would work anyway. 2022-07-08 13:59:44 +00:00
Dylan DPC
54dde8678b
Rollup merge of #98794 - compiler-errors:conflicting-param-env, r=michaelwoerister
Highlight conflicting param-env candidates

This could probably be further improved by noting _why_ equivalent param-env candidates (modulo regions) leads to ambiguity.

Fixes #98786
2022-07-08 18:25:51 +05:30
Dylan DPC
dbae8309a0
Rollup merge of #98657 - compiler-errors:rustc-const-eval-session-diagnostic-1, r=davidtwco
Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`

I'm still trying to get the hang of this, so it doesn't migrate _all_ of `rustc_const_eval`. Working on that later.

r? `@davidtwco`
2022-07-08 18:25:50 +05:30
Dylan DPC
fe87923b54
Rollup merge of #98654 - nnethercote:pest-2.1.3-opt, r=pnkfelix
An optimization for `pest-2.1.3`

An easy win I found while looking at a profile of `pest-2.1.3`. It's also a small code cleanup.

r? `@pnkfelix`
2022-07-08 18:25:49 +05:30
Dylan DPC
1ce8de3087
Rollup merge of #98533 - jyn514:drop-tracking-debugging, r=eholk
Add a `-Zdump-drop-tracking-cfg` debugging flag

This is useful for debugging drop-tracking; previously, you had to recompile
rustc from source and manually add a call to `write_graph_to_file`. This
makes the option more discoverable and configurable at runtime.

I also took the liberty of making the labels for the CFG nodes much easier to read:
previously, they looked like `id(2), local_id: 48`, now they look like
```
expr from_config (hir_id=HirId { owner: DefId(0:10 ~ default_struct_update[79f9]::foo), local_id: 2})
```

r? ``@eholk``
2022-07-08 18:25:48 +05:30
bors
fbdb07f4e7 Auto merge of #98758 - nnethercote:more-derive-output-improvements, r=Mark-Simulacrum
More derive output improvements

This PR includes:
- Some test improvements.
- Some cosmetic changes to derive output that make the code look more like what a human would write.
- Some more fundamental improvements to `cmp` and `partial_cmp` generation.

r? `@Mark-Simulacrum`
2022-07-08 12:44:14 +00:00
bors
1dcff2d507 Auto merge of #98638 - bjorn3:less_string_interning, r=tmiasko
Use less string interning

This removes string interning in a couple of places where doing so won't result in perf improvements. I also switched one place to use pre-interned symbols.
2022-07-08 10:03:27 +00:00
bors
0f97e02bdc Auto merge of #99047 - matthiaskrgr:rollup-01vn70s, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #95635 (sess: stabilize `--terminal-width` as `--diagnostic-width`)
 - #98718 (Stabilize `into_future`)
 - #98795 (A few cleanups)
 - #98798 (Fix caching bug in `download-rustc = true`)
 - #99019 (Add doc comments in `rustc_middle::mir`)
 - #99026 (Add test for and fix rust-lang/rust-clippy#9131)

Failed merges:

 - #98957 ( don't allow ZST in ScalarInt )

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-08 07:22:33 +00:00
Matthias Krüger
445702d0cb
Rollup merge of #99026 - anall:buffix/clippy-9131, r=xFrednet
Add test for and fix rust-lang/rust-clippy#9131

This lint seems to have been broken by #98446 -- but of course, there was no clippy test for this case at the time.

`expr.span.ctxt().outer_expn_data()` now has `MacroKind::Derive` instead of `MacroKind::Attr` for something like:

```
#[derive(Clone, Debug)]
pub struct UnderscoreInStruct {
    _foo: u32,
}
```

---

changelog: none

closes: https://github.com/rust-lang/rust-clippy/issues/9131
2022-07-08 08:00:41 +02:00
Matthias Krüger
e58c2d4f52
Rollup merge of #99019 - pierwill:doc-mir-statement, r=cjgillot
Add doc comments in `rustc_middle::mir`
2022-07-08 08:00:40 +02:00
Matthias Krüger
6c6791a458
Rollup merge of #98798 - jyn514:download-rustc-cached, r=Mark-Simulacrum
Fix caching bug in `download-rustc = true`

When moving this to rustbuild, I introduced a bug: if you had the file already downloaded, but
deleted the sysroot for whatever reason, rustbuil would fail to unpack the cached tarball.

This only affects people if they have a cached tarball, which is probably why we haven't seen an issue yet -
wiping `build/cache` would work around the issue, or just not deleting `build/$TARGET/stage2`.

Fixes the following error:
```
thread 'main' panicked at 'fs::read_dir(&lib_dir) failed with No such file or directory (os error 2) ("/home/jnelson/rust-lang/rust2/build/x86_64-unknown-linux-gnu/ci-rustc/lib")', config.rs:1563:20
```

r? ``@Mark-Simulacrum``
2022-07-08 08:00:39 +02:00
Matthias Krüger
5dcd28cd19
Rollup merge of #98795 - jackh726:lexical_region_resolve_cleanup, r=compiler-errors
A few cleanups

Each commit is (mostly) self-explanatory. These changes have come as I try to remove `ReEmpty` (#98559).
2022-07-08 08:00:38 +02:00
Matthias Krüger
9c6bcb60f3
Rollup merge of #98718 - yoshuawuyts:stabilize-into-future, r=yaahc
Stabilize `into_future`

https://github.com/rust-lang/rust/issues/67644 has been labeled with [S-tracking-ready-to-stabilize](https://github.com/rust-lang/rust/labels/S-tracking-ready-to-stabilize) - which mentions someone needs to file a stabilization PR. So hence this PR!  Thanks!

Closes https://github.com/rust-lang/rust/issues/67644

r? ``@joshtriplett``
2022-07-08 08:00:37 +02:00
Matthias Krüger
b36e58a458
Rollup merge of #95635 - davidtwco:terminal-width-stabilization, r=oli-obk
sess: stabilize `--terminal-width` as `--diagnostic-width`

Formerly `-Zterminal-width`, `--terminal-width` allows the user or build
tool to inform rustc of the width of the terminal so that diagnostics
can be truncated.

Pending agreement to stabilize, see tracking issue at #84673.

r? ```@oli-obk```
2022-07-08 08:00:36 +02:00
Michael Goulet
08135254dc Highlight conflicting param-env candidates 2022-07-08 03:51:08 +00:00
Michael Goulet
2058333780 simplify plurals in fluent messages using hir::ConstContext 2022-07-08 03:48:10 +00:00
Michael Goulet
f97f2a47ff Migrate MutDeref, TransientMutBorrow diagnostics 2022-07-08 03:48:10 +00:00
Michael Goulet
584e5d4c4f Migrate PanicNonStr, RawPtrComparison, RawPtrToInt diagnostics 2022-07-08 03:47:59 +00:00
Michael Goulet
c48f482813 Migrate StaticAccess diagnostic 2022-07-08 03:47:46 +00:00
Michael Goulet
ff9fd36aa4 Implement IntoDiagnosticArg for hir::ConstContext 2022-07-08 03:47:31 +00:00
Michael Goulet
1c4afbd1de Migrate NonConstOp diagnostic 2022-07-08 03:47:28 +00:00
Michael Goulet
934079fd9e Migrate unstable-in-stable diagnostic 2022-07-08 03:39:08 +00:00
Michael Goulet
34d6f08f4d Use dashes instead of underscores in fluent names 2022-07-08 03:37:36 +00:00
bors
eba361ae36 Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebank
Shorten def_span of closures to just their header

Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-08 03:05:15 +00:00
Jack Huey
31e1a777e7 Move code from rustc_trait_selection/opaque_types to better places 2022-07-07 21:45:40 -04:00
Jack Huey
2471431017 Move is_free and is_free_or_static to Region, change resolve_var to resolve_region, and remove RootEmptyRegion 2022-07-07 20:48:51 -04:00
bors
9b21131278 Auto merge of #98360 - estebank:uninit-binding, r=oli-obk
On partial uninit error point at where we need init

When a binding is declared without a value, borrowck verifies that all
codepaths have *one* assignment to them to initialize them fully. If
there are any cases where a condition can be met that leaves the binding
uninitialized or we attempt to initialize a field of an uninitialized
binding, we emit E0381.

We now look at all the statements that initialize the binding, and use
them to explore branching code paths that *don't* and point at them. If
we find *no* potential places where an assignment to the binding might
be missing, we display the spans of all the existing initializers to
provide some context.

Fix https://github.com/rust-lang/rust/issues/97956.
2022-07-07 23:36:21 +00:00
bors
1517f5de01 Auto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #97917 (Implement ExitCodeExt for Windows)
 - #98844 (Reword comments and rename HIR visiting methods.)
 - #98979 (interpret: use AllocRange in UninitByteAccess)
 - #98986 (Fix missing word in comment)
 - #98994 (replace process exit with more detailed exit in src/bootstrap/*.rs)
 - #98995 (Add a test for #80471)
 - #99002 (suggest adding a derive for #[default] applied to variants)
 - #99004 (Add a test for #70408)
 - #99017 (Replace boolean argument for print_where_clause with an enum to make code more clear)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-07 20:55:34 +00:00
Esteban Küber
2a2df9dda9 fix arm test 2022-07-07 13:20:35 -07:00
Andrea Nall
98b84195a2 Add test for and fix rust-lang/rust-clippy#9131
This lint seems to have been broken by #98446
2022-07-07 19:30:37 +00:00
Esteban Küber
d09851cfba Wording tweak 2022-07-07 12:25:56 -07:00
Esteban Küber
5f91614d12 Fix label on uninit binding field assignment 2022-07-07 12:25:56 -07:00
Esteban Küber
a86fa4fa38 Avoid misleading message/label in match-cfg-fake-edges.rs test 2022-07-07 12:25:56 -07:00
Esteban Küber
8ab1cd9fdc Add test for for loop maybe initializing binding 2022-07-07 12:25:56 -07:00
Esteban Küber
95923d1676 Review comments: wording 2022-07-07 12:25:56 -07:00
Esteban Küber
9cb1874cd6 Tweak wording and spans 2022-07-07 12:25:56 -07:00
Esteban Küber
29e2aa12ff On partial uninit error point at where we need init
When a binding is declared without a value, borrowck verifies that all
codepaths have *one* assignment to them to initialize them fully. If
there are any cases where a condition can be met that leaves the binding
uninitialized or we attempt to initialize a field of an unitialized
binding, we emit E0381.

We now look at all the statements that initialize the binding, and use
them to explore branching code paths that *don't* and point at them. If
we find *no* potential places where an assignment to the binding might
be missing, we display the spans of all the existing initializers to
provide some context.
2022-07-07 12:25:55 -07:00
Matthias Krüger
ec0c1560be
Rollup merge of #99017 - GuillaumeGomez:rustdoc-ending-enum, r=notriddle
Replace boolean argument for print_where_clause with an enum to make code more clear

As you suggested ``@notriddle.`` Just not sure if the naming seems good to you?

r? ``@notriddle``
2022-07-07 20:33:32 +02:00
Matthias Krüger
16ad2f50b5
Rollup merge of #99004 - TaKO8Ki:add-test-for-70408, r=Mark-Simulacrum
Add a test for #70408

closes #70408
2022-07-07 20:33:31 +02:00
Matthias Krüger
7fed4fffb6
Rollup merge of #99002 - fee1-dead-contrib:sugg_derive, r=michaelwoerister
suggest adding a derive for #[default] applied to variants

cc ``@TaKO8Ki`` as followup to #98873.
2022-07-07 20:33:30 +02:00
Matthias Krüger
d0e6155679
Rollup merge of #98995 - TaKO8Ki:add-test-for-80471, r=Mark-Simulacrum
Add a test for #80471

Tests #80471, but doesn't close it, see https://github.com/rust-lang/rust/issues/80471#issuecomment-1177658967.
2022-07-07 20:33:29 +02:00
Matthias Krüger
6742dc4d65
Rollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514
replace process exit with more detailed exit in src/bootstrap/*.rs

Fixes [#98830](https://github.com/rust-lang/rust/issues/98830)

I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit.
So, error code should panic in test code.
```
// lib.rs
pub fn detail_exit(code: i32) -> ! {
    // Successful exit
    if code == 0 {
        std::process::exit(0);
    }
    if cfg!(test) {
        panic!("status code: {}", code);
    } else {
        std::panic::resume_unwind(Box::new(code));
    }
}
```

<details>
<summary>% rg "exit\(" src/bootstrap/*.rs</summary>

```
builder.rs
351:            crate::detail_exit(1);
1000:            crate::detail_exit(1);
1429:                    crate::detail_exit(1);

compile.rs
1331:        crate::detail_exit(1);

config.rs
818:                    crate::detail_exit(2);
1488:        crate::detail_exit(1);

flags.rs
263:                crate::detail_exit(exit_code);
349:            crate::detail_exit(exit_code);
381:            crate::detail_exit(1);
602:                        crate::detail_exit(1);
616:                crate::detail_exit(1);
807:            crate::detail_exit(1);

format.rs
35:            crate::detail_exit(1);
117:        crate::detail_exit(1);

lib.rs
714:            detail_exit(1);
1620:                detail_exit(1);
1651:pub fn detail_exit(code: i32) -> ! {
1654:        std::process::exit(0);

sanity.rs
107:            crate::detail_exit(1);

setup.rs
97:        crate::detail_exit(1);
290:            crate::detail_exit(1);

test.rs
676:            crate::detail_exit(1);
1024:                crate::detail_exit(1);
1254:            crate::detail_exit(1);

tool.rs
207:                crate::detail_exit(1);

toolstate.rs
96:    crate::detail_exit(3);
111:            crate::detail_exit(1);
182:            crate::detail_exit(1);
228:            crate::detail_exit(1);

util.rs
339:        crate::detail_exit(1);
378:        crate::detail_exit(1);
468:    crate::detail_exit(1);
```
</details>
2022-07-07 20:33:28 +02:00
Matthias Krüger
b4f8537a56
Rollup merge of #98986 - pierwill:patch-5, r=oli-obk
Fix missing word in comment
2022-07-07 20:33:27 +02:00