about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-1582/+1762
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-01Remove `LintDiagnosticBuilder`Maybe Waffle-25/+1
2022-10-01`ui-fulldeps`: adopt to the new rustc lint APIMaybe Waffle-1/+1
2022-10-01Move lint level source explanation to the bottomMaybe Waffle-2/+1
2022-10-01Refactor rustc lint APIMaybe Waffle-1556/+1761
2022-09-30Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqdMatthias Krüger-25/+37
Group together more size assertions. Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`. r? `@lqd`
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-30Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillotMatthias Krüger-5/+3
Generate synthetic region from `impl` even in closure body within an associated fn Fixes #102209
2022-09-30Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillotMatthias Krüger-28/+22
create def ids for impl traits during ast lowering r? `@cjgillot`
2022-09-30Rollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, ↵Matthias Krüger-0/+10
r=cjgillot Flush delayed bugs before codegen Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem. I tried this on #102366 and it showed tons of of delayed bugs and no error in cg_llvm, so it seems to be working.
2022-09-30Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholkMatthias Krüger-1/+1
Fix ICE in const_trait check code This fixes #102156.
2022-10-01Group together more size assertions.Nicholas Nethercote-25/+37
Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`.
2022-09-30Fix typonils-1/+1
2022-09-30create def ids for impl traits during ast loweringSantiago Pastorino-28/+22
2022-09-30Update compiler/rustc_interface/src/queries.rsCamille Gillot-1/+1
2022-09-30Rollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnrMatthias Krüger-1/+1
Specify `DynKind::Dyn` ref: https://github.com/rust-lang/rust/pull/101212#discussion_r958861297
2022-09-30Rollup merge of #102421 - lyming2007:issue-101866, r=lcnrMatthias Krüger-5/+14
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-30Rollup merge of #102382 - cuviper:defid-order, r=fee1-deadMatthias Krüger-1/+19
Manually order `DefId` on 64-bit big-endian `DefId` uses different field orders on 64-bit big-endian vs. others, in order to optimize its `Hash` implementation. However, that also made it derive different lexical ordering for `PartialOrd` and `Ord`. That caused spurious differences wherever `DefId`s are sorted, like the candidate sources list in `report_method_error`. Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to match the same lexical ordering as other targets, fixing at least one test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.
2022-09-30Add comment explaining why we flush delayed bugs before codegennils-0/+2
2022-09-30Auto merge of #102509 - matthiaskrgr:rollup-gtenet8, r=matthiaskrgrbors-182/+447
Rollup of 5 pull requests Successful merges: - #101075 (Migrate rustc_codegen_gcc to SessionDiagnostics ) - #102350 (Improve errors for incomplete functions in struct definitions) - #102481 (rustdoc: remove unneeded CSS `.rust-example-rendered { position }`) - #102491 (rustdoc: remove no-op source sidebar `opacity`) - #102499 (Adjust the s390x data layout for LLVM 16) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-30Rollup merge of #102499 - cuviper:llvm-16-s390x, r=nikicMatthias Krüger-8/+13
Adjust the s390x data layout for LLVM 16 LLVM [D131158] changed the SystemZ data layout to always set 64-bit vector alignment, which used to be conditional on the "vector" feature. [D131158]: https://reviews.llvm.org/D131158 r? `@nikic`
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-11/+17
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-30Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwcoMatthias Krüger-163/+417
Migrate rustc_codegen_gcc to SessionDiagnostics As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
2022-09-30Auto merge of #102387 - nnethercote:inline-Token-PartialEq, r=lqdbors-0/+3
Inline a few functions. r? `@ghost`
2022-09-30specify `DynKind::Dyn`Takayuki Maeda-1/+1
2022-09-30Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Kibors-0/+50
Serialize return-position `impl Trait` in trait hidden values in foreign libraries Fixes #101630
2022-09-30Auto merge of #102304 - lcnr:coherence-cleanup, r=compiler-errorsbors-33/+0
remove outdated coherence hack we have a more precise detection for downstream conflicts in candidate assembly: the `is_knowable` check in `candidate_from_obligation_no_cache`. r? types cc `@nikomatsakis`
2022-09-29Adjust the s390x data layout for LLVM 16Josh Stone-8/+13
LLVM [D131158] changed the SystemZ data layout to always set 64-bit vector alignment, which used to be conditional on the "vector" feature. [D131158]: https://reviews.llvm.org/D131158
2022-09-30Use let chains instead of let elsefee1-dead-1/+1
2022-09-29Auto merge of #101887 - nnethercote:shrink-Res, r=spastorinobors-130/+159
Shrink `hir::def::Res` r? `@spastorino`
2022-09-29Don't lower assoc bindings just to deny themMichael Goulet-11/+7
2022-09-29Generate synthetic impl region even in closure body in associated fnMichael Goulet-5/+3
2022-09-29remove the unused :: between trait and type to give user correct diagnostic ↵Yiming Lei-5/+14
information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-29Auto merge of #102482 - notriddle:rollup-fjm618g, r=notriddlebors-141/+141
Rollup of 7 pull requests Successful merges: - #102214 (Fix span of byte-escaped left format args brace) - #102426 (Don't export `__wasm_init_memory` on WebAssembly.) - #102437 (rustdoc: cut margin-top from first header in docblock) - #102442 (rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc) - #102447 (rustdoc: add method spacing to trait methods) - #102468 (tidy: make rustc dependency error less confusing) - #102476 (Split out the error reporting logic into a separate function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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-29Rollup merge of #102426 - sunfishcode:sunfishcode/no-wasm-init-memory, r=nagisaMichael Howell-6/+0
Don't export `__wasm_init_memory` on WebAssembly. Since #72889, the Rust wasm target doesn't use --passive-segments, so remove the `--export=__wasm_init_memory`. As documented in the [tool-conventions Linking convention], `__wasm_init_memory` is not intended to be exported. [tool-conventions Linking convention]: https://github.com/WebAssembly/tool-conventions/blob/7c064f304858f67ebf22964a84b7e9658e29557a/Linking.md#shared-memory-and-passive-segments
2022-09-29Rollup merge of #102214 - cassaundra:fix-format-args-span, r=cjgillotMichael Howell-1/+1
Fix span of byte-escaped left format args brace Fix #102057 (see issue for example). Previously, the use of escaped left braces (`\x7B`) in format args resulted in an incorrectly offset span. This patch fixes that by considering any escaped characters within the string instead of using a constant offset.
2022-09-29Auto merge of #101893 - oli-obk:lift_derive, r=lcnrbors-0/+1
Fix perf regression from TypeVisitor changes Regression occurred in https://github.com/rust-lang/rust/pull/101858#issuecomment-1248732579 Instead of just reverting, we only fixed part of the regression. The main regression was due to actually correctly visiting a type that contains types and consts and should therefor be visited. This is not actually observable (yet?), but we should still do it correctly instead of risking major bugs in the future.
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-58/+115
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 #102455 - nnethercote:WhileTrue-check_expr, r=lqdDylan DPC-24/+22
Use let-chaining in `WhileTrue::check_expr`. This has been bugging me for a while. r? `@lqd`
2022-09-29Rollup merge of #102385 - sunfishcode:sunfishcode/wasm-no-export-heap-base, ↵Dylan DPC-4/+6
r=davidtwco Don't export `__heap_base` and `__data_end` on wasm32-wasi. `__heap_base` and `__data_end` are exported for use by wasm-bindgen, which uses the wasm32-unknown-unknown target. On wasm32-wasi, as a step toward implementing the Canonical ABI, and as an aid to building speicalized WASI API polyfill wrappers, don't export `__heap_base` and `__data_end` on wasm32-wasi.
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-29Auto merge of #102461 - oli-obk:split_collect_rs, r=lcnrbors-1179/+1205
Split collect.rs This file was way too big (adding a few lines of code caused tidy to trigger)
2022-09-29Some path updatesOli Scherer-1/+1
2022-09-29Split collect.rsOli Scherer-1178/+1204
2022-09-29Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisabors-18/+36
Enable inline stack probes on PowerPC and SystemZ The LLVM PowerPC and SystemZ targets have both supported `"probe-stack"="inline-asm"` for longer than our current minimum LLVM 13 requirement, so we can turn this on for all `powerpc`, `powerpc64`, `powerpc64le`, and `s390x` targets in Rust. These are all tier-2 or lower, so CI does not run their tests, but I have confirmed that their `linux-gnu` variants do pass on RHEL. cc #43241
2022-09-29Rollup merge of #102416 - lcnr:specialization-fixme, r=compiler-errorsYuki Okushi-5/+5
remove FIXME, improve documentation r? types
2022-09-29Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnrYuki Okushi-4/+10
Account for use of index-based lifetime names in print of binder Fixes https://github.com/rust-lang/rust/issues/102374 r? ```@lcnr``` cc ```@steffahn```
2022-09-29Rollup merge of #102351 - Rageking8:improve-E0585, r=wesleywiserYuki Okushi-3/+3
Improve E0585 help