Skip to content

Commit fd815a5

Browse files
committed
Auto merge of rust-lang#104610 - ouz-a:revert-overflow, r=compiler-errors
Reverts check done by rust-lang#100757 As my `fix` caused more issues than it resolved it's better to revert it. ( rust-lang#103274 rust-lang#104322 rust-lang#104606) r? `@compiler-errors` Reopens rust-lang#95134
2 parents 872631d + 701970e commit fd815a5

File tree

6 files changed

+13
-29
lines changed

6 files changed

+13
-29
lines changed

compiler/rustc_trait_selection/src/traits/project.rs

-16
Original file line numberDiff line numberDiff line change
@@ -566,22 +566,6 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
566566
.flatten()
567567
.unwrap_or_else(|| ty.super_fold_with(self).into())
568568
};
569-
// For cases like #95134 we would like to catch overflows early
570-
// otherwise they slip away and cause ICE.
571-
let recursion_limit = self.tcx().recursion_limit();
572-
if !recursion_limit.value_within_limit(self.depth)
573-
// HACK: Don't overflow when running cargo doc see #100991
574-
&& !self.tcx().sess.opts.actually_rustdoc
575-
{
576-
let obligation = Obligation::with_depth(
577-
self.selcx.tcx(),
578-
self.cause.clone(),
579-
recursion_limit.0,
580-
self.param_env,
581-
ty,
582-
);
583-
self.selcx.infcx().err_ctxt().report_overflow_error(&obligation, true);
584-
}
585569
debug!(
586570
?self.depth,
587571
?ty,

src/test/ui/issues/issue-23122-2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
12
trait Next {
23
type Next: Next;
34
}

src/test/ui/issues/issue-23122-2.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
error[E0275]: overflow evaluating the requirement `<T as Next>::Next`
2-
--> $DIR/issue-23122-2.rs:10:17
1+
error[E0275]: overflow evaluating the requirement `<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized`
2+
--> $DIR/issue-23122-2.rs:11:17
33
|
44
LL | type Next = <GetNext<T::Next> as Next>::Next;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`)
8+
note: required for `GetNext<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next`
9+
--> $DIR/issue-23122-2.rs:10:15
10+
|
11+
LL | impl<T: Next> Next for GetNext<T> {
12+
| ^^^^ ^^^^^^^^^^
13+
= note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-hash.txt'
814

915
error: aborting due to previous error
1016

src/test/ui/recursion/issue-83150.stderr

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ LL | func(&mut iter.map(|x| x + 1))
99
= help: a `loop` may express intention better if this is on purpose
1010
= note: `#[warn(unconditional_recursion)]` on by default
1111

12-
error[E0275]: overflow evaluating the requirement `<std::ops::Range<u8> as Iterator>::Item`
12+
error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>: Iterator`
1313
|
1414
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
15-
= note: required for `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:12:24: 12:27]>` to implement `Iterator`
16-
= note: 64 redundant requirements hidden
1715
= note: required for `&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>` to implement `Iterator`
1816
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt'
1917

src/test/ui/recursion/issue-95134.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// build-fail
2+
// known-bug: #95134
23
// compile-flags: -Copt-level=0
3-
//~^^ ERROR overflow evaluating the requirement
4+
// failure-status: 101
5+
// dont-check-compiler-stderr
46

57
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
68
if n > 15 {

src/test/ui/recursion/issue-95134.stderr

-7
This file was deleted.

0 commit comments

Comments
 (0)