revert-overflow
This commit is contained in:
parent
2a434286a9
commit
90128c30a0
5 changed files with 8 additions and 55 deletions
|
@ -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,
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
error[E0275]: overflow evaluating the requirement `<T as Next>::Next`
|
||||
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:10: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:9: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-2230235837754269907.txt'
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// build-fail
|
||||
// compile-flags: -Copt-level=0
|
||||
//~^^ ERROR overflow evaluating the requirement
|
||||
|
||||
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
|
||||
if n > 15 {
|
||||
encode_num(n / 16, &mut writer)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub trait ExampleWriter {
|
||||
type Error;
|
||||
}
|
||||
|
||||
impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T {
|
||||
type Error = T::Error;
|
||||
}
|
||||
|
||||
struct EmptyWriter;
|
||||
|
||||
impl ExampleWriter for EmptyWriter {
|
||||
type Error = ();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
encode_num(69, &mut EmptyWriter).unwrap();
|
||||
}
|
|
@ -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`.
|
Loading…
Add table
Add a link
Reference in a new issue