Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add type annotation to LambdaRequest's Deserialize impl to avoid compiler recursive loop #960

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raulescobar-g
Copy link

I ran into an issue where the compiler would get into an infinite loop evaluating lambda_http/src/deserializer.rs:23. I haven't seen anyone else complaining, so this might just be an issue from my own code.

error[E0275]: overflow evaluating the requirement `Box<_>: Deserialize<'_>`
  --> /home/redacted/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lambda_http-0.13.0/src/deserializer.rs:23:45
   |
23 |         let raw_value: Box<RawValue> = Box::deserialize(deserializer)?;
   |                                             ^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`lambda_http`)
   = note: required for `Box<zerovec::varzerovec::slice::VarZeroSlice<_, _>>` to implement `Deserialize<'_>`
   = note: 126 redundant requirements hidden
   = note: required for `Box<VarZeroSlice<VarZeroSlice<VarZeroSlice<VarZeroSlice<..., ...>, ...>, ...>, ...>>` to implement `Deserialize<'_>`
   = note: the full name for the type has been written to '/home/redacted/Documents/bernardino-reports/target/debug/deps/lambda_http-09107d4e09e782b6.long-type-5185401784481107607.txt'
   = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0275`.
error: could not compile `lambda_http` (lib) due to 1 previous error

I am not experienced in rust, or oss contributions in general, so apologies in advance if I am not following proper oss ettiquet and any advice/help would be appreciated.

📬 Issue #, if available:
n/a.

✍️ Description of changes:
added a type hint to deserialize implementation of LambdaRequest. This avoids an infinite loop when evaluating a Box::deserialize()

🔏 By submitting this pull request

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

@raulescobar-g raulescobar-g changed the title Add type hint to LambdaRequest's Deserialize impl to avoid compiler recursive loop fix: Add type hint to LambdaRequest's Deserialize impl to avoid compiler recursive loop Jan 21, 2025
@raulescobar-g raulescobar-g changed the title fix: Add type hint to LambdaRequest's Deserialize impl to avoid compiler recursive loop fix: Add type annotation to LambdaRequest's Deserialize impl to avoid compiler recursive loop Jan 21, 2025
@raulescobar-g
Copy link
Author

I don't know why adding the annotation helped when there's already a type hint on the left hand side. My rustc version is cargo 1.82.0 (8f40fc59f 2024-08-21) if thats relevant.

@fabiandiez
Copy link

I can confirm this is happening on rustc 1.85.0 (4d91de4e4 2025-02-17)/lambda_http-0.14.0 as well for me.

@aradwann
Copy link

I can confirm that too

I can confirm this is happening on rustc 1.85.0 (4d91de4e4 2025-02-17)/lambda_http-0.14.0 as well for me.

@bnusunny
Copy link
Contributor

This is interesting. I will take a look soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants