You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recursive function call generates confusing overflow message #72577
changed the title [-]error[E0275]: overflow evaluating the requirement `&mut bytes::bytes_mut::BytesMut: bytes::buf::buf_impl::Buf`[/-][+]Error message that's a bit hard to figure out[/+]on May 25, 2020
@o0Ignition0o: You can make this compile by changing get_value(&mut buf) to get_value(buf) - note that this will cause infinite recursion at runtime if buf.has_remaining() == false
Trying to monomorphize do_more::<B> causes us to recursively monomorphize do_more::<&mut B>, which will eventually hit the recursion limit.
We should be able to detect this kind of recursive monomorphization in simple cases (when the function directly calls itself rather than going through a helper function).
Oh thanks a lot! So long story short I should try to avoid recursion in this kind of scenario ? (the real life use case is a bit more complicated, but i was willing about to use recursion to solve it ^^')
changed the title [-]Error message that's a bit hard to figure out[/-][+]Recursive function call generates confusing overflow message[/+]on May 28, 2020
error: reached the recursion limit while instantiating `do_more::<&mut &mut &mut &mut &mut ...>`
--> src/main.rs:17:9
|
17 | do_more(&mut buf)
| ^^^^^^^^^^^^^^^^^
|
note: `do_more` defined here
--> src/main.rs:10:1
|
10 | / fn do_more<B>(mut buf: B) -> Result<i32, String>
11 | | where
12 | | B: Buf,
| |___________^
= note: the full type name has been written to '/playground/target/debug/deps/playground-b0d2208020a7eb98.long-type.txt'
Activity
[-]error[E0275]: overflow evaluating the requirement `&mut bytes::bytes_mut::BytesMut: bytes::buf::buf_impl::Buf`[/-][+]Error message that's a bit hard to figure out[/+]Aaron1011 commentedon May 25, 2020
@o0Ignition0o: You can make this compile by changing
get_value(&mut buf)toget_value(buf)- note that this will cause infinite recursion at runtime ifbuf.has_remaining() == falseMinimized:
Trying to monomorphize
do_more::<B>causes us to recursively monomorphizedo_more::<&mut B>, which will eventually hit the recursion limit.We should be able to detect this kind of recursive monomorphization in simple cases (when the function directly calls itself rather than going through a helper function).
o0Ignition0o commentedon May 25, 2020
Oh thanks a lot! So long story short I should try to avoid recursion in this kind of scenario ? (the real life use case is a bit more complicated, but i was willing about to use recursion to solve it ^^')
thanks again :D
[-]Error message that's a bit hard to figure out[/-][+]Recursive function call generates confusing overflow message[/+]Rollup merge of rust-lang#73601 - Aaron1011:fix/better-mono-overflow-…
Rollup merge of rust-lang#73601 - Aaron1011:fix/better-mono-overflow-…
estebank commentedon May 27, 2024
Current output: