Commit graph

171 commits

Author SHA1 Message Date
Esteban Küber
c73b3d20c6 Unify wording of resolve error
Remove "failed to resolve" and use the same format we use in other resolution errors "cannot find `name`".

```
error[E0433]: cannot find `nonexistent` in `existent`
  --> $DIR/custom_attr_multisegment_error.rs:5:13
   |
LL | #[existent::nonexistent]
   |             ^^^^^^^^^^^ could not find `nonexistent` in `existent`
```
2026-02-17 16:51:44 +00:00
Jonathan Brouwer
c5a12fbd0d
Rollup merge of #152604 - reddevilmidzy:refactor, r=Zalathar
Relocate some tests

`dynamically-sized-types` -> `dst`
`underscore-imports` -> `imports/underscore-imports`
`btreemap`, `hashmap` -> `collections/btreemap`, `collections/hashmap`
`higher-ranked-trait-bounds` -> `higher-ranked/trait-bounds`
`meta` -> `compiletest-self-test`, `bootstrap`

After the review, I'll squash.
2026-02-15 16:37:37 +01:00
reddevilmidzy
1612988310 Move underscore-imports tests into imports subdir 2026-02-15 04:38:55 +00:00
Vadim Petrochenkov
324267ccaa Partially revert "resolve: Update NameBindingData::vis in place" 2026-02-11 22:27:56 +03:00
Vadim Petrochenkov
0cd0840243 Add tests for issues 152004, 151124 and 152347 2026-02-11 22:21:22 +03:00
Vadim Petrochenkov
c0393cf8db resolve: Report more early resolution ambiguities for imports
The new ambiguities are reported when the import's visibility is ambiguous and may depend on the resolution/expansion order.
2026-02-02 14:44:13 +03:00
Vadim Petrochenkov
44e89f8262 resolve: Mark items under ambigous imports as exported 2026-01-27 16:24:53 +03:00
Vadim Petrochenkov
a8e91473c5 tests: Reproduce the issue with missing MIR for ambiguous reexports 2026-01-27 15:53:15 +03:00
Guillaume Gomez
b5fa7495fe
Rollup merge of #149058 - amb-trait-lint, r=petrochenkov
FCW Lint when using an ambiguously glob imported trait

Related to rust-lang/rust#147992.

Report a lint when using an ambiguously glob import trait, this is a FCW because this should not be allowed.

r? @petrochenkov
2026-01-20 14:36:30 +01:00
LorrensP-2158466
3369a17e51 Implements a FCW lint to detect uses of ambiguously glob imported traits. 2026-01-20 13:34:01 +01:00
Georg Semmler
d028956f11
Add an additional help note to the ambiguity lint error
This PR adds an additional help note to the ambiguity lint error output
to ask users updating their dependencies. This hopefully helps with
cases like https://github.com/rust-lang/rust/issues/149845 where newer crate versions are fixed.
2026-01-16 13:39:01 +01:00
Vadim Petrochenkov
cd05071ec4 resolve: Downgrade ambiguous_glob_imports to warn-by-default
But still keep it report-in-deps.

