-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Resolver: Batched Import Resolution #145108
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
base: master
Are you sure you want to change the base?
Resolver: Batched Import Resolution #145108
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
} | ||
} | ||
|
||
impl<'r, 'ra, 'tcx> AsRef<Resolver<'ra, 'tcx>> for ImportResolver<'r, 'ra, 'tcx> { |
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.
Now it is convenient to have the self: &mut ImportResolver
methods because it makes the diff easier to read.
But right before merge we'll need to move the methods to ImportResolver
itself, and remove the Deref
/AsRef
impls.
Code looks a little better now and should be more correct than the previous commits, but I have yet to find a way to resolve the current test failures. |
This comment has been minimized.
This comment has been minimized.
Okey, I did fix |
a3f8ae2
to
4a2a0dc
Compare
This comment has been minimized.
This comment has been minimized.
Could you update the tests to make CI green, so I can see the difference? |
tests/ui/imports/ambiguous-9.rs
Outdated
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 one is definitely wrong.
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 one is wrong as well.
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 one as well, but this one is different from the other 2.
@@ -6,7 +6,7 @@ | |||
extern crate test_macros; | |||
|
|||
#[derive(Empty)] | |||
#[empty_helper] //~ ERROR cannot find attribute `empty_helper` in this scope | |||
#[empty_helper] |
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.
there is a definition in auxiliary/test-macros.rs
:
#[proc_macro_derive(Empty, attributes(empty_helper))]
pub fn empty_derive(_: TokenStream) -> TokenStream {
TokenStream::new()
}
So maybe it is correct? Or do these attributes only work inside of the struct?
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 looks like a fix from moving the prelude setting to build_reduced_graph.
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.
Yes indeed, also visible on my new branch.
Moving |
I'll create a pr for it. |
Vec<(Module<'ra>, BindingKey, NameBinding<'ra>, bool /* warn_ambiguity */)>, | ||
glob_path_res: Vec<(NodeId, PartialRes)>, | ||
single_import_bindings: PerNS<Vec<(Module<'ra>, Import<'ra>, PendingBinding<'ra>)>>, | ||
} |
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.
I suggest restructuring this structure like this:
struct ImportResolutionOutputs {
indeterminate_imports: Vec<Import>,
determined_imports: Vec<(Import, SideEffect)>,
}
where SideEffect
is a set of changes that need to be applied for that specific import.
Then side effects will be applied in the same order in which the imports are resolved.
It will avoid having superfluous differences with the old algorithm, in emitted diagnostics in particular, and should make debugging the remaining differences easier.
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.
Oh, nice. That sounds better indeed, thanks!
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 way the diagnostics will also go in the source code order in common case, which is nice.
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.
And we would thus not need those changes to the stderr
files of some tests, very nice.
I'm just pushing since it's almost night where I am. It doesn't build stdlib atm. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Transforms the current algorithm for resolving imports to a batched algorithm. Every import in the
indeterminate_imports
set is resolved in isolation. This is the only real difference from the current algorithm.r? petrochenkov