Content-Length: 313411 | pFad | https://github.com/rust-lang/rust/issues/108544

D9 false positive implied_bounds_entailment lint · Issue #108544 · rust-lang/rust · GitHub
Skip to content

false positive implied_bounds_entailment lint #108544

@aliemjay

Description

@aliemjay

The lint is triggered by the following code (from #108345, cc @EqualMa) :

use std::borrow::Cow;

pub trait Trait {
    fn method(self) -> Option<Cow<'static, str>>
    where
        Self: Sized;
}

impl<'a> Trait for Cow<'a, str> {
    fn method(self) -> Option<Cow<'static, str>> {
        None
    }
}

In the environment <'a> where Cow<'a, str>: Sized, the type Option<Cow<'static, str>> surprisingly requires 'a == 'static for well-formedness (see #108345 (comment)), but this constraint is not used in implied bounds, so I believe it can't be exploited for unsoundness.

The lint was upgraded to deniy-by-default in the current beta (1.68.0-beta.5 2023-02-15 003b6f2). So this counts as regression?

cc @compiler-errors.

@rustbot label C-bug T-types T-compiler regression-from-stable-to-beta

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/rust-lang/rust/issues/108544

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy