rust/src/test/ui/privacy
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 tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
pub-priv-dep Normalise notes with the/is 2020-01-24 16:24:50 +00:00
restricted Use more targetted span for error label 2020-03-22 16:09:42 -07:00
associated-item-privacy-inherent.rs rustc: pass Option<&Substs> and Namespace around in ty::item_path. 2019-03-15 13:25:10 +02:00
associated-item-privacy-inherent.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
associated-item-privacy-trait.rs rustc_typeck: remove rustc_hir_pretty usage 2020-03-24 08:38:32 +01:00
associated-item-privacy-trait.stderr rustc_typeck: remove rustc_hir_pretty usage 2020-03-24 08:38:32 +01:00
associated-item-privacy-type-binding.rs use dyn Trait more in tests 2020-02-10 17:42:09 +01:00
associated-item-privacy-type-binding.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
decl-macro.rs
decl-macro.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
issue-57264-1.rs Apply review suggestions 2019-11-06 00:00:00 +00:00
issue-57264-2.rs Apply review suggestions 2019-11-06 00:00:00 +00:00
legacy-ctor-visibility.rs legacy_ctor_visibility -> error 2019-11-06 11:08:23 +01:00
legacy-ctor-visibility.stderr Bless tests 2020-03-21 15:03:58 +01:00
priv-impl-prim-ty.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
privacy-in-paths.rs
privacy-in-paths.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
privacy-ns.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
privacy-ns1.rs test: Update tests with fallout of changes 2019-11-18 17:23:22 -05:00
privacy-ns1.stderr Prefer accessible paths in 'use' suggestions 2020-06-21 18:49:39 +03:00
privacy-ns2.rs test: Update tests with fallout of changes 2019-11-18 17:23:22 -05:00
privacy-ns2.stderr Prefer accessible paths in 'use' suggestions 2020-06-21 18:49:39 +03:00
privacy-reexport.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
privacy-sanity.rs introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
privacy-sanity.stderr Update tests 2019-03-11 23:10:26 +03:00
privacy-ufcs.rs
privacy-ufcs.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
privacy1-rpass.rs tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
privacy1.rs update tests 2020-03-12 15:47:36 -05:00
privacy1.stderr Use more targetted span for error label 2020-03-22 16:09:42 -07:00
privacy2.rs
privacy2.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
privacy3.rs
privacy3.stderr
privacy4.rs
privacy4.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
privacy5.rs resolve: fix error title regarding private constructors 2019-10-11 18:09:23 +03:00
privacy5.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-class-field.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
private-impl-method.rs update tests 2020-03-12 15:47:36 -05:00
private-impl-method.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-in-public-assoc-ty.rs Stop special casing top level TAIT 2020-06-11 16:24:01 +01:00
private-in-public-assoc-ty.stderr Stop special casing top level TAIT 2020-06-11 16:24:01 +01:00
private-in-public-expr-pat.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
private-in-public-ill-formed.rs
private-in-public-ill-formed.stderr Update tests 2019-03-11 23:10:26 +03:00
private-in-public-lint.rs
private-in-public-lint.stderr Update tests 2019-03-11 23:10:26 +03:00
private-in-public-non-principal-2.rs introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
private-in-public-non-principal-2.stderr introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
private-in-public-non-principal.rs introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
private-in-public-non-principal.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
private-in-public-type-alias-impl-trait.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
private-in-public-warn.rs
private-in-public-warn.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
private-in-public.rs
private-in-public.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
private-inferred-type-1.rs
private-inferred-type-1.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-inferred-type-2.rs
private-inferred-type-2.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-inferred-type-3.rs rustc: pass Option<&Substs> and Namespace around in ty::item_path. 2019-03-15 13:25:10 +02:00
private-inferred-type-3.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-inferred-type.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
private-inferred-type.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-item-simple.rs
private-item-simple.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-method-cross-crate.rs update tests 2020-03-12 15:47:36 -05:00
private-method-cross-crate.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-method-inherited.rs update tests 2020-03-12 15:47:36 -05:00
private-method-inherited.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-method-rpass.rs tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
private-method.rs update tests 2020-03-12 15:47:36 -05:00
private-method.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-struct-field-cross-crate.rs
private-struct-field-cross-crate.stderr Add span label to primary error span 2020-03-22 11:18:06 -07:00
private-struct-field-ctor.rs
private-struct-field-ctor.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-struct-field-pattern.rs
private-struct-field-pattern.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-struct-field.rs
private-struct-field.stderr Add span label to primary error span 2020-03-22 11:18:06 -07:00
private-type-in-interface.rs
private-type-in-interface.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
private-variant-reexport.rs
private-variant-reexport.stderr Update tests 2019-03-11 23:10:26 +03:00
pub-extern-privacy.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
pub-use-xcrate.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
pub_use_mods_xcrate_exe.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
union-field-privacy-1.rs
union-field-privacy-1.stderr Normalize wording of privacy access labels 2020-03-22 15:36:54 -07:00
union-field-privacy-2.rs Fix test. 2019-08-30 00:57:20 +05:30
union-field-privacy-2.stderr Add span label to primary error span 2020-03-22 11:18:06 -07:00