Skip to content

incorrect FromEnv predicates around supertraits #49953

Closed

Description

@nikomatsakis

The predicates for supertraits look wrong, as you can see from this example:

#![feature(rustc_attrs)]
#![allow(dead_code)]

trait Foo { }

#[rustc_dump_program_clauses] //~ ERROR program clause dump
trait Bar: Foo { }

I see this:

error: program clause dump
  --> lower_env1.rs:16:1
   |
16 | #[rustc_dump_program_clauses] //~ ERROR program clause dump
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
   = note: FromEnv(Self: Bar) :- FromEnv(Self: Bar).

But I expect FromEnv(Self: Foo) :- FromEnv(Self: Bar).

cc @rust-lang/wg-traits

Activity

  1. scalexm commented on Apr 13, 2018

    @scalexm
    Contributor

    Could it be because of the fact that for the moment, we unconditionally skip the first predicate (because it’s supposed to be Self: Bar)? Maybe in that case we are actually skipping the Self: Foo predicate?

  2. scalexm commented on Apr 13, 2018

    @scalexm
    Contributor
  3. tmandry commented on Apr 13, 2018

    @tmandry
    Member

    Yeah I strongly suspect you are correct @scalexm. It looks like that hack doesn't work in all cases. I'm working to remove the Self: Foo from predicates_of so the hack isn't necessary, but if we want a fix now, it should be possible to run through all the predicates and filter out the one that matches Self: Foo. I'll try to submit one of those fixes tomorrow, if possible.

  4. self-assigned this
    on Apr 14, 2018
  5. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    on Aug 27, 2018
  6. scalexm commented on Oct 2, 2018

    @scalexm
    Contributor

    Closed by #51895.

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

Metadata

Metadata

Assignees

Labels

A-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions