1
Fork 0

Give better diagnostic when using a private tuple struct constructor

This commit is contained in:
Gus Wynn 2020-09-08 15:14:09 -07:00
parent 130359cb05
commit c63f634a4b
9 changed files with 152 additions and 29 deletions

View file

@ -999,7 +999,8 @@ pub struct Resolver<'a> {
/// Table for mapping struct IDs into struct constructor IDs,
/// it's not used during normal resolution, only for better error reporting.
struct_constructors: DefIdMap<(Res, ty::Visibility)>,
/// Also includes of list of each fields visibility
struct_constructors: DefIdMap<(Res, ty::Visibility, Vec<ty::Visibility>)>,
/// Features enabled for this crate.
active_features: FxHashSet<Symbol>,
@ -1036,6 +1037,7 @@ pub struct ResolverArenas<'a> {
name_resolutions: TypedArena<RefCell<NameResolution<'a>>>,
macro_rules_bindings: TypedArena<MacroRulesBinding<'a>>,
ast_paths: TypedArena<ast::Path>,
pattern_spans: TypedArena<Span>,
}
impl<'a> ResolverArenas<'a> {
@ -1067,6 +1069,9 @@ impl<'a> ResolverArenas<'a> {
fn alloc_ast_paths(&'a self, paths: &[ast::Path]) -> &'a [ast::Path] {
self.ast_paths.alloc_from_iter(paths.iter().cloned())
}
fn alloc_pattern_spans(&'a self, spans: impl Iterator<Item = Span>) -> &'a [Span] {
self.pattern_spans.alloc_from_iter(spans)
}
}
impl<'a> AsMut<Resolver<'a>> for Resolver<'a> {