about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-10-03Fix unsound optimization with explicit variant discriminantsFabian Wolff-4/+32
2021-10-02Auto merge of #89408 - Mark-Simulacrum:fix-query-nondet, r=petrochenkovbors-2/+23
Avoid nondeterminism in trimmed_def_paths Previously this query depended on the global interning order of Symbols, which meant that irrelevant changes could influence the query and cause recompilations. This commit ensures that the return set is stable and will not be affected by the global order by deterministically (in lexicographic order) choosing a name to use if there are multiple names for a single DefId. This should fix the cause of the [regressions] in #83343. [regressions]: https://perf.rust-lang.org/compare.html?start=9620f3a84b079decfdc2e557be007580b097fe43&end=addb4da686a97da46159f0123cb6cdc2ce3d7fdb
2021-10-02Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillotbors-508/+460
Fix clippy lints I'm currently working on allowing clippy to run on librustdoc after a discussion I had with `@Mark-Simulacrum.` So in the meantime, I fixed a few lints on the compiler crates.
2021-10-02Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obkbors-58/+17
Revert #86853 Should fix issue found in #89432
2021-10-02Add regression test for #89432Albin Hedman-0/+9
Co-authored-by: Josh Stone <cuviper@gmail.com>
2021-10-01Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearthbors-71/+157
Rollup of 7 pull requests Successful merges: - #85223 (rustdoc: Clarified the attribute which prompts the warning) - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes) - #88963 (Coerce const FnDefs to implement const Fn traits ) - #89376 (Fix use after drop in self-profile with llvm events) - #89422 (Replace whitespaces in doctests' name with dashes) - #89440 (Clarify a sentence in the documentation of Vec (#84488)) - #89441 (Normalize after substituting via `field.ty()`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-02Revert "Auto merge of #86853 - usbalbin:const_try, r=oli-obk"Albin Hedman-58/+8
This reverts commit c6007fdc7059c677a6c089e8d2915b264c0d1326, reversing changes made to 69c1c6a173dcae20c245348f6c7d19074b6109b7.
2021-10-01Rollup merge of #89441 - Nadrieril:fix-89393, r=tmandryManish Goregaokar-27/+62
Normalize after substituting via `field.ty()` Back in https://github.com/rust-lang/rust/issues/72476 I hadn't understood where the problem was coming from, and only worked around the issue. What happens is that calling `field.ty()` on a field of a generic struct substitutes the appropriate generics but doesn't normalize the resulting type. As a consumer of types I'm surprised that one would substitute without normalizing, feels like a footgun, so I added a comment. Fixes https://github.com/rust-lang/rust/issues/89393.
2021-10-01Rollup merge of #89440 - chrismit3s:issue-84488-fix, r=steveklabnikManish Goregaokar-1/+1
Clarify a sentence in the documentation of Vec (#84488) I literally changed a single word, but this should clear up the confusion of #84488. Can probably be `rollup`ed :) (My first PR, hope I'm doing this right) fixes #84488 r? `@steveklabnik`
2021-10-01Rollup merge of #89422 - GuillaumeGomez:doctest-whitespace-name, r=CraftSpiderManish Goregaokar-0/+1
Replace whitespaces in doctests' name with dashes Fixes #88263. Instead of handling white spaces when we filter tests (which would be quite complicated since we split on them!), I propose to instead replace them with dashes. So for example, this: ```console test foo.rs - Iter2<T, P>::len (line 13) ... ok test foo.rs - Iter<T, P>::len (line 4) ... ok ``` becomes: ```console test foo.rs - Iter<T,-P>::len (line 4) ... ok test foo.rs - Iter2<T,-P>::len (line 13) ... ok ``` r? `@jyn514`
2021-10-01Rollup merge of #89376 - andjo403:selfProfileUseAfterDropFix, r=Mark-SimulacrumManish Goregaokar-4/+6
Fix use after drop in self-profile with llvm events self-profile with `-Z self-profile-events=llvm` have failed with a segmentation fault due to this use after drop. this type of events can be more useful now that the new passmanager is the default.
2021-10-01Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obkManish Goregaokar-37/+79
Coerce const FnDefs to implement const Fn traits You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`. r? ``@oli-obk`` ``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01Rollup merge of #88847 - oliverbr:master, r=steveklabnikManish Goregaokar-2/+2
platform-support.md: correct ARMv7+MUSL platform triple notes This PR fixes two minor inconsistencies in the platform support list. - use "with MUSL" suffix for "armv7-unknown-linux-musleabi" - add "hardfloat" suffix for "armv7-unknown-linux-musleabihf" r? `@steveklabnik`
2021-10-01Rollup merge of #85223 - simbleau:master, r=steveklabnikManish Goregaokar-0/+6
rustdoc: Clarified the attribute which prompts the warning The example call was lacking clarification of the `#![warn(rustdoc::invalid_codeblock_attributes)]` attribute which generates the specified warning.
2021-10-01Fix clippy lintsGuillaume Gomez-508/+460
2021-10-01Auto merge of #88880 - cjgillot:no-krate, r=oli-obkbors-209/+193
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-10-01Replace whitespaces in doctests' name with dashesGuillaume Gomez-0/+1
2021-10-01Normalize after substituting via `field.ty()`Nadrieril-27/+62
2021-10-01Clarify a sentence in the documentation of Vec (#84488)chrismit3s-1/+1
2021-10-01Auto merge of #89435 - Manishearth:rollup-vh2ih7k, r=Manishearthbors-66/+527
Rollup of 6 pull requests Successful merges: - #87868 (Added -Z randomize-layout flag) - #88820 (Add `pie` as another `relocation-model` value) - #89029 (feat(rustc_parse): recover from pre-RFC-2000 const generics syntax) - #89322 (Reapply "Remove optimization_fuel_crate from Session") - #89340 (Improve error message for `printf`-style format strings) - #89415 (Correct caller/callsite confusion in inliner message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-01Rollup merge of #89415 - wesleywiser:inliner_caller_callsite_message, ↵Manish Goregaokar-1/+1
r=michaelwoerister Correct caller/callsite confusion in inliner message `callee_body` is the MIR `Body` for the `callsite.callee` so this message basically says `"Inline {bar span} into bar"` when it should say `"Inline bar into foo"`. Extracted out of #82280
2021-10-01Rollup merge of #89340 - FabianWolff:issue-89173, r=petrochenkovManish Goregaokar-26/+105
Improve error message for `printf`-style format strings Fixes #89173. The following is actually supported today: ```rust fn main() { let num = 5; let width = 20; print!("%*2$x", num, width); } ``` ``` error: multiple unused formatting arguments --> src/main.rs:4:21 | 4 | print!("%*2$x", num, width); | ------- ^^^ ^^^^^ argument never used | || | | || argument never used | |help: format specifiers use curly braces: `{:1$x}` | multiple missing formatting specifiers | = note: printf formatting not supported; see the documentation for `std::fmt` ``` However, as noted in #89173, something like ```rust print!("%0*x", width, num); ``` does not give a helpful suggestion. I think this is partly intended, because there actually _is_ no Rust equivalent to this; you always have to use a positional or named argument to specify the width (instead of just using the "next" argument, as `printf` or even `.*` as a precision specifier in Rust would). Therefore, I have added a note: ``` [...] note: format specifiers use curly braces, and you have to use a positional or named parameter for the width --> t2.rs:4:13 | 4 | print!("%0*x", width, num); | ^^^^ = note: printf formatting not supported; see the documentation for `std::fmt` ``` This is not perfect, but it should at least point the user in the right direction, instead of issuing no explanation at all. cc ```@lcnr```
2021-10-01Rollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoeristerManish Goregaokar-6/+1
Reapply "Remove optimization_fuel_crate from Session"
2021-10-01Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebankManish Goregaokar-6/+180
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax Fixes #89013
2021-10-01Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkovManish Goregaokar-8/+147
Add `pie` as another `relocation-model` value MCP: https://github.com/rust-lang/compiler-team/issues/461
2021-10-01Rollup merge of #87868 - Kixiron:packing-on-the-pounds, r=eddybManish Goregaokar-19/+93
Added -Z randomize-layout flag An implementation of #77316, it currently randomly shuffles the fields of `repr(rust)` types based on their `DefPathHash` r? ``@eddyb``
2021-10-01Auto merge of #89403 - camsteffen:fmt-unsafe-private, r=Mark-Simulacrumbors-3/+4
Add private arg to fmt::UnsafeArg As discussed [here](https://github.com/rust-lang/rust/pull/89139#discussion_r719467357) r? `@Mark-Simulacrum`
2021-10-01Auto merge of #89417 - Manishearth:rollup-j2gdu95, r=Manishearthbors-159/+559
Rollup of 7 pull requests Successful merges: - #88838 (Do not suggest importing inaccessible items) - #89251 (Detect when negative literal indices are used and suggest appropriate code) - #89321 (Rebase resume argument projections during state transform) - #89327 (Pick one possible lifetime in case there are multiple choices) - #89344 (Cleanup lower_generics_mut and make span be the bound itself) - #89397 (Update `llvm` submodule to fix function name mangling on x86 Windows) - #89412 (Add regression test for issues #88969 and #89119 ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-30Rollup merge of #89412 - lqd:zvariant-repro, r=Aaron1011Manish Goregaokar-0/+71
Add regression test for issues #88969 and #89119 This adds a regression test to complete https://github.com/rust-lang/rust/pull/89125, and thus for issues #88969 and #89119, which needed a test. Used with multiple crates, [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f665e7e882059157e0f86cfb09c47187) minimized from `zvariant-2.8.0` reproduces the error on `nightly-2021-09-19`. The test in this PR fails on master if the commit 6dbb9d4eee0a2789a74bb2d4b8228626f7cd741c from #89125 is reverted, and passes otherwise since it's now fixed. r? `@Aaron1011`
2021-09-30Rollup merge of #89397 - wesleywiser:update_llvm_submodule, r=cuviperManish Goregaokar-0/+0
Update `llvm` submodule to fix function name mangling on x86 Windows Fixes #89307
2021-09-30Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillotManish Goregaokar-37/+50
Cleanup lower_generics_mut and make span be the bound itself Closes #86298 (supersedes those changes) r? `@cjgillot` since you reviewed the other PR (Used wrong branch for #89338)
2021-09-30Rollup merge of #89327 - oli-obk:nll_diag_infer_vars, r=wesleywiserManish Goregaokar-3/+26
Pick one possible lifetime in case there are multiple choices In case a lifetime variable is created, but doesn't have an obvious lifetime in the list of named lifetimes that it should be inferred to, just pick the first one for the diagnostic. This happens e.g. in ```rust fn foo<'a, 'b>(a: Struct<'a>, b: Struct<'b>) -> impl Trait<'a, 'b> { if bar() { a } else { b } } ``` where we get a lifetime variable that combines the lifetimes of `a` and `b` creating a lifetime that is the intersection of both. Right now the type system cannot express this and thus we get an error, but that error also can't express this. I can also create an entirely new diagnostic that mentions all involved lifetimes, so it would actually mention `'a` and `'b` instead of just `'b`.
2021-09-30Rollup merge of #89321 - tmiasko:rebase-resume-arg, r=estebankManish Goregaokar-5/+12
Rebase resume argument projections during state transform When remapping a resume argument with projections rebase them on top of the new base. The case where resume argument has projections is unusual, but might arise with box syntax where the assignment is performed directly into the box without an intermediate temporary. Fixes #85635.
2021-09-30Rollup merge of #89251 - estebank:negative-index-literals, r=davidtwcoManish Goregaokar-2/+136
Detect when negative literal indices are used and suggest appropriate code
2021-09-30Rollup merge of #88838 - FabianWolff:issue-88472, r=estebankManish Goregaokar-112/+264
Do not suggest importing inaccessible items Fixes #88472. For this example: ```rust mod a { struct Foo; } mod b { type Bar = Foo; } ``` rustc currently emits: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | help: consider importing this struct | 6 | use a::Foo; | ``` this is incorrect, as applying this suggestion leads to ``` error[E0603]: struct `Foo` is private --> test.rs:6:12 | 6 | use a::Foo; | ^^^ private struct | note: the struct `Foo` is defined here --> test.rs:2:5 | 2 | struct Foo; | ^^^^^^^^^^^ ``` With my changes, I get: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | = note: this struct exists but is inaccessible: a::Foo ``` As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.
2021-10-01Auto merge of #89395 - ↵bors-47/+78
In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514 Remove visible path calculation from allowed deprecation lint
2021-10-01Add `pie` as another `relocation-model` valueMarcel Hlopko-8/+147
2021-10-01Auto merge of #89414 - Manishearth:rollup-hs11bcq, r=Manishearthbors-63/+427
Rollup of 8 pull requests Successful merges: - #88782 (Fix ICE when `start` lang item has wrong generics) - #89202 (Resolve infered types when complaining about unexpected call type ) - #89248 (Suggest similarly named associated items in trait impls) - #89303 (Add `#[must_not_suspend]` to some types in std) - #89306 (thread: implements available_concurrency on haiku) - #89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind) - #89370 (CTFE: tweak aggregate rvalue handling) - #89392 (bootstrap: Update comment in config.library.toml.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-30Correct caller/callsite confusion in inliner messageWesley Wiser-1/+1
2021-09-30Rollup merge of #89392 - BGR360:master, r=jyn514Manish Goregaokar-2/+1
bootstrap: Update comment in config.library.toml. Downloading LLVM from CI works for all platforms now. All other templates in this directory already have the proper comment. Seems this one was neglected.
2021-09-30Rollup merge of #89370 - RalfJung:ctfe-aggregate-rvalue, r=oli-obkManish Goregaokar-8/+9
CTFE: tweak aggregate rvalue handling I have not looked at this code in ages... I think Miri does not even hit it, since (most?) aggregate rvalues are lowered somewhere in the MIR pipeline, but CTFE does hit it. So this adds some extra sanity assertions, and removes a ZST special case -- ZST should only be special cased fairly late (when the actual memory access happens); e.g. `!` is a ZST and we still want `copy_op` to be called for it since it will perform validation (and raise UB, since `!` is never valid).
2021-09-30Rollup merge of #89314 - notriddle:notriddle/lint-fix-enum-variant-match, ↵Manish Goregaokar-19/+73
r=davidtwco fix(lint): don't suggest refutable patterns to "fix" irrefutable bind In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work. The general warning is still kept, because code like this is confusing. Fixes #88730 p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
2021-09-30Rollup merge of #89306 - devnexen:haiku_ncpus, r=nagisaManish Goregaokar-1/+10
thread: implements available_concurrency on haiku
2021-09-30Rollup merge of #89303 - guswynn:std_suspend, r=dtolnayManish Goregaokar-0/+68
Add `#[must_not_suspend]` to some types in std I am not sure what else should have it? `Ref`?
2021-09-30Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, ↵Manish Goregaokar-18/+216
r=estebank Suggest similarly named associated items in trait impls Fix #85942 Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-30Rollup merge of #89202 - estebank:infer-call-type, r=oli-obkManish Goregaokar-0/+15
Resolve infered types when complaining about unexpected call type ``` error[E0618]: expected function, found `{integer}` --> $DIR/call-block.rs:2:13 | LL | let _ = {42}(); | ^^^^-- | | | call expression requires function ``` instead of ``` error[E0618]: expected function, found `_` --> $DIR/call-block.rs:2:13 | LL | let _ = {42}(); | ^^^^-- | | | call expression requires function ```
2021-09-30Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillotManish Goregaokar-15/+35
Fix ICE when `start` lang item has wrong generics In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates. This fixes that by updating the requirement to be exactly one generic type. The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it. I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations. Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided. Fixes #79559, fixes #73584, fixes #83117 (all duplicates) Relevant to #9307 r? ````@cjgillot````
2021-10-01Auto merge of #89183 - cjgillot:noenc, r=oli-obkbors-56/+57
Move encode_metadata out of CrateStore. `rustc_metadata` is already accessible by all client crates. It does not need to be called trough a trait object.
2021-09-30add regression test for issue 89119Rémy Rakic-0/+71
2021-09-30Auto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakisbors-0/+38
2229: Consume IfLet expr When using the IfLet guard feature, we can ICE when attempting to resolve PlaceBuilders. For pattern matching, we currently don't consume the IfLet expression when "visiting" the arms leading us to not "read" all variables and hence not being able to resolve them. r? `@nikomatsakis` Closes https://github.com/rust-lang/rust/issues/88118