Auto merge of #45545 - durka:macro-backtrace, r=nrc
show macro backtrace with -Z flag
Fixes #39413 by adding a facility to restore the "old school" macro expansion backtraces (previously removed in 61865384b8
).
The restored functionality is accessed through the flag `-Z external-macro-backtrace`. Errors showing the truncated backtraces will suggest this flag.
### Example
Code: <details>
`a/src/lib.rs`
```rust
#[macro_export]
macro_rules! a {
() => { a!(@) };
(@) => { a!(@@) };
(@@) => {
syntax error;
}
}
```
`b/src/main.rs`
```rust
#[macro_use] extern crate a;
macro_rules! b {
() => { b!(@) };
(@) => { b!(@@) };
(@@) => {
syntax error;
}
}
fn main() {
a!();
b!();
}
```
</details>
<br/><br/>
Running without env var (note: first error is from remote macro, second from local macro):
<details>
```
$ cargo +custom run
Compiling b v0.1.0
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> src/main.rs:12:5
|
12 | a!();
| ^^^^^
| |
| expected one of 8 possible tokens here
| unexpected token
|
= note: this error originates in a macro outside of the current crate (run with RUST_MACRO_BACKTRACE=1 for more info)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> src/main.rs:7:16
|
7 | syntax error;
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
...
13 | b!();
| ----- in this macro invocation
error: aborting due to 2 previous errors
error: Could not compile `b`.
To learn more, run the command again with --verbose.
```
</details>
The output is the same as today, except for an addition to the note which aids discoverability of the new environment variable.
<br/><br/>
Running _with_ env var:
<details>
```
$ RUST_MACRO_BACKTRACE=1 cargo +custom run
Compiling b v0.1.0
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> <a macros>:1:72
|
1 | ( ) => { a ! ( @ ) } ; ( @ ) => { a ! ( @ @ ) } ; ( @ @ ) => { syntax error ;
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
src/main.rs:12:5: 12:10 note: in this expansion of a! (defined in <a macros>)
<a macros>:1:11: 1:20 note: in this expansion of a! (defined in <a macros>)
<a macros>:1:36: 1:47 note: in this expansion of a! (defined in <a macros>)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> src/main.rs:7:16
|
7 | syntax error;
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
src/main.rs:12:5: 12:10 note: in this expansion of a! (defined in <a macros>)
<a macros>:1:11: 1:20 note: in this expansion of a! (defined in <a macros>)
<a macros>:1:36: 1:47 note: in this expansion of a! (defined in <a macros>)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> src/main.rs:7:16
|
7 | syntax error;
| -^^^^^ unexpected token
| |
| expected one of 8 possible tokens here
src/main.rs:13:5: 13:10 note: in this expansion of b! (defined in src/main.rs)
src/main.rs:4:13: 4:18 note: in this expansion of b! (defined in src/main.rs)
src/main.rs:5:14: 5:20 note: in this expansion of b! (defined in src/main.rs)
error: aborting due to 2 previous errors
error: Could not compile `b`.
To learn more, run the command again with --verbose.
```
</details>
The output is hard to read, but better than nothing (and it's exactly what we used to have before the infamous `fix_multispans_in_std_macros`).
<br/><br/>
Wishlist:
- Save the actual source of macros in crate metadata, not just AST, so the output can be improved
- Hopefully this would allow line numbers in the trace as well
- Show the actual macro invocations in the traces
r? @nrc
This commit is contained in:
commit
bac7c53bc3
30 changed files with 211 additions and 58 deletions
|
@ -1036,6 +1036,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
"run all passes except translation; no output"),
|
"run all passes except translation; no output"),
|
||||||
treat_err_as_bug: bool = (false, parse_bool, [TRACKED],
|
treat_err_as_bug: bool = (false, parse_bool, [TRACKED],
|
||||||
"treat all errors that occur as bugs"),
|
"treat all errors that occur as bugs"),
|
||||||
|
external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
|
||||||
|
"show macro backtraces even for non-local macros"),
|
||||||
continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
|
continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
|
||||||
"attempt to recover from parse errors (experimental)"),
|
"attempt to recover from parse errors (experimental)"),
|
||||||
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
||||||
|
@ -2100,7 +2102,7 @@ mod tests {
|
||||||
let registry = errors::registry::Registry::new(&[]);
|
let registry = errors::registry::Registry::new(&[]);
|
||||||
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
||||||
let sess = build_session(sessopts, None, registry);
|
let sess = build_session(sessopts, None, registry);
|
||||||
assert!(!sess.diagnostic().can_emit_warnings);
|
assert!(!sess.diagnostic().flags.can_emit_warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2111,7 +2113,7 @@ mod tests {
|
||||||
let registry = errors::registry::Registry::new(&[]);
|
let registry = errors::registry::Registry::new(&[]);
|
||||||
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
||||||
let sess = build_session(sessopts, None, registry);
|
let sess = build_session(sessopts, None, registry);
|
||||||
assert!(sess.diagnostic().can_emit_warnings);
|
assert!(sess.diagnostic().flags.can_emit_warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2121,7 +2123,7 @@ mod tests {
|
||||||
let registry = errors::registry::Registry::new(&[]);
|
let registry = errors::registry::Registry::new(&[]);
|
||||||
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
let (sessopts, _) = build_session_options_and_crate_config(&matches);
|
||||||
let sess = build_session(sessopts, None, registry);
|
let sess = build_session(sessopts, None, registry);
|
||||||
assert!(sess.diagnostic().can_emit_warnings);
|
assert!(sess.diagnostic().flags.can_emit_warnings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -727,10 +727,12 @@ pub fn build_session_with_codemap(sopts: config::Options,
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
let cap_lints_allow = sopts.lint_cap.map_or(false, |cap| cap == lint::Allow);
|
let cap_lints_allow = sopts.lint_cap.map_or(false, |cap| cap == lint::Allow);
|
||||||
|
|
||||||
let can_print_warnings = !(warnings_allow || cap_lints_allow);
|
let can_emit_warnings = !(warnings_allow || cap_lints_allow);
|
||||||
|
|
||||||
let treat_err_as_bug = sopts.debugging_opts.treat_err_as_bug;
|
let treat_err_as_bug = sopts.debugging_opts.treat_err_as_bug;
|
||||||
|
|
||||||
|
let external_macro_backtrace = sopts.debugging_opts.external_macro_backtrace;
|
||||||
|
|
||||||
let emitter: Box<Emitter> = match (sopts.error_format, emitter_dest) {
|
let emitter: Box<Emitter> = match (sopts.error_format, emitter_dest) {
|
||||||
(config::ErrorOutputType::HumanReadable(color_config), None) => {
|
(config::ErrorOutputType::HumanReadable(color_config), None) => {
|
||||||
Box::new(EmitterWriter::stderr(color_config, Some(codemap.clone()), false))
|
Box::new(EmitterWriter::stderr(color_config, Some(codemap.clone()), false))
|
||||||
|
@ -753,9 +755,14 @@ pub fn build_session_with_codemap(sopts: config::Options,
|
||||||
};
|
};
|
||||||
|
|
||||||
let diagnostic_handler =
|
let diagnostic_handler =
|
||||||
errors::Handler::with_emitter(can_print_warnings,
|
errors::Handler::with_emitter_and_flags(
|
||||||
treat_err_as_bug,
|
emitter,
|
||||||
emitter);
|
errors::HandlerFlags {
|
||||||
|
can_emit_warnings,
|
||||||
|
treat_err_as_bug,
|
||||||
|
external_macro_backtrace,
|
||||||
|
.. Default::default()
|
||||||
|
});
|
||||||
|
|
||||||
build_session_(sopts,
|
build_session_(sopts,
|
||||||
local_crate_source_file,
|
local_crate_source_file,
|
||||||
|
|
|
@ -23,7 +23,7 @@ use syntax_pos::{MultiSpan, Span};
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct DiagnosticBuilder<'a> {
|
pub struct DiagnosticBuilder<'a> {
|
||||||
handler: &'a Handler,
|
pub handler: &'a Handler,
|
||||||
diagnostic: Diagnostic,
|
diagnostic: Diagnostic,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,11 @@ impl Emitter for EmitterWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fix_multispans_in_std_macros(&mut primary_span, &mut children);
|
if !db.handler.flags.external_macro_backtrace {
|
||||||
|
self.fix_multispans_in_std_macros(&mut primary_span, &mut children);
|
||||||
|
}
|
||||||
self.emit_messages_default(&db.level,
|
self.emit_messages_default(&db.level,
|
||||||
|
db.handler.flags.external_macro_backtrace,
|
||||||
&db.styled_message(),
|
&db.styled_message(),
|
||||||
&db.code,
|
&db.code,
|
||||||
&primary_span,
|
&primary_span,
|
||||||
|
@ -793,8 +796,11 @@ impl EmitterWriter {
|
||||||
if spans_updated {
|
if spans_updated {
|
||||||
children.push(SubDiagnostic {
|
children.push(SubDiagnostic {
|
||||||
level: Level::Note,
|
level: Level::Note,
|
||||||
message: vec![("this error originates in a macro outside of the current crate"
|
message: vec![
|
||||||
.to_string(), Style::NoStyle)],
|
(["this error originates in a macro outside of the current crate",
|
||||||
|
"(run with -Z external-macro-backtrace for more info)"].join(" "),
|
||||||
|
Style::NoStyle),
|
||||||
|
],
|
||||||
span: MultiSpan::new(),
|
span: MultiSpan::new(),
|
||||||
render_span: None,
|
render_span: None,
|
||||||
});
|
});
|
||||||
|
@ -882,6 +888,7 @@ impl EmitterWriter {
|
||||||
msg: &Vec<(String, Style)>,
|
msg: &Vec<(String, Style)>,
|
||||||
code: &Option<DiagnosticId>,
|
code: &Option<DiagnosticId>,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
external_macro_backtrace: bool,
|
||||||
max_line_num_len: usize,
|
max_line_num_len: usize,
|
||||||
is_secondary: bool)
|
is_secondary: bool)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
|
@ -1079,6 +1086,12 @@ impl EmitterWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if external_macro_backtrace {
|
||||||
|
if let Some(ref primary_span) = msp.primary_span().as_ref() {
|
||||||
|
self.render_macro_backtrace_old_school(primary_span, &mut buffer)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// final step: take our styled buffer, render it, then output it
|
// final step: take our styled buffer, render it, then output it
|
||||||
emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;
|
emit_to_destination(&buffer.render(), level, &mut self.dst, self.short_message)?;
|
||||||
|
|
||||||
|
@ -1170,6 +1183,7 @@ impl EmitterWriter {
|
||||||
}
|
}
|
||||||
fn emit_messages_default(&mut self,
|
fn emit_messages_default(&mut self,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
external_macro_backtrace: bool,
|
||||||
message: &Vec<(String, Style)>,
|
message: &Vec<(String, Style)>,
|
||||||
code: &Option<DiagnosticId>,
|
code: &Option<DiagnosticId>,
|
||||||
span: &MultiSpan,
|
span: &MultiSpan,
|
||||||
|
@ -1178,7 +1192,13 @@ impl EmitterWriter {
|
||||||
let max_line_num = self.get_max_line_num(span, children);
|
let max_line_num = self.get_max_line_num(span, children);
|
||||||
let max_line_num_len = max_line_num.to_string().len();
|
let max_line_num_len = max_line_num.to_string().len();
|
||||||
|
|
||||||
match self.emit_message_default(span, message, code, level, max_line_num_len, false) {
|
match self.emit_message_default(span,
|
||||||
|
message,
|
||||||
|
code,
|
||||||
|
level,
|
||||||
|
external_macro_backtrace,
|
||||||
|
max_line_num_len,
|
||||||
|
false) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
if !children.is_empty() {
|
if !children.is_empty() {
|
||||||
let mut buffer = StyledBuffer::new();
|
let mut buffer = StyledBuffer::new();
|
||||||
|
@ -1198,6 +1218,7 @@ impl EmitterWriter {
|
||||||
&child.styled_message(),
|
&child.styled_message(),
|
||||||
&None,
|
&None,
|
||||||
&child.level,
|
&child.level,
|
||||||
|
external_macro_backtrace,
|
||||||
max_line_num_len,
|
max_line_num_len,
|
||||||
true) {
|
true) {
|
||||||
Err(e) => panic!("failed to emit error: {}", e),
|
Err(e) => panic!("failed to emit error: {}", e),
|
||||||
|
@ -1226,6 +1247,30 @@ impl EmitterWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_macro_backtrace_old_school(&self,
|
||||||
|
sp: &Span,
|
||||||
|
buffer: &mut StyledBuffer) -> io::Result<()> {
|
||||||
|
if let Some(ref cm) = self.cm {
|
||||||
|
for trace in sp.macro_backtrace().iter().rev() {
|
||||||
|
let line_offset = buffer.num_lines();
|
||||||
|
|
||||||
|
let mut diag_string =
|
||||||
|
format!("in this expansion of {}", trace.macro_decl_name);
|
||||||
|
if let Some(def_site_span) = trace.def_site_span {
|
||||||
|
diag_string.push_str(
|
||||||
|
&format!(" (defined in {})",
|
||||||
|
cm.span_to_filename(def_site_span)));
|
||||||
|
}
|
||||||
|
let snippet = cm.span_to_string(trace.call_site);
|
||||||
|
buffer.append(line_offset, &format!("{} ", snippet), Style::NoStyle);
|
||||||
|
buffer.append(line_offset, "note", Style::Level(Level::Note));
|
||||||
|
buffer.append(line_offset, ": ", Style::NoStyle);
|
||||||
|
buffer.append(line_offset, &diag_string, Style::OldSchoolNoteText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) {
|
fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) {
|
||||||
|
@ -1415,7 +1460,7 @@ impl Destination {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Style::Quotation => {}
|
Style::Quotation => {}
|
||||||
Style::HeaderMsg => {
|
Style::OldSchoolNoteText | Style::HeaderMsg => {
|
||||||
self.start_attr(term::Attr::Bold)?;
|
self.start_attr(term::Attr::Bold)?;
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE))?;
|
self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE))?;
|
||||||
|
|
|
@ -233,10 +233,10 @@ pub use diagnostic_builder::DiagnosticBuilder;
|
||||||
/// (fatal, bug, unimpl) may cause immediate exit,
|
/// (fatal, bug, unimpl) may cause immediate exit,
|
||||||
/// others log errors for later reporting.
|
/// others log errors for later reporting.
|
||||||
pub struct Handler {
|
pub struct Handler {
|
||||||
|
pub flags: HandlerFlags,
|
||||||
|
|
||||||
err_count: Cell<usize>,
|
err_count: Cell<usize>,
|
||||||
emitter: RefCell<Box<Emitter>>,
|
emitter: RefCell<Box<Emitter>>,
|
||||||
pub can_emit_warnings: bool,
|
|
||||||
treat_err_as_bug: bool,
|
|
||||||
continue_after_error: Cell<bool>,
|
continue_after_error: Cell<bool>,
|
||||||
delayed_span_bug: RefCell<Option<Diagnostic>>,
|
delayed_span_bug: RefCell<Option<Diagnostic>>,
|
||||||
tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>,
|
tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>,
|
||||||
|
@ -247,25 +247,55 @@ pub struct Handler {
|
||||||
emitted_diagnostics: RefCell<FxHashSet<u128>>,
|
emitted_diagnostics: RefCell<FxHashSet<u128>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct HandlerFlags {
|
||||||
|
pub can_emit_warnings: bool,
|
||||||
|
pub treat_err_as_bug: bool,
|
||||||
|
pub external_macro_backtrace: bool,
|
||||||
|
}
|
||||||
|
|
||||||
impl Handler {
|
impl Handler {
|
||||||
pub fn with_tty_emitter(color_config: ColorConfig,
|
pub fn with_tty_emitter(color_config: ColorConfig,
|
||||||
can_emit_warnings: bool,
|
can_emit_warnings: bool,
|
||||||
treat_err_as_bug: bool,
|
treat_err_as_bug: bool,
|
||||||
cm: Option<Rc<CodeMapper>>)
|
cm: Option<Rc<CodeMapper>>)
|
||||||
-> Handler {
|
-> Handler {
|
||||||
|
Handler::with_tty_emitter_and_flags(
|
||||||
|
color_config,
|
||||||
|
cm,
|
||||||
|
HandlerFlags {
|
||||||
|
can_emit_warnings,
|
||||||
|
treat_err_as_bug,
|
||||||
|
.. Default::default()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_tty_emitter_and_flags(color_config: ColorConfig,
|
||||||
|
cm: Option<Rc<CodeMapper>>,
|
||||||
|
flags: HandlerFlags)
|
||||||
|
-> Handler {
|
||||||
let emitter = Box::new(EmitterWriter::stderr(color_config, cm, false));
|
let emitter = Box::new(EmitterWriter::stderr(color_config, cm, false));
|
||||||
Handler::with_emitter(can_emit_warnings, treat_err_as_bug, emitter)
|
Handler::with_emitter_and_flags(emitter, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_emitter(can_emit_warnings: bool,
|
pub fn with_emitter(can_emit_warnings: bool,
|
||||||
treat_err_as_bug: bool,
|
treat_err_as_bug: bool,
|
||||||
e: Box<Emitter>)
|
e: Box<Emitter>)
|
||||||
-> Handler {
|
-> Handler {
|
||||||
|
Handler::with_emitter_and_flags(
|
||||||
|
e,
|
||||||
|
HandlerFlags {
|
||||||
|
can_emit_warnings,
|
||||||
|
treat_err_as_bug,
|
||||||
|
.. Default::default()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_emitter_and_flags(e: Box<Emitter>, flags: HandlerFlags) -> Handler {
|
||||||
Handler {
|
Handler {
|
||||||
|
flags,
|
||||||
err_count: Cell::new(0),
|
err_count: Cell::new(0),
|
||||||
emitter: RefCell::new(e),
|
emitter: RefCell::new(e),
|
||||||
can_emit_warnings,
|
|
||||||
treat_err_as_bug,
|
|
||||||
continue_after_error: Cell::new(true),
|
continue_after_error: Cell::new(true),
|
||||||
delayed_span_bug: RefCell::new(None),
|
delayed_span_bug: RefCell::new(None),
|
||||||
tracked_diagnostics: RefCell::new(None),
|
tracked_diagnostics: RefCell::new(None),
|
||||||
|
@ -293,7 +323,7 @@ impl Handler {
|
||||||
-> DiagnosticBuilder<'a> {
|
-> DiagnosticBuilder<'a> {
|
||||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||||
result.set_span(sp);
|
result.set_span(sp);
|
||||||
if !self.can_emit_warnings {
|
if !self.flags.can_emit_warnings {
|
||||||
result.cancel();
|
result.cancel();
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
@ -306,14 +336,14 @@ impl Handler {
|
||||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||||
result.set_span(sp);
|
result.set_span(sp);
|
||||||
result.code(code);
|
result.code(code);
|
||||||
if !self.can_emit_warnings {
|
if !self.flags.can_emit_warnings {
|
||||||
result.cancel();
|
result.cancel();
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
||||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||||
if !self.can_emit_warnings {
|
if !self.flags.can_emit_warnings {
|
||||||
result.cancel();
|
result.cancel();
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
@ -376,7 +406,7 @@ impl Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn panic_if_treat_err_as_bug(&self) {
|
fn panic_if_treat_err_as_bug(&self) {
|
||||||
if self.treat_err_as_bug {
|
if self.flags.treat_err_as_bug {
|
||||||
panic!("encountered error with `-Z treat_err_as_bug");
|
panic!("encountered error with `-Z treat_err_as_bug");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +448,7 @@ impl Handler {
|
||||||
panic!(ExplicitBug);
|
panic!(ExplicitBug);
|
||||||
}
|
}
|
||||||
pub fn delay_span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
pub fn delay_span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||||
if self.treat_err_as_bug {
|
if self.flags.treat_err_as_bug {
|
||||||
self.span_bug(sp, msg);
|
self.span_bug(sp, msg);
|
||||||
}
|
}
|
||||||
let mut diagnostic = Diagnostic::new(Level::Bug, msg);
|
let mut diagnostic = Diagnostic::new(Level::Bug, msg);
|
||||||
|
@ -443,7 +473,7 @@ impl Handler {
|
||||||
self.span_bug(sp, &format!("unimplemented {}", msg));
|
self.span_bug(sp, &format!("unimplemented {}", msg));
|
||||||
}
|
}
|
||||||
pub fn fatal(&self, msg: &str) -> FatalError {
|
pub fn fatal(&self, msg: &str) -> FatalError {
|
||||||
if self.treat_err_as_bug {
|
if self.flags.treat_err_as_bug {
|
||||||
self.bug(msg);
|
self.bug(msg);
|
||||||
}
|
}
|
||||||
let mut db = DiagnosticBuilder::new(self, Fatal, msg);
|
let mut db = DiagnosticBuilder::new(self, Fatal, msg);
|
||||||
|
@ -451,7 +481,7 @@ impl Handler {
|
||||||
FatalError
|
FatalError
|
||||||
}
|
}
|
||||||
pub fn err(&self, msg: &str) {
|
pub fn err(&self, msg: &str) {
|
||||||
if self.treat_err_as_bug {
|
if self.flags.treat_err_as_bug {
|
||||||
self.bug(msg);
|
self.bug(msg);
|
||||||
}
|
}
|
||||||
let mut db = DiagnosticBuilder::new(self, Error, msg);
|
let mut db = DiagnosticBuilder::new(self, Error, msg);
|
||||||
|
@ -504,7 +534,7 @@ impl Handler {
|
||||||
panic!(self.fatal(&s));
|
panic!(self.fatal(&s));
|
||||||
}
|
}
|
||||||
pub fn emit(&self, msp: &MultiSpan, msg: &str, lvl: Level) {
|
pub fn emit(&self, msp: &MultiSpan, msg: &str, lvl: Level) {
|
||||||
if lvl == Warning && !self.can_emit_warnings {
|
if lvl == Warning && !self.flags.can_emit_warnings {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mut db = DiagnosticBuilder::new(self, lvl, msg);
|
let mut db = DiagnosticBuilder::new(self, lvl, msg);
|
||||||
|
@ -515,7 +545,7 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn emit_with_code(&self, msp: &MultiSpan, msg: &str, code: DiagnosticId, lvl: Level) {
|
pub fn emit_with_code(&self, msp: &MultiSpan, msg: &str, code: DiagnosticId, lvl: Level) {
|
||||||
if lvl == Warning && !self.can_emit_warnings {
|
if lvl == Warning && !self.flags.can_emit_warnings {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mut db = DiagnosticBuilder::new_with_code(self, lvl, Some(code), msg);
|
let mut db = DiagnosticBuilder::new_with_code(self, lvl, Some(code), msg);
|
||||||
|
|
|
@ -213,6 +213,7 @@ pub enum Style {
|
||||||
UnderlineSecondary,
|
UnderlineSecondary,
|
||||||
LabelPrimary,
|
LabelPrimary,
|
||||||
LabelSecondary,
|
LabelSecondary,
|
||||||
|
OldSchoolNoteText,
|
||||||
NoStyle,
|
NoStyle,
|
||||||
Level(Level),
|
Level(Level),
|
||||||
Highlight,
|
Highlight,
|
||||||
|
|
|
@ -81,7 +81,9 @@ pub fn run(input: &str,
|
||||||
|
|
||||||
let codemap = Rc::new(CodeMap::new(sessopts.file_path_mapping()));
|
let codemap = Rc::new(CodeMap::new(sessopts.file_path_mapping()));
|
||||||
let handler =
|
let handler =
|
||||||
errors::Handler::with_tty_emitter(ColorConfig::Auto, true, false, Some(codemap.clone()));
|
errors::Handler::with_tty_emitter(ColorConfig::Auto,
|
||||||
|
true, false,
|
||||||
|
Some(codemap.clone()));
|
||||||
|
|
||||||
let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader));
|
let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader));
|
||||||
let mut sess = session::build_session_(
|
let mut sess = session::build_session_(
|
||||||
|
|
|
@ -58,7 +58,7 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.obsolete_set.contains(&kind) &&
|
if !self.obsolete_set.contains(&kind) &&
|
||||||
(error || self.sess.span_diagnostic.can_emit_warnings) {
|
(error || self.sess.span_diagnostic.flags.can_emit_warnings) {
|
||||||
err.note(desc);
|
err.note(desc);
|
||||||
self.obsolete_set.insert(kind);
|
self.obsolete_set.insert(kind);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: requires at least a format string argument
|
||||||
12 | format!();
|
12 | format!();
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected token: `,`
|
error: expected token: `,`
|
||||||
--> $DIR/bad-format-args.rs:13:5
|
--> $DIR/bad-format-args.rs:13:5
|
||||||
|
@ -12,7 +12,7 @@ error: expected token: `,`
|
||||||
13 | format!("" 1);
|
13 | format!("" 1);
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected token: `,`
|
error: expected token: `,`
|
||||||
--> $DIR/bad-format-args.rs:14:5
|
--> $DIR/bad-format-args.rs:14:5
|
||||||
|
@ -20,7 +20,7 @@ error: expected token: `,`
|
||||||
14 | format!("", 1 1);
|
14 | format!("", 1 1);
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str`
|
||||||
12 | assert!("foo");
|
12 | assert!("foo");
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: 1 positional argument in format string, but no arguments were given
|
||||||
16 | myprintln!("{}"); //~ ERROR in this macro
|
16 | myprintln!("{}"); //~ ERROR in this macro
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ error: invalid format string: expected `'}'` but string was terminated
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: if you intended to print `{`, you can escape it using `{{`
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: invalid format string: unmatched `}` found
|
error: invalid format string: unmatched `}` found
|
||||||
--> $DIR/format-string-error.rs:14:5
|
--> $DIR/format-string-error.rs:14:5
|
||||||
|
@ -14,7 +14,7 @@ error: invalid format string: unmatched `}` found
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: if you intended to print `}`, you can escape it using `}}`
|
= note: if you intended to print `}`, you can escape it using `}}`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ error[E0597]: borrowed value does not live long enough
|
||||||
| - temporary value needs to live until here
|
| - temporary value needs to live until here
|
||||||
|
|
|
|
||||||
= note: consider using a `let` binding to increase its lifetime
|
= note: consider using a `let` binding to increase its lifetime
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
20
src/test/ui/macro_backtrace/auxiliary/ping.rs
Normal file
20
src/test/ui/macro_backtrace/auxiliary/ping.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// Test that the macro backtrace facility works (supporting file)
|
||||||
|
|
||||||
|
// a non-local macro
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! ping {
|
||||||
|
() => {
|
||||||
|
pong!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
25
src/test/ui/macro_backtrace/main.rs
Normal file
25
src/test/ui/macro_backtrace/main.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// Test that the macro backtrace facility works
|
||||||
|
// aux-build:ping.rs
|
||||||
|
// compile-flags: -Z external-macro-backtrace
|
||||||
|
|
||||||
|
#[macro_use] extern crate ping;
|
||||||
|
|
||||||
|
// a local macro
|
||||||
|
macro_rules! pong {
|
||||||
|
() => { syntax error };
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
pong!();
|
||||||
|
ping!();
|
||||||
|
}
|
21
src/test/ui/macro_backtrace/main.stderr
Normal file
21
src/test/ui/macro_backtrace/main.stderr
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
|
||||||
|
--> $DIR/main.rs:19:20
|
||||||
|
|
|
||||||
|
19 | () => { syntax error };
|
||||||
|
| -^^^^^ unexpected token
|
||||||
|
| |
|
||||||
|
| expected one of 8 possible tokens here
|
||||||
|
$DIR/main.rs:23:5: 23:13 note: in this expansion of pong! (defined in $DIR/main.rs)
|
||||||
|
|
||||||
|
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
|
||||||
|
--> $DIR/main.rs:19:20
|
||||||
|
|
|
||||||
|
19 | () => { syntax error };
|
||||||
|
| -^^^^^ unexpected token
|
||||||
|
| |
|
||||||
|
| expected one of 8 possible tokens here
|
||||||
|
$DIR/main.rs:24:5: 24:13 note: in this expansion of ping! (defined in <ping macros>)
|
||||||
|
<ping macros>:1:11: 1:24 note: in this expansion of pong! (defined in $DIR/main.rs)
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
|
@ -11,7 +11,7 @@ error: multiple unused formatting arguments
|
||||||
= help: `%.*3$s` should be written as `{:.2$}`
|
= help: `%.*3$s` should be written as `{:.2$}`
|
||||||
= help: `%s` should be written as `{}`
|
= help: `%s` should be written as `{}`
|
||||||
= note: printf formatting not supported; see the documentation for `std::fmt`
|
= note: printf formatting not supported; see the documentation for `std::fmt`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: argument never used
|
error: argument never used
|
||||||
--> $DIR/format-foreign.rs:13:29
|
--> $DIR/format-foreign.rs:13:29
|
||||||
|
|
|
@ -8,7 +8,7 @@ error: multiple unused formatting arguments
|
||||||
| | unused
|
| | unused
|
||||||
| unused
|
| unused
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: multiple unused formatting arguments
|
error: multiple unused formatting arguments
|
||||||
--> $DIR/format-unused-lables.rs:14:5
|
--> $DIR/format-unused-lables.rs:14:5
|
||||||
|
@ -23,7 +23,7 @@ error: multiple unused formatting arguments
|
||||||
18 | | );
|
18 | | );
|
||||||
| |______^
|
| |______^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: named argument never used
|
error: named argument never used
|
||||||
--> $DIR/format-unused-lables.rs:20:35
|
--> $DIR/format-unused-lables.rs:20:35
|
||||||
|
@ -47,7 +47,7 @@ error: multiple unused formatting arguments
|
||||||
|
|
|
|
||||||
= help: `$STUFF` should be written as `{STUFF}`
|
= help: `$STUFF` should be written as `{STUFF}`
|
||||||
= note: shell formatting not supported; see the documentation for `std::fmt`
|
= note: shell formatting not supported; see the documentation for `std::fmt`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ note: lint level defined here
|
||||||
|
|
|
|
||||||
13 | #![deny(unreachable_code)]
|
13 | #![deny(unreachable_code)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ error: unreachable statement
|
||||||
36 | println!("foo");
|
36 | println!("foo");
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ note: lint level defined here
|
||||||
|
|
|
|
||||||
14 | #![deny(unreachable_code)]
|
14 | #![deny(unreachable_code)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ note: lint level defined here
|
||||||
|
|
|
|
||||||
14 | #![deny(unreachable_code)]
|
14 | #![deny(unreachable_code)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: unreachable statement
|
error: unreachable statement
|
||||||
--> $DIR/expr_loop.rs:31:5
|
--> $DIR/expr_loop.rs:31:5
|
||||||
|
@ -17,7 +17,7 @@ error: unreachable statement
|
||||||
31 | println!("I am dead.");
|
31 | println!("I am dead.");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: unreachable statement
|
error: unreachable statement
|
||||||
--> $DIR/expr_loop.rs:41:5
|
--> $DIR/expr_loop.rs:41:5
|
||||||
|
@ -25,7 +25,7 @@ error: unreachable statement
|
||||||
41 | println!("I am dead.");
|
41 | println!("I am dead.");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ error: unreachable statement
|
||||||
25 | println!("I am dead");
|
25 | println!("I am dead");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: unreachable statement
|
error: unreachable statement
|
||||||
--> $DIR/expr_match.rs:35:5
|
--> $DIR/expr_match.rs:35:5
|
||||||
|
@ -24,7 +24,7 @@ error: unreachable statement
|
||||||
35 | println!("I am dead");
|
35 | println!("I am dead");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ note: lint level defined here
|
||||||
|
|
|
|
||||||
14 | #![deny(unreachable_code)]
|
14 | #![deny(unreachable_code)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: unreachable statement
|
error: unreachable statement
|
||||||
--> $DIR/expr_while.rs:33:9
|
--> $DIR/expr_while.rs:33:9
|
||||||
|
@ -17,7 +17,7 @@ error: unreachable statement
|
||||||
33 | println!("I am dead.");
|
33 | println!("I am dead.");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: unreachable statement
|
error: unreachable statement
|
||||||
--> $DIR/expr_while.rs:35:5
|
--> $DIR/expr_while.rs:35:5
|
||||||
|
@ -25,7 +25,7 @@ error: unreachable statement
|
||||||
35 | println!("I am, too.");
|
35 | println!("I am, too.");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ error[E0308]: mismatched types
|
||||||
= note: expected type `&mut std::string::String`
|
= note: expected type `&mut std::string::String`
|
||||||
found type `std::string::String`
|
found type `std::string::String`
|
||||||
= help: try with `&mut format!("foo")`
|
= help: try with `&mut format!("foo")`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ error[E0308]: mismatched types
|
||||||
|
|
|
|
||||||
= note: expected type `std::fmt::Arguments<'_>`
|
= note: expected type `std::fmt::Arguments<'_>`
|
||||||
found type `std::string::String`
|
found type `std::string::String`
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ error[E0597]: `foo` does not live long enough
|
||||||
| | borrow occurs here
|
| | borrow occurs here
|
||||||
| borrowed value needs to live until here
|
| borrowed value needs to live until here
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ error[E0597]: borrowed value does not live long enough
|
||||||
19 | }
|
19 | }
|
||||||
| - temporary value needs to live until here
|
| - temporary value needs to live until here
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ error[E0282]: type annotations needed
|
||||||
| |
|
| |
|
||||||
| consider giving `x` a type
|
| consider giving `x` a type
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ error[E0282]: type annotations needed
|
||||||
| |
|
| |
|
||||||
| consider giving the pattern a type
|
| consider giving the pattern a type
|
||||||
|
|
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
= note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue