Pretty print quantified goals and clauses
This commit is contained in:
parent
64aac8d4c1
commit
eacebf24b0
16 changed files with 198 additions and 79 deletions
|
@ -14,9 +14,11 @@ use traits;
|
||||||
use traits::project::Normalized;
|
use traits::project::Normalized;
|
||||||
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||||
use ty::{self, Lift, TyCtxt};
|
use ty::{self, Lift, TyCtxt};
|
||||||
|
use syntax::symbol::InternedString;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::collections::{BTreeSet, BTreeMap};
|
||||||
|
|
||||||
// structural impls for the structs in traits
|
// structural impls for the structs in traits
|
||||||
|
|
||||||
|
@ -479,7 +481,12 @@ impl<'tcx> fmt::Display for traits::DomainGoal<'tcx> {
|
||||||
Holds(wc) => write!(fmt, "{}", wc),
|
Holds(wc) => write!(fmt, "{}", wc),
|
||||||
WellFormed(wf) => write!(fmt, "{}", wf),
|
WellFormed(wf) => write!(fmt, "{}", wf),
|
||||||
FromEnv(from_env) => write!(fmt, "{}", from_env),
|
FromEnv(from_env) => write!(fmt, "{}", from_env),
|
||||||
Normalize(projection) => write!(fmt, "Normalize({})", projection),
|
Normalize(projection) => write!(
|
||||||
|
fmt,
|
||||||
|
"Normalize({} -> {})",
|
||||||
|
projection.projection_ty,
|
||||||
|
projection.ty
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,6 +502,110 @@ impl fmt::Display for traits::QuantifierKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Collect names for regions / types bound by a quantified goal / clause.
|
||||||
|
/// This collector does not try to do anything clever like in ppaux, it's just used
|
||||||
|
/// for debug output in tests anyway.
|
||||||
|
struct BoundNamesCollector {
|
||||||
|
// Just sort by name because `BoundRegion::BrNamed` does not have a `BoundVar` index anyway.
|
||||||
|
regions: BTreeSet<InternedString>,
|
||||||
|
|
||||||
|
// Sort by `BoundVar` index, so usually this should be equivalent to the order given
|
||||||
|
// by the list of type parameters.
|
||||||
|
types: BTreeMap<u32, InternedString>,
|
||||||
|
|
||||||
|
binder_index: ty::DebruijnIndex,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BoundNamesCollector {
|
||||||
|
fn new() -> Self {
|
||||||
|
BoundNamesCollector {
|
||||||
|
regions: BTreeSet::new(),
|
||||||
|
types: BTreeMap::new(),
|
||||||
|
binder_index: ty::INNERMOST,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_empty(&self) -> bool {
|
||||||
|
self.regions.is_empty() && self.types.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_names(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let mut start = true;
|
||||||
|
for r in &self.regions {
|
||||||
|
if !start {
|
||||||
|
write!(fmt, ", ")?;
|
||||||
|
}
|
||||||
|
start = false;
|
||||||
|
write!(fmt, "{}", r)?;
|
||||||
|
}
|
||||||
|
for (_, t) in &self.types {
|
||||||
|
if !start {
|
||||||
|
write!(fmt, ", ")?;
|
||||||
|
}
|
||||||
|
start = false;
|
||||||
|
write!(fmt, "{}", t)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
|
||||||
|
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
|
||||||
|
self.binder_index.shift_in(1);
|
||||||
|
let result = t.super_visit_with(self);
|
||||||
|
self.binder_index.shift_out(1);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_ty(&mut self, t: ty::Ty<'tcx>) -> bool {
|
||||||
|
use syntax::symbol::Symbol;
|
||||||
|
|
||||||
|
match t.sty {
|
||||||
|
ty::Bound(bound_ty) if bound_ty.index == self.binder_index => {
|
||||||
|
self.types.insert(
|
||||||
|
bound_ty.var.as_u32(),
|
||||||
|
match bound_ty.kind {
|
||||||
|
ty::BoundTyKind::Param(name) => name,
|
||||||
|
ty::BoundTyKind::Anon => Symbol::intern(
|
||||||
|
&format!("?{}", bound_ty.var.as_u32())
|
||||||
|
).as_interned_str(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => (),
|
||||||
|
};
|
||||||
|
|
||||||
|
t.super_visit_with(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
|
||||||
|
use syntax::symbol::Symbol;
|
||||||
|
|
||||||
|
match r {
|
||||||
|
ty::ReLateBound(index, br) if *index == self.binder_index => {
|
||||||
|
match br {
|
||||||
|
ty::BoundRegion::BrNamed(_, name) => {
|
||||||
|
self.regions.insert(*name);
|
||||||
|
}
|
||||||
|
|
||||||
|
ty::BoundRegion::BrAnon(var) => {
|
||||||
|
self.regions.insert(Symbol::intern(
|
||||||
|
&format!("?'{}", var)
|
||||||
|
).as_interned_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => (),
|
||||||
|
};
|
||||||
|
|
||||||
|
r.super_visit_with(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'tcx> fmt::Display for traits::Goal<'tcx> {
|
impl<'tcx> fmt::Display for traits::Goal<'tcx> {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
use traits::GoalKind::*;
|
use traits::GoalKind::*;
|
||||||
|
@ -514,8 +625,22 @@ impl<'tcx> fmt::Display for traits::Goal<'tcx> {
|
||||||
Not(goal) => write!(fmt, "not {{ {} }}", goal),
|
Not(goal) => write!(fmt, "not {{ {} }}", goal),
|
||||||
DomainGoal(goal) => write!(fmt, "{}", goal),
|
DomainGoal(goal) => write!(fmt, "{}", goal),
|
||||||
Quantified(qkind, goal) => {
|
Quantified(qkind, goal) => {
|
||||||
// FIXME: appropriate binder names
|
let mut collector = BoundNamesCollector::new();
|
||||||
write!(fmt, "{}<> {{ {} }}", qkind, goal.skip_binder())
|
goal.skip_binder().visit_with(&mut collector);
|
||||||
|
|
||||||
|
if !collector.is_empty() {
|
||||||
|
write!(fmt, "{}<", qkind)?;
|
||||||
|
collector.write_names(fmt)?;
|
||||||
|
write!(fmt, "> {{ ")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
write!(fmt, "{}", goal.skip_binder())?;
|
||||||
|
|
||||||
|
if !collector.is_empty() {
|
||||||
|
write!(fmt, " }}")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
CannotProve => write!(fmt, "CannotProve"),
|
CannotProve => write!(fmt, "CannotProve"),
|
||||||
}
|
}
|
||||||
|
@ -546,8 +671,22 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> {
|
||||||
match self {
|
match self {
|
||||||
Implies(clause) => write!(fmt, "{}", clause),
|
Implies(clause) => write!(fmt, "{}", clause),
|
||||||
ForAll(clause) => {
|
ForAll(clause) => {
|
||||||
// FIXME: appropriate binder names
|
let mut collector = BoundNamesCollector::new();
|
||||||
write!(fmt, "forall<> {{ {} }}", clause.skip_binder())
|
clause.skip_binder().visit_with(&mut collector);
|
||||||
|
|
||||||
|
if !collector.is_empty() {
|
||||||
|
write!(fmt, "forall<")?;
|
||||||
|
collector.write_names(fmt)?;
|
||||||
|
write!(fmt, "> {{ ")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
write!(fmt, "{}", clause.skip_binder())?;
|
||||||
|
|
||||||
|
if !collector.is_empty() {
|
||||||
|
write!(fmt, " }}")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,8 +250,8 @@ crate fn environment<'a, 'tcx>(
|
||||||
// In an fn, we assume that the arguments and all their constituents are
|
// In an fn, we assume that the arguments and all their constituents are
|
||||||
// well-formed.
|
// well-formed.
|
||||||
if is_fn {
|
if is_fn {
|
||||||
// `skip_binder` because we move late bound regions to the root binder,
|
// `skip_binder` because we move region parameters to the root binder,
|
||||||
// restored in the return type
|
// restored in the return type of this query
|
||||||
let fn_sig = tcx.fn_sig(def_id).skip_binder().subst(tcx, bound_vars);
|
let fn_sig = tcx.fn_sig(def_id).skip_binder().subst(tcx, bound_vars);
|
||||||
|
|
||||||
input_tys.extend(
|
input_tys.extend(
|
||||||
|
|
|
@ -600,14 +600,7 @@ impl<'a, 'tcx> ClauseDumper<'a, 'tcx> {
|
||||||
|
|
||||||
let mut strings: Vec<_> = clauses
|
let mut strings: Vec<_> = clauses
|
||||||
.iter()
|
.iter()
|
||||||
.map(|clause| {
|
.map(|clause| clause.to_string())
|
||||||
// Skip the top-level binder for a less verbose output
|
|
||||||
let program_clause = match clause {
|
|
||||||
Clause::Implies(program_clause) => program_clause,
|
|
||||||
Clause::ForAll(program_clause) => program_clause.skip_binder(),
|
|
||||||
};
|
|
||||||
program_clause.to_string()
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
strings.sort();
|
strings.sort();
|
||||||
|
|
|
@ -17,7 +17,7 @@ trait Foo { }
|
||||||
trait Bar where Self: Foo { }
|
trait Bar where Self: Foo { }
|
||||||
|
|
||||||
#[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
fn bar<T: Bar>() {
|
fn bar<T: Bar + ?Sized>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,9 +4,9 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(Self: Foo) :- FromEnv(Self: Bar).
|
= note: forall<Self> { FromEnv(Self: Foo) :- FromEnv(Self: Bar). }
|
||||||
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
|
= note: forall<Self> { Implemented(Self: Bar) :- FromEnv(Self: Bar). }
|
||||||
= note: WellFormed(Self: Bar) :- Implemented(Self: Bar), WellFormed(Self: Foo).
|
= note: forall<Self> { WellFormed(Self: Bar) :- Implemented(Self: Bar), WellFormed(Self: Foo). }
|
||||||
|
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_env1.rs:19:1
|
--> $DIR/lower_env1.rs:19:1
|
||||||
|
@ -14,10 +14,9 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(Self: Foo) :- FromEnv(Self: Bar).
|
= note: forall<Self> { FromEnv(Self: Foo) :- FromEnv(Self: Bar). }
|
||||||
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
|
= note: forall<Self> { Implemented(Self: Bar) :- FromEnv(Self: Bar). }
|
||||||
= note: Implemented(Self: Foo) :- FromEnv(Self: Foo).
|
= note: forall<Self> { Implemented(Self: Foo) :- FromEnv(Self: Foo). }
|
||||||
= note: Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized).
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
trait Foo { }
|
trait Foo { }
|
||||||
|
|
||||||
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
struct S<'a, T> where T: Foo {
|
struct S<'a, T: ?Sized> where T: Foo {
|
||||||
data: &'a T,
|
data: &'a T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
fn bar<'a, T: Foo>(x: S<T>) {
|
fn bar<T: Foo>(_x: S<'_, T>) { // note that we have an implicit `T: Sized` bound
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,10 +4,9 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(T: Foo) :- FromEnv(S<'a, T>).
|
= note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). }
|
||||||
= note: FromEnv(T: std::marker::Sized) :- FromEnv(S<'a, T>).
|
= note: forall<'a, T> { TypeOutlives(T : 'a) :- FromEnv(S<'a, T>). }
|
||||||
= note: TypeOutlives(T : 'a) :- FromEnv(S<'a, T>).
|
= note: forall<'a, T> { WellFormed(S<'a, T>) :- Implemented(T: Foo), TypeOutlives(T : 'a). }
|
||||||
= note: WellFormed(S<'a, T>) :- Implemented(T: std::marker::Sized), Implemented(T: Foo), TypeOutlives(T : 'a).
|
|
||||||
|
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_env2.rs:21:1
|
--> $DIR/lower_env2.rs:21:1
|
||||||
|
@ -15,11 +14,10 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(T: Foo) :- FromEnv(S<'a, T>).
|
= note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). }
|
||||||
= note: FromEnv(T: std::marker::Sized) :- FromEnv(S<'a, T>).
|
= note: forall<'a, T> { TypeOutlives(T : 'a) :- FromEnv(S<'a, T>). }
|
||||||
= note: Implemented(Self: Foo) :- FromEnv(Self: Foo).
|
= note: forall<Self> { Implemented(Self: Foo) :- FromEnv(Self: Foo). }
|
||||||
= note: Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized).
|
= note: forall<Self> { Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized). }
|
||||||
= note: TypeOutlives(T : 'a) :- FromEnv(S<'a, T>).
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: Implemented(Self: Foo) :- FromEnv(Self: Foo).
|
= note: forall<Self> { Implemented(Self: Foo) :- FromEnv(Self: Foo). }
|
||||||
|
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_env3.rs:20:5
|
--> $DIR/lower_env3.rs:20:5
|
||||||
|
@ -12,9 +12,9 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(Self: std::marker::Sized) :- FromEnv(Self: std::clone::Clone).
|
= note: forall<Self> { FromEnv(Self: std::marker::Sized) :- FromEnv(Self: std::clone::Clone). }
|
||||||
= note: Implemented(Self: std::clone::Clone) :- FromEnv(Self: std::clone::Clone).
|
= note: forall<Self> { Implemented(Self: std::clone::Clone) :- FromEnv(Self: std::clone::Clone). }
|
||||||
= note: Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized).
|
= note: forall<Self> { Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized). }
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: Implemented(T: Foo) :- ProjectionEq(<T as std::iter::Iterator>::Item == i32), TypeOutlives(T : 'static), Implemented(T: std::iter::Iterator), Implemented(T: std::marker::Sized).
|
= note: forall<T> { Implemented(T: Foo) :- ProjectionEq(<T as std::iter::Iterator>::Item == i32), TypeOutlives(T : 'static), Implemented(T: std::iter::Iterator), Implemented(T: std::marker::Sized). }
|
||||||
|
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_impl.rs:23:5
|
--> $DIR/lower_impl.rs:23:5
|
||||||
|
@ -12,7 +12,7 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: Normalize(<T as Bar>::Assoc == std::vec::Vec<T>) :- Implemented(T: Bar).
|
= note: forall<T> { Normalize(<T as Bar>::Assoc -> std::vec::Vec<T>) :- Implemented(T: Bar). }
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
struct Foo<T> where Box<T>: Clone {
|
struct Foo<'a, T> where Box<T>: Clone {
|
||||||
_x: std::marker::PhantomData<T>,
|
_x: std::marker::PhantomData<&'a T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -4,9 +4,10 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Foo<T>).
|
= note: forall<'a, T> { FromEnv(T: std::marker::Sized) :- FromEnv(Foo<'a, T>). }
|
||||||
= note: FromEnv(std::boxed::Box<T>: std::clone::Clone) :- FromEnv(Foo<T>).
|
= note: forall<'a, T> { FromEnv(std::boxed::Box<T>: std::clone::Clone) :- FromEnv(Foo<'a, T>). }
|
||||||
= note: WellFormed(Foo<T>) :- Implemented(T: std::marker::Sized), Implemented(std::boxed::Box<T>: std::clone::Clone).
|
= note: forall<'a, T> { TypeOutlives(T : 'a) :- FromEnv(Foo<'a, T>). }
|
||||||
|
= note: forall<'a, T> { WellFormed(Foo<'a, T>) :- Implemented(T: std::marker::Sized), Implemented(std::boxed::Box<T>: std::clone::Clone), TypeOutlives(T : 'a). }
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(<Self as Foo<S, T>>::Assoc: Bar) :- FromEnv(Self: Foo<S, T>).
|
= note: forall<Self, S, T> { FromEnv(<Self as Foo<S, T>>::Assoc: Bar) :- FromEnv(Self: Foo<S, T>). }
|
||||||
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<S, T>).
|
= note: forall<Self, S, T> { FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<S, T>). }
|
||||||
= note: Implemented(Self: Foo<S, T>) :- FromEnv(Self: Foo<S, T>).
|
= note: forall<Self, S, T> { Implemented(Self: Foo<S, T>) :- FromEnv(Self: Foo<S, T>). }
|
||||||
= note: WellFormed(Self: Foo<S, T>) :- Implemented(Self: Foo<S, T>), WellFormed(S: std::marker::Sized), WellFormed(<Self as Foo<S, T>>::Assoc: Bar).
|
= note: forall<Self, S, T> { WellFormed(Self: Foo<S, T>) :- Implemented(Self: Foo<S, T>), WellFormed(S: std::marker::Sized), WellFormed(<Self as Foo<S, T>>::Assoc: Bar). }
|
||||||
|
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_trait.rs:17:5
|
--> $DIR/lower_trait.rs:17:5
|
||||||
|
@ -15,9 +15,9 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(Self: Foo<S, T>) :- FromEnv(Unnormalized(<Self as Foo<S, T>>::Assoc)).
|
= note: forall<Self, S, T> { FromEnv(Self: Foo<S, T>) :- FromEnv(Unnormalized(<Self as Foo<S, T>>::Assoc)). }
|
||||||
= note: ProjectionEq(<Self as Foo<S, T>>::Assoc == Unnormalized(<Self as Foo<S, T>>::Assoc)).
|
= note: forall<Self, S, T> { ProjectionEq(<Self as Foo<S, T>>::Assoc == Unnormalized(<Self as Foo<S, T>>::Assoc)). }
|
||||||
= note: WellFormed(Unnormalized(<Self as Foo<S, T>>::Assoc)) :- Implemented(Self: Foo<S, T>).
|
= note: forall<Self, S, T> { WellFormed(Unnormalized(<Self as Foo<S, T>>::Assoc)) :- Implemented(Self: Foo<S, T>). }
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
trait Foo<F> where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8
|
trait Foo<F: ?Sized> where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8
|
||||||
{
|
{
|
||||||
fn s(_: F) -> F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,11 +4,10 @@ error: program clause dump
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(F: std::marker::Sized) :- FromEnv(Self: Foo<F>).
|
= note: forall<'a, Self, F> { FromEnv(F: std::ops::Fn<(&'a (u8, u16),)>) :- FromEnv(Self: Foo<F>). }
|
||||||
= note: FromEnv(F: std::ops::Fn<(&'a (u8, u16),)>) :- FromEnv(Self: Foo<F>).
|
= note: forall<'a, Self, F> { ProjectionEq(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) :- FromEnv(Self: Foo<F>). }
|
||||||
= note: Implemented(Self: Foo<F>) :- FromEnv(Self: Foo<F>).
|
= note: forall<Self, F> { Implemented(Self: Foo<F>) :- FromEnv(Self: Foo<F>). }
|
||||||
= note: ProjectionEq(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) :- FromEnv(Self: Foo<F>).
|
= note: forall<Self, F> { WellFormed(Self: Foo<F>) :- Implemented(Self: Foo<F>), forall<'a> { WellFormed(F: std::ops::Fn<(&'a (u8, u16),)>) }, forall<'a> { ProjectionEq(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) }. }
|
||||||
= note: WellFormed(Self: Foo<F>) :- Implemented(Self: Foo<F>), WellFormed(F: std::marker::Sized), forall<> { WellFormed(F: std::ops::Fn<(&'a (u8, u16),)>) }, forall<> { ProjectionEq(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) }.
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,16 @@
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
use std::fmt::{Debug, Display};
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
||||||
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
#[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
trait Foo<'a, 'b, S, T, U>
|
trait Foo<'a, 'b, T, U>
|
||||||
where
|
where
|
||||||
S: Debug,
|
T: Borrow<U> + ?Sized,
|
||||||
T: Borrow<U>,
|
U: ?Sized + 'b,
|
||||||
U: ?Sized,
|
|
||||||
'a: 'b,
|
'a: 'b,
|
||||||
U: 'b,
|
Box<T>:, // NOTE(#53696) this checks an empty list of bounds.
|
||||||
Vec<T>:, // NOTE(#53696) this checks an empty list of bounds.
|
|
||||||
{
|
{
|
||||||
fn s(_: S) -> S;
|
|
||||||
fn t(_: T) -> T;
|
|
||||||
fn u(_: U) -> U;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
error: program clause dump
|
error: program clause dump
|
||||||
--> $DIR/lower_trait_where_clause.rs:16:1
|
--> $DIR/lower_trait_where_clause.rs:15:1
|
||||||
|
|
|
|
||||||
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: FromEnv(S: std::fmt::Debug) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { FromEnv(T: std::borrow::Borrow<U>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
|
||||||
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { Implemented(Self: Foo<'a, 'b, T, U>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
|
||||||
= note: FromEnv(T: std::borrow::Borrow<U>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { RegionOutlives('a : 'b) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
|
||||||
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { TypeOutlives(U : 'b) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
|
||||||
= note: Implemented(Self: Foo<'a, 'b, S, T, U>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { WellFormed(Self: Foo<'a, 'b, T, U>) :- Implemented(Self: Foo<'a, 'b, T, U>), WellFormed(T: std::borrow::Borrow<U>), TypeOutlives(U : 'b), RegionOutlives('a : 'b), WellFormed(std::boxed::Box<T>). }
|
||||||
= note: RegionOutlives('a : 'b) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
= note: forall<'a, 'b, Self, T, U> { WellFormed(std::boxed::Box<T>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
|
||||||
= note: TypeOutlives(U : 'b) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
|
||||||
= note: WellFormed(Self: Foo<'a, 'b, S, T, U>) :- Implemented(Self: Foo<'a, 'b, S, T, U>), WellFormed(S: std::marker::Sized), WellFormed(T: std::marker::Sized), WellFormed(S: std::fmt::Debug), WellFormed(T: std::borrow::Borrow<U>), RegionOutlives('a : 'b), TypeOutlives(U : 'b), WellFormed(std::vec::Vec<T>).
|
|
||||||
= note: WellFormed(std::vec::Vec<T>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue