]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-87199.rs
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
[rust.git] / src / test / ui / issues / issue-87199.rs
1 // Regression test for issue #87199, where attempting to relax a bound
2 // other than the only supported `?Sized` would still cause the compiler
3 // to assume that the `Sized` bound was relaxed.
4
5 // check-fail
6
7 // Check that these function definitions only emit warnings, not errors
8 fn arg<T: ?Send>(_: T) {}
9 //~^ warning: default bound relaxed for a type parameter, but this does nothing
10 fn ref_arg<T: ?Send>(_: &T) {}
11 //~^ warning: default bound relaxed for a type parameter, but this does nothing
12 fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
13 //~^ warning: default bound relaxed for a type parameter, but this does nothing
14
15 // Check that there's no `?Sized` relaxation!
16 fn main() {
17     ref_arg::<i32>(&5);
18     ref_arg::<[i32]>(&[5]);
19     //~^ the size for values of type `[i32]` cannot be known
20 }