Sign in
fuchsia
/
third_party
/
rust
/
7de9402b77ded0d8ec9e1c554521b2121449ef2b
/
.
/
src
/
test
/
ui
/
borrowck
/
borrowck-auto-mut-ref-to-immut-var.rs
blob: 247e3da186be8acbe15ed1512685584b9453967c [
file
] [
log
] [
blame
]
// Tests that auto-ref can't create mutable aliases to immutable memory.
struct
Foo
{
x
:
isize
}
impl
Foo
{
pub
fn
printme
(&
mut
self
)
{
println
!(
"{}"
,
self
.
x
);
}
}
fn
main
()
{
let
x
=
Foo
{
x
:
3
};
x
.
printme
();
//~ ERROR cannot borrow
}