Skip to content
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

legacy_directory_ownership future-compatibility warnings #37872

Closed
2 of 3 tasks
jseyfried opened this issue Nov 19, 2016 · 6 comments · Fixed by #65785
Closed
2 of 3 tasks

legacy_directory_ownership future-compatibility warnings #37872

jseyfried opened this issue Nov 19, 2016 · 6 comments · Fixed by #65785
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-future-incompatibility Category: Future-incompatibility lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jseyfried
Copy link
Contributor

jseyfried commented Nov 19, 2016

This is the summary issue for the legacy_directory_ownership future-compatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made.

What is the warning for?

The legacy_directory_ownership warning is issued when

  • there is a non-inline module with a #[path] attribute (e.g. #[path = "foo.rs"] mod bar;),
  • the module's file ("foo.rs" in the above example) is not named "mod.rs", and
  • the module's file contains a non-inline child module without a #[path] attribute.

The warning can be fixed by renaming the parent module to "mod.rs" and moving it into its own directory if appropriate.

We are making this a warning so that the directory ownership rules apply more consistently to modules with #[path] attributes. This is described in more detail in #37602.

When will this warning become a hard error?

At the beginning of each 6-week release cycle, the Rust compiler team will review the set of outstanding future compatibility warnings and nominate some of them for Final Comment Period. Toward the end of the cycle, we will review any comments and make a final determination whether to convert the warning into a hard error or remove it entirely.

Current status

@jseyfried jseyfried changed the title DIRECTORY_OWNERSHIP future-compatibility warnings legacy_directory_ownership future-compatibility warnings Nov 19, 2016
@nikomatsakis nikomatsakis added B-unstable Blocker: Implemented in the nightly compiler and unstable. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 22, 2016
jonhoo added a commit to HdrHistogram/HdrHistogram_rust that referenced this issue Feb 20, 2017
Split the unit tests into several files.

Also addresses rust-lang/rust#37872.
@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 22, 2017
@cramertj
Copy link
Member

@jseyfried Do you know of any blockers to making this a hard error? In #46936 (comment) it was discovered that the ring crate still depends on the old behavior, so someone needs to send a patch (I can look into it). Are there any other crates that are known to use this behavior? The list from the crater run in #42894 (comment) seems like it missed some, as it shows atomic-0.3.3 as the only failure due to this feature.

@SimonSapin
Copy link
Contributor

Aren’t new epochs when we make breaking changes such as turning warnings into errors?

@cramertj
Copy link
Member

cramertj commented Dec 22, 2017

@SimonSapin Epochs are for releasing breaking changes to the language that were warnings in the last epoch. This is not a breaking change to specified language behavior-- it's a bugfix.

As specified in RFC 1589, bugfixes are "[p]laces where the compiler is not implementing the specified semantics found in an RFC or lang-team decision." RFC 1122 has more details on what sorts of breaking changes are permitted under Rust's semver guarantees.

@jseyfried
Copy link
Contributor Author

jseyfried commented Dec 28, 2017

@cramertj I'm not aware of any other blockers, but there might be other crates that were broken -- it's been a while since the Crater run.

@cramertj
Copy link
Member

@jseyfried should we do a crater run on #46531, then? It would have broken affected crates because it changed the interpretation of mod foo; in non-mod.rs files.

@jseyfried
Copy link
Contributor Author

jseyfried commented Dec 28, 2017

Good point. I don't think breakage is likely, but a Crater run might be warranted. I think it would be better to just do (or wait for) a stable- or beta-to-nightly Crater to also see if there's any other breakage from making this a hard error.

kennytm added a commit to kennytm/rust that referenced this issue Jan 11, 2018
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
kennytm added a commit to kennytm/rust that referenced this issue Jan 11, 2018
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
kennytm added a commit to kennytm/rust that referenced this issue Jan 12, 2018
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
@Mark-Simulacrum Mark-Simulacrum added C-future-incompatibility Category: Future-incompatibility lints and removed C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Jun 2, 2018
bors added a commit that referenced this issue Aug 3, 2019
Transition some C-future-compatibility lints to {ERROR, DENY}

Closes #40107 (ERROR).
Closes #39207 (ERROR).
Closes #37872 (ERROR).
Closes #36887 (ERROR).
Closes #36247 (ERROR.
Closes #42238 (ERROR).
Transitions #59014 (DENY).
Transitions #57571 (DENY).
Closes #60210 (ERROR).
Transitions #35203 (DENY).

r? @petrochenkov
Centril added a commit to Centril/rust that referenced this issue Nov 8, 2019
Transition future compat lints to {ERROR, DENY} - Take 2

Follow up to rust-lang#63247 implementing rust-lang#63247 (comment).

- `legacy_ctor_visibility` (ERROR) -- closes rust-lang#39207
- `legacy_directory_ownership` (ERROR) -- closes rust-lang#37872
- `safe_extern_static` (ERROR) -- closes rust-lang#36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes rust-lang#42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes rust-lang#59014
- `ill_formed_attribute_input` (DENY) -- transitions rust-lang#57571
- `patterns_in_fns_without_body` (DENY) -- transitions rust-lang#35203

r? @varkor
cc @petrochenkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. C-future-incompatibility Category: Future-incompatibility lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants