about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorDan Aloni <alonid@gmail.com>2020-06-13 20:58:46 +0300
committerDan Aloni <alonid@gmail.com>2020-06-21 18:49:39 +0300
commitfea5ab12c269bd816b828d3ceea6bb90e4f72825 (patch)
tree41f3d9a7ea2889b813ea85c277fb4102241959ce /library/std/src/sys/unix/stack_overflow.rs
parenta39c7787ba246353178e099373b9240be0d9e603 (diff)
downloadrust-fea5ab12c269bd816b828d3ceea6bb90e4f72825.tar.gz
rust-fea5ab12c269bd816b828d3ceea6bb90e4f72825.zip
Prefer accessible paths in 'use' suggestions
This fixes an issue with the following sample:

    mod foo {
	mod inaccessible {
	    pub struct X;
	}
	pub mod avail {
	    pub struct X;
	}
    }

    fn main() { X; }

Instead of suggesting both `use crate::foo::inaccessible::X;` and `use
crate::foo::avail::X;`, it should only suggest the latter.

It is done by trimming the list of suggestions from inaccessible paths
if accessible paths are present.

Visibility is checked with `is_accessible_from` now instead of being
hard-coded.

-

Some tests fixes are trivial, and others require a bit more explaining,
here are my comments:

src/test/ui/issues/issue-35675.stderr: Only needs to make the enum
public to have the suggestion make sense.

src/test/ui/issues/issue-42944.stderr: Importing the tuple struct won't
help because its constructor is not visible, so the attempted
constructor does not work. In that case, it's better not to suggest it.
The case where the constructor is public is covered in `issue-26545.rs`.
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions