Address review comments
Fix regressions after rebase
This commit is contained in:
committed by
Vadim Petrochenkov
parent
08a1d45818
commit
a27f8cf8a3
@@ -87,7 +87,7 @@ impl ProcMacro for Quoter {
|
|||||||
let mut info = cx.current_expansion.mark.expn_info().unwrap();
|
let mut info = cx.current_expansion.mark.expn_info().unwrap();
|
||||||
info.callee.allow_internal_unstable = true;
|
info.callee.allow_internal_unstable = true;
|
||||||
cx.current_expansion.mark.set_expn_info(info);
|
cx.current_expansion.mark.set_expn_info(info);
|
||||||
::__internal::set_sess(cx, || quote!(::TokenStream((quote stream))))
|
::__internal::set_sess(cx, || quote!(::TokenStream { 0: (quote stream) }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -590,6 +590,7 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> {
|
|||||||
self.def_id_visibility(did).is_accessible_from(self.current_item, self.tcx)
|
self.def_id_visibility(did).is_accessible_from(self.current_item, self.tcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Take node ID of an expression or pattern and check its type for privacy.
|
||||||
fn check_expr_pat_type(&mut self, id: ast::NodeId, span: Span) -> bool {
|
fn check_expr_pat_type(&mut self, id: ast::NodeId, span: Span) -> bool {
|
||||||
self.span = span;
|
self.span = span;
|
||||||
if let Some(ty) = self.tables.node_id_to_type_opt(id) {
|
if let Some(ty) = self.tables.node_id_to_type_opt(id) {
|
||||||
@@ -797,6 +798,11 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
|||||||
self.tcx.sess.span_err(self.span, &msg);
|
self.tcx.sess.span_err(self.span, &msg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if let ty::TyFnDef(..) = ty.sty {
|
||||||
|
if self.tcx.fn_sig(def_id).visit_with(self) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Inherent static methods don't have self type in substs,
|
// Inherent static methods don't have self type in substs,
|
||||||
// we have to check it additionally.
|
// we have to check it additionally.
|
||||||
if let Some(assoc_item) = self.tcx.opt_associated_item(def_id) {
|
if let Some(assoc_item) = self.tcx.opt_associated_item(def_id) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl Pub<Priv> {
|
|||||||
pub fn static_method() {}
|
pub fn static_method() {}
|
||||||
}
|
}
|
||||||
impl Pub<u8> {
|
impl Pub<u8> {
|
||||||
fn priv_metod(&self) {}
|
fn priv_method(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub macro m() {
|
pub macro m() {
|
||||||
@@ -40,5 +40,5 @@ pub macro m() {
|
|||||||
<u8 as PubTrait>::method;
|
<u8 as PubTrait>::method;
|
||||||
PrivTupleStruct;
|
PrivTupleStruct;
|
||||||
PubTupleStruct;
|
PubTupleStruct;
|
||||||
Pub(0u8).priv_metod();
|
Pub(0u8).priv_method();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
|
// error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
|
||||||
// error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct::{{constructor}}}` is pr
|
// error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct::{{constructor}}}` is pr
|
||||||
// error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct::{{constructor}}}` is priv
|
// error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct::{{constructor}}}` is priv
|
||||||
// error-pattern:type `fn(&ext::Pub<u8>) {<ext::Pub<u8>>::priv_metod}` is private
|
// error-pattern:type `fn(&ext::Pub<u8>) {<ext::Pub<u8>>::priv_method}` is private
|
||||||
|
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ mod m {
|
|||||||
pub const INHERENT_ASSOC_CONST_GENERIC_SELF: u8 = 0;
|
pub const INHERENT_ASSOC_CONST_GENERIC_SELF: u8 = 0;
|
||||||
}
|
}
|
||||||
impl Pub<u8> {
|
impl Pub<u8> {
|
||||||
fn priv_metod(&self) {}
|
fn priv_method(&self) {}
|
||||||
pub fn method_with_substs<T>(&self) {}
|
pub fn method_with_substs<T>(&self) {}
|
||||||
pub fn method_with_priv_params(&self, _: Priv) {}
|
pub fn method_with_priv_params(&self, _: Priv) {}
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,8 @@ mod m {
|
|||||||
//~^ ERROR type `fn(u8) -> m::PrivTupleStruct {m::PrivTupleStruct::{{constructor}}}` is priv
|
//~^ ERROR type `fn(u8) -> m::PrivTupleStruct {m::PrivTupleStruct::{{constructor}}}` is priv
|
||||||
PubTupleStruct;
|
PubTupleStruct;
|
||||||
//~^ ERROR type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct::{{constructor}}}` is privat
|
//~^ ERROR type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct::{{constructor}}}` is privat
|
||||||
Pub(0u8).priv_metod();
|
Pub(0u8).priv_method();
|
||||||
//~^ ERROR type `fn(&m::Pub<u8>) {<m::Pub<u8>>::priv_metod}` is private
|
//~^ ERROR type `fn(&m::Pub<u8>) {<m::Pub<u8>>::priv_method}` is private
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Trait {}
|
trait Trait {}
|
||||||
|
|||||||
Reference in New Issue
Block a user