-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
module resolution regression on rustc 1.24.0-nightly (2017-12-21) #46936
Comments
Ring has
#[path="foo/foo.rs"] pub mod foo;
pub mod bar;
// Empty #34596 strikes again... You shouldn't be able to disable forward compatibility lints. |
Oh, interesting. This is a bit of a weird case-- what's happening here is that, when using The new behavior is motivated because I'm not quite sure the best way to solve this. AFAIK there's no way to check the value of feature gates before parsing the files, and it isn't always valid to pull in both because Looking at #37872, it seems like this lint has been around for quite some time and was made deny-by-default in #42894. While it wasn't originally my intention, I personally think the best solution here is to move forward with the breakage. |
I feel we ought to do some kind of crater run on this change at least, so this might be worth reopening. cc @jseyfried, with whom I was discussing this in another thread. |
I'm going to re-open the ticket for discussion. I think I agree that this was intended breakage that ring ignored, but I also agree that we want to minimize the disruption if at all possible -- it ought to be possible to check if the feature-gate is enabled, I suppose, though it's gonna be annoying (and, later, just opt-in with the new epoch). |
OK, chatting on IRC, @eddyb and I came up with a concrete plan of action: We could add Until then, the old behavior would be preserved. @cramertj, do you think that'd be easy to do? I'm not 100% sure on what path the code was taking before. |
@nikomatsakis Sure, we can just switch on the |
I guess I think it's ok to wait for the new epoch -- I would really prefer not to break ring. I think this is a grey line case, where we can justify making the change, but I am not happy with the real-world effects, so it may not be worth doing it. |
Agreed. I will make the change. |
Sorry if this has already been elaborated on, but could someone with more knowledge clarify this for me? Why does the mod resolution in the new system depend on where the file actually is, rather than what the mod name is? I thought If someone could point me to where this was previously discussed, that would be awesome. I'll keep looking around, but I can't find anything directly in the https://github.com/rust-lang/rfcs/blob/8ee535b4fcc8bb22c121ad19a36414f1259397c0/text/2126-path-clarity.md which clarifies this. |
I've just stumbled across this because rustoto_core hasn't released a new version since removing a dependency on ring. Where is this issue up to? Is it worth backing out the previous PR until a new one with the epoch suggestion is ready? |
Your impression is that a file
I'm currently working on a branch that moves this change into |
Yes, that would be my interpretation of the behavior, given that the crate root is at You're right that this is pretty ambiguous, which is why I would prefer the "only this file directly is affected" interpretation over the one currently implemented. Once #37872 happens, all submodules of |
Treat #[path] files as mod.rs files Fixes rust-lang#46936, cc @briansmith, @SergioBenitez, @nikomatsakis. This (insta-stable) change treats files included via `#[path = "bla.rs"] mod foo;` as though they were `mod.rs` files. Namely, it allows them to include `mod` statements and looks for the child modules in sibling directories, rather than in relative `modname/childmodule.rs` files as happens for non-`mod.rs` files. This change makes the `non_modrs_mods` feature backwards compatible with the existing usage in https://github.com/briansmith/ring, several versions of which are currently broken in beta. If we decide to merge, this change should be backported to beta. cc rust-lang#37872 r? @jseyfried
Treat #[path] files as mod.rs files Fixes rust-lang#46936, cc @briansmith, @SergioBenitez, @nikomatsakis. This (insta-stable) change treats files included via `#[path = "bla.rs"] mod foo;` as though they were `mod.rs` files. Namely, it allows them to include `mod` statements and looks for the child modules in sibling directories, rather than in relative `modname/childmodule.rs` files as happens for non-`mod.rs` files. This change makes the `non_modrs_mods` feature backwards compatible with the existing usage in https://github.com/briansmith/ring, several versions of which are currently broken in beta. If we decide to merge, this change should be backported to beta. cc rust-lang#37872 r? @jseyfried
Treat #[path] files as mod.rs files Fixes rust-lang#46936, cc @briansmith, @SergioBenitez, @nikomatsakis. This (insta-stable) change treats files included via `#[path = "bla.rs"] mod foo;` as though they were `mod.rs` files. Namely, it allows them to include `mod` statements and looks for the child modules in sibling directories, rather than in relative `modname/childmodule.rs` files as happens for non-`mod.rs` files. This change makes the `non_modrs_mods` feature backwards compatible with the existing usage in https://github.com/briansmith/ring, several versions of which are currently broken in beta. If we decide to merge, this change should be backported to beta. cc rust-lang#37872 r? @jseyfried
Beginning with
rustc 1.24.0-nightly (250b49205 2017-12-21)
,rustc
fails to find the appropriate file for a module when the module root is notmod_name/mod.rs
ormod_name.rs
(i.e, when using#[path]
). This has brokenring
, which has the followingmod
declarations:In
lib.rs
:In
arithmetic/arithmetic.rs
:And
arithmetic/montgomery.rs
contains themontgomery
module code. This results in the following error:Related issues: briansmith/ring#598, #46531
The text was updated successfully, but these errors were encountered: