about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-11-04Auto merge of #77227 - oli-obk:const_val_🌳_prelude, r=RalfJungbors-13/+15
Refactorings in preparation for const value trees cc #72396 This PR changes the `Scalar::Bits { data: u128, size: u8 }` variant to `Scalar::Bits(ScalarInt)` where `ScalarInt` contains the same information, but is `repr(packed)`. The reason for using a packed struct is to allow enum variant packing to keep the original size of `Scalar` instead of adding another word to its size due to padding. Other than that the PR just gets rid of all the inspection of the internal fields of `Scalar::Bits` which were frankly scary. These fields have invariants that we need to uphold and we can't do that without making the fields private. r? `@ghost`
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-2/+2
2020-11-04Auto merge of #78677 - Aaron1011:fix/capture-inner-attrs, r=petrochenkovbors-0/+118
Use reparsed `TokenStream` if we captured any inner attributes Fixes #78675 We now bail out of `prepend_attrs` if we ended up capturing any inner attributes (which can happen in several places, due to token capturing for `macro_rules!` arguments.
2020-11-04s/Scalar::Raw/Scalar::Intoli-1/+1
2020-11-04Use packed struct instead of manually packing into an arrayoli-2/+2
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-14/+16
2020-11-03Auto merge of #78711 - m-ou-se:rollup-pxqnny7, r=m-ou-sebors-50/+129
Rollup of 7 pull requests Successful merges: - #77950 (Add support for SHA256 source file hashing) - #78624 (Sync rustc_codegen_cranelift) - #78626 (Improve errors about #[deprecated] attribute) - #78659 (Corrected suggestion for generic parameters in `function_item_references` lint) - #78687 (Suggest library/std when running all stage 0 tests) - #78699 (Show more error information in lldb_batchmode) - #78709 (Fix panic in bootstrap for non-workspace path dependencies.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-03Rollup merge of #78709 - ehuss:fix-in_tree_crates-non-member, r=Mark-SimulacrumMara Bos-0/+4
Fix panic in bootstrap for non-workspace path dependencies. If you add a `path` dependency to a `Cargo.toml` that is located outside of the workspace, then the `in_tree_crates` function can panic because it finds a path dependency that is not defined (since it uses `cargo metadata --no-deps`). This fixes it by skipping over those entries, which are usually not things you select on the command-line. Fixes #78617
2020-11-03Rollup merge of #78699 - pietroalbini:lldb-error, r=jyn514Mara Bos-2/+2
Show more error information in lldb_batchmode Even more information to try and debug #78665.
2020-11-03Rollup merge of #78687 - jyn514:bootstrap-help, r=Mark-SimulacrumMara Bos-1/+2
Suggest library/std when running all stage 0 tests r? ``@Mark-Simulacrum`` cc ``@ijackson`` For context, this came out of a discord conversation where ``@ijackson`` was running `test --stage 1` when they were only adding doc-tests to the standard library.
2020-11-03Rollup merge of #78659 - ayrtonm:fn-ref-lint-fix, r=oli-obkMara Bos-31/+75
Corrected suggestion for generic parameters in `function_item_references` lint This commit handles functions with generic type parameters like you pointed out as well as const generics. Also this is probably a minor thing, but the type alias you used in the example doesn't show up so the suggestion right now would be `size_of::<[u8; 16]> as fn() ->`. This is because the lint checker works with MIR instead of HIR. I don't think we can get the alias at that point, but let me know if I'm wrong and there's a way to fix this. Also I put you as the reviewer, but I'm not sure if you want to review it or if it makes more sense to ask one of the original reviewers of this lint. closes #78571
2020-11-03Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, ↵Mara Bos-15/+36
r=estebank Improve errors about #[deprecated] attribute This change: 1. Turns `#[deprecated]` on a trait impl block into an error, which fixes #78625; 2. Changes these and other errors about `#[deprecated]` to use the span of the attribute instead of the item; and 3. Turns this error into a lint, to make sure it can be capped with `--cap-lints` and doesn't break any existing dependencies. Can be reviewed per commit. --- Example: ```rust struct X; #[deprecated = "a"] impl Default for X { #[deprecated = "b"] fn default() -> Self { X } } ``` Before: ``` error: This deprecation annotation is useless --> src/main.rs:6:5 | 6 | / fn default() -> Self { 7 | | X 8 | | } | |_____^ ``` After: ``` error: this `#[deprecated]' annotation has no effect --> src/main.rs:3:1 | 3 | #[deprecated = "a"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute | = note: `#[deny(useless_deprecated)]` on by default error: this `#[deprecated]' annotation has no effect --> src/main.rs:5:5 | 5 | #[deprecated = "b"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute ```
2020-11-03Rollup merge of #77950 - arlosi:sha256, r=eddybMara Bos-1/+10
Add support for SHA256 source file hashing Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11. Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256. r? `@eddyb` cc #70401 `@est31`
2020-11-03Fix panic in bootstrap for non-workspace path dependencies.Eric Huss-0/+4
2020-11-03Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiserbors-346/+373
Properly handle lint spans after MIR inlining The first commit shows what happens when we apply mir inlining and then cause lints on the inlined MIR. The second commit fixes that. r? `@wesleywiser`
2020-11-03lldb_batchmode: show more error informationPietro Albini-2/+2
Even more information to try and debug #78665.
2020-11-03Rollup merge of #78676 - kiffie:embedded-bare-mipsr2, r=jonas-schievinkYuki Okushi-0/+1
add mipsel-unknown-none target This adds a target for bare MIPS32r2, little endian, softfloat. This target can be used for PIC32 microcontrollers (or possibly for other devices that have a MIPS MCU core such as the M4K core). Tried to find a name for the target that is in line with the naming scheme apparently used for the other MIPS targets. r? `@jonas-schievink`
2020-11-03Rollup merge of #78663 - Aaron1011:fix/cap-future-compat, r=tmandryYuki Okushi-0/+21
Fix ICE when a future-incompat-report has its command-line level capped Fixes #78660 With PR https://github.com/rust-lang/rust/pull/75534 merged, we now run more lint-related code for future-incompat-report, even when their final level is Allow. Some lint-related code was not expecting `Level::Allow`, and had an explicit panic. This PR explicitly tracks the lint level set on the command line before `--cap-lints` is applied. This is used to emit a more precise error note (e.g. we don't say that `-W lint-name` was specified on the command line just because a lint was capped to Warn). As a result, we can now correctly emit a note that `-A` was used if we got `Level::Allow` from the command line (before the cap is applied).
2020-11-03Rollup merge of #78616 - richkadel:unstable-book-instr-cov, r=tmandryYuki Okushi-0/+169
Document -Zinstrument-coverage r? ``@tmandry`` FYI ``@wesleywiser`` Here is my proposed document for LLVM source-based code coverage. I based it on the `profile.md` page, in the same directory, and on the Clang guide for LLVM source-based coverage.
2020-11-03Rollup merge of #78575 - tmiasko:compiletest-rustc-env, r=Aaron1011Yuki Okushi-3/+30
Add a test for compiletest rustc-env & unset-rustc-env directives ... and move compiletest meta tests into a separate directory.
2020-11-03Rollup merge of #78400 - GuillaumeGomez:fix-unindent, r=jyn514Yuki Okushi-92/+163
Fix unindent in doc comments Fixes #70732 r? ``@jyn514``
2020-11-03Rollup merge of #78376 - Aaron1011:feature/consistent-empty-expr, r=petrochenkovYuki Okushi-1/+28
Treat trailing semicolon as a statement in macro call See #61733 (comment) We now preserve the trailing semicolon in a macro invocation, even if the macro expands to nothing. As a result, the following code no longer compiles: ```rust macro_rules! empty { () => { } } fn foo() -> bool { //~ ERROR mismatched { true } //~ ERROR mismatched empty!(); } ``` Previously, `{ true }` would be considered the trailing expression, even though there's a semicolon in `empty!();` This makes macro expansion more token-based.
2020-11-02Suggest library/std when running all stage 0 testsJoshua Nelson-1/+2
2020-11-02add mipsel-unknown-none targetStephan-0/+1
2020-11-03Expand `NtExpr` tokens only in key-value attributesVadim Petrochenkov-1/+251
2020-11-02addressed feedbackRich Kadel-15/+24
2020-11-02Use reparsed `TokenStream` if we captured any inner attributesAaron Hill-0/+118
Fixes #78675 We now bail out of `prepend_attrs` if we ended up capturing any inner attributes (which can happen in several places, due to token capturing for `macro_rules!` arguments.
2020-11-02Treat trailing semicolon as a statement in macro callAaron Hill-1/+28
See https://github.com/rust-lang/rust/issues/61733#issuecomment-716188981 We now preserve the trailing semicolon in a macro invocation, even if the macro expands to nothing. As a result, the following code no longer compiles: ```rust macro_rules! empty { () => { } } fn foo() -> bool { //~ ERROR mismatched { true } //~ ERROR mismatched empty!(); } ``` Previously, `{ true }` would be considered the trailing expression, even though there's a semicolon in `empty!();` This makes macro expansion more token-based.
2020-11-02Auto merge of #78667 - pietroalbini:lldb-unbuffered, r=Mark-Simulacrumbors-0/+1
Try running lldb_batchmode.py with PYTHONUNBUFFERED When reporting fatal errors, LLVM calls abort() to exit the program. There is a chance that might interfere with Python printing stuff to stdout, as by default it relies on buffering to increase performance. This commit tries to disable Python buffering, to hopefully get useful logs while debugging #78665.
2020-11-02Improve deprecation attribute diagnostic messages.Mara Bos-15/+7
(From the PR feedback.) Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
2020-11-02compiletest: try running lldb_batchmode.py with PYTHONUNBUFFEREDPietro Albini-0/+1
When reporting fatal errors, LLVM calls abort() to exit the program. There is a chance that might interfere with Python printing stuff to stdout, as by default it relies on buffering to increase performance. This commit tries to disable Python buffering, to hopefully get useful logs while debugging #78665.
2020-11-02Auto merge of #78661 - JohnTitor:rollup-er2isja, r=JohnTitorbors-55/+25
Rollup of 5 pull requests Successful merges: - #78606 (Clarify handling of final line ending in str::lines()) - #78610 (Do not remove tokens before AST json serialization) - #78620 (Trivial fixes to bitwise operator documentation) - #78627 (Point out that total_cmp is no strict superset of partial comparison) - #78637 (Add fetch_update methods to AtomicBool and AtomicPtr) Failed merges: r? `@ghost`
2020-11-02Only separate notes if span is multilineYuki Okushi-6/+3
2020-11-02Add "this has type `{}` which {}" noteYuki Okushi-0/+13
2020-11-02Address some code reviewsYuki Okushi-16/+4
2020-11-02Separate complex multispan into some notesYuki Okushi-25/+30
2020-11-02Avoid complex diagnostics in snippets which contain newlinesYuki Okushi-0/+56
2020-11-02Fix ICE when a future-incompat-report has its command-line level cappedAaron Hill-0/+21
Fixes #78660 With PR https://github.com/rust-lang/rust/pull/75534 merged, we now run more lint-related code for future-incompat-report, even when their final level is Allow. Some lint-related code was not expecting `Level::Allow`, and had an explicit panic. This PR explicitly tracks the lint level set on the command line before `--cap-lints` is applied. This is used to emit a more precise error note (e.g. we don't say that `-W lint-name` was specified on the command line just because a lint was capped to Warn). As a result, we can now correctly emit a note that `-A` was used if we got `Level::Allow` from the command line (before the cap is applied).
2020-11-02Rollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011Yuki Okushi-55/+25
Do not remove tokens before AST json serialization `TokenStripper` is error-prone and introduces one more use of `MutVisitor`. It's much simpler to treat serialization as just one more place that wants lazy token stream to turn into a real token stream. Also, no code is better than more code, in general. r? @Aaron1011 (I also merged tests for `TokenStripper` ICEs into one.)
2020-11-01Document -Zinstrument-coverageRich Kadel-0/+160
2020-11-01Corrected suggestion for generic parameters in `function_item_references` lintAyrton-31/+75
This lint was incorrectly suggesting casting a function to a pointer without specifying generic type parameters or const generics. This would cause a compiler error since the missing parameters couldn't be inferred. This commit fixed the suggestion and added a few tests with generics.
2020-11-01Add delay_span_bug to no longer ICEkadmin-0/+16
2020-11-01Improve code in unindent_comment a bit moreGuillaume Gomez-21/+22
2020-11-01Add test for #[deprecated] attribute on trait impl block.Mara Bos-1/+18
2020-11-01Use the right span for errors about #[deprecated] attributes.Mara Bos-14/+26
2020-11-01Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelixbors-9/+201
Implement rustc side of report-future-incompat cc https://github.com/rust-lang/rust/issues/71249 This is an alternative to `@pnkfelix's` initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch :smile: ). My approach outputs the entire original `Diagnostic`, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing `-Z emit-future-incompat-report` to `rustc`. Several changes are made to support this feature: * The `librustc_session/lint` module is moved to a new crate `librustc_lint_defs` (name bikesheddable). This allows accessing lint definitions from `librustc_errors`. * The `Lint` struct is extended with an `Option<FutureBreakage>`. When present, it indicates that we should display a lint in the future-compat report. `FutureBreakage` contains additional information that we may want to display in the report (currently, a `date` field indicating when the crate will stop compiling). * A new variant `rustc_error::Level::Allow` is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via `#[allow]` or `--cap-lints`). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to the `Emitter`. * `DiagnosticId::Lint` is extended with a `has_future_breakage` field, indicating whether or not the `Lint` has future breakage information (and should therefore show up in the report). * `Session` is given access to the `LintStore` via a new `SessionLintStore` trait (since `librustc_session` cannot directly reference `LintStore` without a cyclic dependency). We use this to turn a string `DiagnosticId::Lint` back into a `Lint`, to retrieve the `FutureBreakage` data. Currently, `FutureBreakage.date` is always set to `None`. However, this could potentially be interpreted by Cargo in the future. I've enabled the future-breakage report for the `ARRAY_INTO_ITER` lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in [RFC 2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)) without needing to parse the diagnostic itself. cc `@pnkfelix`
2020-11-01Auto merge of #78553 - Nadrieril:fix-78549, r=varkorbors-6/+31
Fix #78549 Before #78430, this worked because `specialize_constructor` didn't actually care too much which constructor was passed to it unless needed. That PR however handles `&str` as a special case, and I did not anticipate patterns for the `&str` type other than string literals. I am not very confident there are not other similar oversights left, but hopefully only `&str` was different enough to break my assumptions. Fixes https://github.com/rust-lang/rust/issues/78549
2020-11-01Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkovbors-22/+69
Suggest calling associated `fn` inside `trait`s When calling a function that doesn't exist inside of a trait's associated `fn`, and another associated `fn` in that trait has that name, suggest calling it with the appropriate fully-qualified path. Expand the label to be more descriptive. Prompted by the following user experience: https://users.rust-lang.org/t/cannot-find-function/50663
2020-11-01Fix #78549Nadrieril-6/+31
Before #78430, string literals worked because `specialize_constructor` didn't actually care too much which constructor was passed to it unless needed. Since then, string literals are special cased and a bit hacky. I did not anticipate patterns for the `&str` type other than string literals, hence this bug. This makes string literals less hacky.
2020-11-01Do not remove tokens before AST json serializationVadim Petrochenkov-55/+25