about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-08-09Rollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomezYuki Okushi-2/+2
Clean up E0502 `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.
2020-08-09Rollup merge of #75291 - GuillaumeGomez:cleanup-e0750, r=pickfireYuki Okushi-6/+19
Clean up E0750 r? @Dylan-DPC
2020-08-09Rollup merge of #75290 - rust-lang:min_const_generics-version, r=jonas-schievinkYuki Okushi-1/+1
fix `min_const_generics` version https://github.com/rust-lang/rust/pull/74877#discussion_r467451813 > This should be 1.47.0
2020-08-09Rollup merge of #74712 - strom-und-spiele:E0271-cleanup, r=Mark-SimulacrumYuki Okushi-30/+13
Update E0271 explanation When reading the explanation, I got confused by it. I hope the wording is clearer now.
2020-08-08Remove E0750 from unchecked error codesGuillaume Gomez-2/+1
2020-08-08Clean up E0750 explanationGuillaume Gomez-4/+18
2020-08-08Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnrbors-15/+104
polymorphize: unevaluated constants This PR makes polymorphization visit the promoted MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used; in addition polymorphization will now visit non-promoted unevaluated constants rather than visit their substs. r? @lcnr
2020-08-08Auto merge of #74533 - nikic:issue-74425, r=eddybbors-8/+32
Emit == null instead of <= null for niche check When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline. Fixes #74425.
2020-08-08Use `&` instead of `let ref` in E0502 Slanterns-2/+2
`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.
2020-08-08fix `min_const_generics` versionBastian Kauschke-1/+1
2020-08-08Update E0271.mdstrom-und-spiele-30/+13
remove references to non existing code, expand solution suggestions remove unneeded code in solution
2020-08-08Emit == null instead of <= nullNikita Popov-8/+32
When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoid the awkward case of "<= null". While LLVM does canonicalize this to "!= null", this appently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline. Fixes #74425.
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-841/+865
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitorbors-93/+152
Rollup of 7 pull requests Successful merges: - #75224 (Don't call a function in function-arguments-naked.rs) - #75237 (Display elided lifetime for non-reference type in doc) - #75250 (make MaybeUninit::as_(mut_)ptr const) - #75253 (clean up const-hacks in int endianess conversion functions) - #75259 (Add missing backtick) - #75267 (Small cleanup) - #75270 (fix a couple of clippy findings) Failed merges: r? @ghost
2020-08-08Rollup merge of #75270 - matthiaskrgr:clippy_aug_1, r=Dylan-DPCYuki Okushi-51/+46
fix a couple of clippy findings
2020-08-08Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPCYuki Okushi-19/+21
Small cleanup * Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-08Rollup merge of #75259 - giraffate:add_missing_backtick, r=lcnrYuki Okushi-1/+1
Add missing backtick
2020-08-08Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514Yuki Okushi-18/+78
Display elided lifetime for non-reference type in doc In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well. Fixes #75225 ~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~
2020-08-08Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=AmanieuYuki Okushi-4/+6
Don't call a function in function-arguments-naked.rs Fixes #75096 It's U.B. to use anything other than inline assmebling in a naked function. Fortunately, the `#break` directive works fine without anything in the function body.
2020-08-08Increase `recursion_limit` in `librustc_plugin_impl`.Nicholas Nethercote-0/+1
To avoid rustdoc problems.
2020-08-08Eliminate `librustc_hir`'s dependency on `librustc_session`.Nicholas Nethercote-12/+25
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-804/+815
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-08Remove some unnecessary uses of `Option`.Nicholas Nethercote-40/+39
These arguments are never `None`.
2020-08-08Auto merge of #74877 - lcnr:min_const_generics, r=oli-obkbors-101/+471
Implement the `min_const_generics` feature gate Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332. Adds the new feature gate `#![feature(min_const_generics)]`. This feature gate adds the following limitations to using const generics: - generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`) - generic parameters must be either integers, `bool` or `char`. We do allow arbitrary expressions in associated consts though, meaning that the following is allowed, even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable. ```rust trait Foo { const ASSOC: usize; } impl<const N: usize> Foo for [u8; N] { const ASSOC: usize = 64 / N; } ``` r? @varkor cc @eddyb @withoutboats
2020-08-08Cross-crate doc inlining test case for elided lifetimeGary Guo-14/+22
2020-08-08Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, ↵bors-0/+23
r=Mark-Simulacrum Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away I've stumbled across some situations where there (unexpectedly) was no `__rust_begin_short_backtrace` frame on the stack during unwinding. On closer examination, it appeared that the calls to that function had been tail-call optimised away. This PR follows [@bjorn3's suggestion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Disabling.20tail.20call.20optimisation.3F/near/205699133), by adding calls to `black_box` that hint to rustc not to perform TCO. Fixes #47429
2020-08-08fix clippy::needless_return: remove unneeded return statementsMatthias Krüger-12/+12
2020-08-08fix clippy::clone_on_copy: don't clone types that are copyMatthias Krüger-7/+7
2020-08-08fix clippy::map_clone: use .cloned() instead of .map(|x| x.clone())Matthias Krüger-1/+1
2020-08-08fix clippy::into_iter_on_ref: use .iter() instead of into_iter() on references.Matthias Krüger-3/+3
2020-08-08fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }Matthias Krüger-7/+5
2020-08-08fix clippy::redundant_closure: remove redundant closures and call functions ↵Matthias Krüger-2/+2
directly
2020-08-07Display elided lifetime for external pathsGary Guo-4/+20
2020-08-07Display elided lifetime for non-reference type in docGary Guo-14/+50
2020-08-07fix clippy::len_zero: use is_empty() instead of comparing .len() to zeroMatthias Krüger-2/+2
2020-08-07fix clippy::unneeded_wildcard_pattern: remove redundant wildcard patternMatthias Krüger-1/+1
2020-08-07fix clippy::unnecessary_mut_passed: function arg is not required to be mutableMatthias Krüger-1/+1
2020-08-07fix clippy::unit_arg: make it explicit that Ok(()) is being returnedMatthias Krüger-2/+2
2020-08-07fix clippy::single_char_pattern: use char instead of string single-char patternMatthias Krüger-1/+1
2020-08-07fix clippy::redundant_pattern_matching: use .is_some() instead of if let ↵Matthias Krüger-1/+2
Some(_) = ..
2020-08-07fix clippy::redundant_clone: remove redundant clonesMatthias Krüger-1/+1
2020-08-07fix clippy::map_identity: remove redundant .map(|x| x) callMatthias Krüger-1/+1
2020-08-07fix clippy::iter_next_slice: use .get(0) instead of .iter().next()Matthias Krüger-1/+1
2020-08-07fix clippy::filter_next: use .find(..) instead of .filter(..).next()Matthias Krüger-5/+1
2020-08-07fix clippy::expect_fun_call: use unwrap_or_else to prevent panic message ↵Matthias Krüger-3/+3
from always being evaluated
2020-08-07Small cleanupEsteban Küber-19/+21
* Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-07Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised ↵Alan Egerton-0/+23
away
2020-08-07Auto merge of #75255 - ↵bors-20/+280
davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures, r=lcnr instance: polymorphize upvar closures/generators This PR modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized. With the new symbol mangling, a fully polymorphised closure will produce the same symbol regardless of what it was instantiated with. However, when that polymorphised closure captures another closure as an upvar, then the type of that other closure in the upvar substitution wouldn't have been polymorphised. The other closure will still refer to the initial substitutions. Therefore, the polymorphised closure will end up hashing differently but producing the same symbol - triggering `assert_symbols_are_distinct` in MIR partitioning. The old mangling scheme had a hash at the end that meant this didn't happen (this would still have been an issue, we just didn't have a way to notice). See [this Zulip discussion for further elaboration](https://rust-lang.zulipchat.com/#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/symbol.20mangling.20v0.20.E2.9C.95.20polymorphisation/near/206152008). r? @eddyb cc @lcnr
2020-08-07instance: polymorphize `FnDef` substsDavid Wood-6/+31
This commit extends previous polymorphization of substs to polymorphize `FnDef`. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: avoid unnecessary `mk_` callsDavid Wood-2/+10
This commit avoids unnecessary calls to `mk_closure` and `mk_generator` by checking if the polymorphized substs match the original substs. Signed-off-by: David Wood <david@davidtw.co>