entry: fix entry-point stub spans (to point to the actual fn name).

This commit is contained in:
Eduard-Mihai Burtescu 2023-05-26 07:57:15 +03:00 committed by Eduard-Mihai Burtescu
parent 344605fde8
commit ecaefff584
5 changed files with 25 additions and 22 deletions

View File

@ -63,7 +63,10 @@ impl<'tcx> CodegenCx<'tcx> {
name: String, name: String,
entry: Entry, entry: Entry,
) { ) {
let span = self.tcx.def_span(instance.def_id()); let span = self
.tcx
.def_ident_span(instance.def_id())
.unwrap_or_else(|| self.tcx.def_span(instance.def_id()));
let hir_params = { let hir_params = {
let fn_local_def_id = if let Some(id) = instance.def_id().as_local() { let fn_local_def_id = if let Some(id) = instance.def_id().as_local() {
id id

View File

@ -20,10 +20,10 @@ note: called by `ptr_copy::main`
33 | copy_via_raw_ptr(&i, o); 33 | copy_via_raw_ptr(&i, o);
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
note: called by `main` note: called by `main`
--> $DIR/ptr_copy.rs:31:1 --> $DIR/ptr_copy.rs:32:8
| |
31 | #[spirv(fragment)] 32 | pub fn main(i: f32, o: &mut f32) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -10,10 +10,10 @@ note: used from within `nested_ref_in_composite::main_pair`
20 | *pair_out = pair_deep_load(&(&123, &3.14)); 20 | *pair_out = pair_deep_load(&(&123, &3.14));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: called by `main_pair` note: called by `main_pair`
--> $DIR/nested-ref-in-composite.rs:18:1 --> $DIR/nested-ref-in-composite.rs:19:8
| |
18 | #[spirv(fragment)] 19 | pub fn main_pair(pair_out: &mut (u32, f32)) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
error: constant arrays/structs cannot contain pointers to other constants error: constant arrays/structs cannot contain pointers to other constants
--> $DIR/nested-ref-in-composite.rs:25:19 --> $DIR/nested-ref-in-composite.rs:25:19
@ -27,10 +27,10 @@ note: used from within `nested_ref_in_composite::main_array3`
25 | *array3_out = array3_deep_load(&[&0, &1, &2]); 25 | *array3_out = array3_deep_load(&[&0, &1, &2]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: called by `main_array3` note: called by `main_array3`
--> $DIR/nested-ref-in-composite.rs:23:1 --> $DIR/nested-ref-in-composite.rs:24:8
| |
23 | #[spirv(fragment)] 24 | pub fn main_array3(array3_out: &mut [u32; 3]) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -6,10 +6,10 @@ note: used from within `allocate_const_scalar::main`
15 | let _pointer = POINTER; 15 | let _pointer = POINTER;
| ^^^^^^^ | ^^^^^^^
note: called by `main` note: called by `main`
--> $DIR/allocate_const_scalar.rs:13:1 --> $DIR/allocate_const_scalar.rs:14:8
| |
13 | #[spirv(fragment)] 14 | pub fn main() {
| ^^^^^^^^^^^^^^^^^^ | ^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -12,10 +12,10 @@ note: used from within `zst_member_ref_arg_broken::main_scalar`
23 | f(&s.y); 23 | f(&s.y);
| ^^^^^^^ | ^^^^^^^
note: called by `main_scalar` note: called by `main_scalar`
--> $DIR/zst_member_ref_arg-broken.rs:21:1 --> $DIR/zst_member_ref_arg-broken.rs:22:8
| |
21 | #[spirv(fragment)] 22 | pub fn main_scalar(#[spirv(push_constant)] s: &S<usize>) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
error: cannot cast between pointer types error: cannot cast between pointer types
from `*struct S<usize, usize> { u32, u32 }` from `*struct S<usize, usize> { u32, u32 }`
@ -31,10 +31,10 @@ note: used from within `zst_member_ref_arg_broken::main_scalar_pair`
28 | f(&s.y); 28 | f(&s.y);
| ^^^^^^^ | ^^^^^^^
note: called by `main_scalar_pair` note: called by `main_scalar_pair`
--> $DIR/zst_member_ref_arg-broken.rs:26:1 --> $DIR/zst_member_ref_arg-broken.rs:27:8
| |
26 | #[spirv(fragment)] 27 | pub fn main_scalar_pair(#[spirv(push_constant)] s: &S<usize, usize>) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: cannot cast between pointer types error: cannot cast between pointer types
from `*struct (usize, usize) { u32, u32 }` from `*struct (usize, usize) { u32, u32 }`
@ -50,10 +50,10 @@ note: used from within `zst_member_ref_arg_broken::main_scalar_scalar_pair_neste
33 | f(&s.y); 33 | f(&s.y);
| ^^^^^^^ | ^^^^^^^
note: called by `main_scalar_scalar_pair_nested` note: called by `main_scalar_scalar_pair_nested`
--> $DIR/zst_member_ref_arg-broken.rs:31:1 --> $DIR/zst_member_ref_arg-broken.rs:32:8
| |
31 | #[spirv(fragment)] 32 | pub fn main_scalar_scalar_pair_nested(#[spirv(push_constant)] s: &S<(usize, usize)>) {
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors