Skip to content
Permalink
Browse files

Auto merge of #63262 - pietroalbini:beta-rollup, r=pietroalbini

[beta] Rollup backports

Cherry picked:

*  Updated RELEASES.md for 1.37.0 #63147
*  Require a value for configure --debuginfo-level #62906
*  Make the parser TokenStream more resilient after mismatched delimiter recovery #62887
*  ci: move .azure-pipelines to src/ci/azure-pipelines #63242

Rolled up:

*  [BETA] Update cargo #62911
*  [beta] Backport #61207 #63254

r? @ghost
  • Loading branch information...
bors committed Aug 5, 2019
2 parents 61d1607 + 775ffd9 commit 3f55461efb25b3c8b5c5c3d829065cb032ec953b
Showing with 1,794 additions and 41 deletions.
  1. +118 −0 RELEASES.md
  2. +5 −5 src/bootstrap/configure.py
  3. 0 {.azure-pipelines → src/ci/azure-pipelines}/auto.yml
  4. 0 {.azure-pipelines → src/ci/azure-pipelines}/master.yml
  5. 0 {.azure-pipelines → src/ci/azure-pipelines}/pr.yml
  6. 0 {.azure-pipelines → src/ci/azure-pipelines}/steps/install-clang.yml
  7. 0 {.azure-pipelines → src/ci/azure-pipelines}/steps/install-sccache.yml
  8. 0 {.azure-pipelines → src/ci/azure-pipelines}/steps/install-windows-build-deps.yml
  9. 0 {.azure-pipelines → src/ci/azure-pipelines}/steps/run.yml
  10. 0 {.azure-pipelines → src/ci/azure-pipelines}/try.yml
  11. +1 −1 src/ci/run.sh
  12. +62 −33 src/librustc/middle/resolve_lifetime.rs
  13. +14 −1 src/libsyntax/parse/parser.rs
  14. +6 −0 src/test/ui/parser/issue-62881.rs
  15. +29 −0 src/test/ui/parser/issue-62881.stderr
  16. +11 −0 src/test/ui/parser/issue-62895.rs
  17. +49 −0 src/test/ui/parser/issue-62895.stderr
  18. +60 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime.rs
  19. +14 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr
  20. +13 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.rs
  21. +20 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr
  22. +28 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch.nll.stderr
  23. +18 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch.rs
  24. +26 −0 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr
  25. +44 −0 src/test/ui/self/elision/README.md
  26. +36 −0 src/test/ui/self/elision/alias.rs
  27. +40 −0 src/test/ui/self/elision/assoc.rs
  28. +38 −0 src/test/ui/self/elision/lt-alias.rs
  29. +44 −0 src/test/ui/self/elision/lt-assoc.rs
  30. +62 −0 src/test/ui/self/elision/lt-ref-self.nll.stderr
  31. +38 −0 src/test/ui/self/elision/lt-ref-self.rs
  32. +62 −0 src/test/ui/self/elision/lt-ref-self.stderr
  33. +49 −0 src/test/ui/self/elision/lt-self.rs
  34. +36 −0 src/test/ui/self/elision/lt-struct.rs
  35. +43 −0 src/test/ui/self/elision/multiple-ref-self.rs
  36. +39 −0 src/test/ui/self/elision/ref-alias.rs
  37. +40 −0 src/test/ui/self/elision/ref-assoc.rs
  38. +36 −0 src/test/ui/self/elision/ref-mut-alias.rs
  39. +62 −0 src/test/ui/self/elision/ref-mut-self.nll.stderr
  40. +38 −0 src/test/ui/self/elision/ref-mut-self.rs
  41. +62 −0 src/test/ui/self/elision/ref-mut-self.stderr
  42. +52 −0 src/test/ui/self/elision/ref-mut-struct.nll.stderr
  43. +32 −0 src/test/ui/self/elision/ref-mut-struct.rs
  44. +52 −0 src/test/ui/self/elision/ref-mut-struct.stderr
  45. +72 −0 src/test/ui/self/elision/ref-self.nll.stderr
  46. +51 −0 src/test/ui/self/elision/ref-self.rs
  47. +72 −0 src/test/ui/self/elision/ref-self.stderr
  48. +52 −0 src/test/ui/self/elision/ref-struct.nll.stderr
  49. +32 −0 src/test/ui/self/elision/ref-struct.rs
  50. +52 −0 src/test/ui/self/elision/ref-struct.stderr
  51. +36 −0 src/test/ui/self/elision/self.rs
  52. +32 −0 src/test/ui/self/elision/struct.rs
  53. +15 −0 src/test/ui/self/self_lifetime.rs
  54. +1 −1 src/tools/cargo
