about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-11-10Rollup merge of #104036 - compiler-errors:option-sugg, r=petrochenkovManish Goregaokar-0/+25
Suggest `is_some` when we've found `Option` but expected `bool` Thanks `@lunasorcery` for the suggestion.
2022-11-10Rollup merge of #103863 - compiler-errors:fulfillcx-less, r=wesleywiserManish Goregaokar-0/+4
Use `TraitEngine` in more places, restrict visibility of `FulfillmentCtxt` constructor Most places that are constructing a `FulfillmentContext` should be constructing a `TraitEngine` generically, so later on if/when we're transitioning it'll be easier. Logical extension of #99746
2022-11-10Auto merge of #104236 - compiler-errors:rollup-adjshd6, r=compiler-errorsbors-0/+63
Rollup of 9 pull requests Successful merges: - #102763 (Some diagnostic-related nits) - #103443 (Parser: Recover from using colon as path separator in imports) - #103675 (remove redundent "<>" for ty::Slice with reference type) - #104046 (bootstrap: add support for running Miri on a file) - #104115 (Migrate crate-search element to CSS variables) - #104190 (Ignore "Change InferCtxtBuilder from enter to build" in git blame) - #104201 (Add check in GUI test for file loading failure) - #104211 (:arrow_up: rust-analyzer) - #104231 (Update mailmap) Failed merges: - #104169 (Migrate `:target` rules to use CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-09Rollup merge of #103675 - lyming2007:issue-103271-fix, r=fee1-deadMichael Goulet-0/+24
remove redundent "<>" for ty::Slice with reference type this fix #103271
2022-11-09Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, ↵Michael Goulet-0/+39
r=compiler-errors Parser: Recover from using colon as path separator in imports I don't know if this is the right approach, any feedback is welcome. r? ```@compiler-errors``` Fixes #103269
2022-11-10Don't print full paths in overlap errorsMichael Goulet-75/+75
2022-11-10Auto merge of #103636 - chenyukang:yukang/fix-103587-sugg-if-let, ↵bors-0/+72
r=jackh276,davidtwco Recover from common if let syntax mistakes/typos Fixes #103587
2022-11-10Don't ICE when encountering ConstKind::Error in RequiredConstsVisitorMichael Goulet-0/+14
2022-11-10bless a chalk testMichael Goulet-0/+4
2022-11-10Auto merge of #101990 - clubby789:dont-machine-apply-placeholder-method, ↵bors-15/+165
r=compiler-errors Fix auto-application of associated generic functions with placeholders Fixes #101920
2022-11-09remove redundent "<>" for ty::Slice with reference typeYiming Lei-0/+24
this fix #103271
2022-11-09Allow and add `track_caller` to generatorsBryan Garza-2/+2
This patch allows the usage of the `track_caller` annotation on generators, as well as sets them conditionally if the parent also has `track_caller` set. Also add this annotation on the `GenFuture`'s `poll()` function.
2022-11-09Don't ICE on operator trait methods with generic methodsNilstrieb-0/+31
Emit a fatal error instead.
2022-11-09Rollup merge of #104020 - nicholasbishop:bishop-limit-efiapi, r=nagisaManish Goregaokar-99/+127
Limit efiapi calling convention to supported arches Supported architectures in UEFI are described here: https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions https://github.com/rust-lang/rust/issues/65815
2022-11-09Rollup merge of #103464 - JakobDegen:mir-parsing, r=oli-obkManish Goregaokar-0/+23
Add support for custom mir This implements rust-lang/compiler-team#564 . Details about the design, motivation, etc. can be found in there. r? ```@oli-obk```
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-126/+126
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-09Rollup merge of #101005 - SLASHLogin:rustc_codegen_llvm_diagnostics, r=davidtwcoManish Goregaokar-3/+3
Migrate rustc_codegen_llvm to SessionDiagnostics WIP: Port current implementation of diagnostics to the new SessionDiagnostics. Part of #100717 ```@rustbot``` label +A-translation
2022-11-09Emit error in `collecting_trait_impl_trait_tys` on mismatched signaturesNilstrieb-0/+135
Previously, a `delay_span_bug` was isssued, failing normalization. This create a `TyKind::Error` in the signature, which caused `compare_predicate_entailment` to swallow its signature mismatch error, causing ICEs because no error was emitted.
2022-11-09Suggest is_some or let when encountering Option and bool type mismatchMichael Goulet-0/+25
2022-11-10add 'is_assign_rhs' to avoid weird suggesting 'let'yukang-4/+24
2022-11-09Add domain size check to fix ICECameron Steffen-0/+59
2022-11-09Correct tests to match errorsSLASHLogin-3/+3
2022-11-09Rollup merge of #104125 - ink-feather-org:const_cmp_tuples, r=fee1-deadDylan DPC-11/+8
Const Compare for Tuples Makes the impls for Tuples of ~const `PartialEq` types also `PartialEq`, impls for Tuples of ~const `PartialOrd` types also `PartialOrd`, for Tuples of ~const `Ord` types also `Ord`. behind the `#![feature(const_cmp)]` gate. ~~Do not merge before #104113 is merged because I want to use this feature to clean up the new test that I added there.~~ r? ``@fee1-dead``
2022-11-09Rollup merge of #103919 - nnethercote:unescaping-cleanups, r=matkladDylan DPC-45/+45
Unescaping cleanups Some code improvements, and some error message improvements. Best reviewed one commit at a time. r? ````@matklad````
2022-11-09Cleanup fn trait ref testonestacked-11/+8
2022-11-09fix tests and code cleanupyukang-16/+70
2022-11-09Fix #104086, Tighten the 'introduce new binding' suggestionyukang-0/+91
2022-11-09Auto merge of #104180 - fee1-dead-contrib:fix-wf-fndef, r=oli-obkbors-0/+5
Use `nominal_obligations_without_const` in wf for FnDef Fixes #104155.
2022-11-08Add support for custom MIR parsingJakob Degen-0/+23
2022-11-09Auto merge of #104179 - Manishearth:rollup-yvsx5hh, r=Manishearthbors-24/+416
Rollup of 7 pull requests Successful merges: - #100508 (avoid making substs of type aliases late bound when used as fn args) - #101381 (Test that target feature mix up with homogeneous floats is sound) - #103353 (Fix Access Violation when using lld & ThinLTO on windows-msvc) - #103521 (Avoid possible infinite loop when next_point reaching the end of file) - #103559 (first move on a nested span_label) - #103778 (Update several crates for improved support of the new targets) - #103827 (Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-08Parser: Recover from using colon as path separator in importsBruno A. Muciño-0/+39
2022-11-09Use `nominal_obligations_without_const` in wf for FnDefDeadbeef-0/+5
2022-11-08Rollup merge of #103827 - compiler-errors:rpitit-substs-compat, r=wesleywiserManish Goregaokar-0/+102
Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate` Fixes #103824
2022-11-08Rollup merge of #103521 - chenyukang:yukang/fix-103451-avoid-hang, ↵Manish Goregaokar-0/+37
r=jackh726,wesleywiser Avoid possible infinite loop when next_point reaching the end of file Fixes #103451 If we return a span with `lo` = `hi`, `span_to_snippet` will always get `Ok("")`, which may introduce infinite loop if we don't care. This PR make `find_width_of_character_at_span` return `width` with 1, so that `span_to_snippet` will get an `Err`.
2022-11-08Rollup merge of #101381 - Urgau:target-mixup-homogenous-floats, r=AmanieuManish Goregaokar-0/+192
Test that target feature mix up with homogeneous floats is sound This pull-request adds a test in `src/test/abi/` that test that target feature mix up with homogeneous floats is sound. This is basically is ripoff of [src/test/ui/simd/target-feature-mixup.rs](https://github.com/rust-lang/rust/blob/47d1cdb0bcac8e417071ce1929d261efe2399ae2/src/test/ui/simd/target-feature-mixup.rs) but for floats and without `#[repr(simd)]`. *Extracted from https://github.com/rust-lang/rust/pull/97559 since I don't yet know what to do with that PR.*
2022-11-08Rollup merge of #100508 - BoxyUwU:make_less_things_late_bound, r=nikomatsakisManish Goregaokar-24/+85
avoid making substs of type aliases late bound when used as fn args fixes #47511 fixes #85533 (although I did not know theses issues existed when i was working on this :upside_down_face:) currently `Alias<...>` is treated the same as `Struct<...>` when deciding if generics should be late bound or early bound but this is not correct as `Alias` might normalize to a projection which does not constrain the generics. I think this needs more tests before merging more explanation of PR [here](https://hackmd.io/v44a-QVjTIqqhK9uretyQg?view) Hackmd inline for future readers: --- This assumes reader is familiar with the concept of early/late bound lifetimes. There's a section on rustc-dev-guide if not (although i think some details are a bit out of date) ## problem & background Not all lifetimes on a fn can be late bound: ```rust fn foo<'a>() -> &'a (); impl<'a> Fn<()> for FooFnDef { type Output = &'a (); // uh oh unconstrained lifetime } ``` so we make make them early bound ```rust fn foo<'a>() -> &'a (); impl<'a> Fn<()> for FooFnDef<'a> {// wow look at all that lifetimey type Output = &'a (); } ``` (Closures have the same constraint however it is not enforced leading to soundness bugs, [#84385](https://github.com/rust-lang/rust/pull/84385) implements this "downgrading late bound to early bound" for closures) lifetimes on fn items are only late bound when they are "constrained" by the fn args: ```rust fn foo<'a>(_: &'a ()) -> &'a (); // late bound, not present on `FooFnItem` // vv impl<'a> Trait<(&'a (),)> for FooFnItem { type Output = &'a (); } // projections do not constrain inputs fn bar<'a, T: Trait>(_: <T as Trait<'a>>::Assoc) -> &'a (); // early bound // vv impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for BarFnItem<'a, T> { type Output = &'a (); } ``` current logic for determining if inputs "constrain" a lifetime works off of HIR so does not normalize aliases. It also assumes that any path with no self type constrains all its substs (i.e. `Foo<'a, u32>` has no self type but `T::Assoc` does). This falls apart for top level type aliases (see linked issues): ```rust type Alias<'a, T> = <T as Trait<'a>>::Assoc; // wow look its a path with no self type uwu // i bet that constrains `'a` so it should be latebound // vvvvvvvvvvv fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a (); // `Alias` normalized to make things clearer // vvvvvvvvvvvvvvvvvvvvvvv impl<'a, T: Trait> Fn<(<T as Trait<'a>>::Assoc,)> for FooFnDef<T> { type Output = &'a (); // oh no `'a` isnt constrained wah wah waaaah *trumbone noises* // i think, idk what musical instrument that is } ``` ## solution The PR solves this by having the hir visitor that checks for lifetimes in constraining uses check if the path is a `DefKind::Alias`. If it is we ""normalize"" it by calling `type_of` and walking the returned type. This is a bit hacky as it requires a mapping between the substs on the path in hir, and the generics of the `type Alias<...>` which is on the ty layer. Alternative solutions may involve calculating the "late boundness" of lifetimes after/during astconv rather than relying on hir at all. We already have code to determine whether a lifetime SHOULD be late bound or not as this is currently how the error for `fn foo<'a, T: Trait>(_: Alias<'a, T>) -> &'a ();` gets emitted. It is probably not possible to do this right now, late boundness is used by `generics_of` and `gather_explicit_predicates_of` as we currently do not put late bound lifetimes in `Generics`. Although this seems sus to me as the long term goal is to make all generics late bound which would result in `generics_of(function)` being empty? [#103448](https://github.com/rust-lang/rust/pull/103448) places all lifetimes in `Generics` regardless of late boundness so that may be a good step towards making this possible.
2022-11-09Auto merge of #103171 - jackh726:gen-interior-hrtb-error, r=cjgillotbors-0/+121
Better error for HRTB error from generator interior cc #100013 This is just a first pass at an error. It could be better, and shouldn't really be emitted in the first place. But this is better than what was being emitted before.
2022-11-08Auto merge of #104168 - GuillaumeGomez:rollup-tf4edqc, r=GuillaumeGomezbors-0/+80
Rollup of 12 pull requests Successful merges: - #103928 (Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed') - #104027 (Place config.toml in current working directory if config not found) - #104093 (disable btree size tests on Miri) - #104097 (run alloc benchmarks in Miri and fix UB) - #104104 (Add split-debuginfo print option) - #104109 (rustdoc: Add mutable to the description) - #104113 (Fix `const_fn_trait_ref_impl`, add test for it) - #104114 (Fix invalid background-image file name) - #104132 (fix: lint against lint functions) - #104139 (Clarify licensing situation of MPSC and SPSC queue) - #104147 (Remove an address comparison from the parser) - #104165 (Add llvm-main to triagebot.toml) Failed merges: - #104115 (Migrate crate-search element to CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-08testsBoxy-0/+31
2022-11-08Rollup merge of #104113 - ink-feather-org:fix_const_fn_ref_impls, ↵Guillaume Gomez-0/+80
r=compiler-errors Fix `const_fn_trait_ref_impl`, add test for it #99943 broke `#[feature(const_fn_trait_ref_impl)]`, this PR fixes this and adds a test for it. r? ````@fee1-dead````
2022-11-08Auto merge of #103252 - lcnr:recompute_applicable_impls, r=jackh726bors-24/+70
selection failure: recompute applicable impls The way we currently skip errors for ambiguous trait obligations seems pretty fragile so we get some duplicate errors because of this. Removing this info from selection errors changes this system to be closer to my image of our new trait solver and is also making it far easier to change overflow errors to be non-fatal :sparkles: r? types cc `@estebank`
2022-11-08Auto merge of #103965 - petrochenkov:effvisperf3, r=oli-obkbors-18/+79
resolve: More detailed effective visibility tracking for imports Per-`DefId` tracking is not enough, due to glob imports in particular, which have a single `DefId` for the whole glob import item. We need to track this stuff per every introduced name (`NameBinding`). Also drop `extern` blocks from the effective visibility table, they are nominally private and it doesn't make sense to keep them there. Later commits add some debug-only invariant checking and optimiaztions to mitigate regressions in https://github.com/rust-lang/rust/pull/103965#issuecomment-1304256445. This is a bugfix and continuation of https://github.com/rust-lang/rust/pull/102026.
2022-11-08ignore wasm in testlcnr-2/+4
2022-11-08selection failure: recompute applicable implslcnr-23/+67
2022-11-08Visit attributes of trait impl items during AST validationLeón Orell Valerian Liehr-0/+23
2022-11-08prevent uninitialized access in black_box for zero-sized-typesKrasimir Georgiev-0/+32
2022-11-08use subdiagnostic for sugesting add letyukang-0/+5
2022-11-08fix #103587, Recover from common if let syntax mistakes/typosyukang-0/+67
2022-11-08Rollup merge of #103651 - Alexendoo:parse-format-unicode-escapes, r=wesleywiserDylan DPC-0/+82
Fix `rustc_parse_format` spans following escaped utf-8 multibyte chars Currently too many skips are created for char escapes that are larger than 1 byte when encoded in UTF-8, [playground:](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c77a9dc669b69b167271b59ed2c8d88c) ```rust fn main() { format!("\u{df}{a}"); format!("\u{211d}{a}"); format!("\u{1f4a3}{a}"); } ``` ``` error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope --> src/main.rs:2:22 | 2 | format!("\u{df}{a}"); | ^ not found in this scope error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope --> src/main.rs:3:25 | 3 | format!("\u{211d}{a}"); | ^ not found in this scope error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find value `a` in this scope --> src/main.rs:4:27 | 4 | format!("\u{1f4a3}{a}"); | ^ not found in this scope ``` This reduces the number of skips to account for that Fixes https://github.com/rust-lang/rust-clippy/issues/9727
2022-11-07Add a known that this is a known limitationJack Huey-0/+3