Commit Graph

120268 Commits

Author SHA1 Message Date
ThibsG
ab87f87ba0 Fix CHANGELOG.md and lint names plural 2020-05-15 18:27:11 +02:00
David Tolnay
d5ea925265
Implement Default for proc_macro::TokenStream 2020-05-15 09:12:41 -07:00
David Tolnay
4c4b4c4ab4
Add test of proc_macro::TokenStream's Debug 2020-05-15 09:04:00 -07:00
David Tolnay
45ee336007
Fix {:#?} representation of proc_macro::Literal
Before:

    TokenStream [
        Ident {
            ident: "name",
            span: #0 bytes(37..41),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(42..43),
        },
        Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } },
        Punct {
            ch: ',',
            spacing: Alone,
            span: #0 bytes(50..51),
        },
        Ident {
            ident: "owner",
            span: #0 bytes(56..61),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(62..63),
        },
        Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } },
    ]

After:

    TokenStream [
        Ident {
            ident: "name",
            span: #0 bytes(37..41),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(42..43),
        },
        Literal {
            kind: Str,
            symbol: "SNPP",
            suffix: None,
            span: #0 bytes(44..50),
        },
        Punct {
            ch: ',',
            spacing: Alone,
            span: #0 bytes(50..51),
        },
        Ident {
            ident: "owner",
            span: #0 bytes(56..61),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(62..63),
        },
        Literal {
            kind: Str,
            symbol: "Canary M Burns",
            suffix: None,
            span: #0 bytes(64..80),
        },
    ]
2020-05-15 08:36:33 -07:00
bors
e22ccf5332 Auto merge of #5592 - ebroto:extend_unused_unit, r=flip1995
unused_unit: lint also in type parameters and where clauses

changelog: unused_unit now also lints in type parameters and where clauses

Fixes #5585
2020-05-15 14:47:11 +00:00
SOFe
084cdde976
Updated documentation of Prefix::VerbatimDisk
PrefixComponent with Prefix::VerbatimDisk does not contain the trailing slash. The documentation here is also inconsistent with the documentation on other variants that reflect the `PrefixComponent::as_os_str()` return value.
2020-05-15 22:41:36 +08:00
Nathan Corbyn
00268be9da Remove lang_items\(\).*\.unwrap\(\) 2020-05-15 12:31:12 +01:00
bors
ed084b0b83 Auto merge of #69659 - CAD97:step-rework-take-3, r=Amanieu
Rework the std::iter::Step trait

Previous attempts: #43127 #62886 #68807
Tracking issue: #42168

This PR reworks the `Step` trait to be phrased in terms of the *successor* and *predecessor* operations. With this, `Step` hopefully has a consistent identity that can have a path towards stabilization. The proposed trait:

```rust
/// Objects that have a notion of *successor* and *predecessor* operations.
///
/// The *successor* operation moves towards values that compare greater.
/// The *predecessor* operation moves towards values that compare lesser.
///
/// # Safety
///
/// This trait is `unsafe` because its implementation must be correct for
/// the safety of `unsafe trait TrustedLen` implementations, and the results
/// of using this trait can otherwise be trusted by `unsafe` code to be correct
/// and fulful the listed obligations.
pub unsafe trait Step: Clone + PartialOrd + Sized {
    /// Returns the number of *successor* steps required to get from `start` to `end`.
    ///
    /// Returns `None` if the number of steps would overflow `usize`
    /// (or is infinite, or if `end` would never be reached).
    ///
    /// # Invariants
    ///
    /// For any `a`, `b`, and `n`:
    ///
    /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward(&a, n) == Some(b)`
    /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward(&a, n) == Some(a)`
    /// * `steps_between(&a, &b) == Some(n)` only if `a <= b`
    ///   * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b`
    ///   * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`;
    ///     this is the case wheen it would require more than `usize::MAX` steps to get to `b`
    /// * `steps_between(&a, &b) == None` if `a > b`
    fn steps_between(start: &Self, end: &Self) -> Option<usize>;

    /// Returns the value that would be obtained by taking the *successor*
    /// of `self` `count` times.
    ///
    /// If this would overflow the range of values supported by `Self`, returns `None`.
    ///
    /// # Invariants
    ///
    /// For any `a`, `n`, and `m`:
    ///
    /// * `Step::forward_checked(a, n).and_then(|x| Step::forward_checked(x, m)) == Step::forward_checked(a, m).and_then(|x| Step::forward_checked(x, n))`
    ///
    /// For any `a`, `n`, and `m` where `n + m` does not overflow:
    ///
    /// * `Step::forward_checked(a, n).and_then(|x| Step::forward_checked(x, m)) == Step::forward_checked(a, n + m)`
    ///
    /// For any `a` and `n`:
    ///
    /// * `Step::forward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::forward_checked(&x, 1))`
    ///   * Corollary: `Step::forward_checked(&a, 0) == Some(a)`
    fn forward_checked(start: Self, count: usize) -> Option<Self>;

    /// Returns the value that would be obtained by taking the *successor*
    /// of `self` `count` times.
    ///
    /// If this would overflow the range of values supported by `Self`,
    /// this function is allowed to panic, wrap, or saturate.
    /// The suggested behavior is to panic when debug assertions are enabled,
    /// and to wrap or saturate otherwise.
    ///
    /// Unsafe code should not rely on the correctness of behavior after overflow.
    ///
    /// # Invariants
    ///
    /// For any `a`, `n`, and `m`, where no overflow occurs:
    ///
    /// * `Step::forward(Step::forward(a, n), m) == Step::forward(a, n + m)`
    ///
    /// For any `a` and `n`, where no overflow occurs:
    ///
    /// * `Step::forward_checked(a, n) == Some(Step::forward(a, n))`
    /// * `Step::forward(a, n) == (0..n).fold(a, |x, _| Step::forward(x, 1))`
    ///   * Corollary: `Step::forward(a, 0) == a`
    /// * `Step::forward(a, n) >= a`
    /// * `Step::backward(Step::forward(a, n), n) == a`
    fn forward(start: Self, count: usize) -> Self {
        Step::forward_checked(start, count).expect("overflow in `Step::forward`")
    }

    /// Returns the value that would be obtained by taking the *successor*
    /// of `self` `count` times.
    ///
    /// # Safety
    ///
    /// It is undefined behavior for this operation to overflow the
    /// range of values supported by `Self`. If you cannot guarantee that this
    /// will not overflow, use `forward` or `forward_checked` instead.
    ///
    /// # Invariants
    ///
    /// For any `a`:
    ///
    /// * if there exists `b` such that `b > a`, it is safe to call `Step::forward_unchecked(a, 1)`
    /// * if there exists `b`, `n` such that `steps_between(&a, &b) == Some(n)`,
    ///   it is safe to call `Step::forward_unchecked(a, m)` for any `m <= n`.
    ///
    /// For any `a` and `n`, where no overflow occurs:
    ///
    /// * `Step::forward_unchecked(a, n)` is equivalent to `Step::forward(a, n)`
    #[unstable(feature = "unchecked_math", reason = "niche optimization path", issue = "none")]
    unsafe fn forward_unchecked(start: Self, count: usize) -> Self {
        Step::forward(start, count)
    }

    /// Returns the value that would be obtained by taking the *successor*
    /// of `self` `count` times.
    ///
    /// If this would overflow the range of values supported by `Self`, returns `None`.
    ///
    /// # Invariants
    ///
    /// For any `a`, `n`, and `m`:
    ///
    /// * `Step::backward_checked(a, n).and_then(|x| Step::backward_checked(x, m)) == n.checked_add(m).and_then(|x| Step::backward_checked(a, x))`
    /// * `Step::backward_checked(a, n).and_then(|x| Step::backward_checked(x, m)) == try { Step::backward_checked(a, n.checked_add(m)?) }`
    ///
    /// For any `a` and `n`:
    ///
    /// * `Step::backward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::backward_checked(&x, 1))`
    ///   * Corollary: `Step::backward_checked(&a, 0) == Some(a)`
    fn backward_checked(start: Self, count: usize) -> Option<Self>;

    /// Returns the value that would be obtained by taking the *predecessor*
    /// of `self` `count` times.
    ///
    /// If this would overflow the range of values supported by `Self`,
    /// this function is allowed to panic, wrap, or saturate.
    /// The suggested behavior is to panic when debug assertions are enabled,
    /// and to wrap or saturate otherwise.
    ///
    /// Unsafe code should not rely on the correctness of behavior after overflow.
    ///
    /// # Invariants
    ///
    /// For any `a`, `n`, and `m`, where no overflow occurs:
    ///
    /// * `Step::backward(Step::backward(a, n), m) == Step::backward(a, n + m)`
    ///
    /// For any `a` and `n`, where no overflow occurs:
    ///
    /// * `Step::backward_checked(a, n) == Some(Step::backward(a, n))`
    /// * `Step::backward(a, n) == (0..n).fold(a, |x, _| Step::backward(x, 1))`
    ///   * Corollary: `Step::backward(a, 0) == a`
    /// * `Step::backward(a, n) <= a`
    /// * `Step::forward(Step::backward(a, n), n) == a`
    fn backward(start: Self, count: usize) -> Self {
        Step::backward_checked(start, count).expect("overflow in `Step::backward`")
    }

    /// Returns the value that would be obtained by taking the *predecessor*
    /// of `self` `count` times.
    ///
    /// # Safety
    ///
    /// It is undefined behavior for this operation to overflow the
    /// range of values supported by `Self`. If you cannot guarantee that this
    /// will not overflow, use `backward` or `backward_checked` instead.
    ///
    /// # Invariants
    ///
    /// For any `a`:
    ///
    /// * if there exists `b` such that `b < a`, it is safe to call `Step::backward_unchecked(a, 1)`
    /// * if there exists `b`, `n` such that `steps_between(&b, &a) == Some(n)`,
    ///   it is safe to call `Step::backward_unchecked(a, m)` for any `m <= n`.
    ///
    /// For any `a` and `n`, where no overflow occurs:
    ///
    /// * `Step::backward_unchecked(a, n)` is equivalent to `Step::backward(a, n)`
    #[unstable(feature = "unchecked_math", reason = "niche optimization path", issue = "none")]
    unsafe fn backward_unchecked(start: Self, count: usize) -> Self {
        Step::backward(start, count)
    }
}
```

Note that all of these are associated functions and not callable via method syntax; the calling syntax is always `Step::forward(start, n)`. This version of the trait additionally changes the stepping functions to talk their arguments by value.

As opposed to previous attempts which provided a "step by one" method directly, this version of the trait only exposes "step by n". There are a few reasons for this:

- `Range*`, the primary consumer of `Step`, assumes that the "step by n" operation is cheap. If a single step function is provided, it will be a lot more enticing to implement "step by n" as n repeated calls to "step by one". While this is not strictly incorrect, this behavior would be surprising for anyone used to using `Range<{primitive integer}>`.
- With a trivial default impl, this can be easily added backwards-compatibly later.
- The debug-wrapping "step by n" needs to exist for `RangeFrom` to be consistent between "step by n" and "step by one" operation. (Note: the behavior is not changed by this PR, but making the behavior consistent is made tenable by this PR.)

Three "kinds" of step are provided: `_checked`, which returns an `Option` indicating attempted overflow; (unsuffixed), which provides "safe overflow" behavior (is allowed to panic, wrap, or saturate, depending on what is most convenient for a given type); and `_unchecked`, which is a version which assumes overflow does not happen.

Review is appreciated to check that:

- The invariants as described on the `Step` functions are enough to specify the "common sense" consistency for successor/predecessor.
- Implementation of `Step` functions is correct in the face of overflow and the edges of representable integers.
- Added tests of `Step` functions are asserting the correct behavior (and not just the implemented behavior).
2020-05-15 11:24:50 +00:00
csmoe
0a86335cd4 implement type_implments_trait query 2020-05-15 15:37:11 +08:00
csmoe
10d7da4e0b implement type_implments_trait query 2020-05-15 15:37:11 +08:00
ThibsG
93386563f6 Rename lint map_unwrap to map_unwrap_or and register lints as renamed 2020-05-15 09:17:39 +02:00
Lzu Tao
257e3772cb doc: add links to rotate_(left|right) 2020-05-15 04:49:23 +00:00
bors
027149919e Auto merge of #72222 - Dylan-DPC:rollup-vaw44dg, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #71809 (Use `LocalDefId` in `DumpVisitor::nest_tables`)
 - #72062 (Add built in PSP target)
 - #72146 (Provide separate option for std debug asserts)
 - #72172 (Forbid stage arguments to check)
 - #72173 (Make intra links work inside trait impl block)
 - #72200 (Add prioritize_on attribute to triagebot)
 - #72214 (Minor fixes to comments)

Failed merges:

r? @ghost
2020-05-15 02:56:38 +00:00
Dylan DPC
49d50e6e94
Rollup merge of #72214 - JOE1994:nitpicky, r=jonas-schievink
Minor fixes to comments

* In 'src/librustc_ast_passes/node_count.rs'
  * typo fix ('rought' -> 'rough')
* In 'src/librustc_middle/middle/region.rs',
  * fixed broken link to 'rustc-dev-guide'
  * typo fix ('aluded' -> 'alluded')

Thank you for reviewing this PR :)
2020-05-15 01:57:24 +02:00
Dylan DPC
b96ceba66b
Rollup merge of #72200 - spastorino:add-prioritize_on-to-triagebot, r=Mark-Simulacrum
Add prioritize_on attribute to triagebot

r? @Mark-Simulacrum
2020-05-15 01:57:22 +02:00
Dylan DPC
da0745a4bb
Rollup merge of #72173 - xliiv:54172-intra-for-trait-impl, r=GuillaumeGomez
Make intra links work inside trait impl block

Closes #54172
2020-05-15 01:57:20 +02:00
Dylan DPC
77096880df
Rollup merge of #72172 - Mark-Simulacrum:check-no-stage, r=alexcrichton
Forbid stage arguments to check

Users generally expect that check builds are fast, and that's only true in stage
0 (stages beyond that need us to build a compiler, which is slow).

Closes #69337

r? @alexcrichton
2020-05-15 01:57:19 +02:00
Dylan DPC
24cd42781f
Rollup merge of #72146 - Mark-Simulacrum:separate-std-asserts, r=alexcrichton
Provide separate option for std debug asserts

On local one-off benchmarking of libcore metadata-only, debug asserts in std are a significant hit (15s to 20s). Provide an option for compiler developers to disable them. A build with a nightly compiler is around 10s, for reference.
2020-05-15 01:57:17 +02:00
Dylan DPC
d01ee6f7f8
Rollup merge of #72062 - overdrivenpotato:psp, r=jonas-schievink
Add built in PSP target

This adds a new target, `mipsel-sony-psp`, corresponding to the Sony PSP. The linker script is necessary to handle special sections, which are required by the target. This has been tested with my [rust-psp] crate and I can confirm it works as intended.

The linker script is taken from [here]. It has been slightly adapted to work with rust and LLD.

The `stdarch` submodule was also updated in order for `libcore` to build successfully.

[rust-psp]: https://github.com/overdrivenpotato/rust-psp
[here]: https://github.com/pspdev/pspsdk/blob/master/src/base/linkfile.prx.in
2020-05-15 01:57:15 +02:00
Dylan DPC
a264acaf1a
Rollup merge of #71809 - marmeladema:fix-issue-71104, r=eddyb
Use `LocalDefId` in `DumpVisitor::nest_tables`

This is a partial fix for #71104
2020-05-15 01:57:07 +02:00
bors
85f0da67ff Auto merge of #71321 - matthewjasper:alloc-min-spec, r=sfackler
Use min_specialization in liballoc

- Remove a type parameter from `[A]RcFromIter`.
- Remove an implementation of `[A]RcFromIter` that didn't actually
  specialize anything.
- Remove unused implementation of `IsZero` for `Option<&mut T>`.
- Change specializations of `[A]RcEqIdent` to use a marker trait version
of `Eq`.
- Remove `BTreeClone`. I couldn't find a way to make this work with
  `min_specialization`.
- Add `rustc_unsafe_specialization_marker` to `Copy` and `TrustedLen`.

After this only libcore is the only standard library crate using `feature(specialization)`.
cc #31844
2020-05-14 23:22:47 +00:00
Wesley Wiser
e84b379351 [const-prop] Don't replace Rvalues that are already constants 2020-05-14 19:07:44 -04:00
Santiago Pastorino
00d42bbd2a
Add prioritize_on attribute to triagebot 2020-05-14 18:32:11 -03:00
Ralf Jung
8954379312 make sure even unleashed miri does not do pointer stuff 2020-05-14 23:30:14 +02:00
CAD97
d53068e3ea improve step_integer_impls macro 2020-05-14 16:57:02 -04:00
JOE1994
c919a6ea09 Minor fixes to comments
* In 'src/librustc_ast_passes/node_count.rs'
  * typo fix ('rought' -> 'rough')
* In 'src/librustc_middle/middle/region.rs',
  * fixed broken link to 'rustc-dev-guide'
  * typo fix ('aluded' -> 'alluded')

Thank you for reviewing this PR :)
2020-05-14 16:39:36 -04:00
bors
a74d1862d4 Auto merge of #72202 - Dylan-DPC:rollup-6lbxh1s, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #71910 (Fix unused_parens false positive when using binary operations)
 - #72087 (Fix hang in lexical_region_resolve)
 - #72126 (Change `WorkProduct::saved_files` to an `Option`.)
 - #72127 (add long error explanation for E0228)
 - #72141 (Warn against thread::sleep in async fn)
 - #72170 (use `require_lang_item` over `unwrap`.)
 - #72191 (Clean up E0589 explanation)
 - #72194 (Don't ICE on missing `Unsize` impl)

Failed merges:

r? @ghost
2020-05-14 19:35:24 +00:00
Tyler Mandry
15c2292298 Don't pass --dynamic-linker for Fuchsia dylibs
This was causing a PT_INTERP header in Fuchsia dylibs (implying that
they're executable when they're not).
2020-05-14 11:46:38 -07:00
sergey-melnychuk
0dc74dc0c6 cleanup stale FIXME(#64197) 2020-05-14 20:02:40 +02:00
David Tolnay
95399f8f94
Downgrade useless_let_if_seq to nursery 2020-05-14 09:57:36 -07:00
Dylan DPC
7b5bc61e99
Rollup merge of #72194 - doctorn:dispatch-from-dyn-ice, r=estebank
Don't ICE on missing `Unsize` impl

Previously code of the form

```rust
#![feature(unsize, dispatch_from_dyn)]

use std::marker::Unsize;
use std::ops::DispatchFromDyn;

pub struct Foo<'a, T: ?Sized> {
    _inner: &'a &'a T,
}

impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
```

would generate an ICE due to the missing `Unsize` impl being run through the `suggest_change_mut` suggestion. This PR adds an early exit and a pointer to the appropriate docs regarding `Unsize` instead:

```
error[E0277]: the trait bound `&'a T: std::marker::Unsize<&'a U>` is not satisfied
  --> src/test/ui/issues/issue-71036.rs:11:1
   |
11 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unsize<&'a U>` is not implemented for `&'a T`
   |
   = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
   = note: required because of the requirements on the impl of `std::ops::DispatchFromDyn<&'a &'a U>` for `&'a &'a T`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

r? @estebank

Resolves #71036
2020-05-14 18:21:59 +02:00
Dylan DPC
d7f5e56498
Rollup merge of #72191 - GuillaumeGomez:cleanup-e0589, r=Dylan-DPC
Clean up E0589 explanation

r? @Dylan-DPC
2020-05-14 18:21:57 +02:00
Dylan DPC
62f184030a
Rollup merge of #72170 - lcnr:lang_item, r=oli-obk
use `require_lang_item` over `unwrap`.

Does not yet replace all uses of `lang_items\(\)\.*\.unwrap\(\)`, as there are more
than I expected 😅

Fixes #72099

r? @RalfJung

*edit: The goal of this this PR is to change ICE from missing lang items to a fatal error.*
2020-05-14 18:21:55 +02:00
Dylan DPC
d732aeff91
Rollup merge of #72141 - kornelski:dontsleep, r=joshtriplett
Warn against thread::sleep in async fn

I've seen `thread::sleep` wrecking havoc in async servers. There's already an [issue for clippy](https://github.com/rust-lang/rust-clippy/issues/4377), but the std docs could warn against it too.
2020-05-14 18:21:53 +02:00
Dylan DPC
746b8ca083
Rollup merge of #72127 - jademcgough:long-error-explanation-E0228, r=petrochenkov
add long error explanation for E0228

Add long explanation for the E0228 error code
Part of #61137

Let me know if this is wrong at all (or can be written more clearly), I'm still learning Rust.
2020-05-14 18:21:51 +02:00
Dylan DPC
96caa257c3
Rollup merge of #72126 - nnethercote:change-WorkProduct-saved_files, r=alexcrichton
Change `WorkProduct::saved_files` to an `Option`.

Because there is at most one file.

r? @bjorn3
2020-05-14 18:21:50 +02:00
Dylan DPC
2e65f7bc1f
Rollup merge of #72087 - matthewjasper:regionck-hang, r=nikomatsakis
Fix hang in lexical_region_resolve

Regionck was stuck in a loop where a region value was changing between two equal regions.

Closes #72051
2020-05-14 18:21:48 +02:00
Dylan DPC
b20b200d2e
Rollup merge of #71910 - mibac138:necessary-paren, r=cuviper
Fix unused_parens false positive when using binary operations

Fixes #71290

r? @cuviper who provided instructions
2020-05-14 18:21:46 +02:00
Nathan Corbyn
f6aa161936 Don't ICE on missing Unsize impl 2020-05-14 15:29:05 +01:00
ThibsG
adbdf7549c Merge for_loop_over_option and for_loop_over_result lints into for_loop_over_fallible lint 2020-05-14 16:01:07 +02:00
ThibsG
0e8be599cd Merge option_expect_used and result_expect_used lints into expect_used lint 2020-05-14 16:01:07 +02:00
ThibsG
bcf61666bd Merge option_unwrap_used and result_unwrap_used lints into unwrap_used lint 2020-05-14 16:01:07 +02:00
ThibsG
6cbdd1e49d Merge option_map_unwrap_or, option_map_unwrap_or_else and result_map_unwrap_or_else lints into map_unwrap lint 2020-05-14 15:56:17 +02:00
ThibsG
945c944709 Merge block_in_if_condition_expr and block_in_if_condition_stmt lints into block_in_if_condition lint 2020-05-14 15:56:17 +02:00
Tomasz Miąsko
bbb63d4554 Consistently use LLVM lifetime markers during codegen
Ensure that inliner inserts lifetime markers if they have been emitted during
codegen. Otherwise if allocas from inlined functions are merged together,
lifetime markers from one function might invalidate load & stores performed
by the other one.
2020-05-14 15:23:24 +02:00
bors
e1842b0cac Auto merge of #5583 - ebroto:reversed_empty_ranges, r=yaahc,flip1995
Reversed empty ranges

This lint checks range expressions with inverted limits which result in empty ranges. This includes also the ranges used to index slices.

The lint reverse_range_loop was covering iteration of reversed ranges in a for loop, which is a subset of what this new lint covers, so it has been removed. I'm not sure if that's the best choice. It would be doable to check in the new lint that we are not in the arguments of a for loop; I went for removing it because the logic was too similar to keep them separated.

changelog: Added reversed_empty_ranges lint that checks for ranges where the limits have been inverted, resulting in empty ranges. Removed reverse_range_loop which was covering a subset of the new lint.

Closes #4192
Closes #96
2020-05-14 12:59:24 +00:00
bors
af6d8865fe Auto merge of #72187 - RalfJung:rollup-a7a9jdi, r=RalfJung
Rollup of 12 pull requests

Successful merges:

 - #71525 (`prefix` should not be mutable.)
 - #71741 (Pointer printing: do not print 0 offset)
 - #71870 (Be slightly more precise about any::type_name()'s guarantees.)
 - #71909 (Document From trait for Option implementations)
 - #71964 (Fix bootstrap failing on win32)
 - #72137 (Clean up E0581 explanation)
 - #72138 (Add doc comment for `rustc_middle::mir::mono::Linkage`)
 - #72150 (Remove UnnormalizedProjection)
 - #72151 (Update books)
 - #72163 (docs: remove comment referencing non-existent method)
 - #72169 (Clean up E0582 explanation)
 - #72183 (Fix Arc::decr_strong_count doc test)

Failed merges:

r? @ghost
2020-05-14 12:28:23 +00:00
Marko Mijalkovic
425723f5b3 Rewrite link script from scratch
This absolves previous licensing issues.
2020-05-14 06:19:36 -04:00
Guillaume Gomez
31fbf33679 Clean up E0589 explanation 2020-05-14 11:51:39 +02:00
Guillaume Gomez
e17ac66899 * Update aliases data struct from HashMap to BTreeMap to have more deterministic results
* Update Javascript to take this change into account
* Update CrateData::aliases field to take a reference instead (it allowed to remove a conversion loop)
2020-05-14 11:36:02 +02:00