"Attempt to return reference to stack var via ref field"

ref struct IntRefWrapper {
	public ref int MyRef;
}

static IntRefWrapper DoSomethingBad() {
	var x = 123;
	var refWrapper = new IntRefWrapper { MyRef = ref x };
	return refWrapper; // Won't compile-- compiler knows we're leaking a reference to 'x'.
}


Code snippet taken from "Complete C# Quick Reference - C# 11".