Weaken unnameable_types lint
This commit is contained in:
parent
4c9ac1e93b
commit
8203d1ddf6
3 changed files with 4 additions and 20 deletions
|
@ -1941,7 +1941,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
||||||
let reexported_at_vis = effective_vis.at_level(Level::Reexported);
|
let reexported_at_vis = effective_vis.at_level(Level::Reexported);
|
||||||
let reachable_at_vis = effective_vis.at_level(Level::Reachable);
|
let reachable_at_vis = effective_vis.at_level(Level::Reachable);
|
||||||
|
|
||||||
if reexported_at_vis != reachable_at_vis {
|
if reachable_at_vis.is_public() && reexported_at_vis != reachable_at_vis {
|
||||||
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
let span = self.tcx.def_span(def_id.to_def_id());
|
let span = self.tcx.def_span(def_id.to_def_id());
|
||||||
self.tcx.emit_spanned_lint(
|
self.tcx.emit_spanned_lint(
|
||||||
|
@ -1973,10 +1973,6 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
||||||
AssocItemKind::Type => (self.tcx.defaultness(def_id).has_value(), true),
|
AssocItemKind::Type => (self.tcx.defaultness(def_id).has_value(), true),
|
||||||
};
|
};
|
||||||
|
|
||||||
if is_assoc_ty {
|
|
||||||
self.check_unnameable(def_id, self.get(def_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
check.in_assoc_ty = is_assoc_ty;
|
check.in_assoc_ty = is_assoc_ty;
|
||||||
check.generics().predicates();
|
check.generics().predicates();
|
||||||
if check_ty {
|
if check_ty {
|
||||||
|
|
|
@ -11,12 +11,12 @@ mod m {
|
||||||
|
|
||||||
pub trait PubTr { //~ ERROR trait `PubTr` is reachable but cannot be named
|
pub trait PubTr { //~ ERROR trait `PubTr` is reachable but cannot be named
|
||||||
const C : i32 = 0;
|
const C : i32 = 0;
|
||||||
type Alias; //~ ERROR associated type `PubTr::Alias` is reachable but cannot be named
|
type Alias;
|
||||||
fn f() {}
|
fn f() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PubTr for PubStruct {
|
impl PubTr for PubStruct {
|
||||||
type Alias = i32; //~ ERROR associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
|
type Alias = i32;
|
||||||
fn f() {}
|
fn f() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,17 +22,5 @@ error: trait `PubTr` is reachable but cannot be named
|
||||||
LL | pub trait PubTr {
|
LL | pub trait PubTr {
|
||||||
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
||||||
|
|
||||||
error: associated type `PubTr::Alias` is reachable but cannot be named
|
error: aborting due to 3 previous errors
|
||||||
--> $DIR/unnameable_types.rs:14:9
|
|
||||||
|
|
|
||||||
LL | type Alias;
|
|
||||||
| ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
|
||||||
|
|
||||||
error: associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
|
|
||||||
--> $DIR/unnameable_types.rs:19:9
|
|
||||||
|
|
|
||||||
LL | type Alias = i32;
|
|
||||||
| ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue