]> git.lizzy.rs Git - rust.git/blob - src/test/ui/object-safety/object-safety-associated-consts.rs
move an `assert!` to the right place
[rust.git] / src / test / ui / object-safety / object-safety-associated-consts.rs
1 // Check that we correctly prevent users from making trait objects
2 // from traits with associated consts.
3 //
4 // revisions: curr object_safe_for_dispatch
5
6 #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))]
7
8 trait Bar {
9     const X: usize;
10 }
11
12 fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
13     //[curr]~^ ERROR E0038
14     t
15     //[object_safe_for_dispatch]~^ ERROR E0038
16 }
17
18 fn main() {
19 }