about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2022-10-05Rollup merge of #102496 - compiler-errors:into-suggestion, r=davidtwcoDylan DPC-36/+119
Suggest `.into()` when all other coercion suggestions fail Also removes some bogus suggestions because we now short-circuit when offering coercion suggestions(instead of, for example, suggesting every one that could possibly apply) Fixes #102415
2022-10-04Rollup merge of #102650 - ↵Michael Howell-1/+1
Rageking8:slightly-improve-no-return-for-returning-function-error, r=compiler-errors Slightly improve no return for returning function error Fixes #100607 The rationale is that absolute beginners will be slightly confused as to why certain lines of code in a function does not require a semicolon. (I have actually witness a beginner having this confusion). Hence, a slight rationale is added "to return this value", which signals to the user that after removing said semicolon the value is returned resolving that error. However, if this is not desirable, I welcome any other suggestions. Thanks.
2022-10-05Suggest `.into()` when all other coercion suggestions failMichael Goulet-36/+119
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-9/+7
2022-10-04slightly improve no return for returning function errorRageking8-1/+1
2022-10-04Auto merge of #102644 - matthiaskrgr:rollup-rg0sw41, r=matthiaskrgrbors-2/+57
Rollup of 7 pull requests Successful merges: - #102441 (Suggest unwrap_or_else when a closure is given) - #102547 (Migrate CSS theme for search results) - #102567 (Delay evaluating lint primary message until after it would be suppressed) - #102624 (rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`) - #102628 (Change the parameter name of From::from to `value`) - #102637 (Ignore fuchsia on two compiler tests) - #102639 (Improve spans when splitting multi-char operator tokens for proc macros.) Failed merges: - #102496 (Suggest `.into()` when all other coercion suggestions fail) r? `@ghost` `@rustbot` modify labels: rollup
2022-10-04Rollup merge of #102441 - chenyukang:fix-102320-unwrap_or_else, ↵Matthias Krüger-2/+57
r=compiler-errors Suggest unwrap_or_else when a closure is given Fixes #102320 r? `@compiler-errors`
2022-10-04Auto merge of #102395 - davidtwco:translation-rename-typeck, r=compiler-errorsbors-44/+45
errors: rename `typeck.ftl` to `hir_analysis.ftl` In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this pull request changes.
2022-10-03errors: rename `typeck.ftl` to `hir_analysis.ftl`David Wood-44/+45
In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this commit changes. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-03`HirId` for `deferred_transmute_checks`lcnr-12/+15
2022-10-02Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-sebors-1/+1
Change `is_some_and` to take by value Consistent with other function-accepting `Option` methods. Tracking issue: #93050 r? `@m-ou-se`
2022-10-02fix #102320, suggest unwrap_or_else when a closure is passed to unwrap_or ↵yukang-2/+57
instead of suggesting calling it
2022-10-01Change feature name to is_some_andCameron Steffen-1/+1
2022-10-01Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillotMatthias Krüger-3/+6
Remove `expr_parentheses_needed` from `ParseSess` Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-209/+219
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Refactor rustc lint APIMaybe Waffle-209/+219
2022-09-30Rollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, ↵Matthias Krüger-11/+7
r=cjgillot Don't lower assoc bindings just to deny them Some clean-up: https://github.com/rust-lang/rust/pull/102338#discussion_r981590931
2022-09-30Remove expr_parentheses_needed from ParseSessMichael Goulet-3/+6
2022-09-29Auto merge of #101887 - nnethercote:shrink-Res, r=spastorinobors-10/+14
Shrink `hir::def::Res` r? `@spastorino`
2022-09-29Don't lower assoc bindings just to deny themMichael Goulet-11/+7
2022-09-29Rollup merge of #102476 - oli-obk:split_error_path, r=cjgillotMichael Howell-134/+140
Split out the error reporting logic into a separate function I was trying to read the function and got distracted by the huge block of code in the middle of it. Turns out it only reports diagnostics and all paths within it end in an error. The main function is now more readable imo.
2022-09-29Split out the error reporting logic into a separate functionOli Scherer-134/+140
2022-09-29Auto merge of #102471 - Dylan-DPC:rollup-ij3okjt, r=Dylan-DPCbors-30/+87
Rollup of 7 pull requests Successful merges: - #102336 (Fix associated type bindings with anon const in GAT position) - #102342 (Add negation methods for signed non-zero integers.) - #102385 (Don't export `__heap_base` and `__data_end` on wasm32-wasi.) - #102435 (Improve example of Iterator::reduce) - #102436 (rustdoc: clean up "normalize.css 8" input override CSS) - #102452 (fix minor ungrammatical sentence) - #102455 (Use let-chaining in `WhileTrue::check_expr`.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-29Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726Dylan DPC-30/+87
Fix associated type bindings with anon const in GAT position The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs. Fixes #102333
2022-09-29Split collect.rsOli Scherer-1178/+1204
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-10/+14
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-28Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiserbors-6/+23
Add `#[rustc_safe_intrinsic]` This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.
2022-09-28Auto merge of #101454 - cjgillot:concat-binders, r=estebankbors-2/+2
Do not overwrite lifetime binders for another HirId. This PR makes higher-ranked bounds in where clauses a bit more principled. We used to conflate `for<'a> T: Trait` with `(for<'a> T): Trait`. This PR separates both binders. This caused issued with fn types, which have their own binder, causing us to overwrite the predicates's binders with `fn`'s binders, ICEing. Fixes https://github.com/rust-lang/rust/issues/98594
2022-09-28rustc_safe_intrinsic: Keep list of safe intrinsics within the compilerArthur Cohen-3/+59
2022-09-28Rollup merge of #102338 - ↵Yuki Okushi-3/+9
compiler-errors:assoc-ty-binding-in-assoc-ty-binding, r=cjgillot Deny associated type bindings within associated type bindings Fixes #102335 This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by #100865, evidenced by the test I added for GATs: ```rust trait T { type A: S<C<(), i32 = ()> = ()>; //~^ ERROR associated type bindings are not allowed here } trait Q {} trait S { type C<T>: Q; } fn main() {} ``` ^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.
2022-09-28Deduplicate some logicmejrs-47/+27
2022-09-27Address feedbackmejrs-16/+45
2022-09-27Wrapper suggestionsmejrs-67/+146
2022-09-27Support bindings with anon consts in genericsMichael Goulet-2/+45
2022-09-27Make type_of work correctly for const arg bindingsMichael Goulet-3/+9
2022-09-27Format type_ofMichael Goulet-28/+36
2022-09-27Deny associated type bindings within associated type bindingsMichael Goulet-3/+9
2022-09-27Do not overwrite binders for another HirId.Camille GILLOT-2/+2
2022-09-27attributes: Add #[rustc_safe_intrinsic] builtinArthur Cohen-49/+10
2022-09-27rustc_typeck to rustc_hir_analysislcnr-0/+56682