-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
fix(resolve): update the ambiguity glob binding recursively #112743
Conversation
Additionally, I am unsure whether fixing errors such as "it should throw an error, but it's not" constitutes a breaking change or not. |
This comment was marked as resolved.
This comment was marked as resolved.
It's a breaking change, but it is also a bugfix. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 1576b8ed41c10aa2263e55f774217b07c8c17966 with merge b1375b2484512d46eeace16657e5b4a5450c610b... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
Finished benchmarking commit (b1375b2484512d46eeace16657e5b4a5450c610b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 658.179s -> 657.807s (-0.06%) |
@bors rollup=maybe |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
||
#[test] | ||
fn test_thing() { | ||
let thing = Thing::Foo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change too: root::Thing
currently refers to root::thing::Thing
, but it will refer to root::Thing
after this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has a typo, but I assume you mean root::thing::Thing
-> root::Thing
.
It's also clearly a bugfix.
Crater will finish soon and show what actually breaks after these changes.
Update: I have rebased and add some tests in this PR. I would like to declare that this PR may have much impact, as it:
|
I think that removing |
🎉 Experiment
|
reduced: macro_rules! m {
() => {
pub fn EVP_PKEY_id() {}
};
}
mod openssl {
pub use self::evp::*;
pub use self::handwritten::*;
mod evp {
m!();
}
mod handwritten {
m!();
}
}
use openssl::*;
fn main() {
EVP_PKEY_id();
} |
It appears to be a bugfix as both mod openssl {
pub use self::evp::*;
pub use self::handwritten::*;
mod evp {
pub fn EVP_PKEY_id() {}
}
mod handwritten {
pub fn EVP_PKEY_id() {}
}
}
use openssl::*;
fn main() {
EVP_PKEY_id(); // `EVP_PKEY_id` is ambiguous
} |
Yes, also a bugfix. |
I have written a script to analyze this regression log and found that it contains 58 types of issues, some of which are unrelated to name resolution: |
The right fix here is probably adding a new boolean flag somewhere around In any case we need to wait until the new release of openssl is published, because it's responsible for the majority of regressions, and because it's not just an ambiguity error, it's a "cannot find" error, likely due to a cross-crate use of this ambiguity. |
Superseded by #113099. |
fix(resolve): update the ambiguity glob binding as warning recursively Fixes rust-lang#47525 Fixes rust-lang#56593, but `issue-56593-2.rs` is not fixed to ensure backward compatibility. Fixes rust-lang#98467 Fixes rust-lang#105235 Fixes rust-lang#112713 This PR had added a field called `warn_ambiguous` in `NameBinding` which is only for back compatibly reason and used for lint. More details: rust-lang#112743 r? `@petrochenkov`
fix(resolve): update the ambiguity glob binding as warning recursively Fixes #47525 Fixes #56593, but `issue-56593-2.rs` is not fixed to ensure backward compatibility. Fixes #98467 Fixes #105235 Fixes #112713 This PR had added a field called `warn_ambiguous` in `NameBinding` which is only for back compatibly reason and used for lint. More details: rust-lang/rust#112743 r? `@petrochenkov`
Fixes #112713
The error was not reported for #112713 because the
ambiguity
in the binding ofroot::sub::C
was lost.The
resolve_imports
process is shown below:importer
module
resolve_glob_import
use sub::*
root::sub
use mod1::*
root::sub::mod1
(root::sub, C) -> root::sub::mod1::C
bytry_define
;2.
(block_module, C) -> NameBinding { kind: Import { binding: root::sub::mod1::C }, .. }
bytry_define
recursively formodule.glob_importers
use mod2::*
root::sub::mod2
(root::sub, C) -> root::sub::mod1::C
with ambiguityHowever, the ambiguity binding generated by iteration 2 points to a different value than the one generated by iteration 1. Therefore, the binding to
root::sub::mod::C
in iteration 1 does not have ambiguity, and no error is thrown in the end.In this PR, I had made update the ambiguity glob binding recursively.
Perhaps changing
&'a NameBinding<'a>
to &'a mut NameBinding<'a>
inNameResolution
would be a better choice.r? @petrochenkov