};
let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver);
- let err_count = ecx.parse_sess.span_diagnostic.err_count();
// Expand macros now!
let krate = time(sess, "expand crate", || {
let msg = "missing fragment specifier";
sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg);
}
- if ecx.parse_sess.span_diagnostic.err_count() - ecx.resolve_err_count > err_count {
- ecx.parse_sess.span_diagnostic.abort_if_errors();
- }
if cfg!(windows) {
env::set_var("PATH", &old_path);
}
})
})?;
- // Unresolved macros might be due to mistyped `#[macro_use]`,
- // so abort after checking for unknown attributes. (#49074)
- if resolver.found_unresolved_macro {
- sess.diagnostic().abort_if_errors();
- }
-
// Lower ast -> hir.
// First, we need to collect the dep_graph.
let dep_graph = match future_dep_graph {
visit::walk_ty(self, ty)
}
- fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
- // Check if the path in this `use` is not generic, such as `use foo::bar<T>;` While this
- // can't happen normally thanks to the parser, a generic might sneak in if the `use` is
- // built using a macro.
- //
- // macro_use foo {
- // ($p:path) => { use $p; }
- // }
- // foo!(bar::baz<T>);
- use_tree.prefix.segments.iter().find(|segment| {
- segment.args.is_some()
- }).map(|segment| {
- self.err_handler().span_err(segment.args.as_ref().unwrap().span(),
- "generic arguments in import path");
- });
-
- visit::walk_use_tree(self, use_tree, id);
- }
-
fn visit_label(&mut self, label: &'a Label) {
self.check_label(label.ident);
visit::walk_label(self, label);
visit::walk_foreign_item(self, fi)
}
- fn visit_vis(&mut self, vis: &'a Visibility) {
- if let VisibilityKind::Restricted { ref path, .. } = vis.node {
- path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| {
- self.err_handler().span_err(segment.args.as_ref().unwrap().span(),
- "generic arguments in visibility path");
- });
- }
-
- visit::walk_vis(self, vis)
- }
-
fn visit_generics(&mut self, generics: &'a Generics) {
let mut seen_non_lifetime_param = false;
let mut seen_default = None;
macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
macro_defs: FxHashMap<Mark, DefId>,
local_macro_def_scopes: FxHashMap<NodeId, Module<'a>>,
- pub found_unresolved_macro: bool,
/// List of crate local macros that we need to warn about as being unused.
/// Right now this only includes macro_rules! macros, and macros 2.0.
name_already_seen: FxHashMap::default(),
potentially_unused_imports: Vec::new(),
struct_constructors: Default::default(),
- found_unresolved_macro: false,
unused_macros: FxHashSet::default(),
current_type_ascription: Vec::new(),
injected_crate: None,
record_used_id: Option<NodeId>,
path_span: Span)
-> Option<LexicalScopeBinding<'a>> {
- let record_used = record_used_id.is_some();
assert!(ns == TypeNS || ns == ValueNS);
+ if ident.name == keywords::Invalid.name() {
+ return Some(LexicalScopeBinding::Def(Def::Err));
+ }
if ns == TypeNS {
ident.span = if ident.name == keywords::SelfUpper.name() {
// FIXME(jseyfried) improve `Self` hygiene
}
// Walk backwards up the ribs in scope.
+ let record_used = record_used_id.is_some();
let mut module = self.graph_root;
for i in (0 .. self.ribs[ns].len()).rev() {
if let Some(def) = self.ribs[ns][i].bindings.get(&ident).cloned() {
};
let parent_scope = self.invoc_parent_scope(invoc_id, derives_in_scope);
- let (def, ext) = self.resolve_macro_to_def(path, kind, &parent_scope, true, force)?;
+ let (def, ext) = match self.resolve_macro_to_def(path, kind, &parent_scope, true, force) {
+ Ok((def, ext)) => (def, ext),
+ Err(Determinacy::Determined) if kind == MacroKind::Attr => {
+ // Replace unresolved attributes with used inert attributes for better recovery.
+ return Ok(Some(self.get_macro(Def::NonMacroAttr(NonMacroAttrKind::Tool))));
+ }
+ Err(determinacy) => return Err(determinacy),
+ };
if let Def::Macro(def_id, _) = def {
if after_derive {
}
PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined),
PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => {
- self.found_unresolved_macro = true;
Err(Determinacy::Determined)
}
PathResult::Module(..) => unreachable!(),
let binding = self.early_resolve_ident_in_lexical_scope(
path[0].ident, ScopeSet::Macro(kind), parent_scope, false, force, path_span
);
- match binding {
- Ok(..) => {}
- Err(Determinacy::Determined) => self.found_unresolved_macro = true,
- Err(Determinacy::Undetermined) => return Err(Determinacy::Undetermined),
+ if let Err(Determinacy::Undetermined) = binding {
+ return Err(Determinacy::Undetermined);
}
if trace {
pub fn finalize_current_module_macro_resolutions(&mut self) {
let module = self.current_module;
- let check_consistency = |this: &mut Self, path: &[Segment], span,
- kind: MacroKind, initial_def, def| {
+ let check_consistency = |this: &mut Self, path: &[Segment], span, kind: MacroKind,
+ initial_def: Option<Def>, def: Def| {
if let Some(initial_def) = initial_def {
if def != initial_def && def != Def::Err && this.ambiguity_errors.is_empty() {
// Make sure compilation does not succeed if preferred macro resolution
// has changed after the macro had been expanded. In theory all such
// situations should be reported as ambiguity errors, so this is a bug.
- span_bug!(span, "inconsistent resolution for a macro");
+ if initial_def == Def::NonMacroAttr(NonMacroAttrKind::Custom) {
+ // Yeah, legacy custom attributes are implemented using forced resolution
+ // (which is a best effort error recovery tool, basically), so we can't
+ // promise their resolution won't change later.
+ let msg = format!("inconsistent resolution for a macro: first {}, then {}",
+ initial_def.kind_name(), def.kind_name());
+ this.session.span_err(span, &msg);
+ } else {
+ span_bug!(span, "inconsistent resolution for a macro");
+ }
}
} else {
// It's possible that the macro was unresolved (indeterminate) and silently
use ast::{self, Attribute, Name, PatKind, MetaItem};
use attr::HasAttrs;
-use source_map::{self, SourceMap, Spanned, respan};
+use source_map::{SourceMap, Spanned, respan};
use syntax_pos::{Span, MultiSpan, DUMMY_SP};
use edition::Edition;
use errors::{DiagnosticBuilder, DiagnosticId};
pub fn raw_expr(sp: Span) -> P<ast::Expr> {
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
- node: ast::ExprKind::Lit(source_map::respan(sp, ast::LitKind::Bool(false))),
+ node: ast::ExprKind::Err,
span: sp,
attrs: ThinVec::new(),
})
}
}
+ /// A plain dummy type.
pub fn raw_ty(sp: Span) -> P<ast::Ty> {
P(ast::Ty {
id: ast::DUMMY_NODE_ID,
- node: ast::TyKind::Infer,
+ node: ast::TyKind::Err,
span: sp
})
}
pub ecfg: expand::ExpansionConfig<'a>,
pub root_path: PathBuf,
pub resolver: &'a mut dyn Resolver,
- pub resolve_err_count: usize,
pub current_expansion: ExpansionData,
pub expansions: FxHashMap<Span, Vec<String>>,
}
ecfg,
root_path: PathBuf::new(),
resolver,
- resolve_err_count: 0,
current_expansion: ExpansionData {
mark: Mark::root(),
depth: 0,
// FIXME(jseyfried): Refactor out the following logic
let (expanded_fragment, new_invocations) = if let Some(ext) = ext {
if let Some(ext) = ext {
- let dummy = invoc.fragment_kind.dummy(invoc.span()).unwrap();
- let fragment = self.expand_invoc(invoc, &*ext).unwrap_or(dummy);
+ let (invoc_fragment_kind, invoc_span) = (invoc.fragment_kind, invoc.span());
+ let fragment = self.expand_invoc(invoc, &*ext).unwrap_or_else(|| {
+ invoc_fragment_kind.dummy(invoc_span).unwrap()
+ });
self.collect_invocations(fragment, &[])
} else if let InvocationKind::Attr { attr: None, traits, item, .. } = invoc.kind {
if !item.derive_allowed() {
fn resolve_imports(&mut self) {
if self.monotonic {
- let err_count = self.cx.parse_sess.span_diagnostic.err_count();
self.cx.resolver.resolve_imports();
- self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count;
}
}
};
if self.monotonic {
- let err_count = self.cx.parse_sess.span_diagnostic.err_count();
- let mark = self.cx.current_expansion.mark;
- self.cx.resolver.visit_ast_fragment_with_placeholders(mark, &fragment_with_placeholders,
- derives);
- self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count;
+ self.cx.resolver.visit_ast_fragment_with_placeholders(
+ self.cx.current_expansion.mark, &fragment_with_placeholders, derives
+ );
}
(fragment_with_placeholders, invocations)
return;
}
}
- if name.starts_with("rustc_") {
- gate_feature!(self, rustc_attrs, attr.span,
- "unless otherwise specified, attributes \
- with the prefix `rustc_` \
- are reserved for internal compiler diagnostics");
- } else if !attr::is_known(attr) {
- // Only run the custom attribute lint during regular feature gate
- // checking. Macro gating runs before the plugin attributes are
- // registered, so we skip this in that case.
- if !is_macro {
+ if !attr::is_known(attr) {
+ if name.starts_with("rustc_") {
+ let msg = "unless otherwise specified, attributes with the prefix `rustc_` \
+ are reserved for internal compiler diagnostics";
+ gate_feature!(self, rustc_attrs, attr.span, msg);
+ } else if !is_macro {
+ // Only run the custom attribute lint during regular feature gate
+ // checking. Macro gating runs before the plugin attributes are
+ // registered, so we skip this in that case.
let msg = format!("The attribute `{}` is currently unknown to the compiler and \
may have meaning added to it in the future", attr.path);
gate_feature!(self, custom_attribute, attr.span, &msg);
use deriving::generic::ty::*;
use syntax::ast::{Expr, MetaItem};
-use syntax::ext::base::{Annotatable, ExtCtxt};
+use syntax::ext::base::{Annotatable, DummyResult, ExtCtxt};
use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::Symbol;
span_err!(cx, trait_span, E0665,
"`Default` cannot be derived for enums, only structs");
// let compilation continue
- cx.expr_usize(trait_span, 0)
+ DummyResult::raw_expr(trait_span)
}
_ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`"),
};
"X" => "UpperHex",
_ => {
ecx.span_err(sp, &format!("unknown format trait `{}`", *tyname));
- "Dummy"
+ return DummyResult::raw_expr(sp);
}
}
}
sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_FORMAT_ARGS_NL);
- return base::DummyResult::expr(sp);
+ return DummyResult::expr(sp);
}
sp = sp.apply_mark(ecx.current_expansion.mark);
match parse_args(ecx, sp, tts) {
#[cfg(foo(bar))] //~ ERROR invalid predicate `foo`
+fn check() {}
+
fn main() {}
}
generate_s10!(concat!("nonexistent"));
+
+fn main() {}
#[macro_export]
macro_rules! myprint {
- ($($arg:tt)*) => (print(format_args!($($arg)*)));
+ ($($arg:tt)*) => ($crate::print(format_args!($($arg)*)));
}
#[macro_export]
type Bar;
}
+struct Bar;
+
impl Bar {
#[derive(Clone)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
| ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
-
fn foo() {
- println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
+ (0..13).collect<Vec<i32>>();
+ //~^ ERROR chained comparison
+ //~| ERROR expected value, found struct `Vec`
+ //~| ERROR expected value, found builtin type `i32`
+ //~| ERROR attempted to take value of method `collect`
}
fn bar() {
- println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
+ Vec<i32>::new();
+ //~^ ERROR chained comparison
+ //~| ERROR expected value, found struct `Vec`
+ //~| ERROR expected value, found builtin type `i32`
+ //~| ERROR cannot find function `new` in the crate root
}
fn qux() {
- println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
+ (0..13).collect<Vec<i32>();
//~^ ERROR chained comparison
+ //~| ERROR chained comparison
+ //~| ERROR expected value, found struct `Vec`
+ //~| ERROR expected value, found builtin type `i32`
+ //~| ERROR attempted to take value of method `collect`
+ //~| ERROR mismatched types
}
fn main() {}
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:2:37
|
-LL | println!("{:?}", (0..13).collect<Vec<i32>>()); //~ ERROR chained comparison
- | ^^^^^^^^
+LL | (0..13).collect<Vec<i32>>();
+ | ^^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
= help: or use `(...)` if you meant to specify fn arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:6:25
|
-LL | println!("{:?}", Vec<i32>::new()); //~ ERROR chained comparison
- | ^^^^^^^
+LL | Vec<i32>::new();
+ | ^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
= help: or use `(...)` if you meant to specify fn arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:10:37
|
-LL | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
- | ^^^^^^^^
+LL | (0..13).collect<Vec<i32>();
+ | ^^^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
= help: or use `(...)` if you meant to specify fn arguments
error: chained comparison operators require parentheses
--> $DIR/issue-40396.rs:10:41
|
-LL | println!("{:?}", (0..13).collect<Vec<i32>()); //~ ERROR chained comparison
- | ^^^^^^
+LL | (0..13).collect<Vec<i32>();
+ | ^^^^^^
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
= help: or use `(...)` if you meant to specify fn arguments
-error: aborting due to 4 previous errors
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-40396.rs:12:21
+ |
+LL | (0..13).collect<Vec<i32>>();
+ | ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+ --> $DIR/issue-40396.rs:12:25
+ |
+LL | (0..13).collect<Vec<i32>>();
+ | ^^^ not a value
+
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-40396.rs:20:5
+ |
+LL | Vec<i32>::new();
+ | ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+ --> $DIR/issue-40396.rs:20:9
+ |
+LL | Vec<i32>::new();
+ | ^^^ not a value
+
+error[E0425]: cannot find function `new` in the crate root
+ --> $DIR/issue-40396.rs:20:15
+ |
+LL | Vec<i32>::new();
+ | ^^^ not found in the crate root
+
+error[E0423]: expected value, found struct `Vec`
+ --> $DIR/issue-40396.rs:28:21
+ |
+LL | (0..13).collect<Vec<i32>();
+ | ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0423]: expected value, found builtin type `i32`
+ --> $DIR/issue-40396.rs:28:25
+ |
+LL | (0..13).collect<Vec<i32>();
+ | ^^^ not a value
+
+error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>`
+ --> $DIR/issue-40396.rs:12:13
+ |
+LL | (0..13).collect<Vec<i32>>();
+ | ^^^^^^^
+ |
+ = help: maybe a `()` to call it is missing?
+
+error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>`
+ --> $DIR/issue-40396.rs:28:13
+ |
+LL | (0..13).collect<Vec<i32>();
+ | ^^^^^^^
+ |
+ = help: maybe a `()` to call it is missing?
+
+error[E0308]: mismatched types
+ --> $DIR/issue-40396.rs:28:29
+ |
+LL | (0..13).collect<Vec<i32>();
+ | ^^ expected bool, found ()
+ |
+ = note: expected type `bool`
+ found type `()`
+
+error: aborting due to 14 previous errors
+Some errors occurred: E0308, E0423, E0425, E0615.
+For more information about an error, try `rustc --explain E0308`.
#[macro_use]
extern crate edition_kw_macro_2015;
+mod module {
+ pub fn async() {}
+}
+
pub fn check_async() {
let mut async = 1; // OK
let mut r#async = 1; // OK
module::async(); // OK
module::r#async(); // OK
}
+
+fn main() {}
| ^^^^^ no rules expected this token in macro call
error: aborting due to 2 previous errors
-
mod two_async {
produces_async_raw! {} // OK
}
+
+fn main() {}
#[macro_use]
extern crate edition_kw_macro_2018;
+mod module {
+ pub fn async() {}
+}
+
pub fn check_async() {
let mut async = 1; // OK
let mut r#async = 1; // OK
module::async(); // OK
module::r#async(); // OK
}
+
+fn main() {}
| ^^^^^ no rules expected this token in macro call
error: aborting due to 2 previous errors
-
mod two_async {
produces_async_raw! {} // OK
}
+
+fn main() {}
//~^ ERROR cannot find derive macro `x3300` in this scope
struct S;
}
+
+fn main() {}
//~^ ERROR `derive` may only be applied to structs, enums and unions
impl S { }
}
+
+fn main() {}
+#![feature(intrinsics, lang_items, no_core)]
+
#![crate_type="rlib"]
#![no_core]
emits_nothing!();
//~^ ERROR macro invocations in `extern {}` blocks are experimental
}
+
+fn main() {}
-// ignore-tidy-linelength
-
// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
#[rustc_foo]
-//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics
+//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved
fn main() {}
// We only want to assert that this doesn't ICE, we don't particularly care
// about whether it nor it fails to compile.
-// error-pattern:
-
macro_rules! foo{
() => {{
macro_rules! bar{() => (())}
assert!({one! two()});
//~^ ERROR macros that expand to items must either be surrounded with braces or followed by a
+ //~| ERROR cannot find macro `one!` in this scope
+ //~| ERROR mismatched types
// regardless of whether nested macro_rules works, the following should at
// least throw a conventional error.
assert!({one! two});
- //~^ ERROR expected
+ //~^ ERROR expected `(` or `{`, found `}`
+ //~| ERROR cannot apply unary operator `!` to type `!`
}
LL | assert!({one! two});
| ^ expected `(` or `{`
-error: aborting due to 2 previous errors
+error: cannot find macro `one!` in this scope
+ --> $DIR/issue-10536.rs:24:14
+ |
+LL | assert!({one! two()});
+ | ^^^
+
+error[E0308]: mismatched types
+ --> $DIR/issue-10536.rs:24:13
+ |
+LL | assert!({one! two()});
+ | ^^^^^^^^^^^^ expected bool, found ()
+ |
+ = note: expected type `bool`
+ found type `()`
+
+error[E0600]: cannot apply unary operator `!` to type `!`
+ --> $DIR/issue-10536.rs:31:5
+ |
+LL | assert!({one! two});
+ | ^^^^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+
+error: aborting due to 5 previous errors
+Some errors occurred: E0308, E0600.
+For more information about an error, try `rustc --explain E0308`.
fn main() {
print!(testo!());
//~^ ERROR: format argument must be a string literal
+ //~| ERROR: cannot find macro `testo!` in this scope
}
LL | print!("{}", testo!());
| ^^^^^
-error: aborting due to previous error
+error: cannot find macro `testo!` in this scope
+ --> $DIR/issue-11692-1.rs:12:12
+ |
+LL | print!(testo!());
+ | ^^^^^
+
+error: aborting due to 2 previous errors
fn main() {
concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
+ //~| ERROR expected a literal
}
+error: expected a literal
+ --> $DIR/issue-11692-2.rs:12:13
+ |
+LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
+ | ^^^^^^^
+ |
+ = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()`
+
error: cannot find macro `test!` in this scope
--> $DIR/issue-11692-2.rs:2:13
|
LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope
| ^^^^
-error: aborting due to previous error
+error: aborting due to 2 previous errors
#[derive(Debug)]
struct Baz<T>(
concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
+ //~^ ERROR cannot find type `FooBar` in this scope
);
fn main() {}
LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error[E0412]: cannot find type `FooBar` in this scope
+ --> $DIR/issue-32950.rs:15:5
+ |
+LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0412`.
Sync, //~ ERROR this unsafe trait should be implemented explicitly
Copy)]
enum Foo {}
+
+fn main() {}
this.drain()
//~^ ERROR no method named
}
+
+fn main() {}
-error[E0601]: `main` function not found in crate `issue_35677`
- |
- = note: consider adding a `main` function to `$DIR/issue-35677.rs`
-
error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
--> $DIR/issue-35677.rs:3:10
|
`K : std::cmp::Eq`
`K : std::hash::Hash`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors occurred: E0599, E0601.
-For more information about an error, try `rustc --explain E0599`.
+For more information about this error, try `rustc --explain E0599`.
#![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
+
+fn main() {}
#[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
type F;
}
+
+fn main() {}
}
}
-trait Trait {}
+trait Tr {}
m!(Tr);
}
fn main() {
- bar!();
+ bar!(); //~ ERROR cannot find macro `bar!` in this scope
}
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
-error: aborting due to previous error
+error: cannot find macro `bar!` in this scope
+ --> $DIR/issue-49074.rs:22:4
+ |
+LL | bar!(); //~ ERROR cannot find macro `bar!` in this scope
+ | ^^^
+ |
+ = help: have you added the `#[macro_use]` on the module/import?
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
//~^ ERROR #[cfg] cannot be applied on a generic parameter
+//~| ERROR attribute `ignored` is currently unknown to the compiler
LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
| ^^^^^^^^^^^^
-error: aborting due to 8 previous errors
+error[E0658]: The attribute `ignored` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/issue-51279.rs:33:8
+ |
+LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to 9 previous errors
+For more information about this error, try `rustc --explain E0658`.
//~^ ERROR cannot infer
}
}
+
+fn main() {}
-error[E0601]: `main` function not found in crate `issue_55796`
- |
- = note: consider adding a `main` function to `$DIR/issue-55796.rs`
-
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/issue-55796.rs:16:9
|
expected std::boxed::Box<(dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node> + 'static)>
found std::boxed::Box<dyn std::iter::Iterator<Item=<Self as Graph<'a>>::Node>>
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors occurred: E0495, E0601.
-For more information about an error, try `rustc --explain E0495`.
+For more information about this error, try `rustc --explain E0495`.
($inp:ident) => (
$nonexistent
//~^ ERROR unknown macro variable `nonexistent`
+ //~| ERROR cannot find value `nonexistent` in this scope
);
}
LL | e!(foo);
| -------- in this macro invocation
-error: aborting due to previous error
+error[E0425]: cannot find value `nonexistent` in this scope
+ --> $DIR/issue-6596-1.rs:14:9
+ |
+LL | $nonexistent
+ | ^^^^^^^^^^^^ not found in this scope
+...
+LL | e!(foo);
+ | -------- in this macro invocation
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0425`.
}
fn main() {
+ let foo = 0;
g!(foo);
}
//~| ERROR expected one of
//~| ERROR expected one of
+struct syntax;
+
fn main() {
pong!();
ping!();
LL | write!(f, "{}",)?;
| ^^
-error: aborting due to 7 previous errors
+error: `#[panic_handler]` function required, but not found
+
+error: language item required, but not found: `eh_personality`
+
+error: language item required, but not found: `eh_unwind_resume`
+
+error: aborting due to 10 previous errors
#[derive]
//~^ WARNING empty trait list
struct Test4;
+
+fn main() {}
// error-pattern:cannot depend on a crate that needs a panic runtime
extern crate depends;
+
+fn main() {}
error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`
-error[E0601]: `main` function not found in crate `runtime_depend_on_needs_runtime`
- |
- = note: consider adding a `main` function to `$DIR/runtime-depend-on-needs-runtime.rs`
+error: aborting due to previous error
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0601`.
}
fn main() {
- let y: u32 = foo::x;
+ let y: u32 = foo::x; //~ ERROR static `x` is private
}
|
= help: try adjusting the macro to put `pub` inside the invocation
-error: aborting due to previous error
+error[E0603]: static `x` is private
+ --> $DIR/pub-item-macro.rs:27:23
+ |
+LL | let y: u32 = foo::x; //~ ERROR static `x` is private
+ | ^
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0603`.
#![emit_unchanged]
//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
+//~| ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro
extern crate issue_41211;
use issue_41211::emit_unchanged;
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
-error: aborting due to previous error
+error: inconsistent resolution for a macro: first custom attribute, then attribute macro
+ --> $DIR/issue-41211.rs:18:4
+ |
+LL | #![emit_unchanged]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
use lifetimes::*;
type A = single_quote_alone!(); //~ ERROR expected type, found `'`
+
+fn main() {}
// aux-build:more-gates.rs
+#![feature(decl_macro)]
+
extern crate more_gates as foo;
use foo::*;
macro four($($tokens:tt)*) {
parent_source_spans!($($tokens)*);
+ //~^ ERROR cannot find value `ok` in this scope
+ //~| ERROR cannot find value `ok` in this scope
+ //~| ERROR cannot find value `ok` in this scope
}
fn main() {
LL | three!("hip", "hop");
| ^^^^^
-error: aborting due to 18 previous errors
+error[E0425]: cannot find value `ok` in this scope
+ --> $DIR/parent-source-spans.rs:40:5
+ |
+LL | parent_source_spans!($($tokens)*);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL | one!("hello", "world");
+ | ----------------------- in this macro invocation
+
+error[E0425]: cannot find value `ok` in this scope
+ --> $DIR/parent-source-spans.rs:40:5
+ |
+LL | parent_source_spans!($($tokens)*);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL | two!("yay", "rust");
+ | -------------------- in this macro invocation
+
+error[E0425]: cannot find value `ok` in this scope
+ --> $DIR/parent-source-spans.rs:40:5
+ |
+LL | parent_source_spans!($($tokens)*);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
+...
+LL | three!("hip", "hop");
+ | --------------------- in this macro invocation
+
+error: aborting due to 21 previous errors
+For more information about this error, try `rustc --explain E0425`.
#[macro_use]
extern crate derive_b;
-#[B]
+#[B] //~ ERROR `B` is ambiguous
#[C] //~ ERROR attribute `C` is currently unknown to the compiler
-#[B(D)]
-#[B(E = "foo")]
-#[B(arbitrary tokens)]
+#[B(D)] //~ ERROR `B` is ambiguous
+#[B(E = "foo")] //~ ERROR `B` is ambiguous
+#[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+ //~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens`
#[derive(B)]
struct B;
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
-error: aborting due to previous error
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+ --> $DIR/proc-macro-attributes.rs:16:3
+ |
+LL | #[B] //~ ERROR `B` is ambiguous
+ | ^ ambiguous name
+ |
+note: `B` could refer to the derive helper attribute defined here
+ --> $DIR/proc-macro-attributes.rs:22:10
+ |
+LL | #[derive(B)]
+ | ^
+note: `B` could also refer to the derive macro imported here
+ --> $DIR/proc-macro-attributes.rs:13:1
+ |
+LL | #[macro_use]
+ | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+ --> $DIR/proc-macro-attributes.rs:18:3
+ |
+LL | #[B(D)] //~ ERROR `B` is ambiguous
+ | ^ ambiguous name
+ |
+note: `B` could refer to the derive helper attribute defined here
+ --> $DIR/proc-macro-attributes.rs:22:10
+ |
+LL | #[derive(B)]
+ | ^
+note: `B` could also refer to the derive macro imported here
+ --> $DIR/proc-macro-attributes.rs:13:1
+ |
+LL | #[macro_use]
+ | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+ --> $DIR/proc-macro-attributes.rs:19:3
+ |
+LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous
+ | ^ ambiguous name
+ |
+note: `B` could refer to the derive helper attribute defined here
+ --> $DIR/proc-macro-attributes.rs:22:10
+ |
+LL | #[derive(B)]
+ | ^
+note: `B` could also refer to the derive macro imported here
+ --> $DIR/proc-macro-attributes.rs:13:1
+ |
+LL | #[macro_use]
+ | ^^^^^^^^^^^^
+
+error[E0659]: `B` is ambiguous (derive helper attribute vs any other name)
+ --> $DIR/proc-macro-attributes.rs:20:3
+ |
+LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+ | ^ ambiguous name
+ |
+note: `B` could refer to the derive helper attribute defined here
+ --> $DIR/proc-macro-attributes.rs:22:10
+ |
+LL | #[derive(B)]
+ | ^
+note: `B` could also refer to the derive macro imported here
+ --> $DIR/proc-macro-attributes.rs:13:1
+ |
+LL | #[macro_use]
+ | ^^^^^^^^^^^^
+
+error: expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens`
+ --> $DIR/proc-macro-attributes.rs:20:15
+ |
+LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous
+ | ^^^^^^ expected one of `(`, `)`, `,`, `::`, or `=` here
+
+error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0658`.
+Some errors occurred: E0658, E0659.
+For more information about an error, try `rustc --explain E0658`.
fn main() {
macro_rules! foo {
($bar:expr) => {
- quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token
+ quote_expr!(cx, $bar)
+ //~^ ERROR quote! with interpolated token
+ //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`?
+ //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`?
+ //~| ERROR cannot find value `cx` in this scope
+ //~| ERROR cannot find function `new_parser_from_tts` in this scope
}
}
foo!(bar);
error: quote! with interpolated token
--> $DIR/quote-with-interpolated.rs:5:29
|
-LL | quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token
+LL | quote_expr!(cx, $bar)
| ^^^^
...
LL | foo!(bar);
| ---------- in this macro invocation
-error: aborting due to previous error
+error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`?
+ --> $DIR/quote-with-interpolated.rs:15:13
+ |
+LL | quote_expr!(cx, $bar)
+ | ^^^^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate syntax;`?
+
+error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`?
+ --> $DIR/quote-with-interpolated.rs:15:29
+ |
+LL | quote_expr!(cx, $bar)
+ | ^^^^ maybe a missing `extern crate syntax;`?
+
+error[E0425]: cannot find value `cx` in this scope
+ --> $DIR/quote-with-interpolated.rs:15:25
+ |
+LL | quote_expr!(cx, $bar)
+ | ^^ not found in this scope
+...
+LL | foo!(bar);
+ | ---------- in this macro invocation
+
+error[E0425]: cannot find function `new_parser_from_tts` in this scope
+ --> $DIR/quote-with-interpolated.rs:15:13
+ |
+LL | quote_expr!(cx, $bar)
+ | ^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 5 previous errors
+Some errors occurred: E0425, E0433.
+For more information about an error, try `rustc --explain E0425`.
-#[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
+#[rustc_attribute_should_be_reserved]
+//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved
macro_rules! foo {
() => (());
}
fn main() {
- foo!();
+ foo!(); //~ ERROR cannot determine resolution for the macro `foo`
}
error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
--> $DIR/reserved-attr-on-macro.rs:1:3
|
-LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
+LL | #[rustc_attribute_should_be_reserved]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
-error: aborting due to previous error
+error: cannot determine resolution for the macro `foo`
+ --> $DIR/reserved-attr-on-macro.rs:18:5
+ |
+LL | foo!(); //~ ERROR cannot determine resolution for the macro `foo`
+ | ^^^
+ |
+ = note: import resolution is stuck, try simplifying macro imports
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
struct Bar<'Self>;
//~^ ERROR lifetimes cannot use keyword names
+//~| ERROR parameter `'Self` is never used
struct Foo;
LL | Self!() => (),
| ^^^^
-error: aborting due to 10 previous errors
+error[E0392]: parameter `'Self` is never used
+ --> $DIR/self_type_keyword.rs:18:12
+ |
+LL | struct Bar<'Self>;
+ | ^^^^^ unused type parameter
+ |
+ = help: consider removing `'Self` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 11 previous errors
+For more information about this error, try `rustc --explain E0392`.
#![foo] //~ ERROR is currently unknown to the compiler
//~| ERROR non-builtin inner attributes are unstable
}
+
+fn main() {}
}
}
+macro_rules! foo { () => () }
+
fn main() {
foo::<T>!(); //~ ERROR generic arguments in macro path
foo::<>!(); //~ ERROR generic arguments in macro path
- m!(MyTrait<>); //~ ERROR generic arguments in macro path
+ m!(Default<>); //~ ERROR generic arguments in macro path
//~^ ERROR unexpected generic arguments in path
}
error: unexpected generic arguments in path
--> $DIR/macro-ty-params.rs:10:8
|
-LL | m!(MyTrait<>); //~ ERROR generic arguments in macro path
- | ^^^^^^^^^
+LL | foo::<T>!(); //~ ERROR generic arguments in macro path
+ | ^^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:10:15
|
-LL | m!(MyTrait<>); //~ ERROR generic arguments in macro path
- | ^^
+LL | foo::<>!(); //~ ERROR generic arguments in macro path
+ | ^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:8:8
|
-LL | foo::<T>!(); //~ ERROR generic arguments in macro path
- | ^^^^^
+LL | m!(Default<>); //~ ERROR generic arguments in macro path
+ | ^^^^^^^^^
error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:9:8
|
-LL | foo::<>!(); //~ ERROR generic arguments in macro path
- | ^^^^
+LL | m!(Default<>); //~ ERROR generic arguments in macro path
+ | ^^
error: aborting due to 4 previous errors
-
struct S<T>(T);
m!{ S<u8> } //~ ERROR unexpected generic arguments in path
+ //~| ERROR expected module, found struct `S`
mod m {
m!{ m<> } //~ ERROR unexpected generic arguments in path
LL | m!{ m<> } //~ ERROR unexpected generic arguments in path
| ^^^
-error: aborting due to 2 previous errors
+error[E0577]: expected module, found struct `S`
+ --> $DIR/visibility-ty-params.rs:16:5
+ |
+LL | m!{ S<u8> } //~ ERROR unexpected generic arguments in path
+ | -^^^^
+ | |
+ | did you mean `m`?
+
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0577`.
}
mod foo {
- define_struct! { (foo) }
+ define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
}
+
+fn main() {}
LL | struct S3(pub $t ());
| ^ expected one of `)` or `,` here
...
-LL | define_struct! { (foo) }
+LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
| ------------------------ in this macro invocation
-error: aborting due to previous error
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test2.rs:21:23
+ |
+LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0412`.
}
mod foo {
- define_struct! { foo }
+ define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
}
+
+fn main() {}
LL | struct S3(pub($t) ());
| ^ expected one of `)` or `,` here
...
-LL | define_struct! { foo }
+LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
| ---------------------- in this macro invocation
-error: aborting due to previous error
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test3.rs:21:22
+ |
+LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0412`.