1. 01 3月, 2022 1 次提交
  2. 26 2月, 2022 2 次提交
  3. 25 2月, 2022 37 次提交
    • B
      Auto merge of #94357 - matthiaskrgr:rollup-xrjaof3, r=matthiaskrgr · 9f8f0a6e
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #93845 (Remove in band lifetimes)
       - #94155 (Extend toggle GUI test a bit)
       - #94252 (don't special case `DefKind::Ctor` in encoding)
       - #94305 (Remove an unnecessary restriction in `dest_prop`)
       - #94343 (Miri fn ptr check: don't use conservative null check)
       - #94344 (diagnostic: suggest parens when users want logical ops, but get closures)
       - #94352 (Fix SGX docs build)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      9f8f0a6e
    • M
      Rollup merge of #94352 - jethrogb:fix-sgx-docs-build, r=Mark-Simulacrum · 60606456
      Matthias Krüger 提交于
      Fix SGX docs build
      
      Without this, I get
      ```
      error[E0432]: unresolved import `crate::sys::cvt`
        --> library/std/src/os/fd/owned.rs:12:5
         |
      12 | use crate::sys::cvt;
         |     ^^^^^^^^^^^^^^^ no `cvt` in `sys`
      ```
      when running rustdoc on `std` for the x86_64-fortanix-unknown-sgx target.
      60606456
    • M
      Rollup merge of #94344 - notriddle:notriddle/suggest-parens-more, r=oli-obk · 731cd3fb
      Matthias Krüger 提交于
      diagnostic: suggest parens when users want logical ops, but get closures
      
      Fixes #93536
      731cd3fb
    • M
      Rollup merge of #94343 - RalfJung:fn-ptr, r=oli-obk · cf3bb098
      Matthias Krüger 提交于
      Miri fn ptr check: don't use conservative null check
      
      In https://github.com/rust-lang/rust/pull/94270 I used the wrong NULL check for function pointers: `memory.ptr_may_be_null` is conservative even on machines that support ptr-to-int casts, leading to false errors in Miri.
      
      This fixes that problem, and also replaces that foot-fun of a method with `scalar_may_be_null` which is never unnecessarily conservative.
      
      r? `@oli-obk`
      cf3bb098
    • M
      Rollup merge of #94305 - JakobDegen:dp-1, r=oli-obk · f9f97b66
      Matthias Krüger 提交于
      Remove an unnecessary restriction in `dest_prop`
      
      I had asked about this [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Do.20unions.20have.20active.20fields.3F) but didn't receive a response, so putting up this PR that makes the change I think we can. If it turns out that this is wrong, hopefully I'll find out here. Reposting my Zulip comment:
      > Not sure what channel to put this into, so using this as a fallback. The dest prop MIR opt has this comment:
      >
      > ```rust
      > //!   Subtle case: If `dest` is a, or projects through a union, then we have to make sure that there
      > //!   remains an assignment to it, since that sets the "active field" of the union. But if `src` is
      > //!   a ZST, it might not be initialized, so there might not be any use of it before the assignment,
      > //!   and performing the optimization would simply delete the assignment, leaving `dest`
      > //!   uninitialized.
      > ```
      >
      > In particular, the claim seems to be that we can't take
      > ```
      > x = ();
      > y.field = x;
      > ```
      > where `y` is a union having `field: ()` as one of its variants, and optimize the entire thing away (assuming `x` is unused otherwise). As far as I know though, Rust unions don't have active fields. Is this comment correct and am I missing something? Is there a worry about this interacting poorly with FFI code/C unions/LTO or something?
      
      This PR just removes that comment and the associated code. Also it fixes one unrelated comment that did not match the code it was commenting on.
      
      r? rust-lang/mir-opt
      f9f97b66
    • M
      Rollup merge of #94252 - lcnr:def_kind-encoding, r=cjgillot · 133de6e1
      Matthias Krüger 提交于
      don't special case `DefKind::Ctor` in encoding
      
      considering that we still use `DefKind::Ctor` for these in `Res`, this seems weird and definitely felt like a bug when encountering it while working on #89862.
      
      r? `@cjgillot`
      133de6e1
    • M
      Rollup merge of #94155 - GuillaumeGomez:extend-toggle-gui-test, r=jsha · 7dcbe692
      Matthias Krüger 提交于
      Extend toggle GUI test a bit
      
      Fixes #84422.
      
      r? `@jsha`
      7dcbe692
    • M
      Rollup merge of #93845 - compiler-errors:in-band-lifetimes, r=cjgillot · ec4fc726
      Matthias Krüger 提交于
      Remove in band lifetimes
      
      As discussed in t-lang backlog bonanza, the `in_band_lifetimes` FCP closed in favor for the feature not being stabilized. This PR removes `#![feature(in_band_lifetimes)]` in its entirety.
      
      Let me know if this PR is too hasty, and if we should instead do something intermediate for deprecate the feature first.
      
      r? `@scottmcm` (or feel free to reassign, just saw your last comment on #44524)
      Closes #44524
      ec4fc726
    • J
      Fix SGX docs build · 355d503a
      Jethro Beekman 提交于
      355d503a
    • B
      Auto merge of #93644 - michaelwoerister:simpler-debuginfo-typemap, r=wesleywiser · 9b2a4659
      bors 提交于
      debuginfo: Simplify TypeMap used during LLVM debuginfo generation.
      
      This PR simplifies the TypeMap that is used in `rustc_codegen_llvm::debuginfo::metadata`. It was unnecessarily complicated because it was originally implemented when types were not yet normalized before codegen. So it did it's own normalization and kept track of multiple unnormalized types being mapped to a single unique id.
      
      This PR is based on https://github.com/rust-lang/rust/pull/93503, which is not merged yet.
      
      The PR also removes the arena used for allocating string ids and instead uses `InlinableString` from the [inlinable_string](https://crates.io/crates/inlinable_string) crate. That might not be the best choice, since that crate does not seem to be very actively maintained. The [flexible-string](https://crates.io/crates/flexible-string) crate would be an alternative.
      
      r? `@ghost`
      9b2a4659
    • G
      Extend toggle GUI test a bit · ec50cdbe
      Guillaume Gomez 提交于
      ec50cdbe
    • M
    • B
      Auto merge of #94350 - matthiaskrgr:rollup-eesfiyr, r=matthiaskrgr · 03c8ffaa
      bors 提交于
      Rollup of 6 pull requests
      
      Successful merges:
      
       - #92714 (Provide ignore message in the result of test)
       - #93273 (Always check cg_llvm with ./x.py check)
       - #94068 (Consider mutations as borrows in generator drop tracking)
       - #94184 (BTree: simplify test code)
       - #94297 (update const_generics_defaults release notes)
       - #94341 (Remove a duplicate space)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      03c8ffaa
    • M
      Rollup merge of #94341 - ChayimFriedman2:patch-1, r=Dylan-DPC · cff3472e
      Matthias Krüger 提交于
      Remove a duplicate space
      
      rustfmt doesn't format `let ... else`.
      cff3472e
    • M
      Rollup merge of #94297 - lcnr:rel-notes, r=Mark-Simulacrum · 10a43d2a
      Matthias Krüger 提交于
      update const_generics_defaults release notes
      
      supersedes #94294
      
      r? `@Mark-Simulacrum`
      10a43d2a
    • M
      Rollup merge of #94184 - ssomers:btree_tests, r=Dylan-DPC · e5bd222c
      Matthias Krüger 提交于
      BTree: simplify test code
      
      Mostly, use `from` & `from_iter`.
      e5bd222c
    • M
      Rollup merge of #94068 - eholk:drop-track-field-assign, r=tmandry · 10070118
      Matthias Krüger 提交于
      Consider mutations as borrows in generator drop tracking
      
      This is needed to match MIR more conservative approximation of any borrowed value being live across a suspend point (See #94067). This change considers an expression such as `x.y = z` to be a borrow of `x` and therefore keeps `x` live across suspend points.
      
      r? `@nikomatsakis`
      10070118
    • M
      Rollup merge of #93273 - bjorn3:rustbuild_improvements, r=Mark-Simulacrum · ae6770e4
      Matthias Krüger 提交于
      Always check cg_llvm with ./x.py check
      
      Previously it would be skipped if codegen-backends doesn't contain llvm.
      ae6770e4
    • M
      Rollup merge of #92714 - yanganto:ignore-message, r=Mark-Simulacrum · 6ec5b056
      Matthias Krüger 提交于
      Provide ignore message in the result of test
      
      Provide ignore the message in the result of the test.
      
      This PR does not need RFC, because it is about the presentation of the report of `cargo test`.
      
      However, the following document listed here helps you to know about PR.
      
      - [RFC](https://github.com/rust-lang/rfcs/pull/3217)
      - [Rendered](https://github.com/yanganto/rfcs/blob/ignore-test-message/text/0000-ignore-test-message.md)
      - [Previous discussion on IRLO](https://internals.rust-lang.org/t/pre-rfc-provide-ignore-message-when-the-test-ignored/15904)
      
      If there is something improper, please let me know.
      Thanks.
      6ec5b056
    • B
      Auto merge of #94130 - erikdesjardins:partially, r=nikic · ece55d41
      bors 提交于
      Use undef for (some) partially-uninit constants
      
      There needs to be some limit to avoid perf regressions on large arrays
      with undef in each element (see comment in the code).
      
      Fixes: #84565
      Original PR: #83698
      
      Depends on LLVM 14: #93577
      ece55d41
    • B
      Auto merge of #93878 - Aaron1011:newtype-macro, r=cjgillot · f6a79936
      bors 提交于
      Convert `newtype_index` to a proc macro
      
      The `macro_rules!` implementation was becomng excessively complicated,
      and difficult to modify. The new proc macro implementation should make
      it much easier to add new features (e.g. skipping certain `#[derive]`s)
      f6a79936
    • M
      Remove LifetimeDefOrigin · 9386ea9d
      Michael Goulet 提交于
      9386ea9d
    • M
      Remove in-band lifetimes · bb548a91
      Michael Goulet 提交于
      bb548a91
    • R
      Miri fn ptr check: don't use conservative null check · d8064d7d
      Ralf Jung 提交于
      d8064d7d
    • B
      Auto merge of #93368 - eddyb:diagbld-guarantee, r=estebank · d4de1f23
      bors 提交于
      rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".
      
      That is, `DiagnosticBuilder` is now generic over the return type of `.emit()`, so we'll now have:
      * `DiagnosticBuilder<ErrorReported>` for error (incl. fatal/bug) diagnostics
        * can only be created via a `const L: Level`-generic constructor, that limits allowed variants via a `where` clause, so not even `rustc_errors` can accidentally bypass this limitation
        * asserts `diagnostic.is_error()` on emission, just in case the construction restriction was bypassed (e.g. by replacing the whole `Diagnostic` inside `DiagnosticBuilder`)
        * `.emit()` returns `ErrorReported`, as a "proof" token that `.emit()` was called
          (though note that this isn't a real guarantee until after completing the work on
           #69426)
      * `DiagnosticBuilder<()>` for everything else (warnings, notes, etc.)
        * can also be obtained from other `DiagnosticBuilder`s by calling `.forget_guarantee()`
      
      This PR is a companion to other ongoing work, namely:
      * #69426
        and it's ongoing implementation:
        #93222
        the API changes in this PR are needed to get statically-checked "only errors produce `ErrorReported` from `.emit()`", but doesn't itself provide any really strong guarantees without those other `ErrorReported` changes
      * #93244
        would make the choices of API changes (esp. naming) in this PR fit better overall
      
      In order to be able to let `.emit()` return anything trustable, several changes had to be made:
      * `Diagnostic`'s `level` field is now private to `rustc_errors`, to disallow arbitrary "downgrade"s from "some kind of error" to "warning" (or anything else that doesn't cause compilation to fail)
        * it's still possible to replace the whole `Diagnostic` inside the `DiagnosticBuilder`, sadly, that's harder to fix, but it's unlikely enough that we can paper over it with asserts on `.emit()`
      * `.cancel()` now consumes `DiagnosticBuilder`, preventing `.emit()` calls on a cancelled diagnostic
        * it's also now done internally, through `DiagnosticBuilder`-private state, instead of having a `Level::Cancelled` variant that can be read (or worse, written) by the user
        * this removes a hazard of calling `.cancel()` on an error then continuing to attach details to it, and even expect to be able to `.emit()` it
        * warnings were switched to *only* `can_emit_warnings` on emission (instead of pre-cancelling early)
        * `struct_dummy` was removed (as it relied on a pre-`Cancelled` `Diagnostic`)
      * since `.emit()` doesn't consume the `DiagnosticBuilder` <sub>(I tried and gave up, it's much more work than this PR)</sub>,
        we have to make `.emit()` idempotent wrt the guarantees it returns
        * thankfully, `err.emit(); err.emit();` can return `ErrorReported` both times, as the second `.emit()` call has no side-effects *only* because the first one did do the appropriate emission
      * `&mut Diagnostic` is now used in a lot of function signatures, which used to take `&mut DiagnosticBuilder` (in the interest of not having to make those functions generic)
        * the APIs were already mostly identical, allowing for low-effort porting to this new setup
        * only some of the suggestion methods needed some rework, to have the extra `DiagnosticBuilder` functionality on the `Diagnostic` methods themselves (that change is also present in #93259)
        * `.emit()`/`.cancel()` aren't available, but IMO calling them from an "error decorator/annotator" function isn't a good practice, and can lead to strange behavior (from the caller's perspective)
        * `.downgrade_to_delayed_bug()` was added, letting you convert any `.is_error()` diagnostic into a `delay_span_bug` one (which works because in both cases the guarantees available are the same)
      
      This PR should ideally be reviewed commit-by-commit, since there is a lot of fallout in each.
      
      r? `@estebank` cc `@Manishearth` `@nikomatsakis` `@mark-i-m`
      d4de1f23
    • M
    • C
      Remove a duplicate space · 4809a6d4
      Chayim Refael Friedman 提交于
      rustfmt doesn't format `let ... else`.
      4809a6d4
    • A
      Include ignore message in libtest output · bb3b5574
      Antonio Yang 提交于
      As an example:
      
          #[test]
          #[ignore = "not yet implemented"]
          fn test_ignored() {
              ...
          }
      
      Will now render as:
      
          running 2 tests
          test tests::test_ignored ... ignored, not yet implemented
      
          test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
      bb3b5574
    • B
      Auto merge of #94333 - Dylan-DPC:rollup-7yxtywp, r=Dylan-DPC · 4e82f354
      bors 提交于
      Rollup of 9 pull requests
      
      Successful merges:
      
       - #91795 (resolve/metadata: Stop encoding macros as reexports)
       - #93714 (better ObligationCause for normalization errors in `can_type_implement_copy`)
       - #94175 (Improve `--check-cfg` implementation)
       - #94212 (Stop manually SIMDing in `swap_nonoverlapping`)
       - #94242 (properly handle fat pointers to uninhabitable types)
       - #94308 (Normalize main return type during mono item collection & codegen)
       - #94315 (update auto trait lint for `PhantomData`)
       - #94316 (Improve string literal unescaping)
       - #94327 (Avoid emitting full macro body into JSON errors)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      4e82f354
    • A
      Fix intra-doc link issues exposed by new macro · 7b7b0f14
      Aaron Hill 提交于
      These links never worked, but the lint was suppressed due to the fact
      that the span was pointing into the macro. With the new macro
      implementation, the span now points directly to the doc comment in the
      macro invocation, so it's no longer suppressed.
      7b7b0f14
    • A
      Address review comments · 01efe6d5
      Aaron Hill 提交于
      01efe6d5
    • A
      Fix test · e686aee4
      Aaron Hill 提交于
      e686aee4
    • A
      Convert `newtype_index` to a proc macro · 339bbebb
      Aaron Hill 提交于
      The `macro_rules!` implementation was becomng excessively complicated,
      and difficult to modify. The new proc macro implementation should make
      it much easier to add new features (e.g. skipping certain `#[derive]`s)
      339bbebb
    • D
      Rollup merge of #94327 - Mark-Simulacrum:avoid-macro-sp, r=petrochenkov · 3bd163f4
      Dylan DPC 提交于
      Avoid emitting full macro body into JSON errors
      
      While investigating https://github.com/rust-lang/rust/issues/94322, it was noted that currently the JSON diagnostics for macro backtraces include the full def_site span -- the whole macro body.
      
      It seems like this shouldn't be necessary, so this PR adjusts the span to just be the "guessed head", typically the macro name. It doesn't look like we keep enough information to synthesize a nicer span here at this time.
      
      Atop #92123, this reduces output for the src/test/ui/suggestions/missing-lifetime-specifier.rs test from 660 KB to 156 KB locally.
      3bd163f4
    • D
      Rollup merge of #94316 - nnethercote:improve-string-literal-unescaping, r=petrochenkov · ec44d48a
      Dylan DPC 提交于
      Improve string literal unescaping
      
      Some easy wins that affect a few popular crates.
      
      r? ```@matklad```
      ec44d48a
    • D
      9e7131a0
    • D
      Rollup merge of #94308 - tmiasko:normalize-main-ret-ty, r=oli-obk · 787c6f33
      Dylan DPC 提交于
      Normalize main return type during mono item collection & codegen
      
      The issue can be observed with `-Zprint-mono-items=lazy` in:
      
      ```rust
      #![feature(termination_trait_lib)]
      fn main() -> impl std::process::Termination { }
      ```
      ```
      BEFORE: MONO_ITEM fn std::rt::lang_start::<impl std::process::Termination> ````@@```` t.93933fa2-cgu.2[External]
      AFTER:  MONO_ITEM fn std::rt::lang_start::<()> ````@@```` t.df56e625-cgu.1[External]
      ```
      787c6f33