about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-30 07:18:13 +0200
committerGitHub <noreply@github.com>2023-08-30 07:18:13 +0200
commitea2347843c24a59367952b0463505539f1b69a93 (patch)
tree3d99e6bc21b083c3c9fffef622508da196a49257 /compiler/rustc_const_eval
parent36182f1f135d844194ddb463000c23f7a68c6bdb (diff)
parent4e9a2a6ff64371a4141c106973a748cfe9625f3d (diff)
downloadrust-ea2347843c24a59367952b0463505539f1b69a93.tar.gz
rust-ea2347843c24a59367952b0463505539f1b69a93.zip
Rollup merge of #115363 - kpreid:suggest-private, r=compiler-errors
Don't suggest adding parentheses to call an inaccessible method.

Previously, code of this form would emit E0615 (attempt to use a method as a field), thus emphasizing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is:

```rust
let x = std::rc::Rc::new(());
x.inner;
```

which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`.

```rust
error[E0615]: attempted to take value of method `inner` on type `Rc<()>`
 --> src/main.rs:3:3
  |
3 | x.inner;
  |   ^^^^^ method, not a field
  |
help: use parentheses to call the method
  |
3 | x.inner();
  |        ++
  ```

  With this change, it emits E0609 and no suggestion.
Diffstat (limited to 'compiler/rustc_const_eval')
0 files changed, 0 insertions, 0 deletions