10000 Rollup of 8 pull requests by pietroalbini · Pull Request #52570 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 8 pull requests #52570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
829bc26
rustc: Remove a workaroudn in ThinLTO fixed upstream
alexcrichton Jul 18, 2018
ec4aaf1
Update stdsimd to undo an accidental stabilization
alexcrichton Jul 19, 2018
5332375
proc_macro: Preserve spans of attributes on functions
alexcrichton Jul 19, 2018
f775c6d
Fix docker/run.sh script when run locally
alexcrichton Jul 19, 2018
0320d1b
Add tests for #34784
wesleywiser Jul 20, 2018
2db7bec
Add compile-fail test for #33264
wesleywiser Jul 20, 2018
1aeed60
Add run-pass test for #44005
wesleywiser Jul 20, 2018
608caeb
Add compile-fail test for #42060
wesleywiser Jul 20, 2018
ea495e3
Add compile-fail test for #43196
wesleywiser Jul 20, 2018
3e0cb23
Update compile-fail tests to be ui tests
wesleywiser Jul 20, 2018
576cfc5
Remove duplicate E0396 tests
ljedrz Jul 19, 2018
826bec3
Update clippy
Manishearth Jul 20, 2018
c44f724
resolve: Remove unused parameter from `resolve_ident_in_module`
petrochenkov Jul 16, 2018
2214349
resolve: Rename `global_macros` to `macro_prelude`
petrochenkov Jul 16, 2018
c2533b6
resolve: Re 10000 move `SingleImports` in favor of a simple set
petrochenkov Jul 17, 2018
414a86e
resolve: Add some comments to in-module resolution
petrochenkov Jul 18, 2018
2eb83ee
data_structures: Add a reference wrapper for pointer-indexed maps/sets
petrochenkov Jul 18, 2018
32453db
resolve: Fully prohibit shadowing of in-scope names by globs in macro…
petrochenkov Jul 19, 2018
e7aeb2b
resolve: Add more comments to in-module resolution
petrochenkov Jul 19, 2018
382285a
Revert some use of `PtrKey` to fix parallel_queries build
petrochenkov Jul 20, 2018
967d252
Rollup merge of #52505 - alexcrichton:remove-thinlto-hack, r=nikomats…
pietroalbini Jul 20, 2018
e10194d
Rollup merge of #52527 - ljedrz:cleanup_13973, r=oli-obk
pietroalbini Jul 20, 2018
7a0ffda
Rollup merge of #52535 - alexcrichton:update-stdsimd, r=Mark-Simulacrum
pietroalbini Jul 20, 2018
db907de
Rollup merge of #52536 - alexcrichton:attr-spans, r=nikomatsakis
pietroalbini Jul 20, 2018
66eacaf
Rollup merge of #52540 - alexcrichton:tweak-script, r=kennytm
pietroalbini Jul 20, 2018
20fb948
Rollup merge of #52555 - petrochenkov:mresfact, r=alexcrichton
pietroalbini Jul 20, 2018
a73627e
Rollup merge of #52558 - wesleywiser:ice_melting, r=estebank
pietroalbini Jul 20, 2018
5407f1c
Rollup merge of #52562 - Manishearth:clippyup, r=kennytm
pietroalbini Jul 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolve: Rename global_macros to macro_prelude
Rename `shadows_glob` to `shadowed_glob`
  • Loading branch information
