about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-08-08Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnrbors-2/+72
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-0/+25
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-08Emit == null instead of <= nullNikita Popov-0/+25
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-4/+4
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitorbors-4/+60
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 #75237 - nbdd0121:rustdoc, r=jyn514Yuki Okushi-0/+54
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-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-4/+4
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-08Auto merge of #74877 - lcnr:min_const_generics, r=oli-obkbors-66/+321
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-07Display elided lifetime for external pathsGary Guo-0/+13
2020-08-07Display elided lifetime for non-reference type in docGary Guo-0/+33
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-0/+187
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-4/+19
This commit extends previous polymorphization of substs to polymorphize `FnDef`. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: always polymorphize substsDavid Wood-0/+37
By always polymorphizing substitutions, functions which take closures as arguments (e.g. `impl Fn()`) can have fewer mono items when some of the argument closures can be polymorphized. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: polymorphize upvar closures/generatorsDavid Wood-0/+135
This commit modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized - this avoids symbol clashes with the new symbol mangling scheme. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07polymorphize: non-promoted unevaluated constantsDavid Wood-0/+33
This commit makes polymorphization visit non-promoted unevaluated constants rather than visit their substs directly. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiserbors-7/+182
Check whether locals are too large instead of whether accesses into them are too large Essentially this stops const prop from attempting to optimize ```rust let mut x = [0_u8; 5000]; x[42] = 3; ``` I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression). r? @wesleywiser
2020-08-07polymorphize: visit promoted MIRDavid Wood-2/+39
This commit makes polymorphization visited the 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. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07Apply `extern "C"` calling conventionAaron Hill-1/+1
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2020-08-07Only test function-arguments-naked.rs on x86_64Aaron Hill-1/+5
We need to use inline assembly, which is inherently platform-specific.
2020-08-07Auto merge of #74627 - petrochenkov:docbeauty2, r=Aaron1011bors-0/+78
rustc_ast: Stop using "string typing" for doc comment tokens Explicitly store their kind and style retrieved during lexing in the `token::DocComment`. Also don't "beautify" doc comments before converting them to `#[doc]` attributes when passing them to macros (both declarative and procedural). The trimming of empty lines, lines containing only `*`s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.
2020-08-07Auto merge of #73842 - euclio:doctest-expn, r=GuillaumeGomezbors-4/+24
Use outermost invocation span for doctest names Fixes #70090. This PR also allows using aux-build files in rustdoc-ui tests.
2020-08-07Auto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrumbors-15/+15
Update hashbrown to 0.8.1 This update includes: - https://github.com/rust-lang/hashbrown/pull/146, which improves the performance of `Clone` and implements `clone_from`. - https://github.com/rust-lang/hashbrown/pull/159, which reduces the size of `HashMap` by 8 bytes. - https://github.com/rust-lang/hashbrown/pull/162, which avoids creating small 1-element tables. Fixes #28481
2020-08-07Fix natvis testsAmanieu d'Antras-15/+15
2020-08-06Rollup merge of #75227 - Amanieu:fix_asm_arch, r=Mark-SimulacrumManish Goregaokar-2/+28
Fix ICE when using asm! on an unsupported architecture Fixes #75220
2020-08-06Rollup merge of #75203 - canova:btreemap-into-iter, r=dtolnayManish Goregaokar-0/+23
Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code. Fixes #74034. r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?
2020-08-06Rollup merge of #75079 - jyn514:disambiguator, r=ManishearthManish Goregaokar-0/+175
Disallow linking to items with a mismatched disambiguator Closes https://github.com/rust-lang/rust/issues/74851 r? @Manishearth
2020-08-07test min_const_generics using revisionsBastian Kauschke-52/+154
2020-08-07Rollup merge of #75188 - Aaron1011:fix/fieldless-tuple-error, r=varkorYuki Okushi-0/+25
Handle fieldless tuple structs in diagnostic code Fixes #75062
2020-08-07Rollup merge of #74888 - infinity0:ignore-endian-big, r=nikomatsakisYuki Okushi-9/+7
compiletest: ignore-endian-big, fixes #74829, fixes #74885 See discussion on #74829 I tested it on a Debian s390x machine, works well.
2020-08-06Fix outdated codeJoshua Nelson-3/+3
2020-08-06Improve testsJoshua Nelson-19/+22
2020-08-06Use the proper kind for associated itemsJoshua Nelson-11/+17
See comments in the diff; this is such a hack. The reason this can't be done properly in `register_res` is because there's no way to get back the parent type: calling `tcx.parent(assoc_item)` gets you the _impl_, not the type. You can call `tcx.impl_trait_ref(impl_).self_ty()`, but there's no way to go from that to a DefId without unwrapping.
2020-08-06allow complex expressions in assoc constsBastian Kauschke-17/+19
2020-08-06Add some comments for magic numbers + Add testsVadim Petrochenkov-0/+78
2020-08-06Fix ICE when using asm! on an unsupported architectureAmanieu d'Antras-2/+28
Fixes #75220
2020-08-06Don't call a function in function-arguments-naked.rsAaron Hill-3/+1
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-06Auto merge of #74889 - JohnTitor:hrtb-tests, r=nikomatsakisbors-0/+28
Add HRTB-related regression test Closes #59311 and cc #71546 This closes the former but the test is taken from https://github.com/rust-lang/rust/issues/71546#issuecomment-620638437 since it seems they have the same cause and it's simplified.
2020-08-05Suggest f() for functions and add a test caseJoshua Nelson-1/+14
2020-08-05Add a test for BTreeMap lifetime bound to see if it compilesNazım Can Altınova-0/+23
2020-08-06Add a FIXME commentYuki Okushi-1/+5
2020-08-05Auto merge of #75166 - JulianKnodt:i64494, r=lcnrbors-0/+37
Add regression test for #64494 Add regression test to indicate if this compilation ever succeeds. Fixes #64494 r? @lcnr
2020-08-05impl reviewBastian Kauschke-16/+20
2020-08-05forbid complex types for generic parametersBastian Kauschke-0/+52
2020-08-05forbid generic params in complex constsBastian Kauschke-0/+95
2020-08-05Auto merge of #75194 - Aaron1011:feature/macro-backtrace-numbers, r=eddybbors-4/+4
Show backtrace numbers in backtrace whenever more than one is involved Previously, we only displayed 'frame' numbers in a macro backtrace when more than two frames were involved. This commit should help make backtrace more readable, since these kinds of messages can quickly get confusing.
2020-08-05Show backtrace numbers in backtrace whenever more than one is involvedAaron Hill-4/+4
Previously, we only displayed 'frame' numbers in a macro backtrace when more than two frames were involved. This commit should help make backtrace more readable, since these kinds of messages can quickly get confusing.