Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.
Discussion options

You must be logged in to vote

So, interestingly, neither of these errors really has anything to do with chumsky (sort of).

One of the lifetime errors you're seeing is pointing at a real problem. Take a look at the following code:

if let Item::Use(item_use) = item {
    let input_file = PathBuf::from(item_use.file_path);
    let source =
        std::fs::read_to_string(&input_file).map_err(|error| error.to_string())?;

    modules = check(&input_file, &source, modules)?;
}

Here, you load the contents of a file into a String, source. You then call check, which returns Result<HashMap<PathBuf, Vec<Item<'src>>>, String>. Note that this type contains the 'src lifetime, which only lives as long as source! But source gets dro…

Replies: 1 comment 15 replies

Comment options

You must be logged in to vote
15 replies
@Zij-IT
Comment options

@jimmycuadra
Comment options

@jimmycuadra
Comment options

@zesterer
Comment options

Answer selected by jimmycuadra
@jimmycuadra
Comment options

@zesterer
Comment options

@jimmycuadra
Comment options

@zesterer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants