Rollup merge of #69605 - JohnTitor:opt-def-id, r=petrochenkov
Use `opt_def_id()` over `def_id()` Fixes #69588
This commit is contained in:
commit
47d87d7ca5
3 changed files with 9 additions and 7 deletions
|
@ -816,7 +816,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
||||||
fn lookup_def_id(&self, ref_id: NodeId) -> Option<DefId> {
|
fn lookup_def_id(&self, ref_id: NodeId) -> Option<DefId> {
|
||||||
match self.get_path_res(ref_id) {
|
match self.get_path_res(ref_id) {
|
||||||
Res::PrimTy(_) | Res::SelfTy(..) | Res::Err => None,
|
Res::PrimTy(_) | Res::SelfTy(..) | Res::Err => None,
|
||||||
def => Some(def.def_id()),
|
def => def.opt_def_id(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
|
// compile-flags: -Zsave-analysis
|
||||||
|
// ~^ Also regression test for #69588
|
||||||
|
|
||||||
#![feature(register_attr)]
|
#![feature(register_attr)]
|
||||||
#![feature(register_tool)]
|
#![feature(register_tool)]
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
error: cannot use an explicitly registered attribute through an import
|
error: cannot use an explicitly registered attribute through an import
|
||||||
--> $DIR/register-attr-tool-import.rs:12:3
|
--> $DIR/register-attr-tool-import.rs:14:3
|
||||||
|
|
|
|
||||||
LL | #[renamed_attr]
|
LL | #[renamed_attr]
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the explicitly registered attribute imported here
|
note: the explicitly registered attribute imported here
|
||||||
--> $DIR/register-attr-tool-import.rs:9:5
|
--> $DIR/register-attr-tool-import.rs:11:5
|
||||||
|
|
|
|
||||||
LL | use attr as renamed_attr; // OK
|
LL | use attr as renamed_attr; // OK
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: cannot use a tool module through an import
|
error: cannot use a tool module through an import
|
||||||
--> $DIR/register-attr-tool-import.rs:13:3
|
--> $DIR/register-attr-tool-import.rs:15:3
|
||||||
|
|
|
|
||||||
LL | #[renamed_tool::attr]
|
LL | #[renamed_tool::attr]
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the tool module imported here
|
note: the tool module imported here
|
||||||
--> $DIR/register-attr-tool-import.rs:10:5
|
--> $DIR/register-attr-tool-import.rs:12:5
|
||||||
|
|
|
|
||||||
LL | use tool as renamed_tool; // OK
|
LL | use tool as renamed_tool; // OK
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: cannot use a tool module through an import
|
error: cannot use a tool module through an import
|
||||||
--> $DIR/register-attr-tool-import.rs:13:3
|
--> $DIR/register-attr-tool-import.rs:15:3
|
||||||
|
|
|
|
||||||
LL | #[renamed_tool::attr]
|
LL | #[renamed_tool::attr]
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the tool module imported here
|
note: the tool module imported here
|
||||||
--> $DIR/register-attr-tool-import.rs:10:5
|
--> $DIR/register-attr-tool-import.rs:12:5
|
||||||
|
|
|
|
||||||
LL | use tool as renamed_tool; // OK
|
LL | use tool as renamed_tool; // OK
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue