diff options
| author | llogiq <bogusandre@gmail.com> | 2024-11-25 20:24:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-25 20:24:39 +0000 |
| commit | 3d881e1e595dae6d5616bfd41da756967f0ae6c3 (patch) | |
| tree | 4061150ceb8998e487e6cd13f78b332c7923758d /tests/ui | |
| parent | d070402440a5a92f427a981784b39eb460e5f292 (diff) | |
| parent | 9fd8e99d91f7029016b9097d1311c1045f35667f (diff) | |
| download | rust-3d881e1e595dae6d5616bfd41da756967f0ae6c3.tar.gz rust-3d881e1e595dae6d5616bfd41da756967f0ae6c3.zip | |
Prevent ICE in case of a bound constraint on generic argument (#13722)
Fix #13706 changelog: [`trait_duplication_in_bounds`]: fix ICE on duplicate type or constant bound
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/trait_duplication_in_bounds.fixed | 17 | ||||
| -rw-r--r-- | tests/ui/trait_duplication_in_bounds.rs | 17 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/ui/trait_duplication_in_bounds.fixed b/tests/ui/trait_duplication_in_bounds.fixed index 779431303ae..e57c79553c3 100644 --- a/tests/ui/trait_duplication_in_bounds.fixed +++ b/tests/ui/trait_duplication_in_bounds.fixed @@ -1,6 +1,6 @@ #![deny(clippy::trait_duplication_in_bounds)] #![allow(unused)] -#![feature(const_trait_impl)] +#![feature(associated_const_equality, const_trait_impl)] use std::any::Any; @@ -179,3 +179,18 @@ fn main() { let _x: fn(_) = f::<()>; let _x: fn(_) = f::<i32>; } + +// #13706 +fn assoc_tys_bounds<T>() +where + T: Iterator<Item: Clone> + Iterator<Item: Clone>, +{ +} +trait AssocConstTrait { + const ASSOC: usize; +} +fn assoc_const_args<T>() +where + T: AssocConstTrait<ASSOC = 0> + AssocConstTrait<ASSOC = 0>, +{ +} diff --git a/tests/ui/trait_duplication_in_bounds.rs b/tests/ui/trait_duplication_in_bounds.rs index 3e974dc0a8f..ee84d3c3011 100644 --- a/tests/ui/trait_duplication_in_bounds.rs +++ b/tests/ui/trait_duplication_in_bounds.rs @@ -1,6 +1,6 @@ #![deny(clippy::trait_duplication_in_bounds)] #![allow(unused)] -#![feature(const_trait_impl)] +#![feature(associated_const_equality, const_trait_impl)] use std::any::Any; @@ -179,3 +179,18 @@ fn main() { let _x: fn(_) = f::<()>; let _x: fn(_) = f::<i32>; } + +// #13706 +fn assoc_tys_bounds<T>() +where + T: Iterator<Item: Clone> + Iterator<Item: Clone>, +{ +} +trait AssocConstTrait { + const ASSOC: usize; +} +fn assoc_const_args<T>() +where + T: AssocConstTrait<ASSOC = 0> + AssocConstTrait<ASSOC = 0>, +{ +} |
