about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-11-04Formatting changes + add UI testclubby789-0/+50
2022-11-04fake a base to suppress later extra error messageyukang-24/+21
2022-11-04Rollup merge of #103950 - nbdd0121:master, r=tmiaskoMatthias Krüger-0/+12
Fix ICE when negative impl is collected during eager mono ```rust trait Foo { fn foo() {} } impl !Foo for () {} ``` This code will currently cause an ICE when mono collection mode is "eager" (with `-C link-dead-code=y` or `-Z print-mono-items=eager`.
2022-11-04Rollup merge of #103780 - compiler-errors:bound-closure-lifetimes, r=jackh726Matthias Krüger-0/+63
Fix late-bound lifetime closure ICEs in HIR typeck and MIR borrowck During HIR typeck, we need to teach astconv to treat late-bound regions within a closure body as free, fixing escaping bound vars ICEs in both of the issues below. However, this then gets us to MIR borrowck, which itself needs to be taught how to instantiate free region vids for late-bound regions that come from items that _aren't_ the typeck root (for now, just closures). Fixes #103771 Fixes #103736
2022-11-04Rollup merge of #103930 - fee1-dead-contrib:mv-from-root, r=jyn514Matthias Krüger-7/+7
Move some tests from `src/test/ui` to more reasonable places
2022-11-04Make non-ASCII errors more consistent.Nicholas Nethercote-45/+45
There are three kinds of "byte" literals: byte literals, byte string literals, and raw byte string literals. None are allowed to have non-ASCII chars in them. Two `EscapeError` variants exist for when that constraint is violated. - `NonAsciiCharInByte`: used for byte literals and byte string literals. - `NonAsciiCharInByteString`: used for raw byte string literals. As a result, the messages for raw byte string literals use different wording, without good reason. Also, byte string literals are incorrectly described as "byte constants" in some error messages. This commit eliminates `NonAsciiCharInByteString` so the three cases are handled similarly, and described correctly. The `mode` is enough to distinguish them. Note: Some existing error messages mention "byte constants" and some mention "byte literals". I went with the latter here, because it's a more correct name, as used by the Reference.
2022-11-04Fix ICE when negative impl is collected during eager monoGary Guo-0/+12
2022-11-04fix #102806, suggest use .. to fill in the rest of the fields of Structyukang-0/+73
2022-11-03Move some tests from `src/test/ui` to more reasonable placesDeadbeef-7/+7
2022-11-03Elaborate supertrait obligations when deducing closure signatureMichael Goulet-28/+30
2022-11-03Correctly resolve Inherent Associated TypesDeadbeef-52/+49
2022-11-03move compiletest's own ui tests into a subdirectoryPietro Albini-0/+0
2022-11-03check for pattern in compiletest-compile-flags-lastPietro Albini-0/+1
2022-11-03Stabilize default_alloc_error_handlerAmanieu d'Antras-31/+0
Closes #66741
2022-11-02Rollup merge of #103870 - TaKO8Ki:fix-103790, r=fee1-deadMatthias Krüger-0/+75
Fix `inferred_kind` ICE Fixes #103790
2022-11-02Rollup merge of #99801 - ↵Matthias Krüger-0/+33
Neo-Zhixing:fix/generic_const_exprs_parent_opaque_predicates, r=oli-obk fix(generic_const_exprs): Fix predicate inheritance for children of opaque types Fixes #99705 We currently have a special case to perform predicate inheritance when the const item is in the generics. I think we're also going to need this for opaque return types. When evaluating the predicates applied to the associated item, it'll inherit from its parent, the opaque type, which will never have predicates applied. This PR bypass the opaque typed parent and inherit predicates directly from the function itself.
2022-11-02asm: Work around LLVM bug on AArch64Amanieu d'Antras-0/+16
Upstream issue: https://github.com/llvm/llvm-project/issues/58384 LLVM gets confused if we assign a 32-bit value to a 64-bit register, so pass the 32-bit register name to LLVM in that case.
2022-11-02Rollup merge of #103774 - compiler-errors:dyn-trait-in-type-name, r=eholkDylan DPC-4/+1
Format `dyn Trait` better in `type_name` intrinsic Noticed this in #103764 (though not related to that PR at all!) ```rust trait Foo { type Bar; } fn main() { println!( "`dyn Fn(i32, i32) -> i32` => `{}`", std::any::type_name::<dyn Fn(i32, i32) -> i32>() ); println!( "`dyn Foo<Bar = i32> + Send + Sync` => `{}`", std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>() ); } ``` ``` `dyn Fn(i32, i32) -> i32` => `dyn core::ops::function::Fn<(i32, i32)>+Output = i32` `dyn Foo<Bar = i32> + Send + Sync` => `dyn playground::Foo+Bar = i32+core::marker::Sync+core::marker::Send` ``` Just reuse `pretty_print_dyn_existential` which already makes an attempt to make its output stable.
2022-11-02Remove has_errors from FnCtxtMichael Goulet-5/+19
2022-11-02return const_error when ty has errorsTakayuki Maeda-0/+75
2022-11-01Don't remap early-bound RPITIT regions that originate from implMichael Goulet-0/+32
2022-11-01fix(generic_const_exprs): Fix predicate inheritance for children of opaque typesZhixing Zhang-0/+33
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+159
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-11-01Format dyn Trait better in type_name intrinsicMichael Goulet-4/+1
2022-11-01Rollup merge of #103760 - petrochenkov:macimp, r=cjgillotDylan DPC-7/+28
resolve: Turn the binding from `#[macro_export]` into a proper `Import` Continuation of https://github.com/rust-lang/rust/pull/91795. ```rust #[macro_export] macro_rules! m { /*...*/ } ``` is desugared to something like ```rust macro_rules! m { /*...*/ } // Non-modularized macro_rules item pub use m; // It's modularized reexport ``` This PR adjusts the internal representation to better match this model.
2022-11-01Rollup merge of #84022 - Aaron1011:remove-derive-res-fallback, r=petrochenkovDylan DPC-100/+36
Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error r? `@ghost`
2022-11-01Test that target feature mix up with homogeneous floats is soundLoïc BRANSTETT-0/+192
This is basically is ripoff of src/test/ui/simd/target-feature-mixup.rs but for floats and without #[repr(simd)]
2022-11-01Rollup merge of #103759 - cjgillot:adt-collect, r=davidtwcoDylan DPC-3/+3
Use `adt_def` during type collection. This removes a wrapper which is close to what `adt_def` does.
2022-11-01Rollup merge of #103706 - zbyrn:issue-101637-fix, r=estebankDylan DPC-19/+111
Fix E0433 No Typo Suggestions Fixes #48676 Fixes #87791 Fixes #96625 Fixes #95462 Fixes #101637 Follows up PR #72923 Several open issues refer to the problem that E0433 does not suggest typos like other errors normally do. This fix augments the implementation of PR #72923. **Background** When the path of a function call, e.g. `Struct::foo()`, involves names that cannot be resolved, there are two errors that could be emitted by the compiler: - If `Struct` is not found, it is ``E0433: failed to resolve: use of undeclared type `Struct` ``. - If `foo` is not found in `Struct`, it is ``E0599: no function or associated item named `foo` found for struct `Struct` in the current scope`` When a name is used as a type, `e.g. fn foo() -> Struct`, and the name cannot be resolved, it is ``E0412: cannot find type `Struct` in this scope``. Before #72923, `E0433` does not implement any suggestions, and the PR introduces suggestions for missing `use`s. When a resolution error occurs in the path of a function call, it tries to smart resolve just the type part of the path, e.g. `module::Struct` of a call to `module::Struct::foo()`. However, along with the suggestions, the smart-resolve function will report `E0412` since it only knows that it is a type that we cannot resolve instead of being a part of the path. So, the original implementation swap out `E0412` errors returned by the smart-resolve function with the real `E0433` error, but keeps the "missing `use`" suggestions to be reported to the programmer. **Issue** The current implementation only reports if there are "missing `use`" suggestions returned by the smart-resolve function; otherwise, it would fall back the normal reporting, which does not emit suggestions. But the smart-resolve function could also produce typo suggestions, which are omitted currently. Also, it seems like that not all info has been swapped out when there are missing suggestions. The error message underlining the name in the snippet still says ``not found in this scope``, which is a `E0412` messages, if there are `use` suggestions, but says the normal `use of undeclared type` otherwise. **Fixes** This fix swaps out all fields in `Diagnostic` returned by the smart-resolve function except for `suggestions` with the current error, and merges the `suggestions` of the returned error and that of the current error together. If there are `use` suggestions, the error is saved to `use_injection` to be reported at the end; otherwise, the error is emitted immediately as `Resolver::report_error` does. Some tests are updated to use the correct underlining error messages, and one additional test for typo suggestion is added to the test suite. r? rust-lang/diagnostics
2022-11-01Rollup merge of #103584 - ouz-a:issue-102303, r=oli-obkDylan DPC-0/+40
Remove bounds check when array is indexed by enum As the title says, this reverts the behavior introduced with 1.64. Fixes #102303 r? `@oli-obk`
2022-11-01Rollup merge of #103061 - Amanieu:rewrite_alloc_error_handler, r=bjorn3Dylan DPC-28/+132
Rewrite implementation of `#[alloc_error_handler]` The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-11-01fix #103751: Fix capacity overflow issue during transmutability checkyukang-0/+53
2022-11-01Rollup merge of #103788 - chenyukang:yukang/fix-ice-103783, r=compiler-errorsYuki Okushi-0/+33
Fix ICE in checking transmutability of NaughtyLenArray Fixes #103783
2022-11-01Rollup merge of #103772 - compiler-errors:better-strict-coherence-err, ↵Yuki Okushi-0/+17
r=davidtwco better error for `rustc_strict_coherence` misuse Fixes #103753
2022-11-01Rollup merge of #103749 - est31:reduce_irrefutable_let_else_span, r=cjgillotYuki Okushi-5/+18
Reduce span of let else irrefutable_let_patterns warning Huge spans aren't good for IDE users as they underline constructs that are possibly multiline. Similar PR to #90761 which did the same for the `unused_macros` lint.
2022-11-01Fix ICE in default impl error reportingMichael Goulet-0/+49
2022-11-01Remap RPITIT substs properlyMichael Goulet-0/+24
2022-11-01Check for substs compatibility for RPITITsMichael Goulet-0/+29
2022-10-31Collect late-bound regions from all closure parents in `closure_mapping`Michael Goulet-0/+47
2022-10-31testsMichael Goulet-0/+16
2022-10-31resolve: Turn the binding from `#[macro_export]` into a proper `Import`Vadim Petrochenkov-7/+28
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-28/+132
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-31Add more track_callermejrs-1/+28
2022-10-31Use AdtDef to check enum.Camille GILLOT-3/+3
2022-10-31Remove bounds check with enum castouz-a-0/+40
2022-10-31Rollup merge of #103338 - l4l:enum-unreachable-pub, r=nagisaDylan DPC-0/+45
Fix unreachable_pub suggestion for enum with fields Resolves #103317
2022-10-30Rollup merge of #103764 - SarthakSingh31:issue-94187-2, r=compiler-errorsMichael Howell-5/+11
All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose` Follow-up to #103428. That pr only partially fixed #94187. In some cases (like closures) `std::any::type_name` was still producing a different output when `-Zverbose` was enabled. This pr fixes those cases and adds a new function `PrettyPrinter::should_print_verbose`. This function should always be used over `self.tcx().sess.verbose()` inside a `impl PrettyPrinter`. Maybe closes #94187 now. r? ``@compiler-errors``
2022-10-30Rollup merge of #97971 - Soveu:varargs, r=jackh726Michael Howell-21/+104
Enable varargs support for calling conventions other than C or cdecl This patch makes it possible to use varargs for calling conventions, which are either based on C (efiapi) or C is based on them (sysv64 and win64). Also pinging ``@phlopsi,`` because he noticed first this oversight when writing a library for UEFI.
2022-10-30better error for rustc_strict_coherence misuseMichael Goulet-0/+17
2022-10-30All verbosity checks in `PrettyPrinter` now go through ↵Sarthak Singh-5/+11
`PrettyPrinter::should_print_verbose`