Skip to content

Handle Format!() #4

@muhammad-hassnain

Description

@muhammad-hassnain

This is just a dump of my notes to handle this function, so I know where to look at if we decide to support this later.

calling Format!() actually

calls these three

  • core::fmt::rt::Argument::<'a>::new_display -> get's called one time for each arg with {} in format
  • std::fmt::Arguments::<'a>::new_v1 -> once upper one is done with all, this gets called
  • std::fmt::format -> finally, this gets called to actually format the string

I have spent 2 days trying to handle all possible cases here, but I think, there is something else wrong in our assign_constant_value (it's ignoring unrecognized types) it will probably be better to either have a heuristic or a default fall back in those cases. Similarly, in parse_assignment , Rvalue::Aggregate is incomplete, it only caters for the case if operands len is 1, but a slice also ends up here, and a struct can also have multiple arguments, need to look both of these cases.

I have pushed placeholder handler functions for above three, with some notes on what each function is supposed to do in handlers.rs and added an example in examples/crates/safe/io_read1 , this should be classified safe, if we handle this correctly. For now that test case fails.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions