Rollup merge of #119448 - klensy:annotate-snippets-0.10, r=davidtwco
annotate-snippets: update to 0.10 Ports `annotate-snippets` to 0.10, temporary dupes versions; other crates left that depends on 0.9 is `ui_test` and `rustfmt`.
This commit is contained in:
commit
fe97e93166
6 changed files with 25 additions and 24 deletions
22
Cargo.lock
22
Cargo.lock
|
@ -119,6 +119,16 @@ dependencies = [
|
||||||
"yansi-term",
|
"yansi-term",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "annotate-snippets"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a433302f833baa830c0092100c481c7ea768c5981a3c36f549517a502f246dd"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
@ -3771,7 +3781,7 @@ dependencies = [
|
||||||
name = "rustc_errors"
|
name = "rustc_errors"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"annotate-snippets",
|
"annotate-snippets 0.10.1",
|
||||||
"derive_setters",
|
"derive_setters",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_ast_pretty",
|
"rustc_ast_pretty",
|
||||||
|
@ -3831,7 +3841,7 @@ dependencies = [
|
||||||
name = "rustc_fluent_macro"
|
name = "rustc_fluent_macro"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"annotate-snippets",
|
"annotate-snippets 0.10.1",
|
||||||
"fluent-bundle",
|
"fluent-bundle",
|
||||||
"fluent-syntax",
|
"fluent-syntax",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -4738,7 +4748,7 @@ dependencies = [
|
||||||
name = "rustfmt-nightly"
|
name = "rustfmt-nightly"
|
||||||
version = "1.7.0"
|
version = "1.7.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"annotate-snippets",
|
"annotate-snippets 0.9.1",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytecount",
|
"bytecount",
|
||||||
"cargo_metadata 0.15.4",
|
"cargo_metadata 0.15.4",
|
||||||
|
@ -5728,7 +5738,7 @@ version = "0.21.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aaf4bf7c184b8dfc7a4d3b90df789b1eb992ee42811cd115f32a7a1eb781058d"
|
checksum = "aaf4bf7c184b8dfc7a4d3b90df789b1eb992ee42811cd115f32a7a1eb781058d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"annotate-snippets",
|
"annotate-snippets 0.9.1",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bstr",
|
"bstr",
|
||||||
"cargo-platform",
|
"cargo-platform",
|
||||||
|
@ -5859,9 +5869,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.10"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"compiler_builtins",
|
"compiler_builtins",
|
||||||
"rustc-std-workspace-core",
|
"rustc-std-workspace-core",
|
||||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
annotate-snippets = "0.9"
|
annotate-snippets = "0.10"
|
||||||
derive_setters = "0.1.6"
|
derive_setters = "0.1.6"
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||||
|
|
|
@ -12,8 +12,7 @@ use crate::{
|
||||||
CodeSuggestion, Diagnostic, DiagnosticId, DiagnosticMessage, Emitter, FluentBundle,
|
CodeSuggestion, Diagnostic, DiagnosticId, DiagnosticMessage, Emitter, FluentBundle,
|
||||||
LazyFallbackBundle, Level, MultiSpan, Style, SubDiagnostic,
|
LazyFallbackBundle, Level, MultiSpan, Style, SubDiagnostic,
|
||||||
};
|
};
|
||||||
use annotate_snippets::display_list::{DisplayList, FormatOptions};
|
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||||
use annotate_snippets::snippet::*;
|
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_error_messages::FluentArgs;
|
use rustc_error_messages::FluentArgs;
|
||||||
use rustc_span::source_map::SourceMap;
|
use rustc_span::source_map::SourceMap;
|
||||||
|
@ -190,11 +189,6 @@ impl AnnotateSnippetEmitter {
|
||||||
annotation_type: annotation_type_for_level(*level),
|
annotation_type: annotation_type_for_level(*level),
|
||||||
}),
|
}),
|
||||||
footer: vec![],
|
footer: vec![],
|
||||||
opt: FormatOptions {
|
|
||||||
color: true,
|
|
||||||
anonymized_line_numbers: self.ui_testing,
|
|
||||||
margin: None,
|
|
||||||
},
|
|
||||||
slices: annotated_files
|
slices: annotated_files
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(file_name, source, line_index, annotations)| {
|
.map(|(file_name, source, line_index, annotations)| {
|
||||||
|
@ -222,7 +216,8 @@ impl AnnotateSnippetEmitter {
|
||||||
// FIXME(#59346): Figure out if we can _always_ print to stderr or not.
|
// FIXME(#59346): Figure out if we can _always_ print to stderr or not.
|
||||||
// `emitter.rs` has the `Destination` enum that lists various possible output
|
// `emitter.rs` has the `Destination` enum that lists various possible output
|
||||||
// destinations.
|
// destinations.
|
||||||
eprintln!("{}", DisplayList::from(snippet))
|
let renderer = Renderer::plain().anonymized_line_numbers(self.ui_testing);
|
||||||
|
eprintln!("{}", renderer.render(snippet))
|
||||||
}
|
}
|
||||||
// FIXME(#59346): Is it ok to return None if there's no source_map?
|
// FIXME(#59346): Is it ok to return None if there's no source_map?
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
annotate-snippets = "0.9"
|
annotate-snippets = "0.10"
|
||||||
fluent-bundle = "0.15.2"
|
fluent-bundle = "0.15.2"
|
||||||
fluent-syntax = "0.11"
|
fluent-syntax = "0.11"
|
||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use annotate_snippets::{
|
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
|
||||||
display_list::DisplayList,
|
|
||||||
snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation},
|
|
||||||
};
|
|
||||||
use fluent_bundle::{FluentBundle, FluentError, FluentResource};
|
use fluent_bundle::{FluentBundle, FluentError, FluentResource};
|
||||||
use fluent_syntax::{
|
use fluent_syntax::{
|
||||||
ast::{
|
ast::{
|
||||||
|
@ -179,10 +176,9 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
|
||||||
range: (pos.start, pos.end - 1),
|
range: (pos.start, pos.end - 1),
|
||||||
}],
|
}],
|
||||||
}],
|
}],
|
||||||
opt: Default::default(),
|
|
||||||
};
|
};
|
||||||
let dl = DisplayList::from(snippet);
|
let renderer = Renderer::plain();
|
||||||
eprintln!("{dl}\n");
|
eprintln!("{}\n", renderer.render(snippet));
|
||||||
}
|
}
|
||||||
|
|
||||||
return failed(&crate_name);
|
return failed(&crate_name);
|
||||||
|
|
|
@ -194,6 +194,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"allocator-api2", // FIXME: only appears in Cargo.lock due to https://github.com/rust-lang/cargo/issues/10801
|
"allocator-api2", // FIXME: only appears in Cargo.lock due to https://github.com/rust-lang/cargo/issues/10801
|
||||||
"annotate-snippets",
|
"annotate-snippets",
|
||||||
|
"anstyle",
|
||||||
"ar_archive_writer",
|
"ar_archive_writer",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"autocfg",
|
"autocfg",
|
||||||
|
@ -391,7 +392,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
||||||
"windows_x86_64_gnullvm",
|
"windows_x86_64_gnullvm",
|
||||||
"windows_x86_64_msvc",
|
"windows_x86_64_msvc",
|
||||||
"writeable",
|
"writeable",
|
||||||
"yansi-term", // this is a false-positive: it's only used by rustfmt, but because it's enabled through a feature, tidy thinks it's used by rustc as well.
|
|
||||||
"yoke",
|
"yoke",
|
||||||
"yoke-derive",
|
"yoke-derive",
|
||||||
"zerocopy",
|
"zerocopy",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue