about summary refs log tree commit diff
path: root/src
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-493/+429
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-43/+97
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-493/+429
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 #79528 - nooberfsh:fix_doc, r=Mark-SimulacrumDylan DPC-1/+1
Fix a bootstrap comment
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 #79484 - sreehax:master, r=Mark-SimulacrumDylan DPC-1/+6
add enable-full-tools to freebsd builds to prevent occasional link er… On FreeBSD, there is sometimes an issue where linking a rust program will fail due to rust not finding a linker, even though lld is included in the base system. This seems to mostly affect bare metal/cross compilation things, such as wasm builds and arm/riscv bare metal work (eg. when trying to compile [this](https://github.com/quantumscraps/scraps)). On Linux and other operating systems, full tools are enabled for builds of rust, so there are no linking issues. This pr should enable fully functional builds on FreeBSD, assuming rust builds correctly with these options.
2020-11-29Rollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514Dylan DPC-6/+35
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 #79443 - GuillaumeGomez:improve-rustdoc-js-error-output, ↵Dylan DPC-0/+31
r=jyn514 Improve rustdoc JS tests error output It's pretty common when starting to add new tests for rustdoc-js to have issues to understand the errors. With this, it should make things a bit simpler. So now, in case of an error, it displays: ``` ---- [js-doc-test] rustdoc-js/basic.rs stdout ---- error: rustdoc-js test failed! failed to decode compiler output as json: line: { output: Checking "basic" ... FAILED ==> Result not found in 'others': '{"path":"basic","name":"Fo"}' Diff of first error: { "path": "basic", - "name": "Fo", + "name": "Foo", } thread '[js-doc-test] rustdoc-js/basic.rs' panicked at 'explicit panic', src/tools/compiletest/src/json.rs:126:21 ``` I think it was ``@camelid`` who asked about it a few days ago? 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-58/+77
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-29Fix a bootstrap commentnooberfsh-1/+1
2020-11-28Add support for multi-argument decl macrosRune Tynan-8/+37
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-28Rollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-SimulacrumJonas Schievink-1/+5
Convert UNC path to local path to satisfy install script on Windows `mkdir` with the `-p` flag attempts to create `//?` if passed a UNC path. This fails on both MSYS2 and Git Bash. The UNC paths come from [canonicalizing](https://github.com/rust-lang/rust/blob/32da90b431919eedb3e281a91caea063ba4edb77/src/bootstrap/install.rs#L79) the install prefix path. `mkdir -p` gets invoked on the [install script](https://github.com/rust-lang/rust-installer/blob/d66f476b4d5e7fdf1ec215c9ac16c923dc292324/install-template.sh#L149).
2020-11-28Rollup merge of #79234 - ortem:fix-hashmap-pretty-printers, r=Mark-SimulacrumJonas Schievink-2/+2
Resolve typedefs in HashMap gdb/lldb pretty-printers `GetTypedefedType` (LLDB) and `strip_typedefs` (GDB) calls are needed to resolve key and value types completely. Without these calls, debugger doesn't show the actual type. **Before** (without `GetTypedefedType`): ``` (lldb) frame variable hm[0] (T) hm[0] = { ... } ``` **After** (with `GetTypedefedType`): ``` (lldb) frame variable hm[0] ((i32, alloc::string::String)) hm[0] = { ... } ``` Based on https://github.com/intellij-rust/intellij-rust/pull/6258
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-2/+19
2020-11-27Apply review: use from_hir, add macro source fix.Rune Tynan-14/+21
2020-11-27Remove doctree::MacroRune Tynan-36/+17
2020-11-28Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514bors-0/+3
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-27add enable-full-tools to freebsd builds to prevent occasional link errors ↵Sreehari S-1/+6
when compiling rust programs
2020-11-27Auto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomezbors-67/+49
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/+3
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-27Allow to have any valid ident used as keyword in doc_keyword featureGuillaume Gomez-6/+18
2020-11-27Auto merge of #77484 - ↵bors-1/+2
terhechte:support-ios-catalyst-macabi-arm64-target-triple, r=nikomatsakis Add support for Arm64 Catalyst on ARM Macs This is an iteration on https://github.com/rust-lang/rust/pull/63467 which was merged a while ago. In the aforementioned PR, I added support for the `X86_64-apple-ios-macabi` target triple, which is Catalyst, iOS apps running on macOS. Very soon, Apple will launch ARM64 based Macs which will introduce `aarch64_apple_darwin.rs`, macOS apps using the Darwin ABI running on ARM. This PR adds support for Catalyst apps on ARM Macs: iOS apps compiled for the darwin ABI. I don't have access to a Apple Developer Transition Kit (DTK), so I can't really test if the generated binaries work correctly. I'm vaguely hopeful that somebody with access to a DTK could give this a spin.
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