Skip to content

Commit 25ec810

Browse files
authored
Rollup merge of rust-lang#47987 - Zoxc:rm-recursion-checking, r=eddyb
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
2 parents 6070d3e + 46a3f2f commit 25ec810

37 files changed

+111
-401
lines changed

src/librustc/ty/maps/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
8484
let span = self.sess.codemap().def_span(span);
8585
let mut err =
8686
struct_span_err!(self.sess, span, E0391,
87-
"unsupported cyclic reference between types/traits detected");
87+
"cyclic dependency detected");
8888
err.span_label(span, "cyclic reference");
8989

9090
err.span_note(self.sess.codemap().def_span(stack[0].0),

src/librustc_driver/driver.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use rustc_typeck as typeck;
3636
use rustc_privacy;
3737
use rustc_plugin::registry::Registry;
3838
use rustc_plugin as plugin;
39-
use rustc_passes::{self, ast_validation, loops, consts, static_recursion, hir_stats};
39+
use rustc_passes::{self, ast_validation, loops, consts, hir_stats};
4040
use rustc_const_eval::{self, check_match};
4141
use super::Compilation;
4242

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

993-
time(time_passes,
994-
"static item recursion checking",
995-
|| static_recursion::check_crate(sess, &hir_map))?;
996-
997993
let mut local_providers = ty::maps::Providers::default();
998994
default_provide(&mut local_providers);
999995
trans.provide(&mut local_providers);

src/librustc_passes/diagnostics.rs

-16
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,6 @@ impl !Enterprise for Foo { }
128128
Please note that negative impls are only allowed for auto traits.
129129
"##,
130130

131-
E0265: r##"
132-
This error indicates that a static or constant references itself.
133-
All statics and constants need to resolve to a value in an acyclic manner.
134-
135-
For example, neither of the following can be sensibly compiled:
136-
137-
```compile_fail,E0265
138-
const X: u32 = X;
139-
```
140-
141-
```compile_fail,E0265
142-
const X: u32 = Y;
143-
const Y: u32 = X;
144-
```
145-
"##,
146-
147131
E0267: r##"
148132
This error indicates the use of a loop keyword (`break` or `continue`) inside a
149133
closure but outside of any loop. Erroneous code example:

src/librustc_passes/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ pub mod consts;
4242
pub mod hir_stats;
4343
pub mod loops;
4444
mod mir_stats;
45-
pub mod static_recursion;
4645

4746
__build_diagnostic_array! { librustc_passes, DIAGNOSTICS }
4847

src/librustc_passes/static_recursion.rs

-280
This file was deleted.

src/test/compile-fail/coherence-inherited-assoc-ty-cycle-err.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#![feature(specialization)]
1818

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

2222
impl<T> Trait<T> for Vec<T> {
2323
type Assoc = ();

src/test/compile-fail/const-size_of-cycle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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

1313
#![feature(const_fn)]
1414

src/test/compile-fail/cycle-projection-based-on-where-clause.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait Trait { type Item; }
2525
struct A<T>
2626
where T : Trait,
2727
T : Add<T::Item>
28-
//~^ ERROR unsupported cyclic reference between types/traits detected
28+
//~^ ERROR cyclic dependency detected
2929
//~| ERROR associated type `Item` not found for `T`
3030
{
3131
data: T

src/test/compile-fail/cycle-trait-default-type-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// again references the trait.
1313

1414
trait Foo<X = Box<Foo>> {
15-
//~^ ERROR unsupported cyclic reference
15+
//~^ ERROR cyclic dependency detected
1616
}
1717

1818
fn main() { }

src/test/compile-fail/cycle-trait-supertrait-direct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test a supertrait cycle where a trait extends itself.
1212

1313
trait Chromosome: Chromosome {
14-
//~^ ERROR unsupported cyclic reference
14+
//~^ ERROR cyclic dependency detected
1515
}
1616

1717
fn main() { }

src/test/compile-fail/infinite-vec-type-recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

1111
type x = Vec<x>;
12-
//~^ ERROR unsupported cyclic reference
12+
//~^ ERROR cyclic dependency detected
1313

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

0 commit comments

Comments
 (0)