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 4b165ee

Browse files
authoredJan 28, 2024
Rollup merge of rust-lang#118533 - chenyukang:yukang-fix-118455, r=petrochenkov
Suppress unhelpful diagnostics for unresolved top level attributes Fixes rust-lang#118455, unresolved top level attribute error didn't imported prelude and already have emitted an error, report builtin macro and attributes error by the way, so `check_invalid_crate_level_attr` in can ignore them. Also fixes rust-lang#89566, fixes rust-lang#67107. r? ```@petrochenkov```
2 parents 8a346d0 + 75f889b commit 4b165ee

30 files changed

+100
-201
lines changed
 

‎compiler/rustc_errors/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ pub enum StashKey {
509509
MaybeForgetReturn,
510510
/// Query cycle detected, stashing in favor of a better error.
511511
Cycle,
512+
UndeterminedMacroResolution,
512513
}
513514

514515
fn default_track_diagnostic(diag: Diagnostic, f: &mut dyn FnMut(Diagnostic)) {

‎compiler/rustc_passes/src/check_attr.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
//! item.
66
77
use crate::{errors, fluent_generated as fluent};
8-
use rustc_ast::{ast, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem};
8+
use rustc_ast::{ast, AttrKind, AttrStyle, Attribute, LitKind};
9+
use rustc_ast::{MetaItemKind, MetaItemLit, NestedMetaItem};
910
use rustc_data_structures::fx::FxHashMap;
11+
use rustc_errors::StashKey;
1012
use rustc_errors::{Applicability, DiagCtxt, IntoDiagnosticArg, MultiSpan};
1113
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
1214
use rustc_hir as hir;
@@ -2530,6 +2532,14 @@ fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) {
25302532
if attr.style == AttrStyle::Inner {
25312533
for attr_to_check in ATTRS_TO_CHECK {
25322534
if attr.has_name(*attr_to_check) {
2535+
if let AttrKind::Normal(ref p) = attr.kind
2536+
&& let Some(diag) = tcx.dcx().steal_diagnostic(
2537+
p.item.path.span,
2538+
StashKey::UndeterminedMacroResolution,
2539+
)
2540+
{
2541+
diag.cancel();
2542+
}
25332543
let item = tcx
25342544
.hir()
25352545
.items()

‎compiler/rustc_resolve/src/macros.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
//! A bunch of methods and structures more or less related to resolving macros and
22
//! interface provided by `Resolver` to macro expander.
33
4-
use crate::errors::{
5-
self, AddAsNonDerive, CannotDetermineMacroResolution, CannotFindIdentInThisScope,
6-
MacroExpectedFound, RemoveSurroundingDerive,
7-
};
4+
use crate::errors::CannotDetermineMacroResolution;
5+
use crate::errors::{self, AddAsNonDerive, CannotFindIdentInThisScope};
6+
use crate::errors::{MacroExpectedFound, RemoveSurroundingDerive};
87
use crate::Namespace::*;
98
use crate::{BuiltinMacroState, Determinacy, MacroData};
109
use crate::{DeriveData, Finalize, ParentScope, ResolutionError, Resolver, ScopeSet};
@@ -15,6 +14,7 @@ use rustc_ast_pretty::pprust;
1514
use rustc_attr::StabilityLevel;
1615
use rustc_data_structures::intern::Interned;
1716
use rustc_data_structures::sync::Lrc;
17+
use rustc_errors::StashKey;
1818
use rustc_errors::{struct_span_code_err, Applicability};
1919
use rustc_expand::base::{Annotatable, DeriveResolutions, Indeterminate, ResolverExpand};
2020
use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
@@ -25,9 +25,8 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
2525
use rustc_middle::middle::stability;
2626
use rustc_middle::ty::RegisteredTools;
2727
use rustc_middle::ty::{TyCtxt, Visibility};
28-
use rustc_session::lint::builtin::{
29-
LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE, UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
30-
};
28+
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
29+
use rustc_session::lint::builtin::{LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE};
3130
use rustc_session::lint::builtin::{UNUSED_MACROS, UNUSED_MACRO_RULES};
3231
use rustc_session::lint::BuiltinLintDiagnostics;
3332
use rustc_session::parse::feature_err;
@@ -703,21 +702,21 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
703702
// situations should be reported as errors, so this is a bug.
704703
this.dcx().span_delayed_bug(span, "inconsistent resolution for a macro");
705704
}
706-
} else {
705+
} else if this.tcx.dcx().has_errors().is_none() && this.privacy_errors.is_empty() {
707706
// It's possible that the macro was unresolved (indeterminate) and silently
708707
// expanded into a dummy fragment for recovery during expansion.
709708
// Now, post-expansion, the resolution may succeed, but we can't change the
710709
// past and need to report an error.
711710
// However, non-speculative `resolve_path` can successfully return private items
712711
// even if speculative `resolve_path` returned nothing previously, so we skip this
713-
// less informative error if the privacy error is reported elsewhere.
714-
if this.privacy_errors.is_empty() {
715-
this.dcx().emit_err(CannotDetermineMacroResolution {
716-
span,
717-
kind: kind.descr(),
718-
path: Segment::names_to_string(path),
719-
});
720-
}
712+
// less informative error if no other error is reported elsewhere.
713+
714+
let err = this.dcx().create_err(CannotDetermineMacroResolution {
715+
span,
716+
kind: kind.descr(),
717+
path: Segment::names_to_string(path),
718+
});
719+
err.stash(span, StashKey::UndeterminedMacroResolution);
721720
}
722721
};
723722

‎tests/ui/derives/issue-36617.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#![derive(Copy)] //~ ERROR cannot determine resolution for the attribute macro `derive`
1+
#![derive(Copy)]
22
//~^ ERROR `derive` attribute cannot be used at crate level
33

4-
#![test]//~ ERROR cannot determine resolution for the attribute macro `test`
4+
#![test]
55
//~^ ERROR `test` attribute cannot be used at crate level
66

7-
#![test_case]//~ ERROR cannot determine resolution for the attribute macro `test_case`
7+
#![test_case]
88
//~^ ERROR `test_case` attribute cannot be used at crate level
99

10-
#![bench]//~ ERROR cannot determine resolution for the attribute macro `bench`
10+
#![bench]
1111
//~^ ERROR `bench` attribute cannot be used at crate level
1212

13-
#![global_allocator]//~ ERROR cannot determine resolution for the attribute macro `global_allocator`
13+
#![global_allocator]
1414
//~^ ERROR `global_allocator` attribute cannot be used at crate level
1515

1616
fn main() {}

‎tests/ui/derives/issue-36617.stderr

+1-41
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,3 @@
1-
error: cannot determine resolution for the attribute macro `derive`
2-
--> $DIR/issue-36617.rs:1:4
3-
|
4-
LL | #![derive(Copy)]
5-
| ^^^^^^
6-
|
7-
= note: import resolution is stuck, try simplifying macro imports
8-
9-
error: cannot determine resolution for the attribute macro `test`
10-
--> $DIR/issue-36617.rs:4:4
11-
|
12-
LL | #![test]
13-
| ^^^^
14-
|
15-
= note: import resolution is stuck, try simplifying macro imports
16-
17-
error: cannot determine resolution for the attribute macro `test_case`
18-
--> $DIR/issue-36617.rs:7:4
19-
|
20-
LL | #![test_case]
21-
| ^^^^^^^^^
22-
|
23-
= note: import resolution is stuck, try simplifying macro imports
24-
25-
error: cannot determine resolution for the attribute macro `bench`
26-
--> $DIR/issue-36617.rs:10:4
27-
|
28-
LL | #![bench]
29-
| ^^^^^
30-
|
31-
= note: import resolution is stuck, try simplifying macro imports
32-
33-
error: cannot determine resolution for the attribute macro `global_allocator`
34-
--> $DIR/issue-36617.rs:13:4
35-
|
36-
LL | #![global_allocator]
37-
| ^^^^^^^^^^^^^^^^
38-
|
39-
= note: import resolution is stuck, try simplifying macro imports
40-
411
error: `derive` attribute cannot be used at crate level
422
--> $DIR/issue-36617.rs:1:1
433
|
@@ -113,5 +73,5 @@ LL - #![global_allocator]
11373
LL + #[global_allocator]
11474
|
11575

116-
error: aborting due to 10 previous errors
76+
error: aborting due to 5 previous errors
11777

‎tests/ui/extenv/issue-55897.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ mod unresolved_env {
44
use env; //~ ERROR unresolved import `env`
55

66
include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
7-
//~^ ERROR cannot determine resolution for the macro `env`
87
}
98

109
mod nonexistent_env {

‎tests/ui/extenv/issue-55897.stderr

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: environment variable `NON_EXISTENT` not defined at compile time
2-
--> $DIR/issue-55897.rs:11:22
2+
--> $DIR/issue-55897.rs:10:22
33
|
44
LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
55
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
88
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
99

1010
error: suffixes on string literals are invalid
11-
--> $DIR/issue-55897.rs:16:22
11+
--> $DIR/issue-55897.rs:15:22
1212
|
1313
LL | include!(concat!("NON_EXISTENT"suffix, "/data.rs"));
1414
| ^^^^^^^^^^^^^^^^^^^^ invalid suffix `suffix`
@@ -33,14 +33,6 @@ help: consider importing this module instead
3333
LL | use std::env;
3434
| ~~~~~~~~
3535

36-
error: cannot determine resolution for the macro `env`
37-
--> $DIR/issue-55897.rs:6:22
38-
|
39-
LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs"));
40-
| ^^^
41-
|
42-
= note: import resolution is stuck, try simplifying macro imports
43-
44-
error: aborting due to 5 previous errors
36+
error: aborting due to 4 previous errors
4537

4638
For more information about this error, try `rustc --explain E0432`.

‎tests/ui/feature-gates/issue-43106-gating-of-bench.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
#![feature(custom_inner_attributes)]
66

77
#![bench = "4100"]
8-
//~^ ERROR cannot determine resolution for the attribute macro `bench`
9-
//~^^ ERROR `bench` attribute cannot be used at crate level
8+
//~^ ERROR `bench` attribute cannot be used at crate level
109
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
error: cannot determine resolution for the attribute macro `bench`
2-
--> $DIR/issue-43106-gating-of-bench.rs:7:4
3-
|
4-
LL | #![bench = "4100"]
5-
| ^^^^^
6-
|
7-
= note: import resolution is stuck, try simplifying macro imports
8-
91
error: `bench` attribute cannot be used at crate level
102
--> $DIR/issue-43106-gating-of-bench.rs:7:1
113
|
124
LL | #![bench = "4100"]
135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
...
6+
LL |
157
LL | fn main() {}
168
| ---- the inner attribute doesn't annotate this function
179
|
@@ -21,5 +13,5 @@ LL - #![bench = "4100"]
2113
LL + #[bench = "4100"]
2214
|
2315

24-
error: aborting due to 2 previous errors
16+
error: aborting due to 1 previous error
2517

‎tests/ui/feature-gates/issue-43106-gating-of-test.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
#![allow(soft_unstable)]
44
#![test = "4200"]
5-
//~^ ERROR cannot determine resolution for the attribute macro `test`
6-
//~^^ ERROR `test` attribute cannot be used at crate level
5+
//~^ ERROR `test` attribute cannot be used at crate level
76
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
error: cannot determine resolution for the attribute macro `test`
2-
--> $DIR/issue-43106-gating-of-test.rs:4:4
3-
|
4-
LL | #![test = "4200"]
5-
| ^^^^
6-
|
7-
= note: import resolution is stuck, try simplifying macro imports
8-
91
error: `test` attribute cannot be used at crate level
102
--> $DIR/issue-43106-gating-of-test.rs:4:1
113
|
124
LL | #![test = "4200"]
135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
...
6+
LL |
157
LL | fn main() {}
168
| ---- the inner attribute doesn't annotate this function
179
|
@@ -21,5 +13,5 @@ LL - #![test = "4200"]
2113
LL + #[test = "4200"]
2214
|
2315

24-
error: aborting due to 2 previous errors
16+
error: aborting due to 1 previous error
2517

‎tests/ui/imports/issue-28134.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// compile-flags: --test
22

33
#![allow(soft_unstable)]
4-
#![test] //~ ERROR cannot determine resolution for the attribute macro `test`
4+
#![test]
55
//~^ ERROR 4:1: 4:9: `test` attribute cannot be used at crate level

‎tests/ui/imports/issue-28134.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error: cannot determine resolution for the attribute macro `test`
2-
--> $DIR/issue-28134.rs:4:4
3-
|
4-
LL | #![test]
5-
| ^^^^
6-
|
7-
= note: import resolution is stuck, try simplifying macro imports
8-
91
error: `test` attribute cannot be used at crate level
102
--> $DIR/issue-28134.rs:4:1
113
|
@@ -18,5 +10,5 @@ LL - #![test]
1810
LL + #[test]
1911
|
2012

21-
error: aborting due to 2 previous errors
13+
error: aborting due to 1 previous error
2214

‎tests/ui/imports/issue-55457.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use NonExistent; //~ ERROR unresolved import `NonExistent`
22
use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
33

4-
#[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent`
5-
#[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent`
6-
//~| ERROR cannot determine resolution for the derive macro `NonExistent`
7-
//~| ERROR cannot determine resolution for the derive macro `NonExistent`
4+
#[non_existent]
5+
#[derive(NonExistent)]
6+
87
struct S;
98

109
fn main() {}

‎tests/ui/imports/issue-55457.stderr

+1-35
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,6 @@ LL | use non_existent::non_existent;
1515
|
1616
= help: consider adding `extern crate non_existent` to use the `non_existent` crate
1717

18-
error: cannot determine resolution for the derive macro `NonExistent`
19-
--> $DIR/issue-55457.rs:5:10
20-
|
21-
LL | #[derive(NonExistent)]
22-
| ^^^^^^^^^^^
23-
|
24-
= note: import resolution is stuck, try simplifying macro imports
25-
26-
error: cannot determine resolution for the attribute macro `non_existent`
27-
--> $DIR/issue-55457.rs:4:3
28-
|
29-
LL | #[non_existent]
30-
| ^^^^^^^^^^^^
31-
|
32-
= note: import resolution is stuck, try simplifying macro imports
33-
34-
error: cannot determine resolution for the derive macro `NonExistent`
35-
--> $DIR/issue-55457.rs:5:10
36-
|
37-
LL | #[derive(NonExistent)]
38-
| ^^^^^^^^^^^
39-
|
40-
= note: import resolution is stuck, try simplifying macro imports
41-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
42-
43-
error: cannot determine resolution for the derive macro `NonExistent`
44-
--> $DIR/issue-55457.rs:5:10
45-
|
46-
LL | #[derive(NonExistent)]
47-
| ^^^^^^^^^^^
48-
|
49-
= note: import resolution is stuck, try simplifying macro imports
50-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
51-
52-
error: aborting due to 6 previous errors
18+
error: aborting due to 2 previous errors
5319

5420
For more information about this error, try `rustc --explain E0432`.

‎tests/ui/imports/issue-59764.rs

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ use issue_59764::foo::makro;
128128
//~^ ERROR unresolved import `issue_59764::foo::makro` [E0432]
129129

130130
makro!(bar);
131-
//~^ ERROR cannot determine resolution for the macro `makro`
132131

133132
fn main() {
134133
bar();

‎tests/ui/imports/issue-59764.stderr

+2-10
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,13 @@ help: a macro with this name exists at the root of the crate
226226
LL | use issue_59764::makro;
227227
| ~~~~~~~~~~~~~~~~~~
228228

229-
error: cannot determine resolution for the macro `makro`
230-
--> $DIR/issue-59764.rs:130:1
231-
|
232-
LL | makro!(bar);
233-
| ^^^^^
234-
|
235-
= note: import resolution is stuck, try simplifying macro imports
236-
237229
error[E0425]: cannot find function `bar` in this scope
238-
--> $DIR/issue-59764.rs:134:5
230+
--> $DIR/issue-59764.rs:133:5
239231
|
240232
LL | bar();
241233
| ^^^ not found in this scope
242234

243-
error: aborting due to 18 previous errors
235+
error: aborting due to 17 previous errors
244236

245237
Some errors have detailed explanations: E0425, E0432.
246238
For more information about an error, try `rustc --explain E0425`.

‎tests/ui/proc-macro/derive-helper-legacy-spurious.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#[macro_use]
66
extern crate test_macros;
77

8-
#[derive(Empty)] //~ ERROR cannot determine resolution for the attribute macro `derive`
8+
#[derive(Empty)]
99
#[empty_helper] //~ ERROR cannot find attribute `empty_helper` in this scope
1010
struct Foo {}
1111

‎tests/ui/proc-macro/derive-helper-legacy-spurious.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,11 @@ error: cannot find attribute `dummy` in this scope
44
LL | #![dummy]
55
| ^^^^^
66

7-
error: cannot determine resolution for the attribute macro `derive`
8-
--> $DIR/derive-helper-legacy-spurious.rs:8:3
9-
|
10-
LL | #[derive(Empty)]
11-
| ^^^^^^
12-
|
13-
= note: import resolution is stuck, try simplifying macro imports
14-
157
error: cannot find attribute `empty_helper` in this scope
168
--> $DIR/derive-helper-legacy-spurious.rs:9:3
179
|
1810
LL | #[empty_helper]
1911
| ^^^^^^^^^^^^
2012

21-
error: aborting due to 3 previous errors
13+
error: aborting due to 2 previous errors
2214

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![some_nonexistent_attribute]
2+
//~^ ERROR cannot find attribute `some_nonexistent_attribute` in this scope
3+
#[derive(Debug)]
4+
pub struct SomeUserCode;
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: cannot find attribute `some_nonexistent_attribute` in this scope
2+
--> $DIR/issue-118455-skip-err-builtin.rs:1:4
3+
|
4+
LL | #![some_nonexistent_attribute]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to 1 previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// run-rustfix
2+
3+
#[derive(Debug)] //~ ERROR `derive` attribute cannot be used at crate level
4+
struct Test {}
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// run-rustfix
2+
3+
#![derive(Debug)] //~ ERROR `derive` attribute cannot be used at crate level
4+
struct Test {}
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: `derive` attribute cannot be used at crate level
2+
--> $DIR/issue-89566-suggest-fix-invalid-top-level-macro-attr.rs:3:1
3+
|
4+
LL | #![derive(Debug)]
5+
| ^^^^^^^^^^^^^^^^^
6+
LL | struct Test {}
7+
| ---- the inner attribute doesn't annotate this struct
8+
|
9+
help: perhaps you meant to use an outer attribute
10+
|
11+
LL - #![derive(Debug)]
12+
LL + #[derive(Debug)]
13+
|
14+
15+
error: aborting due to 1 previous error
16+

‎tests/ui/reserved/reserved-attr-on-macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ macro_rules! foo {
77
}
88

99
fn main() {
10-
foo!(); //~ ERROR cannot determine resolution for the macro `foo`
10+
foo!();
1111
}

‎tests/ui/reserved/reserved-attr-on-macro.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,11 @@ error: attributes starting with `rustc` are reserved for use by the `rustc` comp
44
LL | #[rustc_attribute_should_be_reserved]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

7-
error: cannot determine resolution for the macro `foo`
8-
--> $DIR/reserved-attr-on-macro.rs:10:5
9-
|
10-
LL | foo!();
11-
| ^^^
12-
|
13-
= note: import resolution is stuck, try simplifying macro imports
14-
157
error: cannot find attribute `rustc_attribute_should_be_reserved` in this scope
168
--> $DIR/reserved-attr-on-macro.rs:1:3
179
|
1810
LL | #[rustc_attribute_should_be_reserved]
1911
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2012

21-
error: aborting due to 3 previous errors
13+
error: aborting due to 2 previous errors
2214

‎tests/ui/rust-2018/issue-54006.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ use alloc::vec;
88

99
pub fn foo() {
1010
let mut xs = vec![];
11-
//~^ ERROR cannot determine resolution for the macro `vec`
1211
xs.push(0);
1312
}

‎tests/ui/rust-2018/issue-54006.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ error[E0432]: unresolved import `alloc`
44
LL | use alloc::vec;
55
| ^^^^^ help: a similar path exists: `core::alloc`
66

7-
error: cannot determine resolution for the macro `vec`
8-
--> $DIR/issue-54006.rs:10:18
9-
|
10-
LL | let mut xs = vec![];
11-
| ^^^
12-
|
13-
= note: import resolution is stuck, try simplifying macro imports
14-
15-
error: aborting due to 2 previous errors
7+
error: aborting due to 1 previous error
168

179
For more information about this error, try `rustc --explain E0432`.
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
2-
//~^ ERROR cannot determine resolution for the attribute macro `derive`
3-
//~^^ ERROR `derive` attribute cannot be used at crate level
2+
//~^ ERROR `derive` attribute cannot be used at crate level
43
struct DerivedOn;
54

65
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
error: cannot determine resolution for the attribute macro `derive`
2-
--> $DIR/issue-43927-non-ADT-derive.rs:1:4
3-
|
4-
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
5-
| ^^^^^^
6-
|
7-
= note: import resolution is stuck, try simplifying macro imports
8-
91
error: `derive` attribute cannot be used at crate level
102
--> $DIR/issue-43927-non-ADT-derive.rs:1:1
113
|
124
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
...
6+
LL |
157
LL | struct DerivedOn;
168
| --------- the inner attribute doesn't annotate this struct
179
|
@@ -21,5 +13,5 @@ LL - #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
2113
LL + #[derive(Debug, PartialEq, Eq)] // should be an outer attribute!
2214
|
2315

24-
error: aborting due to 2 previous errors
16+
error: aborting due to 1 previous error
2517

0 commit comments

Comments
 (0)
Please sign in to comment.