Commit Graph

132988 Commits

Author SHA1 Message Date
bors
0c1531a5c4 Auto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis
Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](981346fc07/compiler/rustc_typeck/src/expr_use_visitor.rs (L28-L38)) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

 Closes: https://github.com/rust-lang/project-rfc-2229/issues/20

r? `@ghost`
2020-11-04 22:45:15 +00:00
bors
0fb00251a5 Auto merge of #78662 - sexxi-goose:add_expr_id_to_delegate, r=nikomatsakis
Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](981346fc07/compiler/rustc_typeck/src/expr_use_visitor.rs (L28-L38)) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

 Closes: https://github.com/rust-lang/project-rfc-2229/issues/20

r? `@ghost`
2020-11-04 22:45:15 +00:00
bors
0d2f1aef02 Auto merge of #6247 - giraffate:fix_suggestion_to_add_space_in_unused_unit, r=ebroto
Fix suggestion to add unneeded space in `unused_unit`

Fix https://github.com/rust-lang/rust-clippy/issues/6230

changelog: Fix suggestion to add unneeded space in `unused_unit`
2020-11-04 22:42:10 +00:00
bors
5b52474ae6 Auto merge of #5911 - hegza:issue-568, r=ebroto
Add lint for 'field_reassign_with_default` #568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes #568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](https://github.com/rust-lang/rust-clippy/pull/4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S
2020-11-04 22:21:44 +00:00
bors
62c0d29f17 Auto merge of #6292 - ebroto:rustup, r=ebroto
Rustup

changelog: none

r? `@ghost`
2020-11-04 21:53:32 +00:00
Eduardo Broto
f5166e81b1 Run cargo dev fmt 2020-11-04 22:41:15 +01:00
Eduardo Broto
834ad5c516 Merge remote-tracking branch 'upstream/master' into rustup 2020-11-04 22:37:11 +01:00
bors
f2bbdd0a32 Auto merge of #78740 - pietroalbini:no-more-legacy, r=Mark-Simulacrum
Remove legacy promote-release support from build-manifestg

Now that we're not running the [legacy `promote-release`](https://github.com/rust-lang/rust-central-station/tree/master/promote-release) anymore, this PR removes support from it from `bootstrap` and `build-manifest`.

r? `@Mark-Simulacrum`
2020-11-04 20:02:08 +00:00
Vishnunarayan K I
bd7229daf0 make intern_const_alloc_recursive return error fix #78655 2020-11-04 23:22:14 +05:30
Pietro Albini
53c1eb7a26
ci: demote i686-unknown-freebsd to tier 2 compiler target
While technically the i686-unknown-freebsd target has been a tier 2
development platform for a long time, with full toolchain tarballs
available on static.rust-lang.org, due to a bug in the manifest
generation the target was never available for download through rustup.

The infrastructure team privately inquired the FreeBSD package
maintainers, and they weren't relying on those tarballs either, so it's
a fair assumption to say practically nobody is using those tarballs.

This PR then removes the CI builder that produces full tarballs for the
target, and moves the compilation of rust-std for the target in
dist-various-2.

