File tree 1 file changed +38
-1
lines changed
1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -1933,6 +1933,44 @@ struct Foo<X = Box<Self>> {
1933
1933
```
1934
1934
"## ,
1935
1935
1936
+ E0741 : r##"
1937
+ Visibility is restricted to a module which isn't an ancestor of the current
1938
+ item.
1939
+
1940
+ Erroneous code example:
1941
+
1942
+ ```compile_fail,E0741,edition2018
1943
+ pub mod Sea {}
1944
+
1945
+ pub (in crate::Sea) struct Shark; // error!
1946
+
1947
+ fn main() {}
1948
+ ```
1949
+
1950
+ To fix this error, we need to move the `Shark` struct inside the `Sea` module:
1951
+
1952
+ ```edition2018
1953
+ pub mod Sea {
1954
+ pub (in crate::Sea) struct Shark; // ok!
1955
+ }
1956
+
1957
+ fn main() {}
1958
+ ```
1959
+
1960
+ Of course, you can do it as long as the module you're referring to is an
1961
+ ancestor:
1962
+
1963
+ ```edition2018
1964
+ pub mod Earth {
1965
+ pub mod Sea {
1966
+ pub (in crate::Earth) struct Shark; // ok!
1967
+ }
1968
+ }
1969
+
1970
+ fn main() {}
1971
+ ```
1972
+ "## ,
1973
+
1936
1974
;
1937
1975
// E0153, unused error code
1938
1976
// E0157, unused error code
@@ -1953,5 +1991,4 @@ struct Foo<X = Box<Self>> {
1953
1991
// E0470, removed
1954
1992
E0577 ,
1955
1993
E0578 ,
1956
- E0740 ,
1957
1994
}
You can’t perform that action at this time.
0 commit comments