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

parenthesized_params_in_types_and_modules future-compatibility warnings #42238

Closed
2 of 3 tasks
qnighy opened this issue May 26, 2017 · 2 comments · Fixed by #65785
Closed
2 of 3 tasks

parenthesized_params_in_types_and_modules future-compatibility warnings #42238

qnighy opened this issue May 26, 2017 · 2 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

@qnighy
Copy link
Contributor

qnighy commented May 26, 2017

This is the summary issue for the PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES 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 parenthesized_params_in_types_and_modules warning is issued when you use parenthesized generic parameters in modules, primitive types, type parameters, or Self. For structs, enums, enum variants, unions, and type aliases, the syntax has already issued an error. Typical example of this warning is a code like this:

fn something(&self) -> i32 () {
  //                       ^^ parenthesized params

  ..
  let x = self.foo() as usize();
  //                         ^^ parenthesized params
  ..
}

This warning can always be fixed by removing the parentheses.

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

qnighy added a commit to qnighy/rust that referenced this issue May 26, 2017
@Mark-Simulacrum Mark-Simulacrum 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 May 29, 2017
@qnighy
Copy link
Contributor Author

qnighy commented Jun 12, 2017

I noticed there is a case where () cannot just be removed.

fn main() {
    0 as usize() < 1; // `()` can't just be removed.
}

The cause is the well-known ambiguity between "less-than" and "open angle bracket". In this case, you can fix the problem like this:

fn main() {
    0 as (usize) < 1; // OK
    (0 as usize) < 1; // OK
}

@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 22, 2017
@Centril Centril added the C-future-incompatibility Category: Future-incompatibility lints label Dec 23, 2018
@tchamelot
Copy link

I don't know if this should go here, I am new to Rust and I still make mistakes such as confuse ":" and "=" for struct. Today, the compiler brought me here through a link because of this error. Is this the standard behavior for this kind of error.

error: parenthesized parameters may only be used with a trait --> src/main.rs:100:28 | 100 | let mut ally : Pod::new(); | ^^ | = note: #[deny(parenthesized_params_in_types_and_modules)] 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>

@Centril Centril removed the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jan 13, 2019
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
@bors bors closed this as completed in 7ab50e4 Nov 8, 2019
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
4 participants