self.opts.debugging_opts.teach && self.diagnostic().must_teach(code)
}
+ pub fn rust_2015(&self) -> bool {
+ self.opts.edition == Edition::Edition2015
+ }
+
/// Are we allowed to use features from the Rust 2018 edition?
pub fn rust_2018(&self) -> bool {
self.opts.edition >= Edition::Edition2018
binding.map(|binding| (binding, Flags::MODULE, Flags::empty()))
}
WhereToResolve::MacroUsePrelude => {
- match self.macro_use_prelude.get(&ident.name).cloned() {
- Some(binding) => Ok((binding, Flags::PRELUDE, Flags::empty())),
- None => Err(Determinacy::Determined),
+ let mut result = Err(Determinacy::Determined);
+ if use_prelude || self.session.rust_2015() {
+ if let Some(binding) = self.macro_use_prelude.get(&ident.name).cloned() {
+ result = Ok((binding, Flags::PRELUDE, Flags::empty()));
+ }
}
+ result
}
WhereToResolve::BuiltinMacros => {
match self.builtin_macros.get(&ident.name).cloned() {
}
}
WhereToResolve::LegacyPluginHelpers => {
- if self.session.plugin_attributes.borrow().iter()
+ if (use_prelude || self.session.rust_2015()) &&
+ self.session.plugin_attributes.borrow().iter()
.any(|(name, _)| ident.name == &**name) {
let binding = (Def::NonMacroAttr(NonMacroAttrKind::LegacyPluginHelper),
ty::Visibility::Public, ident.span, Mark::root())
--- /dev/null
+error: cannot find macro `print!` in this scope
+ --> $DIR/no_implicit_prelude-2018.rs:7:9
+ |
+LL | print!(); //~ ERROR cannot find macro `print!` in this scope
+ | ^^^^^
+ |
+ = help: have you added the `#[macro_use]` on the module/import?
+
+error: aborting due to previous error
+