Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upresolve: Improve duplicate glob detection #32814
Conversation
jseyfried
added some commits
Apr 7, 2016
rust-highfive
assigned
nikomatsakis
Apr 8, 2016
This comment has been minimized.
This comment has been minimized.
|
The bug isn't in beta yet, but it landed a month ago so it still might be a good idea to do a crater run. |
jseyfried
reviewed
Apr 8, 2016
| @@ -275,7 +275,6 @@ impl<'a> ::ModuleS<'a> { | |||
| // Define the name or return the existing binding if there is a collision. | |||
| pub fn try_define_child(&self, name: Name, ns: Namespace, binding: NameBinding<'a>) | |||
| -> Result<(), &'a NameBinding<'a>> { | |||
| if self.resolutions.borrow_state() != ::std::cell::BorrowState::Unused { return Ok(()); } | |||
This comment has been minimized.
This comment has been minimized.
jseyfried
Apr 8, 2016
Author
Contributor
This line was preventing the duplicate errors from being reported.
jseyfried
reviewed
Apr 8, 2016
| } | ||
| }; | ||
|
|
||
| self.define_in_glob_importers(name, ns, new_binding); |
This comment has been minimized.
This comment has been minimized.
jseyfried
Apr 8, 2016
Author
Contributor
The above change is so that resolution isn't borrowed during define_in_glob_importers, where it might end up getting re-defined through a glob cycle.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Apr 11, 2016
Contributor
The above change is so that resolution isn't borrowed during define_in_glob_importers, where it might end up getting re-defined through a glob cycle.
I'd suggest adding this as a comment into the code :) (also the note you added below)
jseyfried
reviewed
Apr 8, 2016
| }).collect::<Vec<_>>(); | ||
| for ((name, ns), binding) in bindings { | ||
| if binding.defined_with(DefModifiers::IMPORTABLE | DefModifiers::PUBLIC) { | ||
| let _ = module_.try_define_child(name, ns, directive.import(binding, None)); |
This comment has been minimized.
This comment has been minimized.
jseyfried
Apr 8, 2016
Author
Contributor
resolutions shouldn't be borrowed during try_define_child for the same reason.
This comment has been minimized.
This comment has been minimized.
|
r=me w/ comments |
This comment has been minimized.
This comment has been minimized.
|
|
jseyfried
force-pushed the
jseyfried:improve_duplicate_glob_detection
branch
from
c0b3bb9
to
bc6daea
Apr 11, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
This needs backport if it wants to get in Rust 1.9 beta |
nikomatsakis
added
the
beta-nominated
label
Apr 12, 2016
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Apr 13, 2016
This comment has been minimized.
This comment has been minimized.
bors
merged commit bc6daea
into
rust-lang:master
Apr 13, 2016
This was referenced Apr 13, 2016
nikomatsakis
added
the
beta-accepted
label
Apr 21, 2016
This comment has been minimized.
This comment has been minimized.
|
Fixes a regression, small patch. Approved for beta. |
jseyfried commentedApr 8, 2016
This fixes a bug introduced in #31726 in which we erroneously allow multiple imports of the same item under some circumstances.
More specifically, we erroneously allow a module that is in a cycle of glob re-exports to have other re-exports (besides the glob from the cycle).
For example,
A module in a glob re-export cycle can still have
pubitems after this PR. For example,r? @nikomatsakis