summaryrefslogtreecommitdiff
path: root/tests/ui/range
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-18 19:44:27 +0000
committerMichael Goulet <michael@errs.io>2023-05-08 03:36:30 +0000
commita9051d861ca13a1c16da3cd4248b26d86cf5e1d5 (patch)
tree7fe6eb692e34d808afc4392d1ed73fab56ad0528 /tests/ui/range
parentad6b20bf5225c65aab30169c9a173719f5bdfc04 (diff)
Tweak borrow suggestion
Diffstat (limited to 'tests/ui/range')
-rw-r--r--tests/ui/range/issue-54505-no-literals.fixed24
-rw-r--r--tests/ui/range/issue-54505-no-literals.rs24
-rw-r--r--tests/ui/range/issue-54505-no-literals.stderr120
3 files changed, 96 insertions, 72 deletions
diff --git a/tests/ui/range/issue-54505-no-literals.fixed b/tests/ui/range/issue-54505-no-literals.fixed
index 4d8f67182b9..71c36c741cc 100644
--- a/tests/ui/range/issue-54505-no-literals.fixed
+++ b/tests/ui/range/issue-54505-no-literals.fixed
@@ -16,60 +16,60 @@ fn main() {
take_range(&std::ops::Range { start: 0, end: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::Range { start: 0, end: 1 }
+ //~| SUGGESTION &
take_range(&::std::ops::Range { start: 0, end: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 }
+ //~| SUGGESTION &
take_range(&std::ops::RangeFrom { start: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeFrom { start: 1 }
+ //~| SUGGESTION &
take_range(&::std::ops::RangeFrom { start: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeFrom { start: 1 }
+ //~| SUGGESTION &
take_range(&std::ops::RangeFull {});
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeFull {}
+ //~| SUGGESTION &
take_range(&::std::ops::RangeFull {});
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeFull {}
+ //~| SUGGESTION &
take_range(&std::ops::RangeInclusive::new(0, 1));
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1)
+ //~| SUGGESTION &
take_range(&::std::ops::RangeInclusive::new(0, 1));
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1)
+ //~| SUGGESTION &
take_range(&std::ops::RangeTo { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeTo { end: 5 }
+ //~| SUGGESTION &
take_range(&::std::ops::RangeTo { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeTo { end: 5 }
+ //~| SUGGESTION &
take_range(&std::ops::RangeToInclusive { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 }
+ //~| SUGGESTION &
take_range(&::std::ops::RangeToInclusive { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 }
+ //~| SUGGESTION &
}
diff --git a/tests/ui/range/issue-54505-no-literals.rs b/tests/ui/range/issue-54505-no-literals.rs
index dc21dcbc2db..db125d1a22b 100644
--- a/tests/ui/range/issue-54505-no-literals.rs
+++ b/tests/ui/range/issue-54505-no-literals.rs
@@ -16,60 +16,60 @@ fn main() {
take_range(std::ops::Range { start: 0, end: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::Range { start: 0, end: 1 }
+ //~| SUGGESTION &
take_range(::std::ops::Range { start: 0, end: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 }
+ //~| SUGGESTION &
take_range(std::ops::RangeFrom { start: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeFrom { start: 1 }
+ //~| SUGGESTION &
take_range(::std::ops::RangeFrom { start: 1 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeFrom { start: 1 }
+ //~| SUGGESTION &
take_range(std::ops::RangeFull {});
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeFull {}
+ //~| SUGGESTION &
take_range(::std::ops::RangeFull {});
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeFull {}
+ //~| SUGGESTION &
take_range(std::ops::RangeInclusive::new(0, 1));
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1)
+ //~| SUGGESTION &
take_range(::std::ops::RangeInclusive::new(0, 1));
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1)
+ //~| SUGGESTION &
take_range(std::ops::RangeTo { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeTo { end: 5 }
+ //~| SUGGESTION &
take_range(::std::ops::RangeTo { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeTo { end: 5 }
+ //~| SUGGESTION &
take_range(std::ops::RangeToInclusive { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 }
+ //~| SUGGESTION &
take_range(::std::ops::RangeToInclusive { end: 5 });
//~^ ERROR mismatched types [E0308]
//~| HELP consider borrowing here
- //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 }
+ //~| SUGGESTION &
}
diff --git a/tests/ui/range/issue-54505-no-literals.stderr b/tests/ui/range/issue-54505-no-literals.stderr
index d112983848d..5894bb6ba55 100644
--- a/tests/ui/range/issue-54505-no-literals.stderr
+++ b/tests/ui/range/issue-54505-no-literals.stderr
@@ -2,10 +2,8 @@ error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:16:16
|
LL | take_range(std::ops::Range { start: 0, end: 1 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `Range<{integer}>`
- | | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `Range<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -15,15 +13,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::Range { start: 0, end: 1 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:21:16
|
LL | take_range(::std::ops::Range { start: 0, end: 1 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `Range<{integer}>`
- | | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `Range<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -33,15 +33,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::Range { start: 0, end: 1 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:26:16
|
LL | take_range(std::ops::RangeFrom { start: 1 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeFrom<{integer}>`
- | | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFrom<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -51,15 +53,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::RangeFrom { start: 1 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:31:16
|
LL | take_range(::std::ops::RangeFrom { start: 1 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeFrom<{integer}>`
- | | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFrom<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -69,15 +73,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::RangeFrom { start: 1 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:36:16
|
LL | take_range(std::ops::RangeFull {});
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeFull`
- | | help: consider borrowing here: `&std::ops::RangeFull {}`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFull`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -87,15 +93,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::RangeFull {});
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:41:16
|
LL | take_range(::std::ops::RangeFull {});
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeFull`
- | | help: consider borrowing here: `&::std::ops::RangeFull {}`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFull`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -105,15 +113,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::RangeFull {});
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:46:16
|
LL | take_range(std::ops::RangeInclusive::new(0, 1));
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeInclusive<{integer}>`
- | | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeInclusive<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -123,15 +133,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::RangeInclusive::new(0, 1));
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:51:16
|
LL | take_range(::std::ops::RangeInclusive::new(0, 1));
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeInclusive<{integer}>`
- | | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeInclusive<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -141,15 +153,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::RangeInclusive::new(0, 1));
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:56:16
|
LL | take_range(std::ops::RangeTo { end: 5 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeTo<{integer}>`
- | | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeTo<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -159,15 +173,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::RangeTo { end: 5 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:61:16
|
LL | take_range(::std::ops::RangeTo { end: 5 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeTo<{integer}>`
- | | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeTo<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -177,15 +193,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::RangeTo { end: 5 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:66:16
|
LL | take_range(std::ops::RangeToInclusive { end: 5 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeToInclusive<{integer}>`
- | | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeToInclusive<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -195,15 +213,17 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&std::ops::RangeToInclusive { end: 5 });
+ | +
error[E0308]: mismatched types
--> $DIR/issue-54505-no-literals.rs:71:16
|
LL | take_range(::std::ops::RangeToInclusive { end: 5 });
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | expected `&_`, found `RangeToInclusive<{integer}>`
- | | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeToInclusive<{integer}>`
+ | |
| arguments to this function are incorrect
|
= note: expected reference `&_`
@@ -213,6 +233,10 @@ note: function defined here
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
+help: consider borrowing here
+ |
+LL | take_range(&::std::ops::RangeToInclusive { end: 5 });
+ | +
error: aborting due to 12 previous errors