Skip to content

regression: trait bound is not satisfied #123279

Closed

Description

@Mark-Simulacrum
[INFO] [stdout] error[E0277]: the trait bound `(dyn LoopableJob + 'static): Job` is not satisfied
[INFO] [stdout]    --> src/service.rs:190:18
[INFO] [stdout]     |
[INFO] [stdout] 190 |         self.job.run_once().await
[INFO] [stdout]     |                  ^^^^^^^^ the trait `Job` is not implemented for `(dyn LoopableJob + 'static)`
[INFO] [stdout]     |
[INFO] [stdout] help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
[INFO] [stdout]     |
[INFO] [stdout] 188 | impl Job for LoopingJobService where (dyn LoopableJob + 'static): Job {
[INFO] [stdout]     |                                ++++++++++++++++++++++++++++++++++++++

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 31, 2024
  2. added this to the 1.78.0 milestone on Mar 31, 2024
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 31, 2024
  4. compiler-errors commented on Mar 31, 2024

    @compiler-errors
    Contributor

    Regression in rust-lang-ci@e890bd9
    The PR introducing the regression in this rollup is #120323: On E0277 be clearer about implicit Sized bounds on type p…

    searched nightlies: from nightly-2024-01-01 to nightly-2024-03-18
    regressed nightly: nightly-2024-02-06
    searched commit range: 268dbbb...f067fd6
    regressed commit: 4d87c4a

    bisected with cargo-bisect-rustc v0.6.8

    Host triple: x86_64-unknown-linux-gnu
    Reproduce with:

    cargo bisect-rustc --start=2024-01-01 --end=2024-03-18 

    This PR definitely should not have changed behavior :/
    cc @estebank

  5. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Mar 31, 2024
  6. compiler-errors commented on Mar 31, 2024

    @compiler-errors
    Contributor

    I'll look into what's going on with it anyways -- it at least needs a MCVE

    @rustbot claim

  7. compiler-errors commented on Mar 31, 2024

    @compiler-errors
    Contributor

    Implicitly reordering the Sized predicates as a side-effect of #120323 is the problem here.

    pub trait Job: AsJob {
        fn run_once(&self);
    }
    
    impl<F: Fn()> Job for F {
        fn run_once(&self) {
            todo!()
        }
    }
    
    pub trait AsJob {
    }
    
    impl<T: Job + Sized> AsJob for T { // <----- changing this to `Sized + Job` or just `Job` will FIX it.
    }
    
    pub struct LoopingJobService {
        job: Box<dyn Job>,
    }
    
    impl Job for LoopingJobService {
        fn run_once(&self) {
            self.job.run_once()
        }
    }

    I assume this is because of an overflow on the AsJob impl that isn't cut off short by the Sized predicate being impossible to satisfy?

  8. apiraino commented on Apr 2, 2024

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-high

  9. 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 Apr 2, 2024
  10. added 2 commits that reference this issue on Apr 2, 2024
  11. added a commit that references this issue on Apr 2, 2024
  12. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Apr 3, 2024
  13. cuviper commented on Apr 12, 2024

    @cuviper
    Member

    #123302 was backported in #123466.

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

Metadata

Metadata

Labels

A-trait-systemArea: Trait systemP-highHigh priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler 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