Skip to content

Commit

Permalink
Rollup merge of rust-lang#47987 - Zoxc:rm-recursion-checking, r=eddyb
Browse files Browse the repository at this point in the history
Remove "static item recursion checking" in favor of relying on cycle checks in the query engine

Tests are changed to use the cycle check error message instead. Some duplicate tests are removed.

r? @eddyb
  • Loading branch information
Manishearth committed Feb 24, 2018
2 parents 6070d3e + 46a3f2f commit 25ec810
Show file tree
Hide file tree
Showing 37 changed files with 111 additions and 401 deletions.
2 changes: 1 addition & 1 deletion src/librustc/ty/maps/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let span = self.sess.codemap().def_span(span);
let mut err =
struct_span_err!(self.sess, span, E0391,
"unsupported cyclic reference between types/traits detected");
"cyclic dependency detected");
err.span_label(span, "cyclic reference");

err.span_note(self.sess.codemap().def_span(stack[0].0),
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use rustc_typeck as typeck;
use rustc_privacy;
use rustc_plugin::registry::Registry;
use rustc_plugin as plugin;
use rustc_passes::{self, ast_validation, loops, consts, static_recursion, hir_stats};
use rustc_passes::{self, ast_validation, loops, consts, hir_stats};
use rustc_const_eval::{self, check_match};
use super::Compilation;

Expand Down Expand Up @@ -990,10 +990,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
"loop checking",
|| loops::check_crate(sess, &hir_map));

time(time_passes,
"static item recursion checking",
|| static_recursion::check_crate(sess, &hir_map))?;

let mut local_providers = ty::maps::Providers::default();
default_provide(&mut local_providers);
trans.provide(&mut local_providers);
Expand Down
16 changes: 0 additions & 16 deletions src/librustc_passes/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,6 @@ impl !Enterprise for Foo { }
Please note that negative impls are only allowed for auto traits.
"##,

E0265: r##"
This error indicates that a static or constant references itself.
All statics and constants need to resolve to a value in an acyclic manner.
For example, neither of the following can be sensibly compiled:
```compile_fail,E0265
const X: u32 = X;
```
```compile_fail,E0265
const X: u32 = Y;
const Y: u32 = X;
```
"##,

E0267: r##"
This error indicates the use of a loop keyword (`break` or `continue`) inside a
closure but outside of any loop. Erroneous code example:
Expand Down
1 change: 0 additions & 1 deletion src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub mod consts;
pub mod hir_stats;
pub mod loops;
mod mir_stats;
pub mod static_recursion;

__build_diagnostic_array! { librustc_passes, DIAGNOSTICS }

Expand Down
280 changes: 0 additions & 280 deletions src/librustc_passes/static_recursion.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![feature(specialization)]

trait Trait<T> { type Assoc; }
//~^ unsupported cyclic reference between types/traits detected [E0391]
//~^ cyclic dependency detected [E0391]

impl<T> Trait<T> for Vec<T> {
type Assoc = ();
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/const-size_of-cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: unsupported cyclic reference between types/traits detected
// error-pattern: cyclic dependency detected

#![feature(const_fn)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait Trait { type Item; }
struct A<T>
where T : Trait,
T : Add<T::Item>
//~^ ERROR unsupported cyclic reference between types/traits detected
//~^ ERROR cyclic dependency detected
//~| ERROR associated type `Item` not found for `T`
{
data: T
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/cycle-trait-default-type-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// again references the trait.

trait Foo<X = Box<Foo>> {
//~^ ERROR unsupported cyclic reference
//~^ ERROR cyclic dependency detected
}

fn main() { }
2 changes: 1 addition & 1 deletion src/test/compile-fail/cycle-trait-supertrait-direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Test a supertrait cycle where a trait extends itself.

trait Chromosome: Chromosome {
//~^ ERROR unsupported cyclic reference
//~^ ERROR cyclic dependency detected
}

fn main() { }
2 changes: 1 addition & 1 deletion src/test/compile-fail/infinite-vec-type-recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
// except according to those terms.

type x = Vec<x>;
//~^ ERROR unsupported cyclic reference
//~^ ERROR cyclic dependency detected

fn main() { let b: x = Vec::new(); }
Loading

0 comments on commit 25ec810

Please sign in to comment.