@@ -1,3 +1,121 @@
Version 1.37.0 (2019-08-15)
==========================

Language
--------
- `#[must_use]` will now warn if the type is contained in a [tuple][61100],
[`Box`][62228], or an [array][62235] and unused.
- [You can now use the `cfg` and `cfg_attr` attributes on
generic parameters.][61547]
- [You can now use enum variants through type alias.][61682] e.g. You can
write the following:
```rust
type MyOption = Option<u8>;
fn increment_or_zero(x: MyOption) -> u8 {
match x {
MyOption::Some(y) => y + 1,
MyOption::None => 0,
}
}
```
- [You can now use `_` as an identifier for consts.][61347] e.g. You can write
`const _: u32 = 5;`.
- [You can now use `#[repr(align(X)]` on enums.][61229]
- [The `?`/_"Kleene"_ macro operator is now available in the
2015 edition.][60932]

Compiler
--------
- [You can now enable Profile-Guided Optimization with the `-C profile-generate`
and `-C profile-use` flags.][61268] For more information on how to use profile
guided optimization, please refer to the [rustc book][rustc-book-pgo].
- [The `rust-lldb` wrapper script should now work again.][61827]

Libraries
---------
- [`mem::MaybeUninit<T>` is now ABI-compatible with `T`.][61802]

Stabilized APIs
---------------
- [`BufReader::buffer`]
- [`BufWriter::buffer`]
- [`Cell::from_mut`]
- [`Cell<[T]>::as_slice_of_cells`][`Cell<slice>::as_slice_of_cells`]
- [`DoubleEndedIterator::nth_back`]
- [`Option::xor`]
- [`Wrapping::reverse_bits`]
- [`i128::reverse_bits`]
- [`i16::reverse_bits`]
- [`i32::reverse_bits`]
- [`i64::reverse_bits`]
- [`i8::reverse_bits`]
- [`isize::reverse_bits`]
- [`slice::copy_within`]
- [`u128::reverse_bits`]
- [`u16::reverse_bits`]
- [`u32::reverse_bits`]
- [`u64::reverse_bits`]
- [`u8::reverse_bits`]
- [`usize::reverse_bits`]

Cargo
-----
- [`Cargo.lock` files are now included by default when publishing executable crates
with executables.][cargo/7026]
- [You can now specify `default-run="foo"` in `[package]` to specify the
default executable to use for `cargo run`.][cargo/7056]

Misc
----

Compatibility Notes
-------------------
- [Using `...` for inclusive range patterns will now warn by default.][61342]
Please transition your code to using the `..=` syntax for inclusive
ranges instead.
- [Using a trait object without the `dyn` will now warn by default.][61203]
Please transition your code to use `dyn Trait` for trait objects instead.

[62228]: https://github.com/rust-lang/rust/pull/62228/
[62235]: https://github.com/rust-lang/rust/pull/62235/
[61802]: https://github.com/rust-lang/rust/pull/61802/
[61827]: https://github.com/rust-lang/rust/pull/61827/
[61547]: https://github.com/rust-lang/rust/pull/61547/
[61682]: https://github.com/rust-lang/rust/pull/61682/
[61268]: https://github.com/rust-lang/rust/pull/61268/
[61342]: https://github.com/rust-lang/rust/pull/61342/
[61347]: https://github.com/rust-lang/rust/pull/61347/
[61100]: https://github.com/rust-lang/rust/pull/61100/
[61203]: https://github.com/rust-lang/rust/pull/61203/
[61229]: https://github.com/rust-lang/rust/pull/61229/
[60932]: https://github.com/rust-lang/rust/pull/60932/
[cargo/7026]: https://github.com/rust-lang/cargo/pull/7026/
[cargo/7056]: https://github.com/rust-lang/cargo/pull/7056/
[`BufReader::buffer`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.buffer
[`BufWriter::buffer`]: https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.buffer
[`Cell::from_mut`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.from_mut
[`Cell<slice>::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells
[`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back
[`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor
[`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded
[`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits
[`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits
[`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits
[`i32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i32.html#method.reverse_bits
[`i64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i64.html#method.reverse_bits
[`i8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i8.html#method.reverse_bits
[`isize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.isize.html#method.reverse_bits
[`slice::copy_within`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within
[`u128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u128.html#method.reverse_bits
[`u16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u16.html#method.reverse_bits
[`u32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u32.html#method.reverse_bits
[`u64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u64.html#method.reverse_bits
[`u8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u8.html#method.reverse_bits
[`usize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.usize.html#method.reverse_bits
[rustc-book-pgo]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html


Version 1.36.0 (2019-07-04)
==========================

@@ -76,11 +76,11 @@ def v(*args):
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata")
o("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
o("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")
o("debuginfo-level-std", "rust.debuginfo-level-std", "debuginfo level for the standard library")
o("debuginfo-level-tools", "rust.debuginfo-level-tools", "debuginfo level for the tools")
o("debuginfo-level-tests", "rust.debuginfo-level-tests", "debuginfo level for the test suites run with compiletest")
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
v("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")
v("debuginfo-level-std", "rust.debuginfo-level-std", "debuginfo level for the standard library")
v("debuginfo-level-tools", "rust.debuginfo-level-tools", "debuginfo level for the tools")
v("debuginfo-level-tests", "rust.debuginfo-level-tests", "debuginfo level for the test suites run with compiletest")
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")

v("prefix", "install.prefix", "set installation prefix")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -50,7 +50,7 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.remap-debuginfo"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.debuginfo-level-std=1"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --debuginfo-level-std=1"

if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
@@ -2117,48 +2117,77 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
// First (determined here), if `self` is by-reference, then the
// implied output region is the region of the self parameter.
if has_self {
// Look for `self: &'a Self` - also desugared from `&'a self`,
// and if that matches, use it for elision and return early.
let is_self_ty = |res: Res| {
if let Res::SelfTy(..) = res {
return true;
}

// Can't always rely on literal (or implied) `Self` due
// to the way elision rules were originally specified.
let impl_self = impl_self.map(|ty| &ty.node);
if let Some(&hir::TyKind::Path(hir::QPath::Resolved(None, ref path))) = impl_self {
match path.res {
// Whitelist the types that unambiguously always
// result in the same type constructor being used
// (it can't differ between `Self` and `self`).
Res::Def(DefKind::Struct, _)
| Res::Def(DefKind::Union, _)
| Res::Def(DefKind::Enum, _)
| Res::PrimTy(_) => {
return res == path.res
struct SelfVisitor<'a> {
map: &'a NamedRegionMap,
impl_self: Option<&'a hir::TyKind>,
lifetime: Set1<Region>,
}

impl SelfVisitor<'_> {
// Look for `self: &'a Self` - also desugared from `&'a self`,
// and if that matches, use it for elision and return early.
fn is_self_ty(&self, res: Res) -> bool {
if let Res::SelfTy(..) = res {
return true;
}

// Can't always rely on literal (or implied) `Self` due
// to the way elision rules were originally specified.
if let Some(&hir::TyKind::Path(hir::QPath::Resolved(None, ref path))) =
self.impl_self
{
match path.res {
// Whitelist the types that unambiguously always
// result in the same type constructor being used
// (it can't differ between `Self` and `self`).
Res::Def(DefKind::Struct, _)
| Res::Def(DefKind::Union, _)
| Res::Def(DefKind::Enum, _)
| Res::PrimTy(_) => {
return res == path.res
}
_ => {}
}
_ => {}
}

false
}
}

false
};
impl<'a> Visitor<'a> for SelfVisitor<'a> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'a> {
NestedVisitorMap::None
}

if let hir::TyKind::Rptr(lifetime_ref, ref mt) = inputs[0].node {
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node {
if is_self_ty(path.res) {
if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
let scope = Scope::Elision {
elide: Elide::Exact(lifetime),
s: self.scope,
};
self.with(scope, |_, this| this.visit_ty(output));
return;
fn visit_ty(&mut self, ty: &'a hir::Ty) {
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.node {
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node
{
if self.is_self_ty(path.res) {
if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
self.lifetime.insert(*lifetime);
}
}
}
}
intravisit::walk_ty(self, ty)
}
}

let mut visitor = SelfVisitor {
map: self.map,
impl_self: impl_self.map(|ty| &ty.node),
lifetime: Set1::Empty,
};
visitor.visit_ty(&inputs[0]);
if let Set1::One(lifetime) = visitor.lifetime {
let scope = Scope::Elision {
elide: Elide::Exact(lifetime),
s: self.scope,
};
self.with(scope, |_, this| this.visit_ty(output));
return;
}
}

// Second, if there was exactly one lifetime (either a substitution or a
@@ -7716,14 +7716,27 @@ impl<'a> Parser<'a> {
let ret = f(self);
let last_token = if self.token_cursor.stack.len() == prev {
&mut self.token_cursor.frame.last_token
} else if self.token_cursor.stack.get(prev).is_none() {
// This can happen due to a bad interaction of two unrelated recovery mechanisms with
// mismatched delimiters *and* recovery lookahead on the likely typo `pub ident(`
// (#62881).
return Ok((ret?, TokenStream::new(vec![])));
} else {
&mut self.token_cursor.stack[prev].last_token
};

// Pull out the tokens that we've collected from the call to `f` above.
let mut collected_tokens = match *last_token {
LastToken::Collecting(ref mut v) => mem::replace(v, Vec::new()),
LastToken::Was(_) => panic!("our vector went away?"),
LastToken::Was(ref was) => {
let msg = format!("our vector went away? - found Was({:?})", was);
debug!("collect_tokens: {}", msg);
self.sess.span_diagnostic.delay_span_bug(self.token.span, &msg);
// This can happen due to a bad interaction of two unrelated recovery mechanisms
// with mismatched delimiters *and* recovery lookahead on the likely typo
// `pub ident(` (#62895, different but similar to the case above).
return Ok((ret?, TokenStream::new(vec![])));
}
};

// If we're not at EOF our current token wasn't actually consumed by
@@ -0,0 +1,6 @@
fn main() {}

fn f() -> isize { fn f() -> isize {} pub f<
//~^ ERROR missing `fn` or `struct` for function or struct definition
//~| ERROR mismatched types
//~ ERROR this file contains an un-closed delimiter
@@ -0,0 +1,29 @@
error: this file contains an un-closed delimiter
--> $DIR/issue-62881.rs:6:53
|
LL | fn f() -> isize { fn f() -> isize {} pub f<
| - un-closed delimiter
...
LL |
| ^

error: missing `fn` or `struct` for function or struct definition
--> $DIR/issue-62881.rs:3:41
|
LL | fn f() -> isize { fn f() -> isize {} pub f<
| ^

error[E0308]: mismatched types
--> $DIR/issue-62881.rs:3:29
|
LL | fn f() -> isize { fn f() -> isize {} pub f<
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't return
|
= note: expected type `isize`
found type `()`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
@@ -0,0 +1,11 @@
fn main() {}

fn v() -> isize { //~ ERROR mismatched types
mod _ { //~ ERROR expected identifier
pub fn g() -> isizee { //~ ERROR cannot find type `isizee` in this scope
mod _ { //~ ERROR expected identifier
pub g() -> is //~ ERROR missing `fn` for function definition
(), w20);
}
(), w20); //~ ERROR expected item, found `;`
}
@@ -0,0 +1,49 @@
error: expected identifier, found reserved identifier `_`
--> $DIR/issue-62895.rs:4:5
|
LL | mod _ {
| ^ expected identifier, found reserved identifier

error: expected identifier, found reserved identifier `_`
--> $DIR/issue-62895.rs:6:5
|
LL | mod _ {
| ^ expected identifier, found reserved identifier

error: missing `fn` for function definition
--> $DIR/issue-62895.rs:7:4
|
LL | pub g() -> is
| ^^^^
help: add `fn` here to parse `g` as a public function
|
LL | pub fn g() -> is
| ^^

error: expected item, found `;`
--> $DIR/issue-62895.rs:10:9
|
LL | (), w20);
| ^ help: remove this semicolon

error[E0412]: cannot find type `isizee` in this scope
--> $DIR/issue-62895.rs:5:15
|
LL | pub fn g() -> isizee {
| ^^^^^^ help: a primitive type with a similar name exists: `isize`

error[E0308]: mismatched types
--> $DIR/issue-62895.rs:3:11
|
LL | fn v() -> isize {
| - ^^^^^ expected isize, found ()
| |
| this function's body doesn't return
|
= note: expected type `isize`
found type `()`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`.

0 comments on commit 3f55461

Please sign in to comment.
You can’t perform that action at this time.