Skip to content

Let backends access span information #77614

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Conversation

khyperia
Copy link
Contributor

@khyperia khyperia commented Oct 6, 2020

Sometimes, a backend may need to emit warnings, errors, or otherwise need to know the span of the current item in a basic block. So, add a set_span method to give the backend that information.

The set_source_location method already partially does this, however, it's disabled when debug info is disabled. There needs to be a way to unconditionally provide the span.

Sometimes, a backend may need to emit warnings, errors, or otherwise
need to know the span of the current item in a basic block. So, add a
set_span method to give the backend that information.
@rust-highfive
Copy link
Contributor

r? @ecstatic-morse

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 6, 2020
@eddyb
Copy link
Member

eddyb commented Oct 6, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 6, 2020

📌 Commit c5bc956 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 6, 2020
@jyn514 jyn514 added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 6, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 6, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#76784 (Add some docs to rustdoc::clean::inline and def_id functions)
 - rust-lang#76911 (fix VecDeque::iter_mut aliasing issues)
 - rust-lang#77400 (Fix suggestions for x.py setup)
 - rust-lang#77515 (Update to chalk 0.31)
 - rust-lang#77568 (inliner: use caller param_env)
 - rust-lang#77571 (Use matches! for core::char methods)
 - rust-lang#77582 (Move `EarlyOtherwiseBranch` to mir-opt-level 2)
 - rust-lang#77590 (Update RLS and Rustfmt)
 - rust-lang#77605 (Fix rustc_def_path to show the full path and not the trimmed one)
 - rust-lang#77614 (Let backends access span information)
 - rust-lang#77624 (Add c as a shorthand check alternative for new options rust-lang#77603)

Failed merges:

r? `@ghost`
@bors bors merged commit 1b05615 into rust-lang:master Oct 7, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 7, 2020
@khyperia khyperia deleted the set_span branch October 7, 2020 20:49
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2020
Make set_span take mut self

This was a mistake in rust-lang#77614

It's not a _huge_ deal, because backends can always implement this with interior mutability, but it's nice to avoid interior mutability when possible. For context, the `set_source_location` method, called alongside `set_span`, also takes `&mut self`.

r? `@eddyb`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-codegen Area: Code generation S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants