diag: preserve factual source atomic-access diagnostics
This commit is contained in:
1 parent
ee09a7a290
commit
edfef82cc6
18 files changed
+346
-9
No files matched your search
@@ -0,0 +1,13 @@
|
||||
// expect: reject E4202
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §12; docs/spec/04-concurrency-and-atomics.md §28
|
||||
module test.atomic_access_bool_parenthesized
|
||||
|
||||
fn main() -> bool effects [] {
|
||||
let cell = atomic.new(true);
|
||||
{
|
||||
ref r = cell;
|
||||
let value = *((r)); // diagnostic here: *((r))
|
||||
}
|
||||
trap;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §12; docs/spec/04-concurrency-and-atomics.md §28
|
||||
module test.atomic_access_explicit_load
|
||||
|
||||
fn read<T>(cell: ref<atomic<T>>) -> T effects [atomic] {
|
||||
return atomic.load(cell, seq_cst);
|
||||
}
|
||||
|
||||
fn main() -> u64 effects [atomic] {
|
||||
let cell = atomic.new(42u64);
|
||||
var result: u64 = 0;
|
||||
{
|
||||
ref r = cell;
|
||||
result = read::<u64>(r);
|
||||
}
|
||||
let last = atomic.take(move cell);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// expect: reject E4202
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §12; docs/spec/04-concurrency-and-atomics.md §28
|
||||
module test.atomic_access_parameter
|
||||
|
||||
fn read(cell: ref<atomic<u64>>) -> u64 effects [] {
|
||||
return *cell; // diagnostic here: *cell
|
||||
}
|
||||
|
||||
fn main() -> u64 effects [] {
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// expect: reject E4202
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §12; docs/spec/04-concurrency-and-atomics.md §28
|
||||
module test.atomic_access_reborrow
|
||||
|
||||
fn main() -> u64 effects [] {
|
||||
let cell = atomic.new(1u64);
|
||||
{
|
||||
ref r = cell;
|
||||
ref second = r;
|
||||
let value = *second; // diagnostic here: *second
|
||||
}
|
||||
trap;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// expect: reject E4202
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §12; docs/spec/04-concurrency-and-atomics.md §28
|
||||
module test.atomic_access_u8_cell
|
||||
|
||||
fn main() -> u8 effects [] {
|
||||
let cell = atomic.new(1u8);
|
||||
{
|
||||
ref r = cell;
|
||||
let value = *r; // diagnostic here: *r
|
||||
}
|
||||
trap;
|
||||
}
|
||||
Reference in new issue
Block a user