Skip to content

the trait bound &[u8]: std::convert::From<&[_; 0]> is not satisfied #113238

Closed

Activity

  1. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Jul 1, 2023
  2. added this to the 1.71.0 milestone on Jul 1, 2023
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jul 1, 2023
  4. hameerabbasi commented on Jul 2, 2023

    @hameerabbasi
    Contributor

    This seems to already have been fixed on the main branch and also on cca7ee5 (which is what I get if I run cargo-bisect-rustc with the HEAD of the beta branch).

  5. compiler-errors commented on Jul 2, 2023

    @compiler-errors
    Contributor

    @hameerabbasi how did you build this? You need to build all the tests to reproduce this, too.

  6. compiler-errors commented on Jul 2, 2023

    @compiler-errors
    Contributor

    This seems to have regressed in #106704. From the UI test at the bottom of that PR, it seems to suggest that we've added a new &[u8]: From<gimli::read::endian_slice::EndianSlice<'_, Endian>>> implementation, which may have affected the inference/coercion somewhere in that program.

  7. removed
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Jul 2, 2023
  8. Mark-Simulacrum commented on Jul 2, 2023

    @Mark-Simulacrum
    MemberAuthor

    Seems plausible, and seems like that trait impl might be removable - though maybe a breaking change for gimli?

  9. cuviper commented on Jul 7, 2023

    @cuviper
    Member

    This is reproducible on stable if gimli 0.27.* is pulled in at all:

    extern crate gimli;
    fn main() {
        let _ = <&[u8]>::from(&[]);
    }
    error[E0277]: the trait bound `&[u8]: From<&[_; 0]>` is not satisfied
     --> src/main.rs:3:27
      |
    3 |     let _ = <&[u8]>::from(&[]);
      |             ------------- ^^^ the trait `From<&[_; 0]>` is not implemented for `&[u8]`
      |             |
      |             required by a bound introduced by this call
      |
      = help: the trait `From<EndianSlice<'input, Endian>>` is implemented for `&'input [u8]`
    

    But now that std is pulling that version of gimli, everyone gets to feel the pain. Without that impl, &[u8] would only have the reflexive From, driving the &[] into an unsizing coercion. An uncoerced From<&[T; N]> for &[T] seems totally plausible though - I wonder if we've tried that before? (It's way too late to add new impls to 1.71 though.)

    seems like that trait impl might be removable - though maybe a breaking change for gimli?

    I didn't look into how it's used, but EndianSlice is a public type, so yes that would be breaking to remove it.

    Reverting #106704 is going to be hard too, because the new gimli is coming from backtrace (submodule in std) -> addr2line 0.19 -> gimli 0.27, and there are other backtrace updates that I expect we want to keep.

  10. cuviper commented on Jul 7, 2023

    @cuviper
    Member

    Hmm, actually it seems to build ok if I just downgrade to addr2line 0.18 (which also drops to gimli 0.26) here:

    addr2line = { version = "0.19.0", optional = true, default-features = false }

    So I guess it doesn't really need APIs of the newer version, but I don't know if we'll miss fixes or functionality. I can PR this as a release band-aid if others agree that it makes sense...

  11. Mark-Simulacrum commented on Jul 7, 2023

    @Mark-Simulacrum
    MemberAuthor

    Hm, I think some folks have been more actively poking at backtrace lately, I don't know what we'd lose by downgrading there - cc @rust-lang/crate-maintainers (broader group but hopefully reaches the right people).

    I guess the question is: are we comfortable downgrading addr2line as suggested by @cuviper for 1.70 (releasing next week)?

  12. Noratrieb commented on Jul 7, 2023

    @Noratrieb
    Member

    What's the plan for the future? I don't think we want to stay on old gimli forever. Hope that gimli removes the impl in a breaking release, which we could then pull in?

  13. cuviper commented on Jul 7, 2023

    @cuviper
    Member

    So I guess it doesn't really need APIs of the newer version,

    Actually, there were no API changes in addr2line 0.18 to 0.19, only the dependency changes:
    gimli-rs/addr2line@0.18.0...0.19.0

    for 1.70 (releasing next week)?

    That's 1.71.0.

    What's the plan for the future?

    Unknown. I can see if adding From<&[T; N]> for &[T] is actually feasible, but it's possible that this may introduce other ambiguities. Another (hacky) possibility is to get gimli to only remove that impl under its "rustc-dep-of-std" feature, since they document this feature as not part of their stable API, assuming any internal use can be converted to other means.

  14. workingjubilee commented on Jul 7, 2023

    @workingjubilee
    Member

    @Mark-Simulacrum The backtrace crate is going to need that gimli and object to be capable of later supporting AIX and also probably more recent platforms as well, as some object fixes were fixing platforms like watchOS. And it needs that gimli and addr2line to support the new DWARF formats which finally allow split debuginfo so we can maybe finally not have every Rust program be a hugely bloated binary on Linux and other Unix-y platforms.

    Downgrading is an acceptable hotfix for stopping a regression from hitting stable, not for the long term.

  15. 21 remaining items

  16. apiraino commented on Aug 1, 2023

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

  17. added
    P-highHigh priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 1, 2023
  18. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 1, 2023
  19. added
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    on Aug 3, 2023
  20. wesleywiser commented on Aug 3, 2023

    @wesleywiser
    Member

    Visited during T-compiler's weekly triage meeting. While this doesn't seem to be strictly under our purview, we are a bit concerned that the 1.72 release is coming up and this doesn't seem to have been mitigated in 1.72 yet.

    Personally, I think if gimli is willing to remove the impl and ship a new major release (and coordinate that into a new addr2line release) that seems like the best medium term option. We may already be too late in the beta release cycle for that though so perhaps backporting the addr2line downgrade to 1.72 to ensure this regression does not accidentally get released makes sense?

  21. added a commit that references this issue on Aug 5, 2023
  22. cuviper commented on Aug 12, 2023

    @cuviper
    Member

    @philipc thanks for gimli-rs/gimli#669. Are you planning to make a release? (with addr2line as well if semver bumped)

    We need to figure out the mitigation on 1.72-beta soon, but a downgrade to addr2line 0.18 doesn't work this time:

    error[E0432]: unresolved imports `addr2line::LookupContinuation`, `addr2line::LookupResult`
       --> library/std/src/../../backtrace/src/symbolize/gimli.rs:163:25
        |
    163 |         use addr2line::{LookupContinuation, LookupResult};
        |                         ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^ no `LookupResult` in the root
        |                         |
        |                         no `LookupContinuation` in the root
    
    error[E0412]: cannot find type `SplitDwarfLoad` in crate `addr2line`
       --> library/std/src/../../backtrace/src/symbolize/gimli/elf.rs:461:22
        |
    461 |     load: addr2line::SplitDwarfLoad<EndianSlice<'data, Endian>>,
        |                      ^^^^^^^^^^^^^^ not found in `addr2line`
    
    error[E0599]: no method named `make_dwo` found for struct `Dwarf` in the current scope
       --> library/std/src/../../backtrace/src/symbolize/gimli/elf.rs:488:27
        |
    488 |                 dwo_dwarf.make_dwo(&load.parent);
        |                           ^^^^^^^^ method not found in `Dwarf<EndianSlice<'_, LittleEndian>>`
    

    Maybe those changes can be reverted, but I didn't try.

    edit: going back to library/backtrace 4245978ca8169c40c088ff733825e4527f7b914c like 1.71 works.

  23. philipc commented on Aug 12, 2023

    @philipc
    Contributor

    gimli release PR is up. I'll do some testing and release gimli and addr2line tomorrow.

  24. cuviper commented on Aug 13, 2023

    @cuviper
    Member

    Upgrading beta std to addr2line v0.21.0 -> gimli v0.28.0 works! So I think we could do just that as a targeted fix for 1.72-beta, and a fuller update following rust-lang/backtrace-rs#557 on master for 1.73-nightly.

  25. added a commit that references this issue on Aug 15, 2023
  26. Mark-Simulacrum commented on Aug 18, 2023

    @Mark-Simulacrum
    MemberAuthor

    #114955 / #114825 fixed this, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions