Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2276448

Browse files
committedJan 22, 2023
Auto merge of #107164 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backport * Don't wf-check non-local RPITs #107038 * Revert "Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error" #107133 * bump bootstrap 1.66.1 r? `@Mark-Simulacrum`
2 parents b7a6d74 + e9de5a6 commit 2276448

File tree

17 files changed

+584
-394
lines changed

17 files changed

+584
-394
lines changed
 

‎compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2418,7 +2418,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
24182418
match path.res {
24192419
Res::Def(DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder, did) => {
24202420
// Check for desugared `impl Trait`.
2421-
assert!(ty::is_impl_trait_defn(tcx, did).is_none());
2421+
assert!(tcx.is_type_alias_impl_trait(did));
24222422
let item_segment = path.segments.split_last().unwrap();
24232423
self.prohibit_generics(item_segment.1.iter(), |err| {
24242424
err.note("`impl Trait` types can't have type parameters");

‎compiler/rustc_hir_analysis/src/collect.rs

+11
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ pub fn provide(providers: &mut Providers) {
8282
asm_target_features,
8383
collect_mod_item_types,
8484
should_inherit_track_caller,
85+
is_type_alias_impl_trait,
8586
..*providers
8687
};
8788
}
@@ -2250,3 +2251,13 @@ fn check_target_feature_trait_unsafe(tcx: TyCtxt<'_>, id: LocalDefId, attr_span:
22502251
}
22512252
}
22522253
}
2254+
2255+
fn is_type_alias_impl_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
2256+
match tcx.hir().get_if_local(def_id) {
2257+
Some(Node::Item(hir::Item { kind: hir::ItemKind::OpaqueTy(opaque), .. })) => {
2258+
matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias)
2259+
}
2260+
Some(_) => bug!("tried getting opaque_ty_origin for non-opaque: {:?}", def_id),
2261+
_ => bug!("tried getting opaque_ty_origin for non-local def-id {:?}", def_id),
2262+
}
2263+
}

‎compiler/rustc_lint_defs/src/builtin.rs

+68
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,73 @@ declare_lint! {
19821982
};
19831983
}
19841984

