about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-02-20 03:01:35 +0000
committerMichael Goulet <michael@errs.io>2024-02-20 03:01:35 +0000
commit1c80aadb0566a344adc028b06f47f1a21ec21e0c (patch)
treee9f157e66a85bc4561ac6f51be18ebc8dde858a2
parent18fdf59bf5fc20d1c651f1d0e1dfae5cf421f685 (diff)
downloadrust-1c80aadb0566a344adc028b06f47f1a21ec21e0c.tar.gz
rust-1c80aadb0566a344adc028b06f47f1a21ec21e0c.zip
test
-rw-r--r--tests/ui/ufcs/bad-builder.rs6
-rw-r--r--tests/ui/ufcs/bad-builder.stderr20
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/ufcs/bad-builder.rs b/tests/ui/ufcs/bad-builder.rs
new file mode 100644
index 00000000000..350c96acca0
--- /dev/null
+++ b/tests/ui/ufcs/bad-builder.rs
@@ -0,0 +1,6 @@
+fn hello<Q>() -> Vec<Q> {
+    Vec::<Q>::mew()
+    //~^ ERROR no function or associated item named `mew` found for struct `Vec<Q>` in the current scope
+}
+
+fn main() {}
diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr
new file mode 100644
index 00000000000..7fa47c82de2
--- /dev/null
+++ b/tests/ui/ufcs/bad-builder.stderr
@@ -0,0 +1,20 @@
+error[E0599]: no function or associated item named `mew` found for struct `Vec<Q>` in the current scope
+  --> $DIR/bad-builder.rs:2:15
+   |
+LL |     Vec::<Q>::mew()
+   |               ^^^
+   |               |
+   |               function or associated item not found in `Vec<Q>`
+   |               help: there is an associated function with a similar name: `new`
+   |
+note: if you're trying to build a new `Vec<Q>` consider using one of the following associated functions:
+      Vec::<T>::new
+      Vec::<T>::with_capacity
+      Vec::<T>::from_raw_parts
+      Vec::<T, A>::new_in
+      and 2 others
+  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.