Issue #1124: A run throwing fn parameter beside an own throw: rustc finds no From<Box> for Thrown<..>

Open and answer this issue on GitHub.

ready · opened 2026-11-01 · updated 2026-11-01 · 0 comments

Found by the builder for #1120 on 2026-11-01. The defect is also in the binary from before that fix.

A function can have both of these:

When it does, the parameter’s call scoped(n)? is lowered into the function’s Thrown<Negative>. That conversion fails: rustc finds no From<Box<dyn Error>>.

It looks like the ADR-351 D4 throw set counts the errors of a code call as known, when they are an open Box<dyn Error>.

Probe

struct Negative { why: String }
impl Error for Negative { fn message(ref self) -> String { return self.why.clone() } }

fn checked(n: i64, scoped: fn(i64) -> i64 sync throws) -> i64 sync throws {
	if n > 100 {
		throw Negative { why: "big" }
	}
	return scoped(n)
}

fn main() {
	let k: fn(i64) -> i64 sync throws = fn(x) {
		if x < 0 {
			throw Negative { why: "negative" }
		}
		return x * 2
	}
	let d = checked(21, fn(n) { return k(n) }) catch {
		println(f"refused: {error}")
		return
	}
	println(f"{d}")
}

Expected output: 42. Actual: rustc refuses the program (From<Box<dyn Error>> is not implemented for Thrown<Negative>).

To build

Back to Open Issues