Skip to content

Facade warnings point at file:1:1 under with run/build (correct under with check) #1498

Closed

Description

@ehartford

Spec: §16.2b.2 / ruling §8 (diagnostics carry the fact's provenance, i.e. point at the facade clause that states it).

Repro (stage1 at ba2d5d1, the stage-5 merge):

use c_import("typedef struct db db;
typedef struct st st;
db* db_new(int flags);
void db_close(db* d);
st* st_new(db* d, int n);
void st_free(st* s);
")

c facade dep:
    resource Database wraps *mut db
        from db_new
        drop db_close
    resource Statement wraps *mut st
        from st_new
        drop st_free

fn main:
    print("ok")

with check runwarn.w places the facade warning correctly:

warning: resource 'Statement': no constructor is rendered for producer 'st_new': …
 --> runwarn.w:13:5

with run runwarn.w prints the same warning at the wrong place:

warning: resource 'Statement': no constructor is rendered for producer 'st_new': …
 --> runwarn.w:1:1
1 |

Expected: run (and build) report the same location as check. The facade diagnostics set the source context to the facade block's declaration (SemaFacade.w update_decl_source_context(self.facade_resources[ri].decl), stage 5); the run/build path renders warnings against a span/file mapping that does not match — not yet located.

Also seen on modeled-C stage 6's returns borrow warning under run with the real sqlite3.h. Found while implementing stage 6; not fixed there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions