Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect FromEnv predicates around supertraits #49953

Closed
nikomatsakis opened this issue Apr 13, 2018 · 4 comments
Closed

incorrect FromEnv predicates around supertraits #49953

nikomatsakis opened this issue Apr 13, 2018 · 4 comments
Assignees
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804

Comments

@nikomatsakis
Copy link
Contributor

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

@nikomatsakis nikomatsakis added A-traits Area: Trait system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 labels Apr 13, 2018
@scalexm
Copy link
Member

scalexm commented Apr 13, 2018

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?

@scalexm
Copy link
Member

scalexm commented Apr 13, 2018

cc @tmandry

@tmandry
Copy link
Member

tmandry commented Apr 13, 2018

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.

@tmandry tmandry self-assigned this Apr 14, 2018
tmandry added a commit to tmandry/rust that referenced this issue Apr 27, 2018
@XAMPPRocky XAMPPRocky added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Aug 27, 2018
@scalexm
Copy link
Member

scalexm commented Oct 2, 2018

Closed by #51895.

@scalexm scalexm closed this as completed Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

No branches or pull requests

4 participants