|
| 1 | +warning: trait objects without an explicit `dyn` are deprecated |
| 2 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:20 |
| 3 | + | |
| 4 | +LL | trait Foo<const N: Bar<2>> { |
| 5 | + | ^^^^^^ |
| 6 | + | |
| 7 | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! |
| 8 | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> |
| 9 | + = note: `#[warn(bare_trait_objects)]` on by default |
| 10 | +help: if this is an object-safe trait, use `dyn` |
| 11 | + | |
| 12 | +LL | trait Foo<const N: dyn Bar<2>> { |
| 13 | + | +++ |
| 14 | + |
| 15 | +warning: trait objects without an explicit `dyn` are deprecated |
| 16 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20 |
| 17 | + | |
| 18 | +LL | trait Bar<const M: Foo<2>> {} |
| 19 | + | ^^^^^^ |
| 20 | + | |
| 21 | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! |
| 22 | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> |
| 23 | +help: if this is an object-safe trait, use `dyn` |
| 24 | + | |
| 25 | +LL | trait Bar<const M: dyn Foo<2>> {} |
| 26 | + | +++ |
| 27 | + |
| 28 | +error[E0391]: cycle detected when computing type of `Foo::N` |
| 29 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 |
| 30 | + | |
| 31 | +LL | trait Foo<const N: Bar<2>> { |
| 32 | + | ^^^^^^^^^^^^^^^ |
| 33 | + | |
| 34 | +note: ...which requires computing type of `Bar::M`... |
| 35 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 |
| 36 | + | |
| 37 | +LL | trait Bar<const M: Foo<2>> {} |
| 38 | + | ^^^^^^^^^^^^^^^ |
| 39 | + = note: ...which again requires computing type of `Foo::N`, completing the cycle |
| 40 | +note: cycle used when computing explicit predicates of trait `Foo` |
| 41 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1 |
| 42 | + | |
| 43 | +LL | trait Foo<const N: Bar<2>> { |
| 44 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 45 | + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information |
| 46 | + |
| 47 | +error[E0391]: cycle detected when computing type of `Foo::N` |
| 48 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 |
| 49 | + | |
| 50 | +LL | trait Foo<const N: Bar<2>> { |
| 51 | + | ^^^^^^^^^^^^^^^ |
| 52 | + | |
| 53 | +note: ...which requires computing type of `Bar::M`... |
| 54 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 |
| 55 | + | |
| 56 | +LL | trait Bar<const M: Foo<2>> {} |
| 57 | + | ^^^^^^^^^^^^^^^ |
| 58 | + = note: ...which again requires computing type of `Foo::N`, completing the cycle |
| 59 | +note: cycle used when computing explicit predicates of trait `Foo` |
| 60 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1 |
| 61 | + | |
| 62 | +LL | trait Foo<const N: Bar<2>> { |
| 63 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 64 | + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information |
| 65 | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 66 | + |
| 67 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 68 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:24 |
| 69 | + | |
| 70 | +LL | trait Foo<const N: Bar<2>> { |
| 71 | + | ^ `Foo` cannot be made into an object |
| 72 | + | |
| 73 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> |
| 74 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 |
| 75 | + | |
| 76 | +LL | trait Foo<const N: Bar<2>> { |
| 77 | + | --- this trait cannot be made into an object... |
| 78 | +... |
| 79 | +LL | fn func() { |
| 80 | + | ^^^^ ...because associated function `func` has no `self` parameter |
| 81 | +help: consider turning `func` into a method by giving it a `&self` argument |
| 82 | + | |
| 83 | +LL | fn func(&self) { |
| 84 | + | +++++ |
| 85 | +help: alternatively, consider constraining `func` so it does not apply to trait objects |
| 86 | + | |
| 87 | +LL | fn func() where Self: Sized { |
| 88 | + | +++++++++++++++++ |
| 89 | + |
| 90 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 91 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 |
| 92 | + | |
| 93 | +LL | trait Foo<const N: Bar<2>> { |
| 94 | + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object |
| 95 | + | |
| 96 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> |
| 97 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 |
| 98 | + | |
| 99 | +LL | trait Foo<const N: Bar<2>> { |
| 100 | + | --- this trait cannot be made into an object... |
| 101 | +... |
| 102 | +LL | fn func() { |
| 103 | + | ^^^^ ...because associated function `func` has no `self` parameter |
| 104 | +help: consider turning `func` into a method by giving it a `&self` argument |
| 105 | + | |
| 106 | +LL | fn func(&self) { |
| 107 | + | +++++ |
| 108 | +help: alternatively, consider constraining `func` so it does not apply to trait objects |
| 109 | + | |
| 110 | +LL | fn func() where Self: Sized { |
| 111 | + | +++++++++++++++++ |
| 112 | + |
| 113 | +error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter |
| 114 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:20 |
| 115 | + | |
| 116 | +LL | trait Foo<const N: Bar<2>> { |
| 117 | + | ^^^^^^ |
| 118 | + | |
| 119 | + = note: the only supported types are integers, `bool` and `char` |
| 120 | + |
| 121 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 122 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 |
| 123 | + | |
| 124 | +LL | trait Bar<const M: Foo<2>> {} |
| 125 | + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object |
| 126 | + | |
| 127 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> |
| 128 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 |
| 129 | + | |
| 130 | +LL | trait Foo<const N: Bar<2>> { |
| 131 | + | --- this trait cannot be made into an object... |
| 132 | +... |
| 133 | +LL | fn func() { |
| 134 | + | ^^^^ ...because associated function `func` has no `self` parameter |
| 135 | +help: consider turning `func` into a method by giving it a `&self` argument |
| 136 | + | |
| 137 | +LL | fn func(&self) { |
| 138 | + | +++++ |
| 139 | +help: alternatively, consider constraining `func` so it does not apply to trait objects |
| 140 | + | |
| 141 | +LL | fn func() where Self: Sized { |
| 142 | + | +++++++++++++++++ |
| 143 | + |
| 144 | +error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter |
| 145 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20 |
| 146 | + | |
| 147 | +LL | trait Bar<const M: Foo<2>> {} |
| 148 | + | ^^^^^^ |
| 149 | + | |
| 150 | + = note: the only supported types are integers, `bool` and `char` |
| 151 | + |
| 152 | +error[E0038]: the trait `Foo` cannot be made into an object |
| 153 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 |
| 154 | + | |
| 155 | +LL | trait Foo<const N: Bar<2>> { |
| 156 | + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object |
| 157 | + | |
| 158 | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> |
| 159 | + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 |
| 160 | + | |
| 161 | +LL | trait Foo<const N: Bar<2>> { |
| 162 | + | --- this trait cannot be made into an object... |
| 163 | +... |
| 164 | +LL | fn func() { |
| 165 | + | ^^^^ ...because associated function `func` has no `self` parameter |
| 166 | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 167 | +help: consider turning `func` into a method by giving it a `&self` argument |
| 168 | + | |
| 169 | +LL | fn func(&self) { |
| 170 | + | +++++ |
| 171 | +help: alternatively, consider constraining `func` so it does not apply to trait objects |
| 172 | + | |
| 173 | +LL | fn func() where Self: Sized { |
| 174 | + | +++++++++++++++++ |
| 175 | + |
| 176 | +error: aborting due to 8 previous errors; 2 warnings emitted |
| 177 | + |
| 178 | +Some errors have detailed explanations: E0038, E0391. |
| 179 | +For more information about an error, try `rustc --explain E0038`. |
0 commit comments