Auto merge of #49950 - Zoxc:default-span, r=estebank
Improve query cycle error message r? @michaelwoerister
This commit is contained in:
commit
b91e6a2672
29 changed files with 142 additions and 175 deletions
|
@ -31,6 +31,7 @@ pub(super) enum QueryResult<'tcx, T> {
|
||||||
/// A span and a query key
|
/// A span and a query key
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct QueryInfo<'tcx> {
|
pub struct QueryInfo<'tcx> {
|
||||||
|
/// The span for a reason this query was required
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub query: Query<'tcx>,
|
pub query: Query<'tcx>,
|
||||||
}
|
}
|
||||||
|
@ -73,13 +74,22 @@ impl<'tcx> QueryJob<'tcx> {
|
||||||
cycle.insert(0, job.info.clone());
|
cycle.insert(0, job.info.clone());
|
||||||
|
|
||||||
if &*job as *const _ == self as *const _ {
|
if &*job as *const _ == self as *const _ {
|
||||||
break;
|
// This is the end of the cycle
|
||||||
|
// The span entry we included was for the usage
|
||||||
|
// of the cycle itself, and not part of the cycle
|
||||||
|
// Replace it with the span which caused the cycle to form
|
||||||
|
cycle[0].span = span;
|
||||||
|
// Find out why the cycle itself was used
|
||||||
|
let usage = job.parent.as_ref().map(|parent| {
|
||||||
|
(job.info.span, parent.info.query.clone())
|
||||||
|
});
|
||||||
|
return Err(CycleError { usage, cycle });
|
||||||
}
|
}
|
||||||
|
|
||||||
current_job = job.parent.clone();
|
current_job = job.parent.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(CycleError { span, cycle })
|
panic!("did not find a cycle")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signals to waiters that the query is complete.
|
/// Signals to waiters that the query is complete.
|
||||||
|
|
|
@ -17,6 +17,7 @@ use errors::DiagnosticBuilder;
|
||||||
use errors::Level;
|
use errors::Level;
|
||||||
use ty::tls;
|
use ty::tls;
|
||||||
use ty::{TyCtxt};
|
use ty::{TyCtxt};
|
||||||
|
use ty::maps::Query;
|
||||||
use ty::maps::config::QueryDescription;
|
use ty::maps::config::QueryDescription;
|
||||||
use ty::maps::job::{QueryResult, QueryInfo};
|
use ty::maps::job::{QueryResult, QueryInfo};
|
||||||
use ty::item_path;
|
use ty::item_path;
|
||||||
|
@ -63,7 +64,8 @@ pub(super) trait GetCacheInternal<'tcx>: QueryDescription<'tcx> + Sized {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(super) struct CycleError<'tcx> {
|
pub(super) struct CycleError<'tcx> {
|
||||||
pub(super) span: Span,
|
/// The query and related span which uses the cycle
|
||||||
|
pub(super) usage: Option<(Span, Query<'tcx>)>,
|
||||||
pub(super) cycle: Vec<QueryInfo<'tcx>>,
|
pub(super) cycle: Vec<QueryInfo<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,33 +81,41 @@ pub(super) enum TryGetLock<'a, 'tcx: 'a, T, D: QueryDescription<'tcx> + 'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
pub(super) fn report_cycle(self, CycleError { span, cycle: stack }: CycleError)
|
pub(super) fn report_cycle(self, CycleError { usage, cycle: stack }: CycleError<'gcx>)
|
||||||
-> DiagnosticBuilder<'a>
|
-> DiagnosticBuilder<'a>
|
||||||
{
|
{
|
||||||
assert!(!stack.is_empty());
|
assert!(!stack.is_empty());
|
||||||
|
|
||||||
|
let fix_span = |span: Span, query: &Query<'gcx>| {
|
||||||
|
self.sess.codemap().def_span(query.default_span(self, span))
|
||||||
|
};
|
||||||
|
|
||||||
// Disable naming impls with types in this path, since that
|
// Disable naming impls with types in this path, since that
|
||||||
// sometimes cycles itself, leading to extra cycle errors.
|
// sometimes cycles itself, leading to extra cycle errors.
|
||||||
// (And cycle errors around impls tend to occur during the
|
// (And cycle errors around impls tend to occur during the
|
||||||
// collect/coherence phases anyhow.)
|
// collect/coherence phases anyhow.)
|
||||||
item_path::with_forced_impl_filename_line(|| {
|
item_path::with_forced_impl_filename_line(|| {
|
||||||
let span = self.sess.codemap().def_span(span);
|
let span = fix_span(stack[1 % stack.len()].span, &stack[0].query);
|
||||||
let mut err =
|
let mut err = struct_span_err!(self.sess,
|
||||||
struct_span_err!(self.sess, span, E0391,
|
span,
|
||||||
"cyclic dependency detected");
|
E0391,
|
||||||
err.span_label(span, "cyclic reference");
|
"cycle detected when {}",
|
||||||
|
stack[0].query.describe(self));
|
||||||
|
|
||||||
err.span_note(self.sess.codemap().def_span(stack[0].span),
|
for i in 1..stack.len() {
|
||||||
&format!("the cycle begins when {}...", stack[0].query.describe(self)));
|
let query = &stack[i].query;
|
||||||
|
let span = fix_span(stack[(i + 1) % stack.len()].span, query);
|
||||||
for &QueryInfo { span, ref query, .. } in &stack[1..] {
|
err.span_note(span, &format!("...which requires {}...", query.describe(self)));
|
||||||
err.span_note(self.sess.codemap().def_span(span),
|
|
||||||
&format!("...which then requires {}...", query.describe(self)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err.note(&format!("...which then again requires {}, completing the cycle.",
|
err.note(&format!("...which again requires {}, completing the cycle",
|
||||||
stack[0].query.describe(self)));
|
stack[0].query.describe(self)));
|
||||||
|
|
||||||
|
if let Some((span, query)) = usage {
|
||||||
|
err.span_note(fix_span(span, &query),
|
||||||
|
&format!("cycle used when {}", query.describe(self)));
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -266,6 +276,22 @@ macro_rules! define_maps {
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME(eddyb) Get more valid Span's on queries.
|
||||||
|
pub fn default_span(&self, tcx: TyCtxt<'_, $tcx, '_>, span: Span) -> Span {
|
||||||
|
if span != DUMMY_SP {
|
||||||
|
return span;
|
||||||
|
}
|
||||||
|
// The def_span query is used to calculate default_span,
|
||||||
|
// so exit to avoid infinite recursion
|
||||||
|
match *self {
|
||||||
|
Query::def_span(..) => return span,
|
||||||
|
_ => ()
|
||||||
|
}
|
||||||
|
match *self {
|
||||||
|
$(Query::$name(key) => key.default_span(tcx),)*
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod queries {
|
pub mod queries {
|
||||||
|
@ -303,7 +329,7 @@ macro_rules! define_maps {
|
||||||
/// If the query already executed and panicked, this will fatal error / silently panic
|
/// If the query already executed and panicked, this will fatal error / silently panic
|
||||||
fn try_get_lock(
|
fn try_get_lock(
|
||||||
tcx: TyCtxt<'a, $tcx, 'lcx>,
|
tcx: TyCtxt<'a, $tcx, 'lcx>,
|
||||||
mut span: Span,
|
span: Span,
|
||||||
key: &$K
|
key: &$K
|
||||||
) -> TryGetLock<'a, $tcx, $V, Self>
|
) -> TryGetLock<'a, $tcx, $V, Self>
|
||||||
{
|
{
|
||||||
|
@ -329,13 +355,6 @@ macro_rules! define_maps {
|
||||||
};
|
};
|
||||||
mem::drop(lock);
|
mem::drop(lock);
|
||||||
|
|
||||||
// This just matches the behavior of `try_get_with` so the span when
|
|
||||||
// we await matches the span we would use when executing.
|
|
||||||
// See the FIXME there.
|
|
||||||
if span == DUMMY_SP && stringify!($name) != "def_span" {
|
|
||||||
span = key.default_span(tcx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Err(cycle) = job.await(tcx, span) {
|
if let Err(cycle) = job.await(tcx, span) {
|
||||||
return TryGetLock::JobCompleted(Err(cycle));
|
return TryGetLock::JobCompleted(Err(cycle));
|
||||||
}
|
}
|
||||||
|
@ -343,7 +362,7 @@ macro_rules! define_maps {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_get_with(tcx: TyCtxt<'a, $tcx, 'lcx>,
|
fn try_get_with(tcx: TyCtxt<'a, $tcx, 'lcx>,
|
||||||
mut span: Span,
|
span: Span,
|
||||||
key: $K)
|
key: $K)
|
||||||
-> Result<$V, CycleError<$tcx>>
|
-> Result<$V, CycleError<$tcx>>
|
||||||
{
|
{
|
||||||
|
@ -377,18 +396,6 @@ macro_rules! define_maps {
|
||||||
|
|
||||||
let mut lock = get_lock_or_return!();
|
let mut lock = get_lock_or_return!();
|
||||||
|
|
||||||
// FIXME(eddyb) Get more valid Span's on queries.
|
|
||||||
// def_span guard is necessary to prevent a recursive loop,
|
|
||||||
// default_span calls def_span query internally.
|
|
||||||
if span == DUMMY_SP && stringify!($name) != "def_span" {
|
|
||||||
// This might deadlock if we hold the map lock since we might be
|
|
||||||
// waiting for the def_span query and switch to some other fiber
|
|
||||||
// So we drop the lock here and reacquire it
|
|
||||||
mem::drop(lock);
|
|
||||||
span = key.default_span(tcx);
|
|
||||||
lock = get_lock_or_return!();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fast path for when incr. comp. is off. `to_dep_node` is
|
// Fast path for when incr. comp. is off. `to_dep_node` is
|
||||||
// expensive for some DepKinds.
|
// expensive for some DepKinds.
|
||||||
if !tcx.dep_graph.is_fully_enabled() {
|
if !tcx.dep_graph.is_fully_enabled() {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
|
|
||||||
trait Trait<T> { type Assoc; }
|
trait Trait<T> { type Assoc; }
|
||||||
//~^ cyclic dependency detected [E0391]
|
//~^ cycle detected
|
||||||
|
|
||||||
impl<T> Trait<T> for Vec<T> {
|
impl<T> Trait<T> for Vec<T> {
|
||||||
type Assoc = ();
|
type Assoc = ();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern: cyclic dependency detected
|
// error-pattern: cycle detected
|
||||||
|
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ trait Trait { type Item; }
|
||||||
struct A<T>
|
struct A<T>
|
||||||
where T : Trait,
|
where T : Trait,
|
||||||
T : Add<T::Item>
|
T : Add<T::Item>
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
//~| ERROR associated type `Item` not found for `T`
|
//~| ERROR associated type `Item` not found for `T`
|
||||||
{
|
{
|
||||||
data: T
|
data: T
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// again references the trait.
|
// again references the trait.
|
||||||
|
|
||||||
trait Foo<X = Box<Foo>> {
|
trait Foo<X = Box<Foo>> {
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test a supertrait cycle where a trait extends itself.
|
// Test a supertrait cycle where a trait extends itself.
|
||||||
|
|
||||||
trait Chromosome: Chromosome {
|
trait Chromosome: Chromosome {
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
type x = Vec<x>;
|
type x = Vec<x>;
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
|
|
||||||
fn main() { let b: x = Vec::new(); }
|
fn main() { let b: x = Vec::new(); }
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait T : Iterator<Item=Self::Item>
|
trait T : Iterator<Item=Self::Item>
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
//~| ERROR associated type `Item` not found for `Self`
|
//~| ERROR associated type `Item` not found for `Self`
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub trait Subscriber {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Processor: Subscriber<Input = Self::Input> {
|
pub trait Processor: Subscriber<Input = Self::Input> {
|
||||||
//~^ ERROR cyclic dependency detected [E0391]
|
//~^ ERROR cycle detected
|
||||||
type Input;
|
type Input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ trait Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<T: Trait<A = T::B>>() { }
|
fn foo<T: Trait<A = T::B>>() { }
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
//~| ERROR associated type `B` not found for `T`
|
//~| ERROR associated type `B` not found for `T`
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Expr : PartialEq<Self::Item> {
|
trait Expr : PartialEq<Self::Item> {
|
||||||
//~^ ERROR: cyclic dependency detected
|
//~^ ERROR: cycle detected
|
||||||
type Item;
|
type Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern: cyclic dependency detected
|
// error-pattern: cycle detected when computing layout of
|
||||||
// note-pattern: the cycle begins when computing layout of
|
// note-pattern: ...which requires computing layout of
|
||||||
// note-pattern: ...which then requires computing layout of
|
// note-pattern: ...which again requires computing layout of
|
||||||
// note-pattern: ...which then again requires computing layout of
|
|
||||||
|
|
||||||
|
|
||||||
trait Mirror { type It: ?Sized; }
|
trait Mirror { type It: ?Sized; }
|
||||||
impl<T: ?Sized> Mirror for T { type It = Self; }
|
impl<T: ?Sized> Mirror for T { type It = Self; }
|
||||||
|
|
|
@ -14,8 +14,8 @@ trait Trait<T> {
|
||||||
fn foo(_: T) {}
|
fn foo(_: T) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Foo<T = Box<Trait<DefaultFoo>>>;
|
pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected
|
||||||
type DefaultFoo = Foo; //~ ERROR cyclic dependency detected
|
type DefaultFoo = Foo;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// error-pattern: cycle detected when computing layout of
|
||||||
|
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
|
||||||
|
@ -15,7 +17,6 @@ use std::intrinsics;
|
||||||
|
|
||||||
struct Foo {
|
struct Foo {
|
||||||
bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
//~^ ERROR cyclic dependency detected
|
|
||||||
x: usize,
|
x: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ impl Tr for S where Self: Copy {} // OK
|
||||||
impl Tr for S where S<Self>: Copy {} // OK
|
impl Tr for S where S<Self>: Copy {} // OK
|
||||||
impl Tr for S where Self::A: Copy {} // OK
|
impl Tr for S where Self::A: Copy {} // OK
|
||||||
|
|
||||||
impl Tr for Self {} //~ ERROR cyclic dependency detected
|
impl Tr for Self {} //~ ERROR cycle detected
|
||||||
impl Tr for S<Self> {} //~ ERROR cyclic dependency detected
|
impl Tr for S<Self> {} //~ ERROR cycle detected
|
||||||
impl Self {} //~ ERROR cyclic dependency detected
|
impl Self {} //~ ERROR cycle detected
|
||||||
impl S<Self> {} //~ ERROR cyclic dependency detected
|
impl S<Self> {} //~ ERROR cycle detected
|
||||||
impl Tr<Self::A> for S {} //~ ERROR cyclic dependency detected
|
impl Tr<Self::A> for S {} //~ ERROR cycle detected
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -15,10 +15,9 @@ trait A: B {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait B: C {
|
trait B: C {
|
||||||
|
//~^ ERROR cycle detected
|
||||||
}
|
}
|
||||||
|
|
||||||
trait C: B { }
|
trait C: B { }
|
||||||
//~^ ERROR cyclic dependency detected
|
|
||||||
//~| cyclic reference
|
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when computing the supertraits of `B`
|
||||||
--> $DIR/cycle-trait-supertrait-indirect.rs:20:1
|
|
||||||
|
|
|
||||||
LL | trait C: B { }
|
|
||||||
| ^^^^^^^^^^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when computing the supertraits of `B`...
|
|
||||||
--> $DIR/cycle-trait-supertrait-indirect.rs:14:1
|
|
||||||
|
|
|
||||||
LL | trait A: B {
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
note: ...which then requires computing the supertraits of `C`...
|
|
||||||
--> $DIR/cycle-trait-supertrait-indirect.rs:17:1
|
--> $DIR/cycle-trait-supertrait-indirect.rs:17:1
|
||||||
|
|
|
|
||||||
LL | trait B: C {
|
LL | trait B: C {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
= note: ...which then again requires computing the supertraits of `B`, completing the cycle.
|
|
|
||||||
|
note: ...which requires computing the supertraits of `C`...
|
||||||
|
--> $DIR/cycle-trait-supertrait-indirect.rs:21:1
|
||||||
|
|
|
||||||
|
LL | trait C: B { }
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
= note: ...which again requires computing the supertraits of `B`, completing the cycle
|
||||||
|
note: cycle used when computing the supertraits of `A`
|
||||||
|
--> $DIR/cycle-trait-supertrait-indirect.rs:14:1
|
||||||
|
|
|
||||||
|
LL | trait A: B {
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,7 @@ fn after() -> impl Fn(i32) {
|
||||||
// independently resolved and only require the concrete
|
// independently resolved and only require the concrete
|
||||||
// return type, which can't depend on the obligation.
|
// return type, which can't depend on the obligation.
|
||||||
fn cycle1() -> impl Clone {
|
fn cycle1() -> impl Clone {
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
//~| cyclic reference
|
|
||||||
send(cycle2().clone());
|
send(cycle2().clone());
|
||||||
|
|
||||||
Rc::new(Cell::new(5))
|
Rc::new(Cell::new(5))
|
||||||
|
|
|
@ -28,33 +28,29 @@ note: required by `send`
|
||||||
LL | fn send<T: Send>(_: T) {}
|
LL | fn send<T: Send>(_: T) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when processing `cycle1`
|
||||||
--> $DIR/auto-trait-leak.rs:42:1
|
|
||||||
|
|
|
||||||
LL | fn cycle1() -> impl Clone {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when processing `cycle1`...
|
|
||||||
--> $DIR/auto-trait-leak.rs:42:1
|
--> $DIR/auto-trait-leak.rs:42:1
|
||||||
|
|
|
|
||||||
LL | fn cycle1() -> impl Clone {
|
LL | fn cycle1() -> impl Clone {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which then requires processing `cycle2::{{impl-Trait}}`...
|
|
|
||||||
--> $DIR/auto-trait-leak.rs:50:16
|
note: ...which requires processing `cycle2::{{impl-Trait}}`...
|
||||||
|
--> $DIR/auto-trait-leak.rs:49:16
|
||||||
|
|
|
|
||||||
LL | fn cycle2() -> impl Clone {
|
LL | fn cycle2() -> impl Clone {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
note: ...which then requires processing `cycle2`...
|
note: ...which requires processing `cycle2`...
|
||||||
--> $DIR/auto-trait-leak.rs:50:1
|
--> $DIR/auto-trait-leak.rs:49:1
|
||||||
|
|
|
|
||||||
LL | fn cycle2() -> impl Clone {
|
LL | fn cycle2() -> impl Clone {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which then requires processing `cycle1::{{impl-Trait}}`...
|
note: ...which requires processing `cycle1::{{impl-Trait}}`...
|
||||||
--> $DIR/auto-trait-leak.rs:42:16
|
--> $DIR/auto-trait-leak.rs:42:16
|
||||||
|
|
|
|
||||||
LL | fn cycle1() -> impl Clone {
|
LL | fn cycle1() -> impl Clone {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
= note: ...which then again requires processing `cycle1`, completing the cycle.
|
= note: ...which again requires processing `cycle1`, completing the cycle
|
||||||
|
note: cycle used when type-checking all item bodies
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait t1 : t2 {
|
trait t1 : t2 {
|
||||||
|
//~^ ERROR cycle detected
|
||||||
}
|
}
|
||||||
|
|
||||||
trait t2 : t1 {
|
trait t2 : t1 {
|
||||||
//~^ ERROR cyclic dependency detected
|
|
||||||
//~| cyclic reference
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when computing the supertraits of `t1`
|
||||||
--> $DIR/issue-12511.rs:14:1
|
--> $DIR/issue-12511.rs:11:1
|
||||||
|
|
|
||||||
|
LL | trait t1 : t2 {
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: ...which requires computing the supertraits of `t2`...
|
||||||
|
--> $DIR/issue-12511.rs:15:1
|
||||||
|
|
|
|
||||||
LL | trait t2 : t1 {
|
LL | trait t2 : t1 {
|
||||||
| ^^^^^^^^^^^^^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when computing the supertraits of `t1`...
|
|
||||||
--> $DIR/issue-12511.rs:11:1
|
|
||||||
|
|
|
||||||
LL | trait t1 : t2 {
|
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
note: ...which then requires computing the supertraits of `t2`...
|
= note: ...which again requires computing the supertraits of `t1`, completing the cycle
|
||||||
--> $DIR/issue-12511.rs:11:1
|
|
||||||
|
|
|
||||||
LL | trait t1 : t2 {
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
= note: ...which then again requires computing the supertraits of `t1`, completing the cycle.
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when const-evaluating `X::A::{{initializer}}`
|
||||||
--> $DIR/issue-23302-1.rs:14:9
|
|
||||||
|
|
|
||||||
LL | A = X::A as isize, //~ ERROR E0391
|
|
||||||
| ^^^^^^^^^^^^^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when const-evaluating `X::A::{{initializer}}`...
|
|
||||||
--> $DIR/issue-23302-1.rs:14:9
|
|
||||||
|
|
|
||||||
LL | A = X::A as isize, //~ ERROR E0391
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
note: ...which then requires computing layout of `X`...
|
|
||||||
--> $DIR/issue-23302-1.rs:14:9
|
--> $DIR/issue-23302-1.rs:14:9
|
||||||
|
|
|
|
||||||
LL | A = X::A as isize, //~ ERROR E0391
|
LL | A = X::A as isize, //~ ERROR E0391
|
||||||
| ^^^^
|
| ^^^^
|
||||||
= note: ...which then again requires const-evaluating `X::A::{{initializer}}`, completing the cycle.
|
|
|
||||||
|
note: ...which requires computing layout of `X`...
|
||||||
|
= note: ...which again requires const-evaluating `X::A::{{initializer}}`, completing the cycle
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when const-evaluating `Y::A::{{initializer}}`
|
||||||
--> $DIR/issue-23302-2.rs:14:9
|
|
||||||
|
|
|
||||||
LL | A = Y::B as isize, //~ ERROR E0391
|
|
||||||
| ^^^^^^^^^^^^^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when const-evaluating `Y::A::{{initializer}}`...
|
|
||||||
--> $DIR/issue-23302-2.rs:14:9
|
|
||||||
|
|
|
||||||
LL | A = Y::B as isize, //~ ERROR E0391
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
note: ...which then requires computing layout of `Y`...
|
|
||||||
--> $DIR/issue-23302-2.rs:14:9
|
--> $DIR/issue-23302-2.rs:14:9
|
||||||
|
|
|
|
||||||
LL | A = Y::B as isize, //~ ERROR E0391
|
LL | A = Y::B as isize, //~ ERROR E0391
|
||||||
| ^^^^
|
| ^^^^
|
||||||
= note: ...which then again requires const-evaluating `Y::A::{{initializer}}`, completing the cycle.
|
|
|
||||||
|
note: ...which requires computing layout of `Y`...
|
||||||
|
= note: ...which again requires const-evaluating `Y::A::{{initializer}}`, completing the cycle
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
const A: i32 = B;
|
const A: i32 = B; //~ ERROR cycle detected
|
||||||
|
|
||||||
const B: i32 = A; //~ ERROR cyclic dependency detected
|
const B: i32 = A;
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,30 +1,25 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when const checking if rvalue is promotable to static `A`
|
||||||
--> $DIR/issue-23302-3.rs:13:16
|
|
||||||
|
|
|
||||||
LL | const B: i32 = A; //~ ERROR cyclic dependency detected
|
|
||||||
| ^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when const checking if rvalue is promotable to static `A`...
|
|
||||||
--> $DIR/issue-23302-3.rs:11:1
|
--> $DIR/issue-23302-3.rs:11:1
|
||||||
|
|
|
|
||||||
LL | const A: i32 = B;
|
LL | const A: i32 = B; //~ ERROR cycle detected
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
note: ...which then requires checking which parts of `A` are promotable to static...
|
|
||||||
--> $DIR/issue-23302-3.rs:11:1
|
|
||||||
|
|
|
|
||||||
LL | const A: i32 = B;
|
note: ...which requires checking which parts of `A` are promotable to static...
|
||||||
| ^^^^^^^^^^^^^^^^^
|
|
||||||
note: ...which then requires const checking if rvalue is promotable to static `B`...
|
|
||||||
--> $DIR/issue-23302-3.rs:11:16
|
--> $DIR/issue-23302-3.rs:11:16
|
||||||
|
|
|
|
||||||
LL | const A: i32 = B;
|
LL | const A: i32 = B; //~ ERROR cycle detected
|
||||||
| ^
|
| ^
|
||||||
note: ...which then requires checking which parts of `B` are promotable to static...
|
note: ...which requires const checking if rvalue is promotable to static `B`...
|
||||||
--> $DIR/issue-23302-3.rs:13:1
|
--> $DIR/issue-23302-3.rs:13:1
|
||||||
|
|
|
|
||||||
LL | const B: i32 = A; //~ ERROR cyclic dependency detected
|
LL | const B: i32 = A;
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which then again requires const checking if rvalue is promotable to static `A`, completing the cycle.
|
note: ...which requires checking which parts of `B` are promotable to static...
|
||||||
|
--> $DIR/issue-23302-3.rs:13:16
|
||||||
|
|
|
||||||
|
LL | const B: i32 = A;
|
||||||
|
| ^
|
||||||
|
= note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,21 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when const-evaluating `Foo::B::{{initializer}}`
|
||||||
--> $DIR/issue-36163.rs:14:9
|
|
||||||
|
|
|
||||||
LL | B = A, //~ ERROR E0391
|
|
||||||
| ^ cyclic reference
|
|
||||||
|
|
|
||||||
note: the cycle begins when const-evaluating `Foo::B::{{initializer}}`...
|
|
||||||
--> $DIR/issue-36163.rs:14:9
|
--> $DIR/issue-36163.rs:14:9
|
||||||
|
|
|
|
||||||
LL | B = A, //~ ERROR E0391
|
LL | B = A, //~ ERROR E0391
|
||||||
| ^
|
| ^
|
||||||
note: ...which then requires processing `Foo::B::{{initializer}}`...
|
|
|
||||||
|
note: ...which requires processing `Foo::B::{{initializer}}`...
|
||||||
--> $DIR/issue-36163.rs:14:9
|
--> $DIR/issue-36163.rs:14:9
|
||||||
|
|
|
|
||||||
LL | B = A, //~ ERROR E0391
|
LL | B = A, //~ ERROR E0391
|
||||||
| ^
|
| ^
|
||||||
note: ...which then requires const-evaluating `A`...
|
note: ...which requires const-evaluating `A`...
|
||||||
--> $DIR/issue-36163.rs:11:1
|
|
||||||
|
|
|
||||||
LL | const A: isize = Foo::B as isize;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
note: ...which then requires computing layout of `Foo`...
|
|
||||||
--> $DIR/issue-36163.rs:11:18
|
--> $DIR/issue-36163.rs:11:18
|
||||||
|
|
|
|
||||||
LL | const A: isize = Foo::B as isize;
|
LL | const A: isize = Foo::B as isize;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
= note: ...which then again requires const-evaluating `Foo::B::{{initializer}}`, completing the cycle.
|
note: ...which requires computing layout of `Foo`...
|
||||||
|
= note: ...which again requires const-evaluating `Foo::B::{{initializer}}`, completing the cycle
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,6 @@ pub trait ToNbt<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToNbt<Self> {}
|
impl ToNbt<Self> {}
|
||||||
//~^ ERROR cyclic dependency detected
|
//~^ ERROR cycle detected
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
error[E0391]: cyclic dependency detected
|
error[E0391]: cycle detected when processing `<impl at $DIR/issue-23305.rs:15:1: 15:20>`
|
||||||
--> $DIR/issue-23305.rs:15:12
|
--> $DIR/issue-23305.rs:15:12
|
||||||
|
|
|
|
||||||
LL | impl ToNbt<Self> {}
|
LL | impl ToNbt<Self> {}
|
||||||
| ^^^^ cyclic reference
|
| ^^^^
|
||||||
|
|
|
|
||||||
note: the cycle begins when processing `<impl at $DIR/issue-23305.rs:15:1: 15:20>`...
|
= note: ...which again requires processing `<impl at $DIR/issue-23305.rs:15:1: 15:20>`, completing the cycle
|
||||||
--> $DIR/issue-23305.rs:15:1
|
|
||||||
|
|
|
||||||
LL | impl ToNbt<Self> {}
|
|
||||||
| ^^^^^^^^^^^^^^^^
|
|
||||||
= note: ...which then again requires processing `<impl at $DIR/issue-23305.rs:15:1: 15:20>`, completing the cycle.
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue