summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2022-02-21Soft-disable incremental compilationMark Rousskov-1/+6
This disables incremental compilation by default and adds a snippet to the compiler release notes explaining the rationale and encouraging testing.
2022-02-11Take in account the unreachable! macro in the non_fmt_panic lintLoïc BRANSTETT-4/+22
2022-02-11Fix invalid special casing of the unreachable! macroLoïc BRANSTETT-6/+34
2022-02-11resolve lifetimes for const generic defaultsMichael Goulet-1/+4
2022-02-11Remove obsolete no-op #[main] attribute from compiler.Jeremy Banks-1/+0
2022-02-09Rollup merge of #93394 - m-ou-se:fix-93378, r=estebankMara Bos-11/+24
Don't allow {} to refer to implicit captures in format_args. Fixes #93378
2022-02-09Rollup merge of #92611 - Amanieu:asm-reference, r=m-ou-seMatthias Krüger-0/+8
Add links to the reference and rust by example for asm! docs and lints These were previously removed in #91728 due to broken links. cc ``@ehuss`` since this updates the rust-by-example submodule
2022-01-31Revert -Zbranch-protectionSimonas Kazlauskas-95/+6
This reverts commit d331cb710f0dd969d779510a49a3bafc7f78a54e, reversing changes made to 78fd0f633faaa5b6dd254fc1456735f63a1b1238. This is a fix for #92885 as discussed on Zulip[1]. [1] https://zulip-archive.rust-lang.org/stream/238009-t-compiler/meetings/topic/.5Bweekly.5D.202022-01-27.20.2354818.html#269588396
2022-01-25Auto merge of #93014 - Kobzol:revert-92103-stable-hash-skip-zero-bytes, ↵bors-16/+2
r=the8472 Revert "Do not hash leading zero bytes of i64 numbers in Sip128 hasher" Reverts rust-lang/rust#92103. It had a (in retrospect, obvious) correctness problem where changing the order of two adjacent values would produce identical hashes, which is problematic in stable hashing (see [this comment](https://github.com/rust-lang/rust/pull/92103#issuecomment-1014625442)). I'll try to send the PR again with a fix for this issue. r? `@the8472`
2022-01-07Rollup merge of #92650 - pierwill:patch-2, r=michaelwoeristerEric Huss-2/+2
Fix typo in `StableCrateId` docs
2022-01-07Rollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, ↵Eric Huss-64/+65
r=michaelwoerister Consolidate checking for msvc when generating debuginfo If the target we're generating code for is msvc, then we do two main things differently: we generate type names in a C++ style instead of a Rust style and we generate debuginfo for enums differently. I've refactored the code so that there is one function (`cpp_like_debuginfo`) which determines if we should use the C++ style of naming types and other debuginfo generation or the regular Rust one. r? ``@michaelwoerister`` This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁
2022-01-07Rollup merge of #92336 - dtolnay:printstateself, r=michaelwoeristerEric Huss-24/+24
Remove &self from PrintState::to_string The point of `PrintState::to_string` is to create a `State` and evaluate the caller's closure on it: https://github.com/rust-lang/rust/blob/e9fbe79292783972a222afd270db3f77c0b4f3c8/compiler/rustc_ast_pretty/src/pprust/state.rs#L868-L872 Making the caller *also* construct and pass in a `State`, which is then ignored, was confusing.
2022-01-07Consolidate checking for msvc when generating debuginfoWesley Wiser-64/+65
If the target we're generating code for is msvc, then we do two main things differently: we generate type names in a C++ style instead of a Rust style and we generate debuginfo for enums differently. I've refactored the code so that there is one function (`cpp_like_debuginfo`) which determines if we should use the C++ style of naming types and other debuginfo generation or the regular Rust one.
2022-01-07Fix typo in `StableCrateId` docspierwill-2/+2
2022-01-06Rollup merge of #92607 - petrochenkov:doctrscope2, r=cjgillotMatthias Krüger-99/+97
rustc_metadata: Some minor cleanups and optimizations Mostly extracted from https://github.com/rust-lang/rust/pull/88679 (which is otherwise a rustdoc PR). r? ``@cjgillot``
2022-01-06Rollup merge of #92559 - durin42:llvm-14-attributemask, r=nikicMatthias Krüger-5/+3
RustWrapper: adapt to new AttributeMask API Upstream LLVM change 9290ccc3c1a1 migrated attribute removal to use AttributeMask instead of AttrBuilder, so we need to follow suit here. r? ``@nagisa`` cc ``@nikic``
2022-01-06Rollup merge of #92504 - dtolnay:wall, r=jackh726Matthias Krüger-1/+1
Exit nonzero on rustc -Wall Previously `rustc -Wall /dev/null` would print a paragraph explaining that `-Wall` is not a thing in Rust, but would then exit 0. I believe exiting 0 is not the right behavior. For something like `rustc --version` or `rustc --help` or `rustc -C help` the user is requesting rustc to print some information; rustc prints that information and exits 0 because what the user requested has been accomplished. In the case of `rustc -Wall path/to/main.rs`, I don't find it correct to conceptualize this as "the user requested rustc to print information about the fact that Wall doesn't exist". The user requested a particular thing, and despite rustc knowing what they probably meant and informing them about that, the thing they requested has *not* been accomplished. Thus a nonzero exit code is needed.
2022-01-06Rollup merge of #92417 - dtolnay:printimpl, r=jackh726Matthias Krüger-3/+6
Fix spacing and ordering of words in pretty printed Impl Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($item:item) => { stringify!($item) }; } fn main() { println!("{}", repro!(impl<T> Struct<T> {})); println!("{}", repro!(impl<T> const Trait for T {})); } ``` Before:&ensp;`impl <T> Struct<T> {}` After:&ensp;`impl<T> Struct<T> {}` Before:&ensp;`impl const <T> Trait for T {}` :crying_cat_face: After:&ensp;`impl<T> const Trait for T {}`
2022-01-06Rollup merge of #92207 - tmiasko:delay-drop-elaboration-bug, r=jackh726Matthias Krüger-8/+7
Delay remaining `span_bug`s in drop elaboration This follows changes from #67967 and converts remaining `span_bug`s into delayed bugs, since for const items drop elaboration might be executed on a MIR which failed borrowck. Fixes #81708. Fixes #91816.
2022-01-06Rollup merge of #91055 - lcnr:type_of-closures, r=nikomatsakisMatthias Krüger-13/+9
return the correct type for closures in `type_of` A bit unhappy about the way `typeck::check_crate` works rn. Would have preferred to not change `CollectItemTypesVisitor` in this way. r? ``@nikomatsakis``
2022-01-06Exit nonzero on rustc -WallDavid Tolnay-1/+1
2022-01-06Auto merge of #92609 - matthiaskrgr:rollup-ldp47ot, r=matthiaskrgrbors-108/+123
Rollup of 7 pull requests Successful merges: - #92058 (Make Run button visible on hover) - #92288 (Fix a pair of mistyped test cases in `std::net::ip`) - #92349 (Fix rustdoc::private_doc_tests lint for public re-exported items) - #92360 (Some cleanups around check_argument_types) - #92389 (Regression test for borrowck ICE #92015) - #92404 (Fix font size for [src] links in headers) - #92443 (Rustdoc: resolve associated traits for non-generic primitive types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-06Rollup merge of #92360 - jackh726:param-heuristics-1, r=davidtwcoMatthias Krüger-108/+123
Some cleanups around check_argument_types Split out in ways from my rebase/continuation of #71827 Commits are mostly self-explanatory and these changes should be fairly straightforward
2022-01-06cg: use thorin instead of llvm-dwpDavid Wood-54/+113
`thorin` is a Rust implementation of a DWARF packaging utility that supports reading DWARF objects from archive files (i.e. rlibs) and therefore is better suited for integration into rustc. Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06sess/cg: re-introduce split dwarf kindDavid Wood-56/+165
In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed and unpacked aren't exact parallels to single and split, respectively. On Unix, `-C split-debuginfo=packed` will put debuginfo into object files and package debuginfo into a DWARF package file (`.dwp`) and `-C split-debuginfo=unpacked` will put debuginfo into dwarf object files and won't package it. In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (`.dwo`) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (`.dwp`). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file). This commit re-introduces a `-Z split-dwarf-kind` flag, which can be used to pick between split and single modes when `-C split-debuginfo` is used to enable Split DWARF (either packed or unpacked). Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06rustc_metadata: Split `fn get_implementations_for_trait` into two functionsVadim Petrochenkov-29/+24
2022-01-06rustc_metadata: Make `opt_item_ident` in decoder faster and stricterVadim Petrochenkov-36/+25
By avoiding formatting and allocations in the no-ident case, and by making the span mandatory if the ident exists. Use the optimized `opt_item_ident` to cleanup `fn each_child_of_item`
2022-01-06rustc_metadata: Make attribute decoding slightly faster and stricterVadim Petrochenkov-22/+24
Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions
2022-01-06rustc_middle: Add a method for getting a `SimplifiedType` definition/IDVadim Petrochenkov-12/+24
Import `SimplifiedType` more
2022-01-05RustWrapper: simplify removing attributesAugie Fackler-7/+3
Avoids some extra conversions. Spotted by nikic during review.
2022-01-05Auto merge of #92587 - matthiaskrgr:rollup-qnwa8qx, r=matthiaskrgrbors-24/+36
Rollup of 7 pull requests Successful merges: - #92092 (Drop guards in slice sorting derive src pointers from &mut T, which is invalidated by interior mutation in comparison) - #92388 (Fix a minor mistake in `String::try_reserve_exact` examples) - #92442 (Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId`) - #92483 (Stabilize `result_cloned` and `result_copied`) - #92574 (Add RISC-V detection macro and more architecture instructions) - #92575 (ast: Always keep a `NodeId` in `ast::Crate`) - #92583 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-05Rollup merge of #92575 - petrochenkov:cratenodeid, r=Aaron1011Matthias Krüger-19/+25
ast: Always keep a `NodeId` in `ast::Crate` This makes it more uniform with other expanded nodes. It makes generic code in https://github.com/rust-lang/rust/pull/92573 simpler in particular. This is another follow-up to https://github.com/rust-lang/rust/pull/91313. r? `@Aaron1011`
2022-01-05Rollup merge of #92442 - pierwill:localdefid-doc-ord, r=Aaron1011Matthias Krüger-5/+11
Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId` Suggested in https://github.com/rust-lang/rust/pull/92233#discussion_r776123222. This also fixes some formatting in the doc comment. r? `@cjgillot`
2022-01-05Auto merge of #92580 - matthiaskrgr:rollup-nzyn65y, r=matthiaskrgrbors-54/+140
Rollup of 7 pull requests Successful merges: - #92182 (Label more build steps) - #92188 (rustdoc: Clean up NestedAttributesExt trait/implementation) - #92322 (Add another implementation example to Debug trait) - #92448 (Set font size proportional to user's font size) - #92517 (Explicitly pass `PATH` to the Windows exe resolver) - #92545 (Extract init_env_logger to crate) - #92579 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-05Rollup merge of #92545 - dtolnay:rustlog, r=petrochenkovMatthias Krüger-54/+140
Extract init_env_logger to crate I've been doing some work on rustc_ast_pretty using an out-of-tree main.rs and Cargo.toml with the following: ```toml [dependencies] rustc_ast = { path = "../rust/compiler/rustc_ast" } rustc_ast_pretty = { path = "../rust/compiler/rustc_ast_pretty" } rustc_span = { path = "../rust/compiler/rustc_span" } ``` Rustc_ast_pretty helpfully uses `tracing::debug!` but I found that in order to enable the debug output, my test crate must depend on rustc_driver which is an enormously bigger dependency than what I have been using so far, and slows down iteration time because an enormous dependency tree between rustc_ast and rustc_driver must now be rebuilt after every ast change. I pulled out the tracing initialization to a new minimal rustc_log crate so that projects depending on the other rustc crates, like rustc_ast_pretty, can access the `debug!` messages in them without building all the rest of rustc.
2022-01-05Auto merge of #92103 - Kobzol:stable-hash-skip-zero-bytes, r=the8472bors-2/+16
Do not hash leading zero bytes of i64 numbers in Sip128 hasher I was poking into the stable hasher, trying to improve its performance by compressing the number of hashed bytes. First I was experimenting with LEB128, but it was painful to implement because of the many assumptions that the SipHasher makes, so I tried something simpler - just ignoring leading zero bytes. For example, if an 8-byte integer can fit into a 4-byte integer, I will just hash the four bytes. I wonder if this could produce any hashing ambiguity. Originally I thought so, but then I struggled to find any counter-example where this could cause different values to have the same hash. I'd be glad for any examples that could be broken by this (there are some ways of mitigating it if that would be the case). It could happen if you had e.g. 2x `u8` vs 1x `u16` hashed after one another in two different runs, but that can also happen now, without this "trick". And with collections, it should be fine, because the length is included in their hash. I gathered some statistics for common values used in the `clap` benchmark. I observed that especially `i64` often had very low values, so I started with that type, let's see what perf does on CI. There are some tradeoffs that we can try: 1) What types to use this optimization for? `u64`, `u32`, `u16`? Locally it was a slight loss for `u64`, I noticed that its values are often quite large. 2) What byte sizes to check? E.g. we can only distinguish between `u64`/`u32` or `u64`/`u8` instead of `u64`/`u32`/`u16`/`u8` to reduce branching (with `i64` it seemed to be better to go all the way down to `u8` locally though). (The macro was introduced because I expect that I will be trying out this "trick" for different types). Can you please schedule a perf. run? Thanks. r? `@the8472`
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-19/+25
This makes it more uniform with other expanded nodes
2022-01-04Auto merge of #92560 - matthiaskrgr:rollup-jeli7ip, r=matthiaskrgrbors-54/+146
Rollup of 7 pull requests Successful merges: - #91587 (core::ops::unsize: improve docs for DispatchFromDyn) - #91907 (Allow `_` as the length of array types and repeat expressions) - #92515 (RustWrapper: adapt for an LLVM API change) - #92516 (Do not use deprecated -Zsymbol-mangling-version in bootstrap) - #92530 (Move `contains` method of Option and Result lower in docs) - #92546 (Update books) - #92551 (rename StackPopClean::None to Root) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-04Rollup merge of #92551 - RalfJung:stack-pop-cleanup, r=oli-obkMatthias Krüger-8/+14
rename StackPopClean::None to Root With https://github.com/rust-lang/rust/pull/90102, `StackPopClean::None` is now only used for the "root" frame of the stack, so adjust its name accordingly and add an assertion. r? `@oli-obk`
2022-01-04Rollup merge of #92515 - krasimirgg:rust-head-llvm-0301, r=nagisaMatthias Krüger-10/+10
RustWrapper: adapt for an LLVM API change No functional changes intended. The LLVM commit https://github.com/llvm/llvm-project/commit/ec501f15a8b8ace2b283732740d6d65d40d82e09 removed the signed version of `createExpression`. This adapts the Rust LLVM wrappers accordingly.
2022-01-04Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwUMatthias Krüger-36/+122
Allow `_` as the length of array types and repeat expressions r? `@BoxyUwU` cc `@varkor`
2022-01-04RustWrapper: adapt to new AttributeMask APIAugie Fackler-2/+4
Upstream LLVM change 9290ccc3c1a1 migrated attribute removal to use AttributeMask instead of AttrBuilder, so we need to follow suit here.
2022-01-04Do not hash zero bytes of i64 and u32 in Sip128 hasherJakub Beránek-2/+16
2022-01-04Rollup merge of #92532 - krasimirgg:gsgdt-down, r=Mark-SimulacrumMatthias Krüger-2/+2
revert #92254 "Bump gsgdt to 0.1.3" This reverts https://github.com/rust-lang/rust/pull/92254 since gsgdt 0.1.3 was yanked: https://github.com/rust-lang/rust/pull/92254#issuecomment-1004269481
2022-01-04Rollup merge of #92507 - chordtoll:suggest-single-quotes, r=petrochenkovMatthias Krüger-3/+38
Suggest single quotes when char expected, str provided If a type mismatch occurs where a char is expected and a string literal is provided, suggest changing the double quotes to single quotes. We already provide this suggestion in the other direction ( ' -> " ). Especially useful for new rust devs used to a language in which single/double quotes are interchangeable. Fixes #92479.
2022-01-04Rollup merge of #92107 - nikic:rmeta-lnk-remove, r=nagisaMatthias Krüger-6/+5
Actually set IMAGE_SCN_LNK_REMOVE for .rmeta The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR #84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
2022-01-04rename StackPopClean::None to RootRalf Jung-8/+14
2022-01-03Make rustc_log doc test runnableDavid Tolnay-4/+4
2022-01-03Suggest changing quotes when str/char type mismatchchordtoll-3/+38
2022-01-03Justify why rustc_log existsDavid Tolnay-0/+37