1985+
declare_lint! {
1986+
/// The `proc_macro_derive_resolution_fallback` lint detects proc macro
1987+
/// derives using inaccessible names from parent modules.
1988+
///
1989+
/// ### Example
1990+
///
1991+
/// ```rust,ignore (proc-macro)
1992+
/// // foo.rs
1993+
/// #![crate_type = "proc-macro"]
1994+
///
1995+
/// extern crate proc_macro;
1996+
///
1997+
/// use proc_macro::*;
1998+
///
1999+
/// #[proc_macro_derive(Foo)]
2000+
/// pub fn foo1(a: TokenStream) -> TokenStream {
2001+
/// drop(a);
2002+
/// "mod __bar { static mut BAR: Option<Something> = None; }".parse().unwrap()
2003+
/// }
2004+
/// ```
2005+
///
2006+
/// ```rust,ignore (needs-dependency)
2007+
/// // bar.rs
2008+
/// #[macro_use]
2009+
/// extern crate foo;
2010+
///
2011+
/// struct Something;
2012+
///
2013+
/// #[derive(Foo)]
2014+
/// struct Another;
2015+
///
2016+
/// fn main() {}
2017+
/// ```
2018+
///
2019+
/// This will produce:
2020+
///
2021+
/// ```text
2022+
/// warning: cannot find type `Something` in this scope
2023+
/// --> src/main.rs:8:10
2024+
/// |
2025+
/// 8 | #[derive(Foo)]
2026+
/// | ^^^ names from parent modules are not accessible without an explicit import
2027+
/// |
2028+
/// = note: `#[warn(proc_macro_derive_resolution_fallback)]` on by default
2029+
/// = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2030+
/// = note: for more information, see issue #50504 <https://github.com/rust-lang/rust/issues/50504>
2031+
/// ```
2032+
///
2033+
/// ### Explanation
2034+
///
2035+
/// If a proc-macro generates a module, the compiler unintentionally
2036+
/// allowed items in that module to refer to items in the crate root
2037+
/// without importing them. This is a [future-incompatible] lint to
2038+
/// transition this to a hard error in the future. See [issue #50504] for
2039+
/// more details.
2040+
///
2041+
/// [issue #50504]: https://github.com/rust-lang/rust/issues/50504
2042+
/// [future-incompatible]: ../index.md#future-incompatible-lints
2043+
pub PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
2044+
Deny,
2045+
"detects proc macro derives using inaccessible names from parent modules",
2046+
@future_incompatible = FutureIncompatibleInfo {
2047+
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
2048+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
2049+
};
2050+
}
2051+
19852052
declare_lint! {
19862053
/// The `macro_use_extern_crate` lint detects the use of the
19872054
/// [`macro_use` attribute].
@@ -3220,6 +3287,7 @@ declare_lint_pass! {
32203287
UNSTABLE_NAME_COLLISIONS,
32213288
IRREFUTABLE_LET_PATTERNS,
32223289
WHERE_CLAUSES_OBJECT_SAFETY,
3290+
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
32233291
MACRO_USE_EXTERN_CRATE,
32243292
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
32253293
ILL_FORMED_ATTRIBUTE_INPUT,

‎compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+9
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ provide! { tcx, def_id, other, cdata,
223223
generator_kind => { table }
224224
trait_def => { table }
225225
deduced_param_attrs => { table }
226+
is_type_alias_impl_trait => {
227+
debug_assert_eq!(tcx.def_kind(def_id), DefKind::OpaqueTy);
228+
cdata
229+
.root
230+
.tables
231+
.is_type_alias_impl_trait
232+
.get(cdata, def_id.index)
233+
.is_some()
234+
}
226235
collect_trait_impl_trait_tys => {
227236
Ok(cdata
228237
.root

‎compiler/rustc_metadata/src/rmeta/encoder.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1535,8 +1535,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
15351535
hir::ItemKind::Mod(ref m) => {
15361536
return self.encode_info_for_mod(item.owner_id.def_id, m);
15371537
}
1538-
hir::ItemKind::OpaqueTy(..) => {
1538+
hir::ItemKind::OpaqueTy(ref opaque) => {
15391539
self.encode_explicit_item_bounds(def_id);
1540+
if matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias) {
1541+
self.tables.is_type_alias_impl_trait.set(def_id.index, ());
1542+
}
15401543
}
15411544
hir::ItemKind::Enum(..) => {
15421545
let adt_def = self.tcx.adt_def(def_id);

‎compiler/rustc_metadata/src/rmeta/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ define_tables! {
404404
proc_macro: Table<DefIndex, MacroKind>,
405405
module_reexports: Table<DefIndex, LazyArray<ModChild>>,
406406
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
407+
// Slot is full when opaque is TAIT.
408+
is_type_alias_impl_trait: Table<DefIndex, ()>,
407409

408410
trait_impl_trait_tys: Table<DefIndex, LazyValue<FxHashMap<DefId, Ty<'static>>>>,
409411
}

‎compiler/rustc_middle/src/query/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ rustc_queries! {
175175
separate_provide_extern
176176
}
177177

178+
query is_type_alias_impl_trait(key: DefId) -> bool
179+
{
180+
desc { "determine whether the opaque is a type-alias impl trait" }
181+
separate_provide_extern
182+
}
183+
178184
query analysis(key: ()) -> Result<(), ErrorGuaranteed> {
179185
eval_always
180186
desc { "running analysis passes on this crate" }

‎compiler/rustc_middle/src/ty/parameterized.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ trivially_parameterized_over_tcx! {
5353
usize,
5454
(),
5555
u32,
56+
bool,
5657
std::string::String,
5758
crate::metadata::ModChild,
5859
crate::middle::codegen_fn_attrs::CodegenFnAttrs,

‎compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ impl<'a> Resolver<'a> {
10291029
let root_module = this.resolve_crate_root(root_ident);
10301030
this.add_module_candidates(root_module, &mut suggestions, filter_fn, None);
10311031
}
1032-
Scope::Module(module) => {
1032+
Scope::Module(module, _) => {
10331033
this.add_module_candidates(module, &mut suggestions, filter_fn, None);
10341034
}
10351035
Scope::MacroUsePrelude => {

‎compiler/rustc_resolve/src/ident.rs

+65-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
use rustc_ast as ast;
1+
use rustc_ast::{self as ast, NodeId};
22
use rustc_feature::is_builtin_attr_name;
33
use rustc_hir::def::{DefKind, Namespace, NonMacroAttrKind, PartialRes, PerNS};
44
use rustc_hir::PrimTy;
55
use rustc_middle::bug;
66
use rustc_middle::ty;
7+
use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK;
8+
use rustc_session::lint::BuiltinLintDiagnostics;
79
use rustc_span::def_id::LocalDefId;
810
use rustc_span::edition::Edition;
911
use rustc_span::hygiene::{ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext};
@@ -99,7 +101,7 @@ impl<'a> Resolver<'a> {
99101
};
100102
let mut scope = match ns {
101103
_ if is_absolute_path => Scope::CrateRoot,
102-
TypeNS | ValueNS => Scope::Module(module),
104+
TypeNS | ValueNS => Scope::Module(module, None),
103105
MacroNS => Scope::DeriveHelpers(parent_scope.expansion),
104106
};
105107
let mut ctxt = ctxt.normalize_to_macros_2_0();
@@ -163,7 +165,7 @@ impl<'a> Resolver<'a> {
163165
MacroRulesScope::Invocation(invoc_id) => {
164166
Scope::MacroRules(self.invocation_parent_scopes[&invoc_id].macro_rules)
165167
}
166-
MacroRulesScope::Empty => Scope::Module(module),
168+
MacroRulesScope::Empty => Scope::Module(module, None),
167169
},
168170
Scope::CrateRoot => match ns {
169171
TypeNS => {
@@ -172,10 +174,16 @@ impl<'a> Resolver<'a> {
172174
}
173175
ValueNS | MacroNS => break,
174176
},
175-
Scope::Module(module) => {
177+
Scope::Module(module, prev_lint_id) => {
176178
use_prelude = !module.no_implicit_prelude;
177-
match self.hygienic_lexical_parent(module, &mut ctxt) {
178-
Some(parent_module) => Scope::Module(parent_module),
179+
let derive_fallback_lint_id = match scope_set {
180+
ScopeSet::Late(.., lint_id) => lint_id,
181+
_ => None,
182+
};
183+
match self.hygienic_lexical_parent(module, &mut ctxt, derive_fallback_lint_id) {
184+
Some((parent_module, lint_id)) => {
185+
Scope::Module(parent_module, lint_id.or(prev_lint_id))
186+
}
179187
None => {
180188
ctxt.adjust(ExpnId::root());
181189
match ns {
@@ -207,13 +215,45 @@ impl<'a> Resolver<'a> {
207215
&mut self,
208216
module: Module<'a>,
209217
ctxt: &mut SyntaxContext,
210-
) -> Option<Module<'a>> {
218+
derive_fallback_lint_id: Option<NodeId>,
219+
) -> Option<(Module<'a>, Option<NodeId>)> {
211220
if !module.expansion.outer_expn_is_descendant_of(*ctxt) {
212-
return Some(self.expn_def_scope(ctxt.remove_mark()));
221+
return Some((self.expn_def_scope(ctxt.remove_mark()), None));
213222
}
214223

215224
if let ModuleKind::Block = module.kind {
216-
return Some(module.parent.unwrap().nearest_item_scope());
225+
return Some((module.parent.unwrap().nearest_item_scope(), None));
226+
}
227+
228+
// We need to support the next case under a deprecation warning
229+
// ```
230+
// struct MyStruct;
231+
// ---- begin: this comes from a proc macro derive
232+
// mod implementation_details {
233+
// // Note that `MyStruct` is not in scope here.
234+
// impl SomeTrait for MyStruct { ... }
235+
// }
236+
// ---- end
237+
// ```
238+
// So we have to fall back to the module's parent during lexical resolution in this case.
239+
if derive_fallback_lint_id.is_some() {
240+
if let Some(parent) = module.parent {
241+
// Inner module is inside the macro, parent module is outside of the macro.
242+
if module.expansion != parent.expansion
243+
&& module.expansion.is_descendant_of(parent.expansion)
244+
{
245+
// The macro is a proc macro derive
246+
if let Some(def_id) = module.expansion.expn_data().macro_def_id {
247+
let ext = self.get_macro_by_def_id(def_id).ext;
248+
if ext.builtin_name.is_none()
249+
&& ext.macro_kind() == MacroKind::Derive
250+
&& parent.expansion.outer_expn_is_descendant_of(*ctxt)
251+
{
252+
return Some((parent, derive_fallback_lint_id));
253+
}
254+
}
255+
}
256+
}
217257
}
218258

219259
None
@@ -470,7 +510,7 @@ impl<'a> Resolver<'a> {
470510
Err((Determinacy::Determined, _)) => Err(Determinacy::Determined),
471511
}
472512
}
473-
Scope::Module(module) => {
513+
Scope::Module(module, derive_fallback_lint_id) => {
474514
let adjusted_parent_scope = &ParentScope { module, ..*parent_scope };
475515
let binding = this.resolve_ident_in_module_unadjusted_ext(
476516
ModuleOrUniformRoot::Module(module),
@@ -483,6 +523,21 @@ impl<'a> Resolver<'a> {
483523
);
484524
match binding {
485525
Ok(binding) => {
526+
if let Some(lint_id) = derive_fallback_lint_id {
527+
this.lint_buffer.buffer_lint_with_diagnostic(
528+
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
529+
lint_id,
530+
orig_ident.span,
531+
&format!(
532+
"cannot find {} `{}` in this scope",
533+
ns.descr(),
534+
ident
535+
),
536+
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(
537+
orig_ident.span,
538+
),
539+
);
540+
}
486541
let misc_flags = if ptr::eq(module, this.graph_root) {
487542
Flags::MISC_SUGGEST_CRATE
488543
} else if module.is_normal() {

‎compiler/rustc_resolve/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ enum Scope<'a> {
105105
DeriveHelpersCompat,
106106
MacroRules(MacroRulesScopeRef<'a>),
107107
CrateRoot,
108-
Module(Module<'a>),
108+
// The node ID is for reporting the `PROC_MACRO_DERIVE_RESOLUTION_FALLBACK`
109+
// lint if it should be reported.
110+
Module(Module<'a>, Option<NodeId>),
109111
MacroUsePrelude,
110112
BuiltinAttrs,
111113
ExternPrelude,
@@ -1575,7 +1577,7 @@ impl<'a> Resolver<'a> {
15751577

15761578
self.visit_scopes(ScopeSet::All(TypeNS, false), parent_scope, ctxt, |this, scope, _, _| {
15771579
match scope {
1578-
Scope::Module(module) => {
1580+
Scope::Module(module, _) => {
15791581
this.traits_in_module(module, assoc_item, &mut found_traits);
15801582
}
15811583
Scope::StdLibPrelude => {

‎compiler/rustc_trait_selection/src/traits/wf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ impl<'tcx> WfPredicates<'tcx> {
652652
// All of the requirements on type parameters
653653
// have already been checked for `impl Trait` in
654654
// return position. We do need to check type-alias-impl-trait though.
655-
if ty::is_impl_trait_defn(self.tcx, did).is_none() {
655+
if self.tcx.is_type_alias_impl_trait(did) {
656656
let obligations = self.nominal_obligations(did, substs);
657657
self.out.extend(obligations);
658658
}

‎src/stage0.json

+285-342
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// edition:2021
2+
3+
pub trait T {}
4+
impl T for () {}
5+
6+
pub struct S {}
7+
8+
impl S {
9+
pub async fn f<'a>(&self) -> impl T + 'a {
10+
()
11+
}
12+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// aux-build:issue-107036.rs
2+
// edition:2021
3+
// check-pass
4+
5+
extern crate issue_107036;
6+
use issue_107036::S;
7+
8+
async fn f() {
9+
S{}.f().await;
10+
}
11+
12+
fn main() {
13+
let _ = f();
14+
}

‎src/test/ui/proc-macro/generate-mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ struct S;
1515

1616
#[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
1717
//~| ERROR cannot find type `OuterDerive` in this scope
18+
//~| WARN this was previously accepted
19+
//~| WARN this was previously accepted
1820
struct Z;
1921

2022
fn inner_block() {
2123
#[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
2224
//~| ERROR cannot find type `OuterDerive` in this scope
25+
//~| WARN this was previously accepted
26+
//~| WARN this was previously accepted
2327
struct InnerZ;
2428
}
2529

26-
#[derive(generate_mod::CheckDeriveLint)] //~ ERROR cannot find type `OuterDeriveLint` in this scope
27-
//~| ERROR cannot find type `FromOutside` in this scope
30+
#[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
2831
struct W;
2932

3033
fn main() {}

‎src/test/ui/proc-macro/generate-mod.stderr

+95-34
Original file line numberDiff line numberDiff line change
@@ -38,66 +38,127 @@ LL | #[generate_mod::check_attr]
3838
OuterAttr
3939
= note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
4040

41-
error[E0412]: cannot find type `FromOutside` in this scope
41+
error: cannot find type `FromOutside` in this scope
4242
--> $DIR/generate-mod.rs:16:10
4343
|
4444
LL | #[derive(generate_mod::CheckDerive)]
45-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
45+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
4646
|
47-
= note: consider importing this struct:
48-
FromOutside
47+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
48+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
49+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
4950
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
5051

51-
error[E0412]: cannot find type `OuterDerive` in this scope
52+
error: cannot find type `OuterDerive` in this scope
5253
--> $DIR/generate-mod.rs:16:10
5354
|
5455
LL | #[derive(generate_mod::CheckDerive)]
55-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
56+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
5657
|
57-
= note: consider importing this struct:
58-
OuterDerive
58+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
59+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
5960
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
6061

61-
error[E0412]: cannot find type `FromOutside` in this scope
62-
--> $DIR/generate-mod.rs:21:14
62+
error: cannot find type `FromOutside` in this scope
63+
--> $DIR/generate-mod.rs:23:14
6364
|
6465
LL | #[derive(generate_mod::CheckDerive)]
65-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
66+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
6667
|
67-
= note: consider importing this struct:
68-
FromOutside
68+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
69+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
6970
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
7071

71-
error[E0412]: cannot find type `OuterDerive` in this scope
72-
--> $DIR/generate-mod.rs:21:14
72+
error: cannot find type `OuterDerive` in this scope
73+
--> $DIR/generate-mod.rs:23:14
7374
|
7475
LL | #[derive(generate_mod::CheckDerive)]
75-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
76+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
7677
|
77-
= note: consider importing this struct:
78-
OuterDerive
78+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
7980
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
8081

81-
error[E0412]: cannot find type `FromOutside` in this scope
82-
--> $DIR/generate-mod.rs:26:10
82+
error: aborting due to 8 previous errors
83+
84+
For more information about this error, try `rustc --explain E0412`.
85+
Future incompatibility report: Future breakage diagnostic:
86+
error: cannot find type `FromOutside` in this scope
87+
--> $DIR/generate-mod.rs:16:10
8388
|
84-
LL | #[derive(generate_mod::CheckDeriveLint)]
85-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
89+
LL | #[derive(generate_mod::CheckDerive)]
90+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
8691
|
87-
= note: consider importing this struct:
88-
FromOutside
89-
= note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
92+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
93+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
94+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
95+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
9096

91-
error[E0412]: cannot find type `OuterDeriveLint` in this scope
92-
--> $DIR/generate-mod.rs:26:10
97+
Future breakage diagnostic:
98+
error: cannot find type `OuterDerive` in this scope
99+
--> $DIR/generate-mod.rs:16:10
93100
|
94-
LL | #[derive(generate_mod::CheckDeriveLint)]
95-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
101+
LL | #[derive(generate_mod::CheckDerive)]
102+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
96103
|
97-
= note: consider importing this struct:
98-
OuterDeriveLint
99-
= note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
104+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
105+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
106+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
107+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
100108

101-
error: aborting due to 10 previous errors
109+
Future breakage diagnostic:
110+
error: cannot find type `FromOutside` in this scope
111+
--> $DIR/generate-mod.rs:23:14
112+
|
113+
LL | #[derive(generate_mod::CheckDerive)]
114+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
115+
|
116+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
117+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
118+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
119+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
120+
121+
Future breakage diagnostic:
122+
error: cannot find type `OuterDerive` in this scope
123+
--> $DIR/generate-mod.rs:23:14
124+
|
125+
LL | #[derive(generate_mod::CheckDerive)]
126+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
127+
|
128+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
129+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
130+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
131+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
132+
133+
Future breakage diagnostic:
134+
warning: cannot find type `FromOutside` in this scope
135+
--> $DIR/generate-mod.rs:30:10
136+
|
137+
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
138+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
139+
|
140+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
141+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
142+
note: the lint level is defined here
143+
--> $DIR/generate-mod.rs:30:10
144+
|
145+
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
146+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147+
= note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
148+
149+
Future breakage diagnostic:
150+
warning: cannot find type `OuterDeriveLint` in this scope
151+
--> $DIR/generate-mod.rs:30:10
152+
|
153+
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
154+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
155+
|
156+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
157+
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
158+
note: the lint level is defined here
159+
--> $DIR/generate-mod.rs:30:10
160+
|
161+
LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
162+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163+
= note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
102164

103-
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)
Please sign in to comment.