petrochenkov committed Jul 20, 2018
commit 22143491bc44287b42b6dfa22e9fd702a9d76a0c
2 changes: 1 addition & 1 deletion src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ impl<'a> Resolver<'a> {
binding: &'a NameBinding<'a>,
span: Span,
allow_shadowing: bool) {
if self.global_macros.insert(name, binding).is_some() && !allow_shadowing {
if self.macro_prelude.insert(name, binding).is_some() && !allow_shadowing {
let msg = format!("`{}` is already in scope", name);
let note =
"macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)";
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ pub struct Resolver<'a> {

crate_loader: &'a mut dyn CrateLoader,
macro_names: FxHashSet<Ident>,
global_macros: FxHashMap<Name, &'a NameBinding<'a>>,
macro_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
pub all_macros: FxHashMap<Name, Def>,
lexical_macro_resolutions: Vec<(Ident, &'a Cell<LegacyScope<'a>>)>,
macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
Expand Down Expand Up @@ -1715,7 +1715,7 @@ impl<'a> Resolver<'a> {

crate_loader,
macro_names: FxHashSet(),
global_macros: FxHashMap(),
macro_prelude: FxHashMap(),
all_macros: FxHashMap(),
lexical_macro_resolutions: Vec::new(),
macro_map: FxHashMap(),
Expand Down Expand Up @@ -3224,7 +3224,7 @@ impl<'a> Resolver<'a> {
};
}
}
let is_global = self.global_macros.get(&path[0].name).cloned()
let is_global = self.macro_prelude.get(&path[0].name).cloned()
.map(|binding| binding.get_macro(self).kind() == MacroKind::Bang).unwrap_or(false);
if primary_ns != MacroNS && (is_global ||
self.macro_names.contains(&path[0].modern())) {
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'a> base::Resolver for Resolver<'a> {
vis: ty::Visibility::Invisible,
expansion: Mark::root(),
});
self.global_macros.insert(ident.name, binding);
self.macro_prelude.insert(ident.name, binding);
}

fn resolve_imports(&mut self) {
Expand All @@ -238,7 +238,7 @@ impl<'a> base::Resolver for Resolver<'a> {
attr::mark_known(&attrs[i]);
}

match self.global_macros.get(&name).cloned() {
match self.macro_prelude.get(&name).cloned() {
Some(binding) => match *binding.get_macro(self) {
MultiModifier(..) | MultiDecorator(..) | SyntaxExtension::AttrProcMacro(..) => {
return Some(attrs.remove(i))
Expand Down Expand Up @@ -274,7 +274,7 @@ impl<'a> base::Resolver for Resolver<'a> {
}
let trait_name = traits[j].segments[0].ident.name;
let legacy_name = Symbol::intern(&format!("derive_{}", trait_name));
if !self.global_macros.contains_key(&legacy_name) {
if !self.macro_prelude.contains_key(&legacy_name) {
continue
}
let span = traits.remove(j).span;
Expand Down Expand Up @@ -565,7 +565,7 @@ impl<'a> Resolver<'a> {
module, ident, ns, true, record_used, path_span,
).map(MacroBinding::Modern)
} else {
self.global_macros.get(&ident.name).cloned().ok_or(determinacy)
self.macro_prelude.get(&ident.name).cloned().ok_or(determinacy)
.map(MacroBinding::Global)
};
self.current_module = orig_current_module;
Expand Down Expand Up @@ -652,7 +652,7 @@ impl<'a> Resolver<'a> {

let binding = if let Some(binding) = binding {
MacroBinding::Legacy(binding)
} else if let Some(binding) = self.global_macros.get(&ident.name).cloned() {
} else if let Some(binding) = self.macro_prelude.get(&ident.name).cloned() {
if !self.use_extern_macros {
self.record_use(ident, MacroNS, binding, DUMMY_SP);
}
Expand Down Expand Up @@ -762,8 +762,8 @@ impl<'a> Resolver<'a> {
// Then check global macros.
}.or_else(|| {
// FIXME: get_macro needs an &mut Resolver, can we do it without cloning?
let global_macros = self.global_macros.clone();
let names = global_macros.iter().filter_map(|(name, binding)| {
let macro_prelude = self.macro_prelude.clone();
let names = macro_prelude.iter().filter_map(|(name, binding)| {
if binding.get_macro(self).kind() == kind {
Some(name)
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub struct NameResolution<'a> {
single_imports: SingleImports<'a>,
/// The least shadowable known binding for this name, or None if there are no known bindings.
pub binding: Option<&'a NameBinding<'a>>,
shadows_glob: Option<&'a NameBinding<'a>>,
shadowed_glob: Option<&'a NameBinding<'a>>,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -194,7 +194,7 @@ impl<'a> Resolver<'a> {

if record_used {
if let Some(binding) = resolution.binding {
if let Some(shadowed_glob) = resolution.shadows_glob {
if let Some(shadowed_glob) = resolution.shadowed_glob {
let name = ident.name;
// Forbid expanded shadowing to avoid time travel.
if restricted_shadowing &&
Expand Down Expand Up @@ -401,7 +401,7 @@ impl<'a> Resolver<'a> {
if binding.is_glob_import() {
if !old_binding.is_glob_import() &&
!(ns == MacroNS && old_binding.expansion != Mark::root()) {
resolution.shadows_glob = Some(binding);
resolution.shadowed_glob = Some(binding);
} else if binding.def() != old_binding.def() {
resolution.binding = Some(this.ambiguity(old_binding, binding));
} else if !old_binding.vis.is_at_least(binding.vis, &*this) {
Expand All @@ -414,7 +414,7 @@ impl<'a> Resolver<'a> {
resolution.binding = Some(this.ambiguity(binding, old_binding));
} else {
resolution.binding = Some(binding);
resolution.shadows_glob = Some(old_binding);
resolution.shadowed_glob = Some(old_binding);
}
} else {
return Err(old_binding);
Expand Down
0