diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-11 15:19:31 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-11 15:19:31 +0530 |
| commit | 93f71d4e012df4477a34e911f8734c545b6bca2f (patch) | |
| tree | a1f995016acceb67d449c95e90e17797d6889d22 /src | |
| parent | 92b8adf8e06594cb9b3477526e31fdba74ac63ad (diff) | |
| parent | 913023b6b475ac5caed060771526e0777a13ae94 (diff) | |
| download | rust-93f71d4e012df4477a34e911f8734c545b6bca2f.tar.gz rust-93f71d4e012df4477a34e911f8734c545b6bca2f.zip | |
Rollup merge of #99091 - compiler-errors:private-types-should-stay-private, r=lcnr
Do not mention private types from other crates as impl candidates Fixes #99080
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/suggestions/auxiliary/meow.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-99080.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-99080.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr | 1 |
4 files changed, 47 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/auxiliary/meow.rs b/src/test/ui/suggestions/auxiliary/meow.rs new file mode 100644 index 00000000000..115df70a690 --- /dev/null +++ b/src/test/ui/suggestions/auxiliary/meow.rs @@ -0,0 +1,11 @@ +pub trait Meow { + fn meow(&self) {} +} + +pub struct GlobalMeow; + +impl Meow for GlobalMeow {} + +pub(crate) struct PrivateMeow; + +impl Meow for PrivateMeow {} diff --git a/src/test/ui/suggestions/issue-99080.rs b/src/test/ui/suggestions/issue-99080.rs new file mode 100644 index 00000000000..91f574f35b8 --- /dev/null +++ b/src/test/ui/suggestions/issue-99080.rs @@ -0,0 +1,16 @@ +// aux-build:meow.rs + +extern crate meow; + +use meow::Meow; + +fn needs_meow<T: Meow>(t: T) {} + +fn main() { + needs_meow(1usize); + //~^ ERROR the trait bound `usize: Meow` is not satisfied +} + +struct LocalMeow; + +impl Meow for LocalMeow {} diff --git a/src/test/ui/suggestions/issue-99080.stderr b/src/test/ui/suggestions/issue-99080.stderr new file mode 100644 index 00000000000..d1908dd9d0d --- /dev/null +++ b/src/test/ui/suggestions/issue-99080.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `usize: Meow` is not satisfied + --> $DIR/issue-99080.rs:10:16 + | +LL | needs_meow(1usize); + | ---------- ^^^^^^ the trait `Meow` is not implemented for `usize` + | | + | required by a bound introduced by this call + | + = help: the following other types implement trait `Meow`: + GlobalMeow + LocalMeow +note: required by a bound in `needs_meow` + --> $DIR/issue-99080.rs:7:18 + | +LL | fn needs_meow<T: Meow>(t: T) {} + | ^^^^ required by this bound in `needs_meow` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 115539a6dc2..6ce57b6263e 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -15,7 +15,6 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) &'c &'b str [char; N] char - pattern::MultiCharEqPattern<C> = note: required because of the requirements on the impl of `Pattern<'_>` for `u8` error: aborting due to previous error |
