about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-03-28Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726Yuki Okushi-3/+48
Add regression tests for #56445 Closes #56445.
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-0/+14
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27Add regression tests for #56445Simon Jakobi-3/+48
Closes #56445.
2021-03-27Auto merge of #78618 - workingjubilee:ieee754-fmt, r=m-ou-sebors-1/+1
Add IEEE 754 compliant fmt/parse of -0, infinity, NaN This pull request improves the Rust float formatting/parsing libraries to comply with IEEE 754's formatting expectations around certain special values, namely signed zero, the infinities, and NaN. It also adds IEEE 754 compliance tests that, while less stringent in certain places than many of the existing flt2dec/dec2flt capability tests, are intended to serve as the beginning of a roadmap to future compliance with the standard. Some relevant documentation is also adjusted with clarifying remarks. This PR follows from discussion in https://github.com/rust-lang/rfcs/issues/1074, and closes #24623. The most controversial change here is likely to be that -0 is now printed as -0. Allow me to explain: While there appears to be community support for an opt-in toggle of printing floats as if they exist in the naively expected domain of numbers, i.e. not the extended reals (where floats live), IEEE 754-2019 is clear that a float converted to a string should be capable of being transformed into the original floating point bit-pattern when it satisfies certain conditions (namely, when it is an actual numeric value i.e. not a NaN and the original and destination float width are the same). -0 is given special attention here as a value that should have its sign preserved. In addition, the vast majority of other programming languages not only output `-0` but output `-0.0` here. While IEEE 754 offers a broad leeway in how to handle producing what it calls a "decimal character sequence", it is clear that the operations a language provides should be capable of round tripping, and it is confusing to advertise the f32 and f64 types as binary32 and binary64 yet have the most basic way of producing a string and then reading it back into a floating point number be non-conformant with the standard. Further, existing documentation suggested that e.g. -0 would be printed with -0 regardless of the presence of the `+` fmt character, but it prints "+0" instead if given such (which was what led to the opening of #24623). There are other parsing and formatting issues for floating point numbers which prevent Rust from complying with the standard, as well as other well-documented challenges on the arithmetic level, but I hope that this can be the beginning of motion towards solving those challenges.
2021-03-27format macro argument parsing fixÖmer Sinan Ağacan-0/+14
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344
2021-03-27Rollup merge of #83343 - osa1:issue83340, r=jackh726Yuki Okushi-0/+16
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes #83340
2021-03-27Rollup merge of #83328 - tmiasko:asm-test, r=joshtriplettYuki Okushi-2/+2
Fixes to inline assmebly tests * Join test thread to make assertion effective in sym.rs test case * Use a single codegen unit to reduce non-determinism in srcloc.rs test #82886
2021-03-26Auto merge of #83488 - Aaron1011:ban-expr-inner-attrs, r=petrochenkovbors-143/+212
Ban custom inner attributes in expressions and statements Split out from https://github.com/rust-lang/rust/pull/82608 Custom inner attributes are unstable, so this won't break any stable users. This allows us to speed up token collection, and avoid a redundant call to `collect_tokens_no_attrs` when parsing an `Expr` that has outer attributes. r? `@petrochenkov`
2021-03-26Auto merge of #83404 - michaelwoerister:issue83045, r=eddybbors-0/+36
Fix #83045 by moving some crate loading verification code to a better place r? `@eddyb`
2021-03-26Fix #83045 by moving some crate loading verification code to a better place.Michael Woerister-0/+36
2021-03-26Update char::escape_debug_ext to handle different escapes in strings vs. charsÖmer Sinan Ağacan-4/+4
Fixes #83046 The program fn main() { println!("{:?}", '"'); println!("{:?}", "'"); } would previously print '\"' "\'" With this patch it now prints: '"' "'"
2021-03-26Rollup merge of #83486 - Aaron1011:fix/global-alloc-error, r=petrochenkovDylan DPC-0/+18
Don't ICE when using `#[global_alloc]` on a non-item statement Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-26Rollup merge of #83485 - Amanieu:asm_llvm10, r=joshtriplettDylan DPC-15/+15
Mark asm tests as requiring LLVM 10.0.1
2021-03-26Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkovDylan DPC-46/+103
Refactor #82270 as lint instead of an error This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly: - It is now a warn-by-default lint instead of an error. - The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86. - The lint no longer provides machine-applicable suggestions for two reasons: - These changes should not be made automatically since changes to assembly code can be very subtle. - The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc. cc ``@asquared31415``
2021-03-26Rollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514Dylan DPC-0/+49
[rustdoc] Don't document stripped items in JSON renderer. Fixes #80664, see [my comment there](https://github.com/rust-lang/rust/issues/80664#issuecomment-797557948) for why Note that we already do something similar in `convert_item`: https://github.com/rust-lang/rust/blob/bb4cdf8ec034dca5c056ec9295f38062e5b7e871/src/librustdoc/json/conversions.rs#L28-L31 ``@rustbot`` modify labels: +T-rustdoc +A-rustdoc-json r? ``@jyn514`` cc ``@CraftSpider``
2021-03-25Ban custom inner attributes in expressions and statementsAaron Hill-143/+212
2021-03-25Mark inline asm tests as requiring LLVM 10.0.1Amanieu d'Antras-15/+15
2021-03-25Don't ICE when using `#[global_alloc]` on a non-item statementAaron Hill-0/+18
Fixes #83469 We need to return an `Annotatable::Stmt` if we were passed an `Annotatable::Stmt`
2021-03-25Auto merge of #82743 - jackh726:resolve-refactor, r=nikomatsakisbors-432/+230
Refactor rustc_resolve::late::lifetimes to resolve per-item There are some changes to tests that I'd like some feedback on; so this is still WIP. The reason behind this change will (hopefully) allow us to (as part of #76814) be able to essentially use the lifetime resolve code to resolve *all* late bound vars (including those of super traits). Currently, it only resolves those that are *syntactically* in scope. In #76814, I'm essentially finding that I would essentially have to redo the passing of bound vars through scopes (i.e. when instantiating a poly trait ref), and that's what this code does anyways. However, to be able to do this (ask super traits what bound vars are in scope), we have to be able to resolve items separately. The first commit is actually partially orthogonal. Essentially removing one use of late bound debruijn indices. Not exactly sure who would be best to review here. Let r? `@nikomatsakis`
2021-03-25Bless nll testJack Huey-84/+3
2021-03-25Refactor #82270 as lint instead of an errorAmanieu d'Antras-46/+103
2021-03-25Auto merge of #83387 - cuviper:min-llvm-10, r=nagisabors-2/+0
Update the minimum external LLVM to 10 r? `@nikic`
2021-03-25Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJungbors-0/+32
RemoveZsts: don't touch unions This should fix a Miri ICE r? `@RalfJung`
2021-03-25Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandrybors-133/+2609
coverage bug fixes and optimization support Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to address multiple, somewhat related issues. Fixed a significant flaw in prior coverage solution: Every counter generated a new counter variable, but there should have only been one counter variable per function. This appears to have bloated .profraw files significantly. (For a small program, it increased the size by about 40%. I have not tested large programs, but there is anecdotal evidence that profraw files were way too large. This is a good fix, regardless, but hopefully it also addresses related issues. Fixes: #82144 Invalid LLVM coverage data produced when compiled with -C opt-level=1 Existing tests now work up to at least `opt-level=3`. This required a detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR when compiled with coverage, and a lot of trial and error with codegen adjustments. The biggest hurdle was figuring out how to continue to support coverage results for unused functions and generics. Rust's coverage results have three advantages over Clang's coverage results: 1. Rust's coverage map does not include any overlapping code regions, making coverage counting unambiguous. 2. Rust generates coverage results (showing zero counts) for all unused functions, including generics. (Clang does not generate coverage for uninstantiated template functions.) 3. Rust's unused functions produce minimal stubbed functions in LLVM IR, sufficient for including in the coverage results; while Clang must generate the complete LLVM IR for each unused function, even though it will never be called. This PR removes the previous hack of attempting to inject coverage into some other existing function instance, and generates dedicated instances for each unused function. This change, and a few other adjustments (similar to what is required for `-C link-dead-code`, but with lower impact), makes it possible to support LLVM optimizations. Fixes: #79651 Coverage report: "Unexecuted instantiation:..." for a generic function from multiple crates Fixed by removing the aforementioned hack. Some "Unexecuted instantiation" notices are unavoidable, as explained in the `used_crate.rs` test, but `-Zinstrument-coverage` has new options to back off support for either unused generics, or all unused functions, which avoids the notice, at the cost of less coverage of unused functions. Fixes: #82875 Invalid LLVM coverage data produced with crate brotli_decompressor Fixed by disabling the LLVM function attribute that forces inlining, if `-Z instrument-coverage` is enabled. This attribute is applied to Rust functions with `#[inline(always)], and in some cases, the forced inlining breaks coverage instrumentation and reports. FYI: `@wesleywiser` r? `@tmandry`
2021-03-25Rollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpiderYuki Okushi-0/+12
Add documentation for rustdoc-gui tests I think a bit of documentation doesn't hurt in this case considering how "out of the ordinary" this is. r? ``@jyn514``
2021-03-25Rollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnayYuki Okushi-5/+0
Remove Option::{unwrap_none, expect_none}. This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see https://github.com/rust-lang/rust/issues/62633. Closes #62633
2021-03-24resolve late lifetimes by itemJack Huey-348/+227
This reverts commit 22ae20733515d710c1134600bc1e29cdd76f6b9b.
2021-03-24Use `EvaluatedToOkModuloRegions` whenever we erase regionsAaron Hill-0/+184
Fixes #80691 When we evaluate a trait predicate, we convert an `EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any regions. We cache the result under a region-erased 'freshened' predicate, so `EvaluatedToOk` may not be correct for other predicates that have the same cache key.
2021-03-24Rename `span` to `source`Nixon Enraght-Moony-4/+4
Caused by https://github.com/rust-lang/rust/commit/b0659f9b1bfb92626c40dabceb3268f88bb26224#diff-ede26372490522288745c5b3df2b6b2a1cc913dcd09b29af3a49935afe00c7e6L464-R464
2021-03-24RemoveZsts: don't touch unionsErik Desjardins-0/+32
2021-03-24Don't call `item` on modules for json rendererNixon Enraght-Moony-0/+49
Closes #80664
2021-03-24Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakisbors-0/+25
2229 migration: Don't try resolve regions before writeback In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`, because we might not have performed regionck yet. Fixes: #83176 r? `@nikomatsakis`
2021-03-24Auto merge of #83050 - osa1:issue83048, r=matthewjasperbors-0/+14
Run analyses before thir-tree dumps Fixes #83048
2021-03-24Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnrbors-42/+276
implement `feature(const_generics_defaults)` Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`. ~~This currently creates a field which is always false on `GenericParamDefKind` for future use when consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~ r? `@lcnr`
2021-03-24Rollup merge of #83399 - camelid:rustdoc-priv-link-from-crate, r=jyn514Dylan DPC-0/+17
rustdoc: Record crate name instead of using `None` Fixes #83365. r? `@jyn514`
2021-03-24Rollup merge of #83393 - GuillaumeGomez:codeblock-tooltip-position, r=Nemo157Dylan DPC-4/+23
Codeblock tooltip position The codeblocks tooltips were misplaced. Normally, there is no top margin applied to a tooltip unless the codeblock is the first element of the doc block. The CSS rule was too vague though, applying it to all tooltips where the codeblock was the first child of its parent. Which can be easily seen with lists: Before: ![Screenshot from 2021-03-22 22-05-16](https://user-images.githubusercontent.com/3050060/112059812-a667ba80-8b5c-11eb-88dd-1c598ceb3766.png) After: ![Screenshot from 2021-03-22 22-06-31](https://user-images.githubusercontent.com/3050060/112059815-a7005100-8b5c-11eb-9e40-8fc57513e498.png) r? ``@Nemo157``
2021-03-24Rollup merge of #83391 - hyd-dev:uwtable, r=alexcrichtonDylan DPC-0/+22
Allow not emitting `uwtable` on Android `uwtable` is marked as required on Android, so it can't be disabled via `-C force-unwind-tables=no`. However, I found that the reason it's marked as required was to resolve a [backtrace issue in Gecko](https://github.com/rust-lang/rust/issues/49867), and I haven't find any other reasons that make it required ([yet](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Unwind.20tables.20are.20strictly.20required.20on.20Windows.20and.20Android)). Therefore, I assume it's safe to turn it off if a (nice) backtrace is not needed, and submit this PR to allow `-C force-unwind-tables=no` when targeting Android. Note that I haven't tested this change on Android as I don't have an Android environment for testing.
2021-03-24Rollup merge of #83313 - cjgillot:assert, r=michaelwoeristerDylan DPC-1/+49
Only enable assert_dep_graph when query-dep-graph is enabled. This is a debugging option. The only effect should be on rustc tests. r? ``@michaelwoerister``
2021-03-24Rollup merge of #83051 - GuillaumeGomez:sidebar-trait-items-order, ↵Dylan DPC-2/+14
r=CraftSpider,jyn514 Sidebar trait items order We were actually sorting `Symbol` and not `String`, creating a completely invalid sort result. I added a test to prevent regressions. r? ``@jyn514``
2021-03-23Add documentation for rustdoc-gui testsGuillaume Gomez-0/+12
2021-03-23Update to not have extra matchkadmin-0/+75
2021-03-23Auto merge of #82994 - camelid:rename-source-to-span, r=jyn514bors-4/+4
Rename `source` to `span` and `span` to `source` - Rename `clean::Item.source` to `span` - Rename `clean::Span::span()` to `clean::Span::inner()` - Rename `rustdoc_json_types::Item.source` to `span` - rustdoc-json: Rename `Import.span` to `Import.source` *See also the [discussion on Zulip][z] (this is a bit more than discussed in that conversation, but all the changes are related).* r? `@jyn514` [z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/get.20span.20of.20file.20from.20name/near/229603729
2021-03-23Update with commentskadmin-3/+33
2021-03-23Update with commentskadmin-0/+53
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23Add query for const_param_defaultkadmin-0/+56
2021-03-23Update testskadmin-5/+4
2021-03-23progress, stuff compiles nowlcnr-23/+40
2021-03-23Some refactoringvarkor-49/+22
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-2/+33
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-23Add test to enforce sidebar trait items orderGuillaume Gomez-2/+14