rust/src/test/ui/resolve
Dan Aloni fea5ab12c2 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`.
2020-06-21 18:49:39 +03:00
..
auxiliary Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
block-with-trait-parent.rs resolve: Adjust hygienic_lexical_parent to account for enum and trait modules 2019-09-07 17:42:24 +03:00
enums-are-namespaced-xc.rs Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
enums-are-namespaced-xc.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
impl-items-vis-unresolved.rs Appease tidy 2020-01-12 15:37:50 +00:00
impl-items-vis-unresolved.stderr Update output-default.json and rustdoc test 2020-01-12 15:37:50 +00:00
issue-2356.rs
issue-2356.stderr Free default() forwarding to Default::default() 2020-06-07 01:27:06 -07:00
issue-3907-2.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-3907-2.stderr Store idents for DefPathData into crate metadata 2020-03-22 23:40:19 -04:00
issue-3907.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-3907.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-5035-2.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-5035-2.stderr
issue-5035.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-5035.stderr Tweak some suggestions in rustc_resolve 2020-04-26 11:43:43 -07:00
issue-6702.rs Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
issue-6702.stderr Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
issue-14254.rs
issue-14254.stderr Change suggestion of field when not in self context 2019-04-18 18:39:56 -07:00
issue-16058.rs Ignore SGX on a few ui tests 2020-05-05 19:19:39 -07:00
issue-16058.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-17518.rs
issue-17518.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-18252.rs Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
issue-18252.stderr Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
issue-19452.rs Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
issue-19452.stderr Point at definition when misusing ADT 2019-09-22 11:27:55 -07:00
issue-21221-1.rs
issue-21221-1.stderr Prefer accessible paths in 'use' suggestions 2020-06-21 18:49:39 +03:00
issue-21221-2.rs
issue-21221-2.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-21221-3.rs
issue-21221-3.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-21221-4.rs
issue-21221-4.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-22692.rs
issue-22692.stderr Deduplicate code for path suggestion 2019-03-24 19:43:02 -07:00
issue-23305.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-23305.stderr Add descriptions for all queries 2020-05-31 20:15:32 +01:00
issue-24968.rs
issue-24968.stderr
issue-33876.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-33876.stderr Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-39226.rs
issue-39226.stderr Use heuristics for capitalization warning in suggestions 2019-10-14 14:32:10 -07:00
issue-54379.rs Do not complain about unmentioned fields in recovered patterns 2019-03-14 18:28:24 -07:00
issue-54379.stderr Do not complain about unmentioned fields in recovered patterns 2019-03-14 18:28:24 -07:00
issue-57523.rs Use check-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
issue-65025-extern-static-parent-generics.rs resolve: prohibit foreign statics w/ generics 2019-10-08 18:46:24 +01:00
issue-65025-extern-static-parent-generics.stderr resolve: prohibit foreign statics w/ generics 2019-10-08 18:46:24 +01:00
issue-65035-static-with-parent-generics.rs adjust tests 2020-05-09 14:40:17 +02:00
issue-65035-static-with-parent-generics.stderr adjust tests 2020-05-09 14:40:17 +02:00
issue-69401-trait-fn-no-body-ty-local.rs late resolve, visit_fn: bail early if there's no body. 2020-02-28 07:58:37 +01:00
issue-69401-trait-fn-no-body-ty-local.stderr late resolve, visit_fn: bail early if there's no body. 2020-02-28 07:58:37 +01:00
issue-70736-async-fn-no-body-def-collector.rs def_collector, visit_fn: account for no body 2020-04-03 17:01:21 +02:00
issue-70736-async-fn-no-body-def-collector.stderr def_collector, visit_fn: account for no body 2020-04-03 17:01:21 +02:00
levenshtein.rs tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
levenshtein.stderr tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
name-clash-nullary.rs
name-clash-nullary.stderr check_pat_path: use pattern_cause 2020-02-25 05:41:03 +01:00
privacy-enum-ctor.rs
privacy-enum-ctor.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
privacy-struct-ctor.rs resolve: fix error title regarding private constructors 2019-10-11 18:09:23 +03:00
privacy-struct-ctor.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
raw-ident-in-path.rs resolve: Fix regression in resolution of raw keywords in paths 2020-03-14 19:21:38 +03:00
raw-ident-in-path.stderr resolve: Fix regression in resolution of raw keywords in paths 2020-03-14 19:21:38 +03:00
resolve-assoc-suggestions.rs Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
resolve-assoc-suggestions.stderr Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
resolve-bad-import-prefix.rs
resolve-bad-import-prefix.stderr Update tests 2019-03-11 23:10:26 +03:00
resolve-bad-visibility.rs resolve: Move late resolution into a separate visitor 2019-08-10 13:15:15 +03:00
resolve-bad-visibility.stderr Update ui tests 2019-10-30 14:49:53 +01:00
resolve-conflict-extern-crate-vs-extern-crate.rs Remove lint annotations in specific crates that are already enforced by rustbuild 2019-07-28 18:46:24 +03:00
resolve-conflict-extern-crate-vs-extern-crate.stderr Remove lint annotations in specific crates that are already enforced by rustbuild 2019-07-28 18:46:24 +03:00
resolve-conflict-import-vs-extern-crate.rs
resolve-conflict-import-vs-extern-crate.stderr Update tests 2019-03-11 23:10:26 +03:00
resolve-conflict-import-vs-import.rs
resolve-conflict-import-vs-import.stderr Mark duplicate import removal suggestion tool only 2019-03-23 13:05:30 -07:00
resolve-conflict-item-vs-extern-crate.rs
resolve-conflict-item-vs-extern-crate.stderr Update tests 2019-03-11 23:10:26 +03:00
resolve-conflict-item-vs-import.rs
resolve-conflict-item-vs-import.stderr
resolve-conflict-type-vs-import.rs
resolve-conflict-type-vs-import.stderr
resolve-hint-macro.rs
resolve-hint-macro.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
resolve-inconsistent-binding-mode.rs resolve, inconsistent binding mode: tweak wording. 2020-03-04 03:58:52 +01:00
resolve-inconsistent-binding-mode.stderr resolve, inconsistent binding mode: tweak wording. 2020-03-04 03:58:52 +01:00
resolve-inconsistent-names.rs resolve, inconsistent binding mode: tweak wording. 2020-03-04 03:58:52 +01:00
resolve-inconsistent-names.stderr resolve, inconsistent binding mode: tweak wording. 2020-03-04 03:58:52 +01:00
resolve-label.rs
resolve-label.stderr Update tests 2019-03-11 23:10:26 +03:00
resolve-primitive-fallback.rs On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
resolve-primitive-fallback.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
resolve-self-in-impl-2.rs
resolve-self-in-impl-2.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
resolve-self-in-impl.rs
resolve-self-in-impl.stderr Add descriptions for all queries 2020-05-31 20:15:32 +01:00
resolve-speculative-adjustment.rs
resolve-speculative-adjustment.stderr Change suggestion of field when not in self context 2019-04-18 18:39:56 -07:00
resolve-type-param-in-item-in-trait.rs Make name resolution handle consts in GenericParamsFromOuterFunction properly 2019-02-07 15:03:20 +01:00
resolve-type-param-in-item-in-trait.stderr Resolve inconsistency in error messages between "parameter" and "variable". 2019-04-17 13:25:07 +03:00
resolve-unknown-trait.rs
resolve-unknown-trait.stderr
resolve-variant-assoc-item.rs clarify what the item is in "not a module" error 2019-04-10 12:55:21 -04:00
resolve-variant-assoc-item.stderr clarify what the item is in "not a module" error 2019-04-10 12:55:21 -04:00
suggest-path-instead-of-mod-dot-item.rs
suggest-path-instead-of-mod-dot-item.stderr Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
token-error-correct-2.rs tweak wording of mismatched delimiter errors 2020-01-03 08:40:15 -05:00
token-error-correct-2.stderr tweak wording of mismatched delimiter errors 2020-01-03 08:40:15 -05:00
token-error-correct-3.rs Do not emit type errors after parse error in last statement of block 2019-07-12 18:55:01 -07:00
token-error-correct-3.stderr Remove "here" from "expected one of X here" 2019-11-06 17:26:20 -08:00
token-error-correct.rs tweak wording of mismatched delimiter errors 2020-01-03 08:40:15 -05:00
token-error-correct.stderr tweak wording of mismatched delimiter errors 2020-01-03 08:40:15 -05:00
tuple-struct-alias.rs Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
tuple-struct-alias.stderr Point at local similarly named element and tweak references to variants 2019-10-27 11:50:43 -07:00
typo-suggestion-named-underscore.rs Do not suggest things named underscore 2020-02-02 04:55:37 +09:00
typo-suggestion-named-underscore.stderr Do not suggest things named underscore 2020-02-02 04:55:37 +09:00
unboxed-closure-sugar-nonexistent-trait.rs
unboxed-closure-sugar-nonexistent-trait.stderr Tweak some suggestions in rustc_resolve 2020-04-26 11:43:43 -07:00
unresolved_static_type_field.rs
unresolved_static_type_field.stderr review comments: change wording 2019-04-18 18:39:56 -07:00
use_suggestion.rs Improve E0433, so that it suggests missing imports 2020-06-02 20:41:25 +02:00
use_suggestion.stderr Remove noisy suggestion of hash_map #72642 2020-06-09 08:49:05 +05:30
use_suggestion_placement.rs
use_suggestion_placement.stderr Remove noisy suggestion of hash_map #72642 2020-06-09 08:49:05 +05:30
visibility-indeterminate.rs resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
visibility-indeterminate.stderr update ui tests 2019-10-31 14:27:16 +01:00