-
Notifications
You must be signed in to change notification settings - Fork 2.7k
WIP: fix(shell): Switch to annotate snippets for warnings #15917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't find a concrete example, but conceptually adding indentations to trailing lines would add efforts for people to remove those indentations when copy-pasting. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,7 +222,10 @@ impl Shell { | |
|
||
/// Prints an amber 'warning' message. | ||
pub fn warn<T: fmt::Display>(&mut self, message: T) -> CargoResult<()> { | ||
self.print(&"warning", Some(&message), &WARN, false) | ||
let report = &[annotate_snippets::Group::with_title( | ||
annotate_snippets::Level::WARNING.secondary_title(message.to_string()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used |
||
)]; | ||
self.print_report(report, false) | ||
} | ||
|
||
/// Prints a cyan 'note' message. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ fn rustc_bootstrap() { | |
.with_stderr_data(str![[r#" | ||
[COMPILING] has-dashes v0.0.1 ([ROOT]/foo) | ||
[WARNING] [email protected]: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `has-dashes v0.0.1 ([ROOT]/foo)`. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
||
"#]]) | ||
|
@@ -155,7 +155,7 @@ fn rustc_bootstrap() { | |
.env("RUSTC_BOOTSTRAP", "has_dashes") | ||
.with_stderr_data(str![[r#" | ||
[WARNING] [email protected]: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `has-dashes v0.0.1 ([ROOT]/foo)`. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
||
"#]]) | ||
|
@@ -190,7 +190,7 @@ fn rustc_bootstrap() { | |
.with_stderr_data(str![[r#" | ||
[COMPILING] foo v0.0.1 ([ROOT]/foo) | ||
[WARNING] [email protected]: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `foo v0.0.1 ([ROOT]/foo)`. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
||
"#]]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,9 +222,9 @@ fn cdylib_link_arg_transitive() { | |
[RUNNING] `[ROOT]/foo/target/debug/build/bar-[HASH]/build-script-build` | ||
[WARNING] [email protected]: cargo::rustc-link-arg-cdylib was specified in the build script of bar v1.0.0 \ | ||
([ROOT]/foo/bar), but that package does not contain a cdylib target | ||
Allowing this was an unintended change in the 1.50 release, and may become an error in \ | ||
the future. For more information, see <https://github.com/rust-lang/cargo/issues/9562>. | ||
Allowing this was an unintended change in the 1.50 release, and may become an error in \ | ||
the future. For more information, see <https://github.com/rust-lang/cargo/issues/9562>. | ||
[RUNNING] `rustc --crate-name bar --edition=2015 bar/src/lib.rs [..] | ||
[COMPILING] foo v0.1.0 ([ROOT]/foo) | ||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]-C link-arg=--bogus[..]` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we will need to rework on most of our messages. Not all the
help
andnote
should be under the same group.