about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-01-17Rollup merge of #106953 - kylematsuda:early-binder-docs, r=jackh726Matthias Krüger-0/+19
Document `EarlyBinder::subst_identity` and `skip_binder` Finishing implementing #105779 will change several commonly used queries to return `EarlyBinder` by default. This PR adds documentation for two of the methods used to access data inside the `EarlyBinder`. I tried to summarize some of the [discussion from the issue](https://github.com/rust-lang/rust/issues/105779#issuecomment-1375512647) in writing this. r? `@lcnr`
2023-01-17Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwUMatthias Krüger-8/+48
ConstBlocks are poly if their substs are poly r? `@BoxyUwU` fixes #106926
2023-01-17Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorinoMatthias Krüger-114/+54
Unify `Opaque`/`Projection` handling in region outlives code They share basically identical paths in most places which are even easier to unify now that they're both `ty::Alias` r? types
2023-01-17Rollup merge of #106712 - Ezrashaw:impl-ref-trait, r=estebankMatthias Krüger-5/+38
make error emitted on `impl &Trait` nicer Fixes #106694 Turned out to be simpler than I thought, also added UI test. Before: ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9bda53271ef3a8886793cf427b8cea91)) ```text error: expected one of `:`, ``@`,` or `|`, found `)` --> src/main.rs:2:22 | 2 | fn foo(_: impl &Trait) {} | ^ expected one of `:`, ``@`,` or `|` | = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) help: if this is a parameter name, give it a type | 2 | fn foo(_: impl Trait: &TypeName) {} | ~~~~~~~~~~~~~~~~ help: if this is a type, explicitly ignore the parameter name | 2 | fn foo(_: impl _: &Trait) {} | ++ error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `&` --> src/main.rs:2:16 | 2 | fn foo(_: impl &Trait) {} | -^ expected one of 9 possible tokens | | | help: missing `,` error: expected one of `!`, `(`, `,`, `=`, `>`, `?`, `for`, `~`, lifetime, or path, found `&` --> src/main.rs:3:11 | 3 | fn bar<T: &Trait>(_: T) {} | ^ expected one of 10 possible tokens ``` After: ```text error: expected a trait, found type --> <anon>:2:16 | 2 | fn foo(_: impl &Trait) {} | -^^^^^ | | | help: consider removing the indirection error: expected a trait, found type --> <anon>:3:11 | 3 | fn bar<T: &Trait>(_: T) {} | -^^^^^ | | | help: consider removing the indirection ```
2023-01-17Rollup merge of #106591 - Ezrashaw:attempted-integer-identifer, r=EstebankMatthias Krüger-4/+33
suggestion for attempted integer identifier in patterns Fixes #106552 Implemented a suggestion on `E0005` that occurs when no bindings are present and the pattern is a literal integer.
2023-01-16document EarlyBinder::subst_identity and skip_binderKyle Matsuda-0/+19
2023-01-16Properly pluralize 'generic constants'Michael Goulet-6/+6
2023-01-16ConstBlocks are poly if their substs are polyMichael Goulet-2/+42
2023-01-16Rollup merge of #106940 - oli-obk:tait_error, r=compiler-errorsMatthias Krüger-13/+94
Improve a TAIT error and add an error code plus documentation cc https://github.com/rust-lang/rust/issues/106858
2023-01-16Rollup merge of #106912 - gftea:pr-106736, r=NilstriebMatthias Krüger-0/+5
check -Z query-dep-graph is enabled if -Z dump-dep-graph (#106736) PR to solve #106736, r? `@cjgillot`
2023-01-16Rollup merge of #106835 - compiler-errors:new-solver-gat-rebase-oops, r=lcnrMatthias Krüger-1/+1
new trait solver: rebase impl substs for gats correctly you might've caught this while working on projection code, if so then you can close this pr r? `@lcnr`
2023-01-16Improve a TAIT error and add an error code plus documentationOli Scherer-13/+94
2023-01-16Auto merge of #106853 - TimNN:undo-remap, r=oli-obkbors-6/+100
Heuristically undo path prefix mappings. Because the compiler produces better diagnostics if it can find the source of (potentially remapped) dependencies. The new test fails without the other changes in this PR. Let me know if you have better suggestions for the test directory. I moved the existing remapping test to be in the same location as the new one. Some more context: I'm exploring running UI tests with remapped paths by default in https://github.com/rust-lang/rust/pull/105924 and this was one of the issues discovered. This may also be useful in the context of https://github.com/rust-lang/rfcs/pull/3127 ("New rustc and Cargo options to allow path sanitisation by default").
2023-01-16Auto merge of #106850 - cjgillot:issue-106141, r=oli-obkbors-24/+28
Make the inlining destination a Local. Fixes https://github.com/rust-lang/rust/issues/106141
2023-01-16check -Z query-dep-graph is enabled if -Z dump-dep-graph (#106736)gftea-0/+5
2023-01-16Auto merge of #106872 - dtolnay:nbsp, r=fee1-deadbors-5/+26
Emit only one nbsp error per file Fixes #106101. See https://github.com/rust-lang/rust/issues/106098 for an explanation of how someone would end up with a large number of these nbsp characters in their source code, which is why I think rustc needs to handle this specific case in a friendlier way.
2023-01-16Auto merge of #106395 - compiler-errors:rework-predicates, r=eholkbors-156/+155
Rework some `predicates_of`/`{Generic,Instantiated}Predicates` code 1. Make `instantiate_own` return an iterator, since it's a bit more efficient and easier to work with 2. Remove `bound_{explicit,}_predicates_of` -- these `bound_` methods in particular were a bit awkward to work with since `ty::GenericPredicates` *already* acts kinda like an `EarlyBinder` with its own `instantiate_*` methods, and had only a few call sites anyways. 3. Implement `IntoIterator` for `InstantiatedPredicates`, since it's *very* commonly being `zip`'d together.
2023-01-16fix dropping diagnostic without emitEzra Shaw-1/+2
2023-01-15Rollup merge of #106909 - compiler-errors:only-types-can-be, r=estebankMatthias Krüger-1/+1
Only suggest adding type param if path being resolved was a type
2023-01-15Rollup merge of #106906 - matthiaskrgr:clone, r=NilstriebMatthias Krüger-3/+3
remove redundant clones
2023-01-15Rollup merge of #106900 - clubby789:unused-braces-regression, r=estebankMatthias Krüger-4/+8
Fix regression in `unused_braces` with macros Fixes #106899
2023-01-15Rollup merge of #106896 - Ezrashaw:str-cast-bool-emptyness, r=compiler-errorsMatthias Krüger-1/+45
suggest `is_empty` for collections when casting to `bool` Fixes #106883 Matches on slices, `String` and `str`. It would be nice to do this with something like `Deref<Target=str>` as well, but AFAIK it's not possible in this part of the compiler.
2023-01-15Only suggest adding type param if path being resolved was a typeMichael Goulet-1/+1
2023-01-15Remove bound_{explicit,}_item_boundsMichael Goulet-64/+40
2023-01-15drive-by: assert when iterating through InstantiatedPredicatesMichael Goulet-0/+2
2023-01-15Make InstantiatedPredicates impl IntoIteratorMichael Goulet-65/+74
2023-01-15instantiate_own doesn't need to return a pair of vectorsMichael Goulet-27/+39
2023-01-15Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnrbors-41/+186
Implement some FIXME methods in the new trait solver Implement just enough of the solver's response logic to make it not ICE. Also, fix a bug with `no_bound_vars` call failing due to canonical bound vars. r? `@lcnr`
2023-01-15remove redundant clonesMatthias Krüger-3/+3
2023-01-15Auto merge of #106171 - compiler-errors:consolidate-extract_callable_info, ↵bors-185/+149
r=estebank,lcnr Consolidate two almost duplicated fn info extraction routines Moves `extract_callable_info` up to trait selection, because it was being (almost) duplicated fully there for similar diagnostic purposes. This also generalizes the diagnostics we can give slightly (see UI test).
2023-01-15suggest `is_empty` for collections when casting to `bool`Ezra Shaw-1/+45
2023-01-15Fix regression in `unused_braces` with macrosclubby789-4/+8
2023-01-15Rollup merge of #106863 - anden3:compiler-double-spaces, r=NilstriebMatthias Krüger-10/+10
Remove various double spaces in compiler source comments. Was asked to do it by `@Nilstrieb`
2023-01-15Rollup merge of #106859 - tialaramex:master, r=NilstriebMatthias Krüger-0/+16
Suggestion for type mismatch when we need a u8 but the programmer wrote a char literal Today Rust just points out that we have a char and we need a u8, but if I wrote 'A' then I could fix this by just writing b'A' instead. This code should detect the case where we're about to report a type mismatch of this kind, and the programmer wrote a char literal, and the char they wrote is ASCII, so therefore just prefixing b to make a byte literal will do what they meant. I have definitely written this mistake more than once, it's not difficult to figure out what to do, but the compiler might as well tell us anyway. I provided a test with two simple examples where the suggestion is appropriate, and one where it is not because the char literal is not ASCII, showing that the suggestion is only triggered in the former cases. I have contributed only a small typo doc fix before, so this is my first substantive rustc change.
2023-01-15Rollup merge of #106072 - eopb:dyn-derive, r=estebankMatthias Krüger-1/+7
fix: misleading "add dyn keyword before derive macro" suggestion Fixes #106071
2023-01-15make error emitted on `impl &Trait` nicerEzra Shaw-5/+37
2023-01-14Improve E0308: suggest user meant to use byte literal, w/ tests and fixNick Lamb-0/+16
suggested by Nilstrieb Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-14Auto merge of #106866 - matthiaskrgr:rollup-r063s44, r=matthiaskrgrbors-6/+8
Rollup of 8 pull requests Successful merges: - #105526 (libcore: make result of iter::from_generator Clone) - #106563 (Fix `unused_braces` on generic const expr macro call) - #106661 (Stop probing for statx unless necessary) - #106820 (Deprioritize fulfillment errors that come from expansions.) - #106828 (rustdoc: remove `docblock` class from notable trait popover) - #106849 (Allocate one less vec while parsing arrays) - #106855 (rustdoc: few small cleanups) - #106860 (Remove various double spaces in the libraries.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-14Emit only one nbsp error per fileDavid Tolnay-5/+26
2023-01-14Rollup merge of #106849 - WaffleLapkin:unvec, r=NilstriebMatthias Krüger-3/+2
Allocate one less vec while parsing arrays Probably does not matter, but imo a little bit nicer.
2023-01-14Rollup merge of #106820 - m-ou-se:macro-type-error-thing, r=estebankMatthias Krüger-3/+5
Deprioritize fulfillment errors that come from expansions. Fixes (part of?) #69455
2023-01-14Rollup merge of #106563 - clubby789:gce-macro-braces, r=TaKO8KiMatthias Krüger-0/+1
Fix `unused_braces` on generic const expr macro call Fixes #106545 `@rustbot` label +A-const-generics +A-lint
2023-01-14Auto merge of #106696 - kylematsuda:early-binder, r=lcnrbors-100/+131
Switch to `EarlyBinder` for `const_param_default` and `impl_trait_ref` queries Part of the work to close #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This PR adds `EarlyBinder` to the return type of `const_param_default` and `impl_trait_ref`, and removes their `bound_X` variants. r? `@lcnr`
2023-01-14Fix some missed double spaces.André Vennberg-4/+4
2023-01-14Remove visit_place.Camille GILLOT-6/+0
2023-01-14Removed various double spaces in compiler source comments.André Vennberg-6/+6
2023-01-14Fix `unused_braces` on generic const expr macro callclubby789-0/+1
2023-01-14Deprioritize fulfillment errors that come from expansions.Mara Bos-3/+5
2023-01-14Heuristically undo path prefix mappings.Tim Neumann-6/+100
Because the compiler produces better diagnostics if it can find the source of (potentially remapped) dependencies.
2023-01-14fix: misleading add `dyn` to derive macro suggestionEthan Brierley-1/+7