about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-05-30Restrict access to crate_name.Camille GILLOT-2/+3
Also remove original_crate_name, which had the exact same implementation
2021-05-30Auto merge of #85804 - bjorn3:merge_crate_disambiguator, r=cjgillotbors-92/+92
Merge CrateDisambiguator into StableCrateId This simplifies the code and potentially improves performance by reducing the amount of hashed data. Fixes https://github.com/rust-lang/rust/issues/85795
2021-05-30Auto merge of #84586 - GuillaumeGomez:enforce-rustdoc-gui-test-suite-run, ↵bors-77/+135
r=Mark-Simulacrum Enforce rustdoc-gui test-suite run Part of https://github.com/rust-lang/rust/issues/84550
2021-05-30Update mir opt testsbjorn3-24/+24
2021-05-30Update testsbjorn3-68/+68
2021-05-30Auto merge of #85786 - GuillaumeGomez:error-code-checker-improvement, ↵bors-9/+18
r=Mark-Simulacrum Error code checker improvement Just realized that some error codes shouldn't be ignored anymore. So I updated the script to ensure that if an error code is tested and ignored, it will trigger an error.
2021-05-30Auto merge of #83772 - jhpratt:revamp-step-trait, r=Mark-Simulacrumbors-11/+17
Make `Step` trait safe to implement This PR makes a few modifications to the `Step` trait that I believe better position it for stabilization in the short term. In particular, 1. `unsafe trait TrustedStep` is introduced, indicating that the implementation of `Step` for a given type upholds all stated invariants (which have remained unchanged). This is gated behind a new `trusted_step` feature, as stabilization is realistically blocked on min_specialization. 2. The `Step` trait is internally specialized on the `TrustedStep` trait, which avoids a serious performance regression. 3. `TrustedLen` is implemented for `T: TrustedStep` as the latter's invariants subsume the former's. 4. The `Step` trait is no longer `unsafe`, as the invariants must not be relied upon by unsafe code (unless the type implements `TrustedStep`). 5. `TrustedStep` is implemented for all types that implement `Step` in the standard library and compiler. 6. The `step_trait_ext` feature is merged into the `step_trait` feature. I was unable to find any reasoning for the features being split; the `_unchecked` methods need not necessarily be stabilized at the same time, but I think it is useful to have them under the same feature flag. All existing implementations of `Step` will be broken, as it is not possible to `unsafe impl` a safe trait. Given this trait only exists on nightly, I feel this breakage is acceptable. The blanket `impl<T: Step> TrustedLen for T` will likely cause some minor breakage, but this should be covered by the equivalent impl for `TrustedStep`. Hopefully these changes are sufficient to place `Step` in decent position for stabilization, which would allow user-defined types to be used with `a..b` syntax.
2021-05-29Auto merge of #85698 - ehuss:incremental-session-panic, r=estebankbors-0/+15
Don't panic when failing to initialize incremental directory. This removes a panic when rustc fails to initialize the incremental directory. This can commonly happen on various filesystems that don't support locking (often various network filesystems). Panics can be confusing and scary, and there are already plenty of issues reporting this. This has been panicking since 1.22 due to I think #44502 which was a major rework of how things work. Previously, things were simpler and the [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.21.0/src/librustc_incremental/persist/load.rs#L43-L65) function would emit an error and then continue on without panicking. With 1.22, [`load_dep_graph`](https://github.com/rust-lang/rust/blob/1.22.0/src/librustc_incremental/persist/load.rs#L44) was changed so that it assumes it can load the data without errors. Today, the problem is that it calls [`prepare_session_directory`](https://github.com/rust-lang/rust/blob/fbf1b1a7193cda17008ab590e06ad28d9924023b/compiler/rustc_interface/src/passes.rs#L175-L179) and then immediately calls `garbage_collect_session_directories` which will panic since the session is `IncrCompSession::NotInitialized`. The solution here is to have `prepare_session_directory` return an error that must be handled so that compilation stops if it fails. Some other options: * Ignore directory lock failures. * Print a warning on directory lock failure, but otherwise continue with incremental enabled. * Print a warning on directory lock failure, and disable incremental. * Provide a different locking mechanism. Cargo ignores lock errors if locking is not supported, so that would be a precedent for the first option. These options would require quite a bit more changes, but I'm happy to entertain any of them, as I think they all have valid justifications. There is more discussion on the many issues where this is reported: #49773, #59224, #66513, #76251. I'm not sure if this can be considered closing any of those, though, since I think there is some value in discussing if there is a way to avoid the error altogether. But I think it would make sense to at least close all but one to consolidate them.
2021-05-29Auto merge of #85540 - GuillaumeGomez:better-result-dom-generation, r=jshabors-22/+70
Better result dom generation First commit is from https://github.com/rust-lang/rust/pull/85506. We realized in https://github.com/rust-lang/rust/pull/85506#issuecomment-844984162 thanks to `@dns2utf8` that in some cases, the generated search result DOM was invalid. This was not strict enough and the DOM was inserted as a big string, which wasn't great. r? `@jsha`
2021-05-29Fix incremental-session-fail to work when run as root.Eric Huss-2/+1
2021-05-29Auto merge of #85767 - lqd:stackless_span_stacks, r=oli-obkbors-14/+15
A bit more polish on const eval errors This PR adds a bit more polish to the const eval errors: - a slight improvement to the PME messages from #85633: I mentioned there that the erroneous item's paths were dependent on the environment, and could be displayed fully qualified or not. This can obscure the items when they come from a dependency. This PR uses the pretty-printing code ensuring the items' paths are not trimmed. - whenever there are generics involved in an item where const evaluation errors out, the error message now displays the instance and its const arguments, so that we can see which instantiated item and compile-time values lead to the error. So we get this slight improvement for our beloved `stdarch` example, on nightly: ``` error[E0080]: evaluation of constant value failed --> ./stdarch/crates/core_arch/src/macros.rs:8:9 | 8 | assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', /rustc/9111b8ae9793f18179a1336417618fc07a9cac85/library/core/src/../../stdarch/crates/core_arch/src/macros.rs:8:9 | ``` to this PR's: ``` error[E0080]: evaluation of `core::core_arch::macros::ValidateConstImm::<51_i32, 0_i32, 15_i32>::VALID` failed --> ./stdarch/crates/core_arch/src/macros.rs:8:9 | 8 | assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', ./stdarch/crates/core_arch/src/macros.rs:8:9 | ``` with this PR. Of course this is an idea from Oli, so maybe r? `@oli-obk` if they have the time.
2021-05-29Auto merge of #85798 - hyd-dev:miri, r=RalfJungbors-8/+8
Update Miri Fixes #85780.
2021-05-29Auto merge of #85790 - ehuss:nvptx-no-std, r=nagisabors-1/+1
Fix typo on nvptx support I made a minor mistake in https://github.com/rust-lang/rust-forge/pull/356 setting nvptx as std instead of no-std.
2021-05-29Update Mirihyd-dev-8/+8
2021-05-28Auto merge of #85607 - LeSeulArtichaut:thir-unsafeck-closures, r=nikomatsakisbors-15/+143
Make closures inherit their parent's "safety context" Fixes rust-lang/project-thir-unsafeck#9, ~~blocked on #85273~~. r? `@nikomatsakis`
2021-05-28Fix typo on nvptx supportEric Huss-1/+1
2021-05-28Clean up error codes from being ignoredGuillaume Gomez-6/+5
2021-05-28Add checks to ensure the error_codes checker is "clean"Guillaume Gomez-3/+13
2021-05-28Auto merge of #85700 - Bobo1239:dso_local_ppc64, r=nagisabors-2/+9
Fix static relocation model for PowerPC64 We now also use `should_assume_dso_local()` for declarations and port two additional cases from clang: - Exclude PPC64 [1] - Exclude thread-local variables [2] [1]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1038-L1040 [2]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1048-L1050 Tbh I don't know enough about PowerPC(64) to explain why the TOC (table of contents; like the GOT in x86?) is still needed even with the static relocation model. But with these changes [Rust-For-Linux](https://github.com/Rust-for-Linux/linux) runs again on ppc64le. (instead of [getting loaded successfully but crashing](https://github.com/Bobo1239/linux/runs/2646478783?check_suite_focus=true#step:47:358)) r? `@nagisa`
2021-05-28Auto merge of #84968 - FabianWolff:master, r=estebankbors-7/+22
Fix incorrect suggestions for E0605 Fixes #84598. Here is a simplified version of the problem presented in issue #84598: ```Rust #![allow(unused_variables)] #![allow(dead_code)] trait T { fn t(&self) -> i32; } unsafe fn foo(t: *mut dyn T) { (t as &dyn T).t(); } fn main() {} ``` The current output is: ``` error[E0605]: non-primitive cast: `*mut (dyn T + 'static)` as `&dyn T` --> src/main.rs:7:5 | 7 | (t as &dyn T).t(); | ^^^^^^^^^^^^^ invalid cast | help: borrow the value for the cast to be valid | 7 | (&t as &dyn T).t(); | ^ ``` This is incorrect, though: The cast will _not_ be valid when writing `&t` instead of `t`: ``` error[E0277]: the trait bound `*mut (dyn T + 'static): T` is not satisfied --> t4.rs:7:6 | 7 | (&t as &dyn T).t(); | ^^ the trait `T` is not implemented for `*mut (dyn T + 'static)` | = note: required for the cast to the object type `dyn T` ``` The correct suggestion is `&*t`, which I have implemented in this pull request. Of course, this suggestion will always require an unsafe block, but arguably, that's what the user really wants if they're trying to cast a pointer to a reference. In any case, claiming that the cast will be valid after implementing the suggestion is overly optimistic, as the coercion logic doesn't seem to resolve all nested obligations, i.e. the cast may still be invalid after implementing the suggestion. I have therefore rephrased the suggestion slightly ("consider borrowing the value" instead of "borrow the value for the cast to be valid"). Additionally, I have fixed another incorrect suggestion not mentioned in #84598, which relates to casting immutable references to mutable ones: ```rust fn main() { let mut x = 0; let m = &x as &mut i32; } ``` currently leads to ``` error[E0605]: non-primitive cast: `&i32` as `&mut i32` --> t5.rs:3:13 | 3 | let m = &x as &mut i32; | ^^^^^^^^^^^^^^ invalid cast | help: borrow the value for the cast to be valid | 3 | let m = &mut &x as &mut i32; | ^^^^ ``` which is obviously incorrect: ``` error[E0596]: cannot borrow data in a `&` reference as mutable --> t5.rs:3:13 | 3 | let m = &mut &x as &mut i32; | ^^^^^^^ cannot borrow as mutable ``` I've changed the suggestion to a note explaining the problem: ``` error[E0605]: non-primitive cast: `&i32` as `&mut i32` --> t5.rs:3:13 | 3 | let m = &x as &mut i32; | ^^^^^^^^^^^^^^ invalid cast | note: this reference is immutable --> t5.rs:3:13 | 3 | let m = &x as &mut i32; | ^^ note: trying to cast to a mutable reference type --> t5.rs:3:19 | 3 | let m = &x as &mut i32; | ^^^^^^^^ ``` In this example, it would have been even nicer to suggest replacing `&x` with `&mut x`, but this would be much more complex because we would have to take apart the expression to be cast (currently, we only look at its type), and `&x` could be stored in a variable, where such a suggestion would not even be directly applicable: ```rust fn main() { let mut x = 0; let r = &x; let m = r as &mut i32; } ``` My solution covers this case, too.
2021-05-28Fix static relocation model for PowerPC64Boris-Chengbiao Zhou-2/+9
We now also use `should_assume_dso_local()` for declarations and port two additional cases from clang: - Exclude PPC64 [1] - Exclude thread-local variables [2] [1]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1038-L1040 [2]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1048-L1050
2021-05-28Auto merge of #85743 - bjorn3:sync_cg_clif-2021-05-27, r=bjorn3bors-10/+0
Sync rustc_codegen_cranelift The main highlight this sync is the removal of several dependencies, making compilation of cg_clif itself faster. There have also been a couple of new features like `#[link_section]` now supporting different segments for Mach-O binaries (thanks `@eggyal!)` and the `imported_main` feature, which is currently unstable. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2021-05-28const eval errors: display the current item instance if there are generics ↵Rémy Rakic-12/+13
involved
2021-05-27don't trim paths in collector PME messageRémy Rakic-2/+2
2021-05-27Test THIR unsafeck for unsafe ops in closuresLeSeulArtichaut-15/+143
2021-05-27Rollup merge of #85722 - GuillaumeGomez:trait-toggle, r=jshaGuillaume Gomez-5/+18
Fix trait methods' toggle A `<details>` tag wasn't closed on trait methods, which created broken DOM. I also used this occasion to only generate the toggle in case there is documentation on the method. r? `@jsha`
2021-05-27Remove unused tidy dep exceptionsbjorn3-10/+0
2021-05-27Auto merge of #85732 - Smittyvb:trait-alias-camelcase-lint, r=varkorbors-0/+18
Lint against non-CamelCase trait alias names Type aliases are linted as such, so (unstable) trait aliases should be treated the same way.
2021-05-27Auto merge of #85734 - Dylan-DPC:rollup-q6iiees, r=Dylan-DPCbors-178/+271
Rollup of 8 pull requests Successful merges: - #84221 (E0599 suggestions and elision of generic argument if no canditate is found) - #84701 (stabilize member constraints) - #85564 ( readd capture disjoint fields gate) - #85583 (Get rid of PreviousDepGraph.) - #85649 (Update cc) - #85689 (Remove Iterator #[rustc_on_unimplemented]s that no longer apply.) - #85719 (Add inline attr to CString::into_inner so it can optimize out NonNull checks) - #85725 (Remove unneeded workaround) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-05-26Add test to check behavior when incremental session init fails.Eric Huss-0/+16
2021-05-27Rollup merge of #85649 - ChrisDenton:update-cc, r=matthewjasperDylan DPC-1/+1
Update cc Recent commits have improved `cc`'s finding of MSVC tools on Windows. In particular it should help to address these issues: #83043 and #43468
2021-05-27Rollup merge of #85564 - ↵Dylan DPC-0/+27
pnkfelix:issue-85435-readd-capture-disjoint-fields-gate, r=nikomatsakis readd capture disjoint fields gate This readds a feature gate guard that was added in PR #83521. (Basically, there were unintended consequences to the code exposed by removing the feature gate guard.) The root bug still remains to be resolved, as discussed in issue #85561. This is just a band-aid suitable for a beta backport. Cc issue #85435 Note that the latter issue is unfixed until we backport this (or another fix) to 1.53 beta
2021-05-27Rollup merge of #84701 - nikomatsakis:stabilize-member-constraints-61997, ↵Dylan DPC-169/+29
r=jackh726 stabilize member constraints Stabilizes the use of "member constraints" in solving `impl Trait` bindings. This is a step towards stabilizing a "MVP" of "named impl Trait". # Member constraint stabilization report | Info | | | --- | --- | | Tracking issue | [rust-lang/rust#61997](https://github.com/rust-lang/rust/issues/61997) | | Implementation history | [rust-lang/rust#61775] | | rustc-dev-guide coverage | [link](https://rustc-dev-guide.rust-lang.org/borrow_check/region_inference/member_constraints.html) | | Complications | [rust-lang/rust#61773] | [rust-lang/rust#61775]: https://github.com/rust-lang/rust/pull/61775 [rust-lang/rust#61773]: https://github.com/rust-lang/rust/issues/61773 ## Background Member constraints are an extension to our region solver that was introduced to make async fn region solving tractable. There are used in situations like the following: ```rust fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. } ``` The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`). This cannot be expressed simply via 'outlives constriants' like `R: 'a`. Therefore, we introduce a 'member constraint' `R member of ['a, 'b]`. These constraints were introduced in [rust-lang/rust#61775]. At the time, we kept them feature gated and used them only for `impl Trait` return types that are derived from `async fn`. The intention, however, was always to support them in other contexts once we had time to gain more experience with them. **In the time since their introduction, we have encountered no surprises or bugs due to these member constraints.** They are tested extensively as part of every async function that involves multiple unrelated lifetimes in its arguments. ## Tests The behavior of member constraints is covered by the following tests: * [`src/test/ui/async-await/multiple-lifetimes`](https://github.com/rust-lang/rust/tree/20e032e65007ff1376e8480c1fbdb0a5068028fa/src/test/ui/async-await/multiple-lifetimes) -- tests using the async await, which are mostly already stabilized * [`src/test/ui/impl-trait/multiple-lifetimes.rs`](https://github.com/rust-lang/rust/blob/20e032e65007ff1376e8480c1fbdb0a5068028fa/src/test/ui/impl-trait/multiple-lifetimes.rs) * [`src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs`](https://github.com/rust-lang/rust/blob/20e032e65007ff1376e8480c1fbdb0a5068028fa/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs) * [`src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs`](https://github.com/rust-lang/rust/blob/20e032e65007ff1376e8480c1fbdb0a5068028fa/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs) * [`src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs`](https://github.com/rust-lang/rust/blob/20e032e65007ff1376e8480c1fbdb0a5068028fa/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs) These tests cover a number of scenarios: * `-> implTrait<'a, 'b>` with unrelated lifetimes `'a` and `'b`, as described above * `async fn` that returns an `impl Trait` like the previous case, which desugars to a kind of "nested" impl trait like `impl Future<Output = impl Trait<'a, 'b>>` ## Potential concerns There is a potential interaction with `impl Trait` on local variables, described in [rust-lang/rust#61773]. The challenge is that if you have a program like: ```rust= trait Foo<'_> { } impl Foo<'_> for &u32 { } fn bar() { let x: impl Foo<'_> = &44; // let's call the region variable for `'_` `'1` } ``` then we would wind up with `'0 member of ['1, 'static]`, where `'0` is the region variable in the hidden type (`&'0 u32`) and `'1` is the region variable in the bounds `Foo<'1>`. This is tricky because both `'0` and `'1` are being inferred -- so making them equal may have other repercussions. That said, `impl Trait` in bindings are not stable, and the implementation is pretty far from stabilization. Moreover, the difficulty highlighted here is not due to the presence of member constraints -- it's inherent to the design of the language. In other words, stabilizing member constraints does not actually cause us to accept anything that would make this problem any harder. So I don't see this as a blocker to stabilization of member constraints; it is potentially a blocker to stablization of `impl trait` in let bindings.
2021-05-27Rollup merge of #84221 - ABouttefeux:generic-arg-elision, r=estebankDylan DPC-8/+214
E0599 suggestions and elision of generic argument if no canditate is found fixes #81576 changes: In error E0599 (method not found) generic argument are eluded if the method was not found anywhere. If the method was found in another inherent implementation suggest that it was found elsewhere. Example ```rust struct Wrapper<T>(T); struct Wrapper2<T> { x: T, } impl Wrapper2<i8> { fn method(&self) {} } fn main() { let wrapper = Wrapper(i32); wrapper.method(); let wrapper2 = Wrapper2{x: i32}; wrapper2.method(); } ``` ``` Error[E0599]: no method named `method` found for struct `Wrapper<_>` in the current scope .... error[E0599]: no method named `method` found for struct `Wrapper2<i32>` in the current scope ... = note: The method was found for Wrapper2<i8>. ``` I am not very happy with the ```no method named `test` found for struct `Vec<_, _>` in the current scope```. I think it might be better to show only one generic argument `Vec<_>` if there is a default one. But I haven't yet found a way to do that,
2021-05-26Lint against non-camelCase trait alias namesSmitty-0/+18
Type aliases are linted as such, so (unstable) trait aliases should be treated the same way.
2021-05-26Auto merge of #85652 - ehuss:linkchecker-perf, r=Mark-Simulacrumbors-227/+505
Optimize linkchecker and add report. This makes three changes to the linkchecker: * Adds a report displayed after it finishes. * Improves the performance by caching all filesystem access. The linkchecker can take over a minute to run on some systems, and this should make it about 2-3 times faster. * Added a few tests.
2021-05-26Bless test outputJacob Pratt-9/+16
2021-05-26Unify feature flags as `step_trait`Jacob Pratt-1/+0
While stdlib implementations of the unchecked methods require unchecked math, there is no reason to gate it behind this for external users. The reasoning for a separate `step_trait_ext` feature is unclear, and as such has been merged as well.
2021-05-26Auto merge of #85721 - Xanewok:update-rls, r=Xanewokbors-0/+0
Update RLS Closes #85453 r? `@ghost`
2021-05-26bless compare-mode=nll outputNiko Matsakis-3/+3
2021-05-26Update trait toggle testGuillaume Gomez-1/+5
2021-05-26* Fix bug where some <details> tags were not closed.Guillaume Gomez-4/+13
* Don't generate a <details> if there is no documentation
2021-05-26Update RLSIgor Matuszewski-0/+0
2021-05-26Rollup merge of #85678 - lukas-code:matches2021, r=dtolnayDylan DPC-0/+12
fix `matches!` and `assert_matches!` on edition 2021 Previously this code failed to compile on edition 2021. [(Playground)](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=53960f2f051f641777b9e458da747707) ```rust fn main() { matches!((), ()); } ``` ``` Compiling playground v0.0.1 (/playground) error: `$pattern:pat` may be followed by `|`, which is not allowed for `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` error: aborting due to previous error error: could not compile `playground` To learn more, run the command again with --verbose. ```
2021-05-26Rollup merge of #85633 - lqd:stackless_span_stacks, r=oli-obkDylan DPC-0/+56
Post-monomorphization errors traces MVP This PR works towards better diagnostics for the errors encountered in #85155 and similar. We can encounter post-monomorphization errors (PMEs) when collecting mono items. The current diagnostics are confusing for these cases when they happen in a dependency (but are acceptable when they happen in the local crate). These kinds of errors will be more likely now that `stdarch` uses const generics for its intrinsics' immediate arguments, and validates these const arguments with a mechanism that triggers such PMEs. (Not to mention that the errors happen during codegen, so only when building code that actually uses these code paths. Check builds don't trigger them, neither does unused code) So in this PR, we detect these kinds of errors during the mono item graph walk: if any error happens while collecting a node or its neighbors, we print a diagnostic about the current collection step, so that the user has at least some context of which erroneous code and dependency triggered the error. The diagnostics for issue #85155 now have this note showing the source of the erroneous const argument: ``` note: the above error was encountered while instantiating `fn std::arch::x86_64::_mm_blend_ps::<51_i32>` --> issue-85155.rs:11:24 | 11 | let _blended = _mm_blend_ps(a, b, 0x33); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ``` Note that #85155 is a reduced version of a case happening in the wild, to indirect users of the `rustfft` crate, as seen in https://github.com/ejmahler/RustFFT/issues/74. The crate had a few of these out-of-range immediates. Here's how the diagnostics in this PR would have looked on one of its examples before it was fixed: <details> ``` error[E0080]: evaluation of constant value failed --> ./stdarch/crates/core_arch/src/macros.rs:8:9 | 8 | assert!(IMM >= MIN && IMM <= MAX, "IMM value not in expected range"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'IMM value not in expected range', ./stdarch/crates/core_arch/src/macros.rs:8:9 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) note: the above error was encountered while instantiating `fn _mm_blend_ps::<51_i32>` --> /tmp/RustFFT/src/avx/avx_vector.rs:1314:23 | 1314 | let blended = _mm_blend_ps(rows[0], rows[2], 0x33); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn _mm_permute_pd::<5_i32>` --> /tmp/RustFFT/src/avx/avx_vector.rs:1859:9 | 1859 | _mm_permute_pd(self, 0x05) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn _mm_permute_pd::<15_i32>` --> /tmp/RustFFT/src/avx/avx_vector.rs:1863:32 | 1863 | (_mm_movedup_pd(self), _mm_permute_pd(self, 0x0F)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. error: could not compile `rustfft` To learn more, run the command again with --verbose. ``` </details> I've developed and discussed this with them, so maybe r? `@oli-obk` -- but feel free to redirect to someone else of course. (I'm not sure we can say that this PR definitely closes issue 85155, as it's still unclear exactly which diagnostics and information would be interesting to report in such cases -- and we've discussed printing backtraces before. I have prototypes of some complete and therefore noisy backtraces I showed Oli, but we decided to not include them in this PR for now)
2021-05-26Rollup merge of #85627 - LeSeulArtichaut:thir-unsafe-fn-lint, r=nikomatsakisDylan DPC-16/+141
Fix a few details in THIR unsafeck This makes it consistent with RFC 2585 (`unsafe_op_in_unsafe_fn`) and with the MIR unsafeck. r? `@nikomatsakis`
2021-05-26Rollup merge of #85478 - FabianWolff:issue-85348, r=petrochenkovDylan DPC-0/+77
Disallow shadowing const parameters This pull request fixes #85348. Trying to shadow a `const` parameter as follows: ```rust fn foo<const N: i32>() { let N @ _ = 0; } ``` currently causes an ICE. With my changes, I get: ``` error[E0530]: let bindings cannot shadow const parameters --> test.rs:2:9 | 1 | fn foo<const N: i32>() { | - the const parameter `N` is defined here 2 | let N @ _ = 0; | ^ cannot be named the same as a const parameter error: aborting due to previous error ``` This is the same error you get when trying to shadow a constant: ```rust const N: i32 = 0; let N @ _ = 0; ``` ``` error[E0530]: let bindings cannot shadow constants --> src/lib.rs:3:5 | 2 | const N: i32 = 0; | ----------------- the constant `N` is defined here 3 | let N @ _ = 0; | ^ cannot be named the same as a constant error: aborting due to previous error ``` The reason for disallowing shadowing in both cases is described [here](https://github.com/rust-lang/rust/issues/33118#issuecomment-233962221) (the comment there only talks about constants, but the same reasoning applies to `const` parameters).
2021-05-26stabilize member constraintsNiko Matsakis-166/+26
2021-05-26Update install of browser-ui-test package in CIGuillaume Gomez-5/+7
2021-05-26Also run check in case there are changes in the rustdoc-gui toolsGuillaume Gomez-2/+4