Skip to content

Panic on unimplemented math expression for macro call #657

@ghost

Description

use tera::{Context, Tera};

fn main() {
    let data = "{{x::y()+0}}";

    let _ = Tera::one_off(&data, &Context::new(), true);
}

Gives

thread 'main' panicked at 'internal error: entered unreachable code: unimplemented math expression for MacroCall(MacroCall { namespace: "x", name: "y", args: {} })', /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:895:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/952fdf2a1119affa1b37bcacb0c49cf9f0168ac8/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/952fdf2a1119affa1b37bcacb0c49cf9f0168ac8/library/core/src/panicking.rs:92:14
   2: tera::renderer::processor::Processor::eval_as_number
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:895:18
   3: tera::renderer::processor::Processor::eval_expr_as_number
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:694:13
   4: tera::renderer::processor::Processor::eval_as_number
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:719:37
   5: tera::renderer::processor::Processor::eval_expression
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:424:39
   6: tera::renderer::processor::Processor::render_node
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:959:49
   7: tera::renderer::processor::Processor::render
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/processor.rs:1063:13
   8: tera::renderer::Renderer::render_to
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/mod.rs:60:9
   9: tera::renderer::Renderer::render
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/renderer/mod.rs:51:9
  10: tera::tera::Tera::render
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/tera.rs:314:9
  11: tera::tera::Tera::render_str
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/tera.rs:357:22
  12: tera::tera::Tera::one_off
             at /home/jess/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-1.12.1/src/tera.rs:381:9
  13: scratchYmFlkqOVl::main
             at ./main.rs:6:13
  14: core::ops::function::FnOnce::call_once
             at /rustc/952fdf2a1119affa1b37bcacb0c49cf9f0168ac8/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions