diff options
| author | Samuel Moelius <samuel.moelius@trailofbits.com> | 2025-04-03 20:59:05 -0400 |
|---|---|---|
| committer | Samuel Moelius <sam@moeli.us> | 2025-08-15 12:10:54 -0400 |
| commit | c3c2c23e0d96c76f11a307cf3c4cf14a86fd158b (patch) | |
| tree | b5dc6f3ae9ee7f8957c5dc14bff21bcd23b7c1d2 /tests/ui-fulldeps | |
| parent | 3672a55b7cfd0a12e7097197b6242872473ffaa7 (diff) | |
| download | rust-c3c2c23e0d96c76f11a307cf3c4cf14a86fd158b.tar.gz rust-c3c2c23e0d96c76f11a307cf3c4cf14a86fd158b.zip | |
Extend `QueryStability` to handle `IntoIterator` implementations
Fix adjacent code Fix duplicate warning; merge test into `tests/ui-fulldeps/internal-lints` Use `rustc_middle::ty::FnSig::inputs` Address two review comments - https://github.com/rust-lang/rust/pull/139345#discussion_r2109006991 - https://github.com/rust-lang/rust/pull/139345#discussion_r2109058588 Use `Instance::try_resolve` Import `rustc_middle::ty::Ty` as `Ty` rather than `MiddleTy` Simplify predicate handling Add more `#[allow(rustc::potential_query_instability)]` following rebase Remove two `#[allow(rustc::potential_query_instability)]` following rebase Address review comment Update compiler/rustc_lint/src/internal.rs Co-authored-by: lcnr <rust@lcnr.de>
Diffstat (limited to 'tests/ui-fulldeps')
| -rw-r--r-- | tests/ui-fulldeps/internal-lints/query_stability.rs | 12 | ||||
| -rw-r--r-- | tests/ui-fulldeps/internal-lints/query_stability.stderr | 18 |
2 files changed, 29 insertions, 1 deletions
diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 7b897fabd2d..9dc65250064 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -34,4 +34,16 @@ fn main() { //~^ ERROR using `values_mut` can result in unstable query results *val = *val + 10; } + + FxHashMap::<u32, i32>::default().extend(x); + //~^ ERROR using `into_iter` can result in unstable query results +} + +fn hide_into_iter<T>(x: impl IntoIterator<Item = T>) -> impl Iterator<Item = T> { + x.into_iter() +} + +fn take(map: std::collections::HashMap<i32, i32>) { + _ = hide_into_iter(map); + //~^ ERROR using `into_iter` can result in unstable query results } diff --git a/tests/ui-fulldeps/internal-lints/query_stability.stderr b/tests/ui-fulldeps/internal-lints/query_stability.stderr index 43b156dc20a..a95ffd25a47 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.stderr +++ b/tests/ui-fulldeps/internal-lints/query_stability.stderr @@ -59,5 +59,21 @@ LL | for val in x.values_mut() { | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale -error: aborting due to 7 previous errors +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:38:38 + | +LL | FxHashMap::<u32, i32>::default().extend(x); + | ^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:47:9 + | +LL | _ = hide_into_iter(map); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: aborting due to 9 previous errors |
