Skip to content

Commit f9c8c49

Browse files
committed
Use opt_def_id() over def_id()
1 parent d3c7934 commit f9c8c49

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
816816
fn lookup_def_id(&self, ref_id: NodeId) -> Option<DefId> {
817817
match self.get_path_res(ref_id) {
818818
Res::PrimTy(_) | Res::SelfTy(..) | Res::Err => None,
819-
def => Some(def.def_id()),
819+
def => def.opt_def_id(),
820820
}
821821
}
822822

src/test/ui/attributes/register-attr-tool-import.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// edition:2018
2+
// compile-flags: -Zsave-analysis
3+
// ~^ Also regression test for #69588
24

35
#![feature(register_attr)]
46
#![feature(register_tool)]

src/test/ui/attributes/register-attr-tool-import.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
error: cannot use an explicitly registered attribute through an import
2-
--> $DIR/register-attr-tool-import.rs:12:3
2+
--> $DIR/register-attr-tool-import.rs:14:3
33
|
44
LL | #[renamed_attr]
55
| ^^^^^^^^^^^^
66
|
77
note: the explicitly registered attribute imported here
8-
--> $DIR/register-attr-tool-import.rs:9:5
8+
--> $DIR/register-attr-tool-import.rs:11:5
99
|
1010
LL | use attr as renamed_attr; // OK
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: cannot use a tool module through an import
14-
--> $DIR/register-attr-tool-import.rs:13:3
14+
--> $DIR/register-attr-tool-import.rs:15:3
1515
|
1616
LL | #[renamed_tool::attr]
1717
| ^^^^^^^^^^^^
1818
|
1919
note: the tool module imported here
20-
--> $DIR/register-attr-tool-import.rs:10:5
20+
--> $DIR/register-attr-tool-import.rs:12:5
2121
|
2222
LL | use tool as renamed_tool; // OK
2323
| ^^^^^^^^^^^^^^^^^^^^
2424

2525
error: cannot use a tool module through an import
26-
--> $DIR/register-attr-tool-import.rs:13:3
26+
--> $DIR/register-attr-tool-import.rs:15:3
2727
|
2828
LL | #[renamed_tool::attr]
2929
| ^^^^^^^^^^^^
3030
|
3131
note: the tool module imported here
32-
--> $DIR/register-attr-tool-import.rs:10:5
32+
--> $DIR/register-attr-tool-import.rs:12:5
3333
|
3434
LL | use tool as renamed_tool; // OK
3535
| ^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)