To revert after ~February 27 2026, when Rust 1.95 branches out from the main branch.
2026-01-15 13:02:20 +03:00
Vadim Petrochenkov
83c5f2c194 resolve: Relax one more assert in glob overwriting and add a test
Also avoid losing some glob ambiguities when re-fetching globs
2026-01-14 19:58:40 +03:00
Vadim Petrochenkov
1c3841b372 Add a test for issue 150977 2026-01-14 19:58:40 +03:00
Vadim Petrochenkov
8b52c73b3e resolve: Relax some asserts in glob overwriting and add tests 2026-01-14 19:57:21 +03:00
Lukas Bergdoll
506762f3ff Explicitly export core and std macros
Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
2026-01-13 08:47:48 +01:00
Vadim Petrochenkov
a251ae2615 resolve: Update NameBindingData::ambiguity in place
instead of creating fresh bindings, except in one case.
2026-01-08 10:51:11 +03:00
Vadim Petrochenkov
c2379717a2 resolve: Tweak overwriting with ambiguous globs
Do not overwrite unless necessary, and combine both globs instead of losing the first one.
2026-01-08 10:42:53 +03:00
Vadim Petrochenkov
2e123aef70 resolve: Avoid additional ambiguities from splitting modules into two scopes 2026-01-02 15:31:09 +03:00
Vadim Petrochenkov
78c61beb48 resolve: Patch up an inconsistent resolution ICE revealed by the previous commit 2026-01-02 15:26:06 +03:00
Vadim Petrochenkov
0016a71747 resolve: Migrate one more special ambiguity for glob vs non-glob bindings
in the same module to the usual ambiguity infra in `resolve_ident_in_scope_set`
2026-01-02 15:25:56 +03:00
Vadim Petrochenkov
bcfbb5619c resolve: Migrate a special ambiguity for glob vs non-glob bindings
in the same module to the usual ambiguity infra in `resolve_ident_in_scope_set`
2026-01-02 15:11:14 +03:00
Vadim Petrochenkov
75d90094e7 resolve: Split Scope::Module into two scopes for non-glob and glob bindings 2026-01-02 15:02:03 +03:00
Aditya-PS-05
678f58151e fix ICE when {{root}} appears in import suggestions 2025-12-19 19:28:35 +05:30
Esteban Küber
1bd7934d89 Point at span within local macros even when error happens in nested external macro
```
error[E0308]: mismatched types
  --> $DIR/macro-span-caller-replacement.rs:5:17
   |
LL |             s = format!("{arg}");
   |                 ^^^^^^^^^^^^^^^^ expected `&str`, found `String`
...
LL |     macro_with_format!();
   |     -------------------- in this macro invocation
   |
   = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2025-12-10 19:27:40 +00:00
Matthias Krüger
4da61b6d69
Rollup merge of #149816 - estebank:verbose-typo-suggestion, r=JonathanBrouwer,Kivooeo
Make typo in field and name suggestions verbose

Part of https://github.com/rust-lang/rust/issues/141973.
2025-12-10 07:54:21 +01:00
Esteban Küber
6cd44a472c Make typo in field and name suggestions verbose 2025-12-09 17:29:23 +00:00
Vadim Petrochenkov
51780a53f6 resolve: Preserve ambiguous glob reexports in crate metadata
So in cross-crate scenarios they can work in the same way as in crate-local scenarios.
2025-12-09 13:40:02 +03:00
reddevilmidzy
22a7457d12 Cleaned up some tests
Merged tests/ui/typeck/non-function-call-error-2 with
tests/ui/typeck/non-function-call-error

Add comment to
tests/ui/traits/normalize-associated-type-in-where-clause.rs

Merged tests/ui/privacy/private-item-simple-2.rs with
tests/ui/privacy/private-item-simple.rs

Merged tests/ui/str/str-add-operator-2.rs with
tests/ui/str/str-add-operator.rs

Add comment to tests/ui/imports/duplicate-empty-imports.rs

Add comment to tests/ui/for-loop-while/nested-loop-break-unit.rs

Add comment to tests/ui/match/match-ref-option-pattern.rs

Add comment to tests/ui/closures/simple-capture-and-call.rs

Add comment to tests/ui/type/never-type-inference-fail.rs

Add comment to tests/ui/match/match-stack-overflow-72933.rs
2025-12-08 07:06:13 +09:00
reddevilmidzy
c2e43fffbc moved tests 2025-12-05 20:41:51 +09:00
xonx4l
4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Christian Poveda
b2ab7cf980
Gate 2015 UI tests 2025-11-27 11:19:00 -05:00
LorrensP-2158466
a7eed086b9 Add the check-pass and check-fail tests. 2025-10-01 18:02:16 +02:00
Jacob Pratt
82bb6d523b
Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-09-13 03:26:02 -04:00
Oneirical
957fa10d50 Add test batch 3 2025-09-12 14:45:12 -04:00
Vadim Petrochenkov
8930d3a750 resolve: Avoid a regression from splitting prelude into two scopes 2025-08-29 16:58:51 +03:00
Scott Schafer
93d16c5100
fix: Add col separator before secondary messages with no source 2025-08-26 15:15:17 -06:00
Scott Schafer
8835ea854e
fix: Don't add an end column separator after a file with no source 2025-08-26 15:15:17 -06:00
Karol Zwolak
d14b83e378 bless tests with new lint messages 2025-08-19 21:27:10 +02:00
Vadim Petrochenkov
d98eaad509 resolve: Improve diagnostics for ambiguities in extern prelude 2025-08-13 17:45:40 +03:00
Vadim Petrochenkov
772493d51d resolve: Split extern prelude into two scopes
One for `--extern` options and another for `extern crate` items.
2025-08-13 17:45:40 +03:00
Jacob Pratt
5bd4e832d3
Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxu
Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`

rust-lang/rust#143902 divided into smaller, easier to review chunks.

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-10 15:43:52 -04:00
Oneirical
aa543963c6 Rehome tests/ui/issues/ tests [4/?] 2025-08-10 11:54:15 -04:00
Stuart Cook
62b406d4b1
Rollup merge of #144403 - Kivooeo:issue4, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [4/N]

Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895.

r? ````````@jieyouxu````````
2025-08-10 19:45:48 +10:00
Kivooeo
16765639b3 comments 2025-08-09 16:27:20 +05:00
Vadim Petrochenkov
33cb4190a2 Mark all deprecation lints in name resolution as deny-by-default and report-in-deps 2025-08-05 15:28:49 +03:00
Kivooeo
e9959aa74e comments 2025-07-25 20:38:54 +05:00
Kivooeo
9f38ca97ea move 28 tests 2025-07-25 20:38:54 +05:00
Kivooeo
90bb5cacb5 moved 34 tests to organized locations 2025-07-25 15:34:28 +05:00
Scott Schafer
d67bf6095a
chore: Improve how the other suggestions message gets rendered 2025-07-10 08:00:20 -06:00