Repository: clap-rs/clap (language: rust)

Issue:
Prevent user from using both `required` and `required_unless_present`
### Please complete the following tasks

- [X] I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
- [X] I have searched the [open](https://github.com/clap-rs/clap/issues) and [rejected](https://github.com/clap-rs/clap/issues?q=is%3Aissue+label%3AS-wont-fix+is%3Aclosed) issues

### Clap Version

3.1.11

### Describe your use case

Given the following pattern:

```rs
/// The name of the module to be printed
#[clap(required = true, required_unless_present = "list")]
name: Option<String>,
```

`required_unless_present` will silently be overruled by `required`, which is confusing.

### Describe the solution you'd like

Ideally, an error is given to the user so that they are made aware of the conflicting derives (specifically, one that points out to them that `required_unless_present` is sufficient by itself and `required` is not additionally necessary). 

### Alternatives, if applicable

_No response_

### Additional Context

Coming from this discussion: #3658


Discussion / hints:

Fix patch:
diff --git a/src/build/debug_asserts.rs b/src/build/debug_asserts.rs
index 251ed8766ab..76bc0a96f09 100644
--- a/src/build/debug_asserts.rs
+++ b/src/build/debug_asserts.rs
@@ -155,6 +155,14 @@ pub(crate) fn assert_app(cmd: &Command) {
         }
 
         for req in &arg.r_ifs {
+            #[cfg(feature = "unstable-v4")]
+            {
+                assert!(
+                    !arg.is_required_set(),
+                    "Argument {}: `required` conflicts with `required_if_eq*`",
+                    arg.name
+                );
+            }
             assert!(
                 cmd.id_exists(&req.0),
                 "Command {}: Argument or group '{:?}' specified in 'required_if_eq*' for '{}' does not exist",
@@ -165,6 +173,14 @@ pub(crate) fn assert_app(cmd: &Command) {
         }
 
         for req in &arg.r_ifs_all {
+            #[cfg(feature = "unstable-v4")]
+            {
+                assert!(
+                    !arg.is_required_set(),
+                    "Argument {}: `required` conflicts with `required_if_eq_all`",
+                    arg.name
+                );
+            }
             assert!(
                 cmd.id_exists(&req.0),
                 "Command {}: Argument or group '{:?}' specified in 'required_if_eq_all' for '{}' does not exist",
@@ -175,6 +191,32 @@ pub(crate) fn assert_app(cmd: &Command) {
         }
 
         for req in &arg.r_unless {
+            #[cfg(feature = "unstable-v4")]
+            {
+                assert!(
+                    !arg.is_required_set(),
+                    "Argument {}: `required` conflicts with `required_unless*`",
+                    arg.name
+                );
+            }
+            assert!(
+                cmd.id_exists(req),
+                "Command {}: Argument or group '{:?}' specified in 'required_unless*' for '{}' does not exist",
+                    cmd.get_name(),
+                req,
+                arg.name,
+            );
+        }
+
+        for req in &arg.r_unless_all {
+            #[cfg(feature = "unstable-v4")]
+            {
+                assert!(
+                    !arg.is_required_set(),
+                    "Argument {}: `required` conflicts with `required_unless*`",
+                    arg.name
+                );
+            }
             assert!(
                 cmd.id_exists(req),
                 "Command {}: Argument or group '{:?}' specified in 'required_unless*' for '{}' does not exist",


Test patch: