Use a dedicated type instead of a reference for the diagnostic context

This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
This commit is contained in:
Oli Scherer
2024-06-18 10:35:56 +00:00
parent c91edc3888
commit 7ba82d61eb
77 changed files with 363 additions and 328 deletions

View File

@@ -7,6 +7,7 @@ use crate::formats::renderer::FormatRenderer;
use crate::html::render::Context;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::DiagCtxtHandle;
use rustc_hir::{
self as hir,
intravisit::{self, Visitor},
@@ -38,7 +39,7 @@ pub(crate) struct ScrapeExamplesOptions {
}
impl ScrapeExamplesOptions {
pub(crate) fn new(matches: &getopts::Matches, dcx: &rustc_errors::DiagCtxt) -> Option<Self> {
pub(crate) fn new(matches: &getopts::Matches, dcx: DiagCtxtHandle<'_>) -> Option<Self> {
let output_path = matches.opt_str("scrape-examples-output-path");
let target_crates = matches.opt_strs("scrape-examples-target-crate");
let scrape_tests = matches.opt_present("scrape-tests");
@@ -336,7 +337,7 @@ pub(crate) fn run(
// options.
pub(crate) fn load_call_locations(
with_examples: Vec<String>,
dcx: &rustc_errors::DiagCtxt,
dcx: DiagCtxtHandle<'_>,
) -> AllCallLocations {
let mut all_calls: AllCallLocations = FxHashMap::default();
for path in with_examples {