diff options
| author | bors <bors@rust-lang.org> | 2022-11-24 03:29:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-24 03:29:04 +0000 |
| commit | fd815a5091eb4d49cd317f8ad272f17b7a5f550d (patch) | |
| tree | 456c3356e45849e24608f3f61439f7070521177d | |
| parent | 872631d0f0fadffe3220ab1bd9c8f1f2342341e2 (diff) | |
| parent | 701970e0b8941537f3b34381d2cc98940c4e71db (diff) | |
| download | rust-fd815a5091eb4d49cd317f8ad272f17b7a5f550d.tar.gz rust-fd815a5091eb4d49cd317f8ad272f17b7a5f550d.zip | |
Auto merge of #104610 - ouz-a:revert-overflow, r=compiler-errors
Reverts check done by #100757 As my `fix` caused more issues than it resolved it's better to revert it. ( #103274 #104322 https://github.com/rust-lang/rust/issues/104606) r? `@compiler-errors` Reopens #95134
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23122-2.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23122-2.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/recursion/issue-83150.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/recursion/issue-95134.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/recursion/issue-95134.stderr | 7 |
6 files changed, 13 insertions, 29 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 9f19b0092c0..7b2329b1ddd 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -566,22 +566,6 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> { .flatten() .unwrap_or_else(|| ty.super_fold_with(self).into()) }; - // For cases like #95134 we would like to catch overflows early - // otherwise they slip away and cause ICE. - let recursion_limit = self.tcx().recursion_limit(); - if !recursion_limit.value_within_limit(self.depth) - // HACK: Don't overflow when running cargo doc see #100991 - && !self.tcx().sess.opts.actually_rustdoc - { - let obligation = Obligation::with_depth( - self.selcx.tcx(), - self.cause.clone(), - recursion_limit.0, - self.param_env, - ty, - ); - self.selcx.infcx().err_ctxt().report_overflow_error(&obligation, true); - } debug!( ?self.depth, ?ty, diff --git a/src/test/ui/issues/issue-23122-2.rs b/src/test/ui/issues/issue-23122-2.rs index 95e1f60d8b0..338789c2e87 100644 --- a/src/test/ui/issues/issue-23122-2.rs +++ b/src/test/ui/issues/issue-23122-2.rs @@ -1,3 +1,4 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" trait Next { type Next: Next; } diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index f6cda3de5c7..5828e027b59 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -1,10 +1,16 @@ -error[E0275]: overflow evaluating the requirement `<T as Next>::Next` - --> $DIR/issue-23122-2.rs:10:17 +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` + --> $DIR/issue-23122-2.rs:11:17 | LL | type Next = <GetNext<T::Next> as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) +note: required for `GetNext<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` + --> $DIR/issue-23122-2.rs:10:15 + | +LL | impl<T: Next> Next for GetNext<T> { + | ^^^^ ^^^^^^^^^^ + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-hash.txt' error: aborting due to previous error diff --git a/src/test/ui/recursion/issue-83150.stderr b/src/test/ui/recursion/issue-83150.stderr index a67bfd018a2..4d00a708313 100644 --- a/src/test/ui/recursion/issue-83150.stderr +++ b/src/test/ui/recursion/issue-83150.stderr @@ -9,11 +9,9 @@ LL | func(&mut iter.map(|x| x + 1)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `<std::ops::Range<u8> as Iterator>::Item` +error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required for `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:12:24: 12:27]>` to implement `Iterator` - = note: 64 redundant requirements hidden = note: required for `&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>` to implement `Iterator` = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt' diff --git a/src/test/ui/recursion/issue-95134.rs b/src/test/ui/recursion/issue-95134.rs index adc9c6ee2d9..fdc4d536981 100644 --- a/src/test/ui/recursion/issue-95134.rs +++ b/src/test/ui/recursion/issue-95134.rs @@ -1,6 +1,8 @@ // build-fail +// known-bug: #95134 // compile-flags: -Copt-level=0 -//~^^ ERROR overflow evaluating the requirement +// failure-status: 101 +// dont-check-compiler-stderr pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { if n > 15 { diff --git a/src/test/ui/recursion/issue-95134.stderr b/src/test/ui/recursion/issue-95134.stderr deleted file mode 100644 index 57a498694b7..00000000000 --- a/src/test/ui/recursion/issue-95134.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error[E0275]: overflow evaluating the requirement `<EmptyWriter as ExampleWriter>::Error` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_95134`) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0275`. |
