-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Warn on bare_trait_objects by default #61203
Conversation
This comment has been minimized.
This comment has been minimized.
2dc7a7a
to
9eb7ad3
Compare
This comment has been minimized.
This comment has been minimized.
and now for level 2: updating run-pass suite. |
This comment has been minimized.
This comment has been minimized.
8596ee9
to
cf792cb
Compare
This comment has been minimized.
This comment has been minimized.
cf792cb
to
b03c80e
Compare
This comment has been minimized.
This comment has been minimized.
@Centril ready for review! \o/ |
418e39b
to
afa2bd6
Compare
src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs
Show resolved
Hide resolved
@rust-lang/lang N.B. This PR implements the "lint against bare trait syntax" as specified in RFC 2113. As we only move to a warning, I think we can dispense with a crater run for now and perhaps move to |
On Tue, May 28, 2019 at 06:51:30AM -0700, Mazdak Farrokhzad wrote:
@rust-lang/lang N.B. This PR implements the *"lint against bare trait syntax"* as specified in [RFC 2113](https://github.com/Ixrec/rfcs/blob/dyn-trait-syntax/text/2113-dyn-trait-syntax.md#migration). As we only move to a warning, I think we can dispense with a crater run for now and perhaps move to `deny` later in the year.
Note that under normal circumstances, I'd say we need a crater run to
assess the impact of even a new warning, as that *can* cause build
failures (`deny(warnings)`). However, as this was announced and
advertised as part of the Rust 2018 edition, I think we can reasonably
introduce it as an idiom lint, to be enabled as part of that family of
lints.
|
afa2bd6
to
a6eda0d
Compare
Rebased on top of master and addressed comments ^^ |
Thanks! @bors r+ p=1 rollup=never |
📌 Commit a6eda0d1b841e18235575b4977435cf78ab711a3 has been approved by |
@bors p=2 |
⌛ Testing commit a6eda0d1b841e18235575b4977435cf78ab711a3 with merge f4d9baf059c86bacc6e25f38308f409c808f0cf9... |
💔 Test failed - checks-travis |
Changes: ```` Rustup to rust-lang#61203 rustup rust-lang#60928 rustup rust-lang#61164 (which is included in rust-lang#61274) ````
It appears that this lint isn't automatically rust-fixable, is that correct? If so I would prefer that this were reverted, it's generating thousands of warnings in just one local project, and without rustfix to fix the majority of these it seems like this is prematurely warning by default. |
I was able to rustfix this automatically in rust-lang/gll#100. Did you use |
Since this is now an on-by-default warning it should not require Tweaking the |
@alexcrichton Ah; I assumed the
But |
Missing `dyn` for trait object (bare trait object) is a warning by default now as rust-lang/rust#61203 is merged, which breaks labrpc. Also fixed a few other warnings and unclear documents. Signed-off-by: Liqueur Librazy <im@librazy.org>
No fix was necessary, it's simply on by default and all that's needed is |
Missing `dyn` for trait object (bare trait object) is a warning by default now as rust-lang/rust#61203 is merged, which breaks labrpc. Also fixed a few other warnings and unclear documents. Signed-off-by: Liqueur Librazy <im@librazy.org>
This change is proving disruptive: #61963 |
Pkgsrc changes: * Add a patch to llvm to deal with const dli_saddr. * Adapt two other patches. * Cross-build currently fails, so i386, powerpc and sparc64 bootstrap kits for 1.37.0 are built natively. Missing aarch64 hardware, so that's not available yet. * Bump bootstrap requirements to 1.36.0 except for armv7-unknown-netbsd-eabihf which I've not managed to cross-build. Upstream changes: Version 1.37.0 (2019-08-15) ========================== Language -------- - `#[must_use]` will now warn if the type is contained in a [tuple][61100], [`Box`][62228], or an [array][62235] and unused. - [You can now use the `cfg` and `cfg_attr` attributes on generic parameters.][61547] - [You can now use enum variants through type alias.][61682] e.g. You can write the following: ```rust type MyOption = Option<u8>; fn increment_or_zero(x: MyOption) -> u8 { match x { MyOption::Some(y) => y + 1, MyOption::None => 0, } } ``` - [You can now use `_` as an identifier for consts.][61347] e.g. You can write `const _: u32 = 5;`. - [You can now use `#[repr(align(X)]` on enums.][61229] - [The `?`/_"Kleene"_ macro operator is now available in the 2015 edition.][60932] Compiler -------- - [You can now enable Profile-Guided Optimization with the `-C profile-generate` and `-C profile-use` flags.][61268] For more information on how to use profile guided optimization, please refer to the [rustc book][rustc-book-pgo]. - [The `rust-lldb` wrapper script should now work again.][61827] Libraries --------- - [`mem::MaybeUninit<T>` is now ABI-compatible with `T`.][61802] Stabilized APIs --------------- - [`BufReader::buffer`] - [`BufWriter::buffer`] - [`Cell::from_mut`] - [`Cell<[T]>::as_slice_of_cells`][`Cell<slice>::as_slice_of_cells`] - [`DoubleEndedIterator::nth_back`] - [`Option::xor`] - [`Wrapping::reverse_bits`] - [`i128::reverse_bits`] - [`i16::reverse_bits`] - [`i32::reverse_bits`] - [`i64::reverse_bits`] - [`i8::reverse_bits`] - [`isize::reverse_bits`] - [`slice::copy_within`] - [`u128::reverse_bits`] - [`u16::reverse_bits`] - [`u32::reverse_bits`] - [`u64::reverse_bits`] - [`u8::reverse_bits`] - [`usize::reverse_bits`] Cargo ----- - [`Cargo.lock` files are now included by default when publishing executable crates with executables.][cargo/7026] - [You can now specify `default-run="foo"` in `[package]` to specify the default executable to use for `cargo run`.][cargo/7056] Misc ---- Compatibility Notes ------------------- - [Using `...` for inclusive range patterns will now warn by default.][61342] Please transition your code to using the `..=` syntax for inclusive ranges instead. - [Using a trait object without the `dyn` will now warn by default.][61203] Please transition your code to use `dyn Trait` for trait objects instead. [62228]: rust-lang/rust#62228 [62235]: rust-lang/rust#62235 [61802]: rust-lang/rust#61802 [61827]: rust-lang/rust#61827 [61547]: rust-lang/rust#61547 [61682]: rust-lang/rust#61682 [61268]: rust-lang/rust#61268 [61342]: rust-lang/rust#61342 [61347]: rust-lang/rust#61347 [61100]: rust-lang/rust#61100 [61203]: rust-lang/rust#61203 [61229]: rust-lang/rust#61229 [60932]: rust-lang/rust#60932 [cargo/7026]: rust-lang/cargo#7026 [cargo/7056]: rust-lang/cargo#7056 [`BufReader::buffer`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.buffer [`BufWriter::buffer`]: https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.buffer [`Cell::from_mut`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.from_mut [`Cell<slice>::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells [`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back [`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor [`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded [`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits [`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits [`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits [`i32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i32.html#method.reverse_bits [`i64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i64.html#method.reverse_bits [`i8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i8.html#method.reverse_bits [`isize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.isize.html#method.reverse_bits [`slice::copy_within`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within [`u128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u128.html#method.reverse_bits [`u16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u16.html#method.reverse_bits [`u32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u32.html#method.reverse_bits [`u64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u64.html#method.reverse_bits [`u8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u8.html#method.reverse_bits [`usize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.usize.html#method.reverse_bits [rustc-book-pgo]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html
When using Rust 1.37 a missing 'dyn' in conjunction with a trait object is now emitting a warning (see [Rust issue #61203][issue-61203]), causing all generated programs to warn as well: > warning: trait objects without an explicit `dyn` are deprecated > --> src/valmap.rs:36:34 > | > 36 | pub fn format(&self, w: &mut io::Write) -> io::Result<()> { > | ^^^^^^^^^ help: use `dyn`: `dyn io::Write` > | > = note: #[warn(bare_trait_objects)] on by default Let's remove these warnings by adding this keyword to the uses of trait objects in the project template. [issue-61203]: rust-lang/rust#61203
Using bare trait objects is deprecated and now triggers a warning by default: rust-lang/rust#61203.
Using bare trait objects is deprecated and now triggers a warning by default: rust-lang/rust#61203.
Changes: ```` Rustup to rust-lang/rust#61203 rustup rust-lang/rust#60928 rustup rust-lang/rust#61164 (which is included in rust-lang/rust#61274) ````
Using bare trait objects is deprecated and now triggers a warning by default: rust-lang/rust#61203.
Using bare trait objects is deprecated and now triggers a warning by default: rust-lang/rust#61203.
The
bare_trait_objects
lint is set towarn
by default.Most ui tests have been updated to use
dyn
to avoid creating noise in stderr files.r? @Centril
cc #54910