Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwco

Remove `--extern-location` and all associated code

`--extern-location` was an experiment to investigate the best way to
generate useful diagnostics for unused dependency warnings by enabling a
build system to identify the corresponding build config.

While I did successfully use this, I've since been convinced the
alternative `--json unused-externs` mechanism is the way to go, and
there's no point in having two mechanisms with basically the same
functionality.

This effectively reverts https://github.com/rust-lang/rust/pull/72603
This commit is contained in:
Dylan DPC 2022-04-19 14:43:17 +02:00 committed by GitHub
commit 5f10d1312d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 6 additions and 517 deletions

View file

@ -36,13 +36,11 @@ pub use rustc_error_messages::{
LazyFallbackBundle, MultiSpan, SpanLabel, DEFAULT_LOCALE_RESOURCES,
};
pub use rustc_lint_defs::{pluralize, Applicability};
use rustc_serialize::json::Json;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_span::source_map::SourceMap;
use rustc_span::{Loc, Span};
use std::borrow::Cow;
use std::hash::{Hash, Hasher};
use std::hash::Hash;
use std::num::NonZeroUsize;
use std::panic;
use std::path::Path;
@ -93,39 +91,6 @@ impl SuggestionStyle {
}
}
#[derive(Clone, Debug, PartialEq, Default)]
pub struct ToolMetadata(pub Option<Json>);
impl ToolMetadata {
fn new(json: Json) -> Self {
ToolMetadata(Some(json))
}
fn is_set(&self) -> bool {
self.0.is_some()
}
}
impl Hash for ToolMetadata {
fn hash<H: Hasher>(&self, _state: &mut H) {}
}
// Doesn't really need to round-trip
impl<D: Decoder> Decodable<D> for ToolMetadata {
fn decode(_d: &mut D) -> Self {
ToolMetadata(None)
}
}
impl<S: Encoder> Encodable<S> for ToolMetadata {
fn encode(&self, e: &mut S) -> Result<(), S::Error> {
match &self.0 {
None => e.emit_unit(),
Some(json) => json.encode(e),
}
}
}
#[derive(Clone, Debug, PartialEq, Hash, Encodable, Decodable)]
pub struct CodeSuggestion {
/// Each substitute can have multiple variants due to multiple
@ -159,8 +124,6 @@ pub struct CodeSuggestion {
/// which are useful for users but not useful for
/// tools like rustfix
pub applicability: Applicability,
/// Tool-specific metadata
pub tool_metadata: ToolMetadata,
}
#[derive(Clone, Debug, PartialEq, Hash, Encodable, Decodable)]