- 09 7月, 2022 9 次提交
-
-
由 Nicholas Nethercote 提交于
-
由 Nicholas Nethercote 提交于
`cs_fold` has four distinct cases, covered by three different function arguments: - first field - combine current field with previous results - no fields - non-matching enum variants This commit clarifies things by replacing the three function arguments with one that takes a new `CsFold` type with four slightly different) cases - single field - combine result for current field with results for previous fields - no fields - non-matching enum variants This makes the code shorter and clearer.
-
由 Nicholas Nethercote 提交于
This makes `cs_cmp`, `cs_partial_cmp`, and `cs_op` (for `PartialEq`) more similar. It also fixes some out of date comments.
-
由 Nicholas Nethercote 提交于
When deriving functions for zero-variant enums, we just generated a function body that calls `std::instrincs::unreachable`. There is a large comment with some not-very-useful historical discussion about alternatives, including some discussion of feature-gating zero-variant enums, which is clearly irrelevant today. This commit cuts the comment down greatly.
-
由 Nicholas Nethercote 提交于
The deriving code has some complex parts involving iterations over selflike args and also fields within structs and enum variants. The return types for a few functions demonstrate this: - `TraitDef::create_{struct_pattern,enum_variant_pattern}` returns a `(P<ast::Pat>, Vec<(Span, Option<Ident>, P<Expr>)>)` - `TraitDef::create_struct_field_accesses` returns a `Vec<(Span, Option<Ident>, P<Expr>)>`. This results in per-field data stored within per-selflike-arg data, with lots of repetition within the per-field data elements. This then has to be "transposed" in two places (`expand_struct_method_body` and `expand_enum_method_body`) into per-self-like-arg data stored within per-field data. It's all quite clumsy and confusing. This commit rearranges things greatly. Data is obtained in the needed form up-front, avoiding the need for transposition. Also, various functions are split, removed, and added, to make things clearer and avoid tuple return values. The diff is hard to read, which reflects the messiness of the original code -- there wasn't an easy way to break these changes into small pieces. (Sorry!) It's a net reduction of 35 lines and a readability improvement. The generated code is unchanged.
-
由 Nicholas Nethercote 提交于
It's unused. This also removes the need for the lifetime on `FieldInfo`, which is nice.
-
由 Nicholas Nethercote 提交于
Use `self_exprs` and `other_selflike_exprs` in a manner similar to the previous commit.
-
由 Nicholas Nethercote 提交于
The deriving code has inconsistent terminology to describe args. In some places it distinguishes between: - the `&self` arg (if present), versus - all other args. In other places it distinguishes between: - the `&self` arg (if present) and any other arguments with the same type (in practice there is at most one, e.g. in `PartialEq::eq`), versus - all other args. The terms "self_args" and "nonself_args" are sometimes used for the former distinction, and sometimes for the latter. "args" is also sometimes used for "all other args". This commit makes the code consistently uses "self_args"/"nonself_args" for the former and "selflike_args"/"nonselflike_args" for the latter. This change makes the code easier to read. The commit also adds a panic on an impossible path (the `Self_` case) in `extract_arg_details`.
-
由 bors 提交于
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).
-
- 08 7月, 2022 31 次提交
-
-
由 bors 提交于
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
-
由 Oli Scherer 提交于
-
由 Dylan DPC 提交于
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
-
由 Dylan DPC 提交于
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`
-
由 Dylan DPC 提交于
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`
-
由 Dylan DPC 提交于
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``
-
由 bors 提交于
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`
-
由 bors 提交于
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.
-
由 bors 提交于
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
-
由 Matthias Krüger 提交于
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
-
由 Matthias Krüger 提交于
Add doc comments in `rustc_middle::mir`
-
由 Matthias Krüger 提交于
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``
-
由 Matthias Krüger 提交于
A few cleanups Each commit is (mostly) self-explanatory. These changes have come as I try to remove `ReEmpty` (#98559).
-
由 Matthias Krüger 提交于
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`` -
由 Matthias Krüger 提交于
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```
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 Michael Goulet 提交于
-
由 bors 提交于
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
-
由 Jack Huey 提交于
-
由 Jack Huey 提交于
Move is_free and is_free_or_static to Region, change resolve_var to resolve_region, and remove RootEmptyRegion
-
由 bors 提交于
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.
-
由 bors 提交于
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
-
由 Esteban Küber 提交于
-
由 Andrea Nall 提交于
This lint seems to have been broken by #98446
-