You might be interested in the Strict Memory Safety option
https://docs.swift.org/compiler/documentation/diagnostics/st...