about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-11-29Remove extra call to upvar_tysAman Arora-0/+74
Fixes #78720
2020-11-29Auto merge of #79209 - spastorino:trait-inheritance-self, r=nikomatsakisbors-79/+192
Allow Trait inheritance with cycles on associated types Fixes #35237 r? `@nikomatsakis` cc `@estebank`
2020-11-29Auto merge of #79523 - Nadrieril:fix-usize-ranges, r=varkorbors-2/+8
Fix overlap detection of `usize`/`isize` range patterns `usize` and `isize` are a bit of a special case in the match usefulness algorithm, because the range of values they contain depends on the platform. Specifically, we don't want `0..usize::MAX` to count as an exhaustive match (see also [`precise_pointer_size_matching`](https://github.com/rust-lang/rust/issues/56354)). The way this was initially implemented is by treating those ranges like float ranges, i.e. with limited cleverness. This means we didn't catch the following as unreachable: ```rust match 0usize { 0..10 => {}, 10..20 => {}, 5..15 => {}, // oops, should be detected as unreachable _ => {}, } ``` This PRs fixes this oversight. Now the only difference between `usize` and `u64` range patterns is in what ranges count as exhaustive. r? `@varkor` `@rustbot` label +A-exhaustiveness-checking
2020-11-29Auto merge of #78380 - bstrie:rm-old-num-const-from-tests, r=jyn514bors-492/+428
Update tests to remove old numeric constants Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-29Auto merge of #78863 - KodrAus:feat/simd-array, r=oli-obkbors-71/+306
Support repr(simd) on ADTs containing a single array field This is a squash and rebase of `@gnzlbg's` #63531 I've never actually written code in the compiler before so just fumbled my way around until it would build 😅 I imagine there'll be some work we need to do in `rustc_codegen_cranelift` too for this now, but might need some input from `@bjorn3` to know what that is. cc `@rust-lang/project-portable-simd` ----- This PR allows using `#[repr(simd)]` on ADTs containing a single array field: ```rust #[repr(simd)] struct S0([f32; 4]); #[repr(simd)] struct S1<const N: usize>([f32; N]); #[repr(simd)] struct S2<T, const N: usize>([T; N]); ``` This should allow experimenting with portable packed SIMD abstractions on nightly that make use of const generics.
2020-11-29args may be passed by valueAshley Mannix-4/+4
2020-11-29Auto merge of #79455 - CraftSpider:master, r=jyn514bors-0/+53
Remove doctree::Macro and distinguish between `macro_rules!` and `pub macro` This is a part of #78082, removing doctree::Macro. Uses the changes in #79372 Fixes #76761
2020-11-29Update tests to remove old numeric constantsbstrie-492/+428
Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-29Auto merge of #75752 - jakoschiko:test-suite-time, r=m-ou-sebors-53/+122
libtest: Print the total time taken to execute a test suite Print the total time taken to execute a test suite by default, without any kind of flag. Closes #75660 # Example ``` anon@anon:~/code/rust/example$ cargo test Compiling example v0.1.0 (/home/anon/code/rust/example) Finished test [unoptimized + debuginfo] target(s) in 0.18s Running target/debug/deps/example-745b64d3885c3565 running 3 tests test tests::foo ... ok test tests::bar ... ok test tests::baz ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s Doc-tests example running 3 tests test src/lib.rs - foo (line 3) ... ok test src/lib.rs - bar (line 11) ... ok test src/lib.rs - baz (line 19) ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s ``` ``` anon@anon:~/code/rust/example$ cargo test -- --format terse Finished test [unoptimized + debuginfo] target(s) in 0.08s Running target/debug/deps/example-745b64d3885c3565 running 3 tests ... test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.2s Doc-tests example running 3 tests ... test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; 1.3s ``` ``` anon@anon:~/code/rust/example$ cargo test -- --format json -Z unstable-options Compiling example v0.1.0 (/home/anon/code/rust/example) Finished test [unoptimized + debuginfo] target(s) in 0.25s Running target/debug/deps/example-745b64d3885c3565 { "type": "suite", "event": "started", "test_count": 3 } { "type": "test", "event": "started", "name": "tests::bar" } { "type": "test", "event": "started", "name": "tests::baz" } { "type": "test", "event": "started", "name": "tests::foo" } { "type": "test", "name": "tests::foo", "event": "ok" } { "type": "test", "name": "tests::bar", "event": "ok" } { "type": "test", "name": "tests::baz", "event": "ok" } { "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.2s" } Doc-tests example { "type": "suite", "event": "started", "test_count": 3 } { "type": "test", "event": "started", "name": "src/lib.rs - bar (line 11)" } { "type": "test", "event": "started", "name": "src/lib.rs - baz (line 19)" } { "type": "test", "event": "started", "name": "src/lib.rs - foo (line 3)" } { "type": "test", "name": "src/lib.rs - foo (line 3)", "event": "ok" } { "type": "test", "name": "src/lib.rs - bar (line 11)", "event": "ok" } { "type": "test", "name": "src/lib.rs - baz (line 19)", "event": "ok" } { "type": "suite", "event": "ok", "passed": 3, "failed": 0, "allowed_fail": 0, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": "1.3s" } ```
2020-11-28Add test for macro by example syntax in decl macros with only one optionRune Tynan-0/+7
2020-11-29Rollup merge of #79514 - Julian-Wollersberger:order-dependent-bounds, ↵Dylan DPC-0/+47
r=Mark-Simulacrum Add test for issue #54121: order dependent trait bounds This adds a test for #54121, which has already been fixed by #73905. Now that issue can be closed. I tested the test [on the playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6cb061d3b81518f268649551eb67769f) where it indeed fails on stable 1.48, but compiles successfully on beta and nightly. fixes #54121
2020-11-29Rollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514Dylan DPC-0/+17
Extend doc keyword feature by allowing any ident Part of #51315. As suggested by ``@danielhenrymantilla`` in [this comment](https://github.com/rust-lang/rust/issues/51315#issuecomment-733879934), this PR extends `#[doc(keyword = "...")]` to allow any ident to be used as keyword. The final goal is to allow (proc-)macro crates' owners to write documentation of the keywords they might introduce. r? ``@jyn514``
2020-11-29Rollup merge of #79395 - Havvy:test-move-if, r=Mark-SimulacrumDylan DPC-0/+0
Move ui if tests from top-level into `expr/if` This lowers the number of top-level files in src/test/ui from 1612 to 1604.
2020-11-29Rollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514Dylan DPC-7/+7
Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short` Follow-up of #79300 The point of this PR is to make the CSS class more accurate since it's not only about stability anymore. r? ``@jyn514``
2020-11-28Add support for multi-argument decl macrosRune Tynan-0/+17
2020-11-29libtest: Make `sed` arguments compatible with appleJakob Schikowski-2/+2
2020-11-29looser regex on local argsAshley Mannix-6/+6
2020-11-28Auto merge of #79511 - cjgillot:fitem-2, r=lcnrbors-0/+12
Do not visit ForeignItemRef for HIR indexing and validation. Similarly to what is done for ImplItemRef and TraitItemRef. Fixes #79487 r? `@lcnr`
2020-11-28Correctly detect `usize`/`isize` range overlapsNadrieril-2/+8
2020-11-28Add test for issue #54121:Julian Wollersberger-0/+47
"simple type inference fails depending on order of trait bounds"
2020-11-28Do not visit ForeignItemRef for HIR indexing and validation.Camille GILLOT-0/+12
Similarly to what is done for ImplItemRef and TraitItemRef. Fixes #79487
2020-11-28Rollup merge of #79486 - camelid:E0591-code-cleanup, r=lcnrJonas Schievink-5/+13
Slightly improve code samples in E0591 * Improve formatting * Don't hide `unsafe` block - it's important!
2020-11-28Auto merge of #78296 - Aaron1011:fix/stmt-tokens, r=petrochenkovbors-119/+376
Properly handle attributes on statements We now collect tokens for the underlying node wrapped by `StmtKind` nstead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-28Update src/test/rustdoc/decl_macro_priv.rsRune Tynan-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-11-27Slightly improve code samples in E0591Camelid-5/+13
* Improve formatting * Don't hide `unsafe` block - it's important!
2020-11-27Update decl_macro test, add decl_macro_priv test for --document-private-itemsRune Tynan-3/+15
2020-11-27Add test, fix pub macro impl, compile errorRune Tynan-0/+16
2020-11-28Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514bors-0/+1
Revert "Normalize `<X as Y>::T` for rustdoc" Reverts rust-lang/rust#77467 by disabling normalization. See https://github.com/rust-lang/rust/issues/79459; I intend to reland normalization once that's fixed. r? `@Aaron1011` cc `@oli-obk` `@GuillaumeGomez`
2020-11-27Auto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomezbors-2/+1
Cleanup more of rustdoc - Use `Item::from_def_id` for StructField - Use `from_def_id_and_parts` for primitives and keywords - Take `String` instead of `Symbol` in `from_def_id` - this avoids having to intern then immediately stringify the existing string. - Remove unused `get_stability` and `get_deprecation` - Remove unused `attrs` field from `primitives` - Remove unused `attrs` field from `keywords` This will probably conflict with https://github.com/rust-lang/rust/pull/79335 and I would prefer for that PR to land first - I'm anxious for https://github.com/rust-lang/rust/pull/77467 to land :) Makes https://github.com/rust-lang/rust/issues/76998 easier to add. r? `@GuillaumeGomez`
2020-11-27Revert the effect of #77467 by disabling normalization in rustdocoli-0/+1
2020-11-27Add tests for doc_keyword feature extensionGuillaume Gomez-0/+17
2020-11-27libtest: Print the total time taken to execute a test suiteJakob Schikowski-53/+122
2020-11-27Don't lint on redundant semicolons after item statementsAaron Hill-0/+10
This preserves the current lint behavior for now. Linting after item statements currently prevents the compiler from bootstrapping. Fixing this is blocked on fixing this upstream in Cargo, and bumping the Cargo submodule.
2020-11-27Add test to check that we handle predicates that can define assoc types ↵Santiago Pastorino-0/+10
correctly
2020-11-27adjust super_predicates_that_define_assoc_type query descriptionSantiago Pastorino-18/+20
2020-11-27Bless testsSantiago Pastorino-13/+13
2020-11-27Add description on testSantiago Pastorino-0/+4
2020-11-27Add test for a still ambiguous scenarioSantiago Pastorino-0/+26
2020-11-27Avoid ICEing when associated type bound trait is missingSantiago Pastorino-0/+26
2020-11-27Fix super_traits_of to consider where boundsSantiago Pastorino-0/+21
2020-11-27Add test to check that we do not get a cycle due to resolving `Self::Bar` in ↵Niko Matsakis-0/+27
the where clauses
2020-11-27Update testsSantiago Pastorino-61/+31
2020-11-27Allow to self reference associated types in where clausesSantiago Pastorino-0/+12
2020-11-27Allow to use super trait bounds in where clausesSantiago Pastorino-0/+15
2020-11-27Auto merge of #79318 - cjgillot:fitem, r=lcnrbors-104/+79
Store HIR ForeignItem in a side table In a similar fashion to Item, ImplItem and TraitItem.
2020-11-26Use custom macro instead of printlnAaron Hill-141/+152
Loading a macro from libstd causes us to load serialized `SyntaxContext`s in a platform-dependent way, causing the printed spans to differ between platforms.
2020-11-27Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkovbors-32/+346
Generic Associated Types in Trait Paths - Ast part The Ast part of https://github.com/rust-lang/rust/pull/78978 r? `@petrochenkov`
2020-11-26Fix new 'unnecessary trailing semicolon' warningsAaron Hill-20/+20
2020-11-26Add additional semicolon testAaron Hill-108/+126
2020-11-26Only eat semicolons for statements that need themAaron Hill-6/+1
When parsing a statement (e.g. inside a function body), we now consider `struct Foo {};` and `$stmt;` to each consist of two statements: `struct Foo {}` and `;`, and `$stmt` and `;`. As a result, an attribute macro invoke as `fn foo() { #[attr] struct Bar{}; }` will see `struct Bar{}` as its input. Additionally, the 'unused semicolon' lint now fires in more places.