The x86_64-unknown-freebsd target is *not* affected.
2020-11-04 18:38:49 +01:00
bors
89631663b7 Auto merge of #78280 - bugadani:span, r=lcnr
Codegen: Query span as late as possible
2020-11-04 17:17:01 +00:00
Hameer Abbasi
a70e0c20c3 Fix issue 78654. 2020-11-04 16:04:32 +00:00
Daiki Ihara
232b9ba129 Move range in ui test to ops test in library/core 2020-11-05 00:00:44 +09:00
bors
75f1db1102 Auto merge of #77227 - oli-obk:const_val_🌳_prelude, r=RalfJung
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 14:26:03 +00:00
Oli Scherer
332750f9eb
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:13:06 +01:00
Oli Scherer
5f087f089f
Update compiler/rustc_target/src/abi/mod.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 15:12:44 +01:00
oli
6e6c8a86e9 u64::try_from will now fail if ScalarInt isn't exactly 64 bits, thus we use to_bits with the correct size 2020-11-04 13:59:11 +00:00
oli
97bfff1f56 Make ScalarInt entirely independent of MIR interpretation 2020-11-04 13:55:29 +00:00
Daniel Henry-Mantilla
69e5729c58 Simplify the implementation of get_mut (no unsafe) 2020-11-04 14:54:22 +01:00
oli
2e53625421 Document an unwrap 2020-11-04 13:44:17 +00:00
oli
abacaf2aef u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
Matthias Krüger
bcd2f2df67 fix a couple of clippy warnings:
filter_next
manual_strip
redundant_static_lifetimes
single_char_pattern
unnecessary_cast
unused_unit
op_ref
redundant_closure
useless_conversion
2020-11-04 13:48:50 +01:00
bors
601c13c6fd Auto merge of #78677 - Aaron1011:fix/capture-inner-attrs, r=petrochenkov
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-04 11:37:36 +00:00
est31
93fa023111 Fix outdated comment next to array_impl_default
The comment has become outdated as the array_impl macro
has been removed.
2020-11-04 12:21:22 +01:00
Kornel
340c94ad76 Expand explanation of reverse_bits 2020-11-04 11:21:07 +00:00
Benoît du Garreau
795bbfe056 Add tracking issue 2020-11-04 11:58:41 +01:00
Benoît du Garreau
9a12d727df Constantify UnsafeCell::into_inner and related
Also includes:
- Cell::into_inner
- RefCell::into_inner
- Atomic*::into_inner
2020-11-04 11:41:57 +01:00
oli
e67c768110 Move ZST constant to the top of the impl block 2020-11-04 10:15:54 +00:00
Oli Scherer
cb1cf6ae95 Update compiler/rustc_middle/src/ty/consts/int.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04 10:15:40 +00:00
oli
98b70c9ac0 Simplify assert_bits impl 2020-11-04 10:15:09 +00:00
oli
dad0036cb4 Do not raise interp errors from the scalar int module 2020-11-04 10:14:40 +00:00
oli
500af76831 Add helper for getting an int out of a Scalar 2020-11-04 10:13:59 +00:00
oli
f03b18b99b Add is_null helper
This is cheaper than creating a null-`ScalarInt` and comparing
and then just throwing it away.
2020-11-04 10:13:22 +00:00
oli
0347ca7d02 Explain why we forward to self-printing during self-printing 2020-11-04 10:13:09 +00:00
oli
d1074edb64 catch conversion errors during ptr_sized_op 2020-11-04 10:12:55 +00:00
oli
8282d526e0 Replace Scalar::zst with a Scalar::ZST constant 2020-11-04 10:12:41 +00:00
oli
b8751c1fbb No need for a zst constructor method when we can have a constant 2020-11-04 10:12:27 +00:00
oli
3ef9dfdd42 Update comment 2020-11-04 10:12:13 +00:00
oli
1eb300ede1 Unaligned reads are UB in Rust irrelevant on which platform we are 2020-11-04 10:11:59 +00:00
oli
e5258e6143 Remove outdated FIXME 2020-11-04 10:11:45 +00:00
oli
83edb2f4e4 s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
oli
df4d717d0b s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
oli
3a7970848c Fix cranelift build 2020-11-04 10:10:44 +00:00
oli
c478574786 Explain the use of blocks around self.data accesses 2020-11-04 10:10:04 +00:00
oli
02131f4dcd Use packed struct instead of manually packing into an array 2020-11-04 10:09:10 +00:00
Guillaume Gomez
8db2bf2b0c Add link to rust website 2020-11-04 11:06:42 +01:00
Oliver Scherer
6fdbde5f46 Split the "raw integer bytes" part out of Scalar 2020-11-04 09:58:59 +00:00
Oliver Scherer
ed7a4adeb3 32 bit platforms don't have 64 bit pointers 2020-11-04 09:58:59 +00:00
Oliver Scherer
eac309984f Encode ScalarInt::bytes as u128 instead of [u8; 16] to see if that caused the performance regression 2020-11-04 09:58:59 +00:00
Oliver Scherer
362123dd75 Split the "raw integer bytes" part out of Scalar 2020-11-04 09:58:59 +00:00