Auto merge of #100810 - matthiaskrgr:rollup-xep778s, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #97963 (net listen backlog set to negative on Linux.) - #99935 (Reenable disabled early syntax gates as future-incompatibility lints) - #100129 (add miri-test-libstd support to libstd) - #100500 (Ban references to `Self` in trait object substs for projection predicates too.) - #100636 (Revert "Revert "Allow dynamic linking for iOS/tvOS targets."") - #100718 ([rustdoc] Fix item info display) - #100769 (Suggest adding a reference to a trait assoc item) - #100777 (elaborate how revisions work with FileCheck stuff in src/test/codegen) - #100796 (Refactor: remove unnecessary string searchings) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
878aef79dc
51 changed files with 754 additions and 150 deletions
|
|
@ -1,2 +1,24 @@
|
|||
The files here use the LLVM FileCheck framework, documented at
|
||||
<https://llvm.org/docs/CommandGuide/FileCheck.html>.
|
||||
|
||||
One extension worth noting is the use of revisions as custom prefixes for
|
||||
FileCheck. If your codegen test has different behavior based on the chosen
|
||||
target or different compiler flags that you want to exercise, you can use a
|
||||
revisions annotation, like so:
|
||||
|
||||
```rust
|
||||
// revisions: aaa bbb
|
||||
// [bbb] compile-flags: --flags-for-bbb
|
||||
```
|
||||
|
||||
After specifying those variations, you can write different expected, or
|
||||
explicitly *unexpected* output by using `<prefix>-SAME:` and `<prefix>-NOT:`,
|
||||
like so:
|
||||
|
||||
```rust
|
||||
// CHECK: expected code
|
||||
// aaa-SAME: emitted-only-for-aaa
|
||||
// aaa-NOT: emitted-only-for-bbb
|
||||
// bbb-NOT: emitted-only-for-aaa
|
||||
// bbb-SAME: emitted-only-for-bbb
|
||||
```
|
||||
|
|
|
|||
|
|
@ -8,20 +8,24 @@
|
|||
// 'Experimental'
|
||||
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs'
|
||||
|
||||
// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \
|
||||
// '👎 Deprecated since 1.0.0: text'
|
||||
// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎'
|
||||
// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \
|
||||
// 'Deprecated since 1.0.0: text'
|
||||
// @hasraw - '<code>test</code> <a href="https://issue_url/32374">#32374</a>'
|
||||
// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬'
|
||||
// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \
|
||||
// '🔬 This is a nightly-only experimental API. \(test\s#32374\)$'
|
||||
// 'This is a nightly-only experimental API. \(test\s#32374\)$'
|
||||
/// Docs
|
||||
#[deprecated(since = "1.0.0", note = "text")]
|
||||
#[unstable(feature = "test", issue = "32374")]
|
||||
pub struct T;
|
||||
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎'
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \
|
||||
// '👎 Deprecated since 1.0.0: deprecated'
|
||||
// 'Deprecated since 1.0.0: deprecated'
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬'
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \
|
||||
// '🔬 This is a nightly-only experimental API. (test #32374)'
|
||||
// 'This is a nightly-only experimental API. (test #32374)'
|
||||
#[deprecated(since = "1.0.0", note = "deprecated")]
|
||||
#[unstable(feature = "test", issue = "32374", reason = "unstable")]
|
||||
pub struct U;
|
||||
|
|
|
|||
30
src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs
Normal file
30
src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// check-fail
|
||||
// This file is used to test the behavior of the early-pass syntax warnings.
|
||||
// If macro syntax is stabilized, replace with a different unstable syntax.
|
||||
|
||||
macro a() {}
|
||||
//~^ ERROR: `macro` is experimental
|
||||
|
||||
#[cfg(FALSE)]
|
||||
macro b() {}
|
||||
|
||||
macro_rules! identity {
|
||||
($($x:tt)*) => ($($x)*);
|
||||
}
|
||||
|
||||
identity! {
|
||||
macro c() {}
|
||||
//~^ ERROR: `macro` is experimental
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
identity! {
|
||||
macro d() {} // No error
|
||||
}
|
||||
|
||||
identity! {
|
||||
#[cfg(FALSE)]
|
||||
macro e() {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
error[E0658]: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-with-errors.rs:5:1
|
||||
|
|
||||
LL | macro a() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-with-errors.rs:16:5
|
||||
|
|
||||
LL | macro c() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// check-pass
|
||||
// This file is used to test the behavior of the early-pass syntax warnings.
|
||||
// If macro syntax is stabilized, replace with a different unstable syntax.
|
||||
|
||||
#[cfg(FALSE)]
|
||||
macro b() {}
|
||||
//~^ WARN: `macro` is experimental
|
||||
//~| WARN: unstable syntax
|
||||
|
||||
macro_rules! identity {
|
||||
($($x:tt)*) => ($($x)*);
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
identity! {
|
||||
macro d() {} // No error
|
||||
}
|
||||
|
||||
identity! {
|
||||
#[cfg(FALSE)]
|
||||
macro e() {}
|
||||
//~^ WARN: `macro` is experimental
|
||||
//~| WARN: unstable syntax
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
warning: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-without-errors.rs:6:1
|
||||
|
|
||||
LL | macro b() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: `macro` is experimental
|
||||
--> $DIR/soft-syntax-gates-without-errors.rs:21:5
|
||||
|
|
||||
LL | macro e() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #39412 <https://github.com/rust-lang/rust/issues/39412> for more information
|
||||
= help: add `#![feature(decl_macro)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
|
|
@ -3,11 +3,18 @@
|
|||
// compile-flags: --test
|
||||
|
||||
#![feature(async_closure)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(decl_macro)]
|
||||
#![feature(generators)]
|
||||
#![feature(half_open_range_patterns)]
|
||||
#![feature(label_break_value)]
|
||||
#![feature(more_qualified_paths)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(try_blocks)]
|
||||
#![feature(type_ascription)]
|
||||
#![deny(unused_macros)]
|
||||
|
||||
macro_rules! stringify_block {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn main() {}
|
|||
|
||||
// Test the `pat` macro fragment parser:
|
||||
macro_rules! accept_pat {
|
||||
($p:pat) => {}
|
||||
($p:pat) => {};
|
||||
}
|
||||
|
||||
accept_pat!((p | q));
|
||||
|
|
@ -21,28 +21,28 @@ accept_pat!([p | q]);
|
|||
#[cfg(FALSE)]
|
||||
fn or_patterns() {
|
||||
// Top level of `let`:
|
||||
let (| A | B);
|
||||
let (A | B);
|
||||
let (A | B);
|
||||
let (A | B): u8;
|
||||
let (A | B) = 0;
|
||||
let (A | B): u8 = 0;
|
||||
|
||||
// Top level of `for`:
|
||||
for | A | B in 0 {}
|
||||
for A | B in 0 {}
|
||||
for A | B in 0 {}
|
||||
|
||||
// Top level of `while`:
|
||||
while let | A | B = 0 {}
|
||||
while let A | B = 0 {}
|
||||
while let A | B = 0 {}
|
||||
|
||||
// Top level of `if`:
|
||||
if let | A | B = 0 {}
|
||||
if let A | B = 0 {}
|
||||
if let A | B = 0 {}
|
||||
|
||||
// Top level of `match` arms:
|
||||
match 0 {
|
||||
| A | B => {},
|
||||
A | B => {},
|
||||
A | B => {}
|
||||
A | B => {}
|
||||
}
|
||||
|
||||
// Functions:
|
||||
|
|
@ -68,6 +68,8 @@ fn or_patterns() {
|
|||
|
||||
// These bind as `(prefix p) | q` as opposed to `prefix (p | q)`:
|
||||
let (box 0 | 1); // Unstable; we *can* change the precedence if we want.
|
||||
//~^ WARN box pattern syntax is experimental
|
||||
//~| WARN unstable syntax
|
||||
let (&0 | 1);
|
||||
let (&mut 0 | 1);
|
||||
let (x @ 0 | 1);
|
||||
|
|
|
|||
13
src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr
Normal file
13
src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
warning: box pattern syntax is experimental
|
||||
--> $DIR/or-patterns-syntactic-pass.rs:70:10
|
||||
|
|
||||
LL | let (box 0 | 1); // Unstable; we *can* change the precedence if we want.
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #29641 <https://github.com/rust-lang/rust/issues/29641> for more information
|
||||
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
@ -3,7 +3,11 @@
|
|||
#[cfg(FALSE)]
|
||||
fn syntax() {
|
||||
foo::<T = u8, T: Ord, String>();
|
||||
//~^ WARN associated type bounds are unstable
|
||||
//~| WARN unstable syntax
|
||||
foo::<T = u8, 'a, T: Ord>();
|
||||
//~^ WARN associated type bounds are unstable
|
||||
//~| WARN unstable syntax
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
warning: associated type bounds are unstable
|
||||
--> $DIR/constraints-before-generic-args-syntactic-pass.rs:5:19
|
||||
|
|
||||
LL | foo::<T = u8, T: Ord, String>();
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: associated type bounds are unstable
|
||||
--> $DIR/constraints-before-generic-args-syntactic-pass.rs:8:23
|
||||
|
|
||||
LL | foo::<T = u8, 'a, T: Ord>();
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
|
||||
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
|
|
@ -19,6 +19,8 @@ fn rest_patterns() {
|
|||
|
||||
// Box patterns:
|
||||
let box ..;
|
||||
//~^ WARN box pattern syntax is experimental
|
||||
//~| WARN unstable syntax
|
||||
|
||||
// In or-patterns:
|
||||
match x {
|
||||
|
|
@ -57,7 +59,7 @@ fn rest_patterns() {
|
|||
.. |
|
||||
[
|
||||
(
|
||||
box ..,
|
||||
box .., //~ WARN box pattern syntax is experimental
|
||||
&(..),
|
||||
&mut ..,
|
||||
x @ ..
|
||||
|
|
@ -67,4 +69,5 @@ fn rest_patterns() {
|
|||
ref mut x @ ..
|
||||
=> {}
|
||||
}
|
||||
//~| WARN unstable syntax
|
||||
}
|
||||
|
|
|
|||
24
src/test/ui/pattern/rest-pat-syntactic.stderr
Normal file
24
src/test/ui/pattern/rest-pat-syntactic.stderr
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
warning: box pattern syntax is experimental
|
||||
--> $DIR/rest-pat-syntactic.rs:21:9
|
||||
|
|
||||
LL | let box ..;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #29641 <https://github.com/rust-lang/rust/issues/29641> for more information
|
||||
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: box pattern syntax is experimental
|
||||
--> $DIR/rest-pat-syntactic.rs:62:17
|
||||
|
|
||||
LL | box ..,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #29641 <https://github.com/rust-lang/rust/issues/29641> for more information
|
||||
= help: add `#![feature(box_patterns)]` to the crate attributes to enable
|
||||
= warning: unstable syntax can change at any point in the future, causing a hard error!
|
||||
= note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
4
src/test/ui/suggestions/many-type-ascription.rs
Normal file
4
src/test/ui/suggestions/many-type-ascription.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fn main() {
|
||||
let _ = 0: i32; //~ ERROR: type ascription is experimental
|
||||
let _ = 0: i32; // (error only emitted once)
|
||||
}
|
||||
12
src/test/ui/suggestions/many-type-ascription.stderr
Normal file
12
src/test/ui/suggestions/many-type-ascription.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0658]: type ascription is experimental
|
||||
--> $DIR/many-type-ascription.rs:2:13
|
||||
|
|
||||
LL | let _ = 0: i32;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
|
||||
= help: add `#![feature(type_ascription)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// run-rustfix
|
||||
#![allow(unused_variables)]
|
||||
|
||||
fn foo(foo: &mut usize) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn bar(bar: &usize) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo(&mut Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied
|
||||
bar(&Default::default()); //~ the trait bound `&usize: Default` is not satisfied
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// run-rustfix
|
||||
#![allow(unused_variables)]
|
||||
|
||||
fn foo(foo: &mut usize) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn bar(bar: &usize) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo(Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied
|
||||
bar(Default::default()); //~ the trait bound `&usize: Default` is not satisfied
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
error[E0277]: the trait bound `&mut usize: Default` is not satisfied
|
||||
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9
|
||||
|
|
||||
LL | foo(Default::default());
|
||||
| ^^^^^^^^^^^^^^^^ expected an implementor of trait `Default`
|
||||
|
|
||||
help: consider mutably borrowing here
|
||||
|
|
||||
LL | foo(&mut Default::default());
|
||||
| ++++
|
||||
|
||||
error[E0277]: the trait bound `&usize: Default` is not satisfied
|
||||
--> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9
|
||||
|
|
||||
LL | bar(Default::default());
|
||||
| ^^^^^^^^^^^^^^^^ expected an implementor of trait `Default`
|
||||
|
|
||||
help: consider borrowing here
|
||||
|
|
||||
LL | bar(&Default::default());
|
||||
| +
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
fn main() {
|
||||
not rust; //~ ERROR
|
||||
let _ = 0: i32; // (error hidden by existing error)
|
||||
#[cfg(FALSE)]
|
||||
let _ = 0: i32; // (warning hidden by existing error)
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `rust`
|
||||
--> $DIR/type-ascription-and-other-error.rs:2:9
|
||||
|
|
||||
LL | not rust;
|
||||
| ^^^^ expected one of 8 possible tokens
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
12
src/test/ui/traits/alias/self-in-const-generics.rs
Normal file
12
src/test/ui/traits/alias/self-in-const-generics.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#![allow(incomplete_features)]
|
||||
#![feature(generic_const_exprs)]
|
||||
#![feature(trait_alias)]
|
||||
|
||||
trait Bar<const N: usize> {}
|
||||
|
||||
trait BB = Bar<{ 2 + 1 }>;
|
||||
|
||||
fn foo(x: &dyn BB) {}
|
||||
//~^ ERROR the trait alias `BB` cannot be made into an object [E0038]
|
||||
|
||||
fn main() {}
|
||||
11
src/test/ui/traits/alias/self-in-const-generics.stderr
Normal file
11
src/test/ui/traits/alias/self-in-const-generics.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0038]: the trait alias `BB` cannot be made into an object
|
||||
--> $DIR/self-in-const-generics.rs:9:16
|
||||
|
|
||||
LL | fn foo(x: &dyn BB) {}
|
||||
| ^^
|
||||
|
|
||||
= note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0038`.
|
||||
|
|
@ -1,3 +1,10 @@
|
|||
// astconv uses `FreshTy(0)` as a dummy `Self` type when instanciating trait objects.
|
||||
// This `FreshTy(0)` can leak into substs, causing ICEs in several places.
|
||||
// Using `save-analysis` triggers type-checking `f` that would be normally skipped
|
||||
// as `type_of` emitted an error.
|
||||
//
|
||||
// compile-flags: -Zsave-analysis
|
||||
|
||||
#![feature(trait_alias)]
|
||||
|
||||
pub trait SelfInput = Fn(&mut Self);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0038]: the trait alias `SelfInput` cannot be made into an object
|
||||
--> $DIR/self-in-generics.rs:5:19
|
||||
--> $DIR/self-in-generics.rs:12:19
|
||||
|
|
||||
LL | pub fn f(_f: &dyn SelfInput) {}
|
||||
| ^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied
|
|||
--> $DIR/issue-39029.rs:16:37
|
||||
|
|
||||
LL | let _errors = TcpListener::bind(&bad);
|
||||
| ----------------- ^^^^
|
||||
| | |
|
||||
| | the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs`
|
||||
| | help: consider dereferencing here: `&*bad`
|
||||
| ----------------- ^^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs`
|
||||
|
|
@ -14,6 +12,10 @@ note: required by a bound in `TcpListener::bind`
|
|||
|
|
||||
LL | pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> {
|
||||
| ^^^^^^^^^^^^^ required by this bound in `TcpListener::bind`
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | let _errors = TcpListener::bind(&*bad);
|
||||
| +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: the trait bound `&String: SomeTrait` is not satisfied
|
|||
--> $DIR/issue-62530.rs:13:26
|
||||
|
|
||||
LL | takes_type_parameter(&string); // Error
|
||||
| -------------------- ^^^^^^^
|
||||
| | |
|
||||
| | the trait `SomeTrait` is not implemented for `&String`
|
||||
| | help: consider dereferencing here: `&*string`
|
||||
| -------------------- ^^^^^^^ the trait `SomeTrait` is not implemented for `&String`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `takes_type_parameter`
|
||||
|
|
@ -13,6 +11,10 @@ note: required by a bound in `takes_type_parameter`
|
|||
|
|
||||
LL | fn takes_type_parameter<T>(_x: T) where T: SomeTrait {}
|
||||
| ^^^^^^^^^ required by this bound in `takes_type_parameter`
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | takes_type_parameter(&*string); // Error
|
||||
| +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: the trait bound `&Baz: Happy` is not satisfied
|
|||
--> $DIR/multiple-0.rs:34:9
|
||||
|
|
||||
LL | foo(&baz);
|
||||
| --- ^^^^
|
||||
| | |
|
||||
| | the trait `Happy` is not implemented for `&Baz`
|
||||
| | help: consider dereferencing here: `&***baz`
|
||||
| --- ^^^^ the trait `Happy` is not implemented for `&Baz`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required by a bound in `foo`
|
||||
|
|
@ -13,6 +11,10 @@ note: required by a bound in `foo`
|
|||
|
|
||||
LL | fn foo<T>(_: T) where T: Happy {}
|
||||
| ^^^^^ required by this bound in `foo`
|
||||
help: consider dereferencing here
|
||||
|
|
||||
LL | foo(&***baz);
|
||||
| +++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue