Avoid re-export errors in the generated test harness.
This commit is contained in:
parent
d0623cf7bd
commit
dd47815478
2 changed files with 11 additions and 4 deletions
|
@ -683,9 +683,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||||
};
|
};
|
||||||
|
|
||||||
match (value_result, type_result) {
|
match (value_result, type_result) {
|
||||||
// With `#![feature(item_like_imports)]`, all namespaces
|
// All namespaces must be re-exported with extra visibility for an error to occur.
|
||||||
// must be re-exported with extra visibility for an error to occur.
|
(Ok(value_binding), Ok(type_binding)) => {
|
||||||
(Ok(value_binding), Ok(type_binding)) if self.new_import_semantics => {
|
|
||||||
let vis = directive.vis.get();
|
let vis = directive.vis.get();
|
||||||
if !value_binding.pseudo_vis().is_at_least(vis, self) &&
|
if !value_binding.pseudo_vis().is_at_least(vis, self) &&
|
||||||
!type_binding.pseudo_vis().is_at_least(vis, self) {
|
!type_binding.pseudo_vis().is_at_least(vis, self) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ use std::iter;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
use attr;
|
use attr::{self, HasAttrs};
|
||||||
use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos};
|
use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -243,12 +243,20 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
|
||||||
tested_submods: Vec<(ast::Ident, ast::Ident)>) -> (P<ast::Item>, ast::Ident) {
|
tested_submods: Vec<(ast::Ident, ast::Ident)>) -> (P<ast::Item>, ast::Ident) {
|
||||||
let super_ = token::str_to_ident("super");
|
let super_ = token::str_to_ident("super");
|
||||||
|
|
||||||
|
// Generate imports with `#[allow(private_in_public)]` to work around issue #36768.
|
||||||
|
let allow_private_in_public = cx.ext_cx.attribute(DUMMY_SP, cx.ext_cx.meta_list(
|
||||||
|
DUMMY_SP,
|
||||||
|
InternedString::new("allow"),
|
||||||
|
vec![cx.ext_cx.meta_list_item_word(DUMMY_SP, InternedString::new("private_in_public"))],
|
||||||
|
));
|
||||||
let items = tests.into_iter().map(|r| {
|
let items = tests.into_iter().map(|r| {
|
||||||
cx.ext_cx.item_use_simple(DUMMY_SP, ast::Visibility::Public,
|
cx.ext_cx.item_use_simple(DUMMY_SP, ast::Visibility::Public,
|
||||||
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
|
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
|
||||||
|
.map_attrs(|_| vec![allow_private_in_public.clone()])
|
||||||
}).chain(tested_submods.into_iter().map(|(r, sym)| {
|
}).chain(tested_submods.into_iter().map(|(r, sym)| {
|
||||||
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
|
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
|
||||||
cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Visibility::Public, r, path)
|
cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Visibility::Public, r, path)
|
||||||
|
.map_attrs(|_| vec![allow_private_in_public.clone()])
|
||||||
})).collect();
|
})).collect();
|
||||||
|
|
||||||
let reexport_mod = ast::Mod {
|
let reexport_mod = ast::Mod {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue