Handle more cases in cfg_accessible
This commit is contained in:
parent
bef2b7cd1c
commit
163374644b
3 changed files with 55 additions and 49 deletions
|
@ -443,11 +443,20 @@ impl<'a> ResolverExpand for Resolver<'a> {
|
|||
PathResult::NonModule(partial_res) if partial_res.unresolved_segments() == 0 => {
|
||||
return Ok(true);
|
||||
}
|
||||
PathResult::NonModule(..) => {
|
||||
self.session
|
||||
.struct_span_err(span, "not sure whether the path is accessible or not")
|
||||
.note("the type may have associated items, but we are currently not checking them")
|
||||
.emit();
|
||||
|
||||
// If we get a partially resolved NonModule in one namespace, we should get the
|
||||
// same result in any other namespaces, so we can return early.
|
||||
return Ok(false);
|
||||
}
|
||||
PathResult::Indeterminate => indeterminate = true,
|
||||
// FIXME: `resolve_path` is not ready to report partially resolved paths
|
||||
// correctly, so we just report an error if the path was reported as unresolved.
|
||||
// This needs to be fixed for `cfg_accessible` to be useful.
|
||||
PathResult::NonModule(..) | PathResult::Failed { .. } => {}
|
||||
// We can only be sure that a path doesn't exist after having tested all the
|
||||
// posibilities, only at that time we can return false.
|
||||
PathResult::Failed { .. } => {}
|
||||
PathResult::Module(_) => panic!("unexpected path resolution"),
|
||||
}
|
||||
}
|
||||
|
@ -456,10 +465,6 @@ impl<'a> ResolverExpand for Resolver<'a> {
|
|||
return Err(Indeterminate);
|
||||
}
|
||||
|
||||
self.session
|
||||
.struct_span_err(span, "not sure whether the path is accessible or not")
|
||||
.span_note(span, "`cfg_accessible` is not fully implemented")
|
||||
.emit();
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue