diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-08 16:50:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-08 16:50:33 +0100 |
| commit | 7ab50e40063a5f11aec148f59ad4d32e2a13fd70 (patch) | |
| tree | 5450ddc2785c74a9a373a0d5a92182d20d8551d8 /src/doc | |
| parent | 76ade3e8ac42cd7a7b7c3c5ef54818ab68e3ebdc (diff) | |
| parent | 574d2b83a16dbbe975bbb3cf2ed541563a2f756c (diff) | |
| download | rust-7ab50e40063a5f11aec148f59ad4d32e2a13fd70.tar.gz rust-7ab50e40063a5f11aec148f59ad4d32e2a13fd70.zip | |
Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Transition future compat lints to {ERROR, DENY} - Take 2
Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.
- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203
r? @varkor
cc @petrochenkov
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc/src/lints/listing/deny-by-default.md | 91 | ||||
| -rw-r--r-- | src/doc/rustc/src/lints/listing/warn-by-default.md | 40 |
2 files changed, 27 insertions, 104 deletions
diff --git a/src/doc/rustc/src/lints/listing/deny-by-default.md b/src/doc/rustc/src/lints/listing/deny-by-default.md index 5688e90ada1..dc5a9e44acf 100644 --- a/src/doc/rustc/src/lints/listing/deny-by-default.md +++ b/src/doc/rustc/src/lints/listing/deny-by-default.md @@ -45,53 +45,6 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type` = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> ``` -## legacy-constructor-visibility - -[RFC 1506](https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md) modified some -visibility rules, and changed the visibility of struct constructors. Some -example code that triggers this lint: - -```rust,ignore -mod m { - pub struct S(u8); - - fn f() { - // this is trying to use S from the 'use' line, but because the `u8` is - // not pub, it is private - ::S; - } -} - -use m::S; -``` - -This will produce: - -```text -error: private struct constructors are not usable through re-exports in outer modules - --> src/main.rs:5:9 - | -5 | ::S; - | ^^^ - | - = note: `#[deny(legacy_constructor_visibility)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207> -``` - - -## legacy-directory-ownership - -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. - - ## missing-fragment-specifier The missing_fragment_specifier warning is issued when an unused pattern in a @@ -169,39 +122,49 @@ error: literal out of range for u8 | ``` -## parenthesized-params-in-types-and-modules +## patterns-in-fns-without-body -This lint detects incorrect parentheses. Some example code that triggers this -lint: +This lint detects patterns in functions without body were that were +previously erroneously allowed. Some example code that triggers this lint: -```rust,ignore -let x = 5 as usize(); +```rust,compile_fail +trait Trait { + fn foo(mut arg: u8); +} ``` This will produce: ```text -error: parenthesized parameters may only be used with a trait - --> src/main.rs:2:21 +warning: patterns aren't allowed in methods without bodies + --> src/main.rs:2:12 | -2 | let x = 5 as usize(); - | ^^ +2 | fn foo(mut arg: u8); + | ^^^^^^^ | - = note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default + = note: `#[warn(patterns_in_fns_without_body)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238> + = note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203> ``` -To fix it, remove the `()`s. +To fix this, remove the pattern; it can be used in the implementation without +being used in the definition. That is: -## pub-use-of-private-extern-crate +```rust +trait Trait { + fn foo(arg: u8); +} -This lint detects a specific situation of re-exporting a private `extern crate`; +impl Trait for i32 { + fn foo(mut arg: u8) { + + } +} +``` -## safe-extern-statics +## pub-use-of-private-extern-crate -In older versions of Rust, there was a soundness issue where `extern static`s were allowed -to be accessed in safe code. This lint now catches and denies this kind of code. +This lint detects a specific situation of re-exporting a private `extern crate`; ## unknown-crate-types diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index 813d7c4bafe..77642a850fa 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -307,46 +307,6 @@ warning: path statement with no effect | ``` -## patterns-in-fns-without-body - -This lint detects patterns in functions without body were that were -previously erroneously allowed. Some example code that triggers this lint: - -```rust -trait Trait { - fn foo(mut arg: u8); -} -``` - -This will produce: - -```text -warning: patterns aren't allowed in methods without bodies - --> src/main.rs:2:12 - | -2 | fn foo(mut arg: u8); - | ^^^^^^^ - | - = note: `#[warn(patterns_in_fns_without_body)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203> -``` - -To fix this, remove the pattern; it can be used in the implementation without -being used in the definition. That is: - -```rust -trait Trait { - fn foo(arg: u8); -} - -impl Trait for i32 { - fn foo(mut arg: u8) { - - } -} -``` - ## plugin-as-library This lint detects when compiler plugins are used as ordinary library in |
