Skip to content

Rollup of 11 pull requests #86126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
86562b4
Use `Iterator::find` instead of open-coding it
LingMan Jun 1, 2021
51d98e3
Update the documentation of `-C force-unwind-tables`
Jun 3, 2021
c176e04
Add debug info tests for range, fix-sized array, and cell types
nanguye Mar 30, 2021
eb3fd6d
Default panic message should print Box<dyn Any>
reaganmcf Jun 6, 2021
570ba09
Fix invalid weight for type pages
GuillaumeGomez Jun 6, 2021
4597362
Add test to check that font-weight is correctly set on type page
GuillaumeGomez Jun 6, 2021
8330233
Update testsuite to match new panic msg
reaganmcf Jun 6, 2021
a0aabf7
:arrow_up: rust-analyzer
lnicola Jun 7, 2021
4ca7a11
Fix integration of codeblocks in search result description
GuillaumeGomez Jun 7, 2021
314ef59
Add test to ensure the result descripton is correctly handling codebl…
GuillaumeGomez Jun 7, 2021
a20870b
Comment out unused error codes in error_codes.rs
FabianWolff Jun 7, 2021
c01d63a
Add E0316.md
FabianWolff Jun 7, 2021
09307a3
Bless ui/where-clauses/where-for-self.rs test
FabianWolff Jun 7, 2021
fb92c92
Remove lifetime hack
camsteffen Jun 7, 2021
5aa188a
Correct type signature in doc for Bound::as_mut
glittershark Jun 7, 2021
fddf012
Clarify documentation of slice sorting methods
Lionelf329 Jun 4, 2021
b7c611e
Rollup merge of #85448 - nanguye2496:nanguye2496/debuginfo_tests, r=M…
JohnTitor Jun 8, 2021
9df63ac
Rollup merge of #85906 - LingMan:iter_find, r=matthewjasper
JohnTitor Jun 8, 2021
97a7828
Rollup merge of #85951 - hyd-dev:force-unwind-tables, r=steveklabnik
JohnTitor Jun 8, 2021
040c912
Rollup merge of #85985 - Lionelf329:master, r=joshtriplett
JohnTitor Jun 8, 2021
f51634d
Rollup merge of #86074 - reaganmcf:iss-86039, r=jyn514
JohnTitor Jun 8, 2021
a1e7ee2
Rollup merge of #86078 - GuillaumeGomez:type-page-font-weight, r=jsha
JohnTitor Jun 8, 2021
8e1b959
Rollup merge of #86090 - lnicola:rust-analyzer-2021-06-07, r=jonas-sc…
JohnTitor Jun 8, 2021
dad96ce
Rollup merge of #86095 - GuillaumeGomez:search-description-codeblock,…
JohnTitor Jun 8, 2021
7606a8c
Rollup merge of #86096 - FabianWolff:ec-E0316, r=GuillaumeGomez
JohnTitor Jun 8, 2021
e0464fc
Rollup merge of #86101 - glittershark:bound-as-mut-doc-fix, r=m-ou-se
JohnTitor Jun 8, 2021
ef579cc
Rollup merge of #86103 - camsteffen:lifetime-hack, r=jackh726
JohnTitor Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ E0308: include_str!("./error_codes/E0308.md"),
E0309: include_str!("./error_codes/E0309.md"),
E0310: include_str!("./error_codes/E0310.md"),
E0312: include_str!("./error_codes/E0312.md"),
E0316: include_str!("./error_codes/E0316.md"),
E0317: include_str!("./error_codes/E0317.md"),
E0321: include_str!("./error_codes/E0321.md"),
E0322: include_str!("./error_codes/E0322.md"),
Expand Down Expand Up @@ -553,9 +554,8 @@ E0783: include_str!("./error_codes/E0783.md"),
E0311, // thing may not live long enough
E0313, // lifetime of borrowed pointer outlives lifetime of captured
// variable
E0314, // closure outlives stack frame
E0315, // cannot invoke closure outside of its lifetime
E0316, // nested quantification of lifetimes
// E0314, // closure outlives stack frame
// E0315, // cannot invoke closure outside of its lifetime
// E0319, // trait impls for defaulted traits allowed just for structs/enums
E0320, // recursive overflow during dropck
// E0372, // coherence not object safe
Expand Down Expand Up @@ -584,21 +584,21 @@ E0783: include_str!("./error_codes/E0783.md"),
// E0470, removed
// E0471, // constant evaluation error (in pattern)
E0472, // llvm_asm! is unsupported on this target
E0473, // dereference of reference outside its lifetime
E0474, // captured variable `..` does not outlive the enclosing closure
E0475, // index of slice outside its lifetime
// E0473, // dereference of reference outside its lifetime
// E0474, // captured variable `..` does not outlive the enclosing closure
// E0475, // index of slice outside its lifetime
E0476, // lifetime of the source pointer does not outlive lifetime bound...
E0479, // the type `..` (provided as the value of a type parameter) is...
E0480, // lifetime of method receiver does not outlive the method call
E0481, // lifetime of function argument does not outlive the function call
// E0479, // the type `..` (provided as the value of a type parameter) is...
// E0480, // lifetime of method receiver does not outlive the method call
// E0481, // lifetime of function argument does not outlive the function call
E0482, // lifetime of return value does not outlive the function call
E0483, // lifetime of operand does not outlive the operation
E0484, // reference is not valid at the time of borrow
E0485, // automatically reference is not valid at the time of borrow
E0486, // type of expression contains references that are not valid during..
E0487, // unsafe use of destructor: destructor might be called while...
E0488, // lifetime of variable does not enclose its declaration
E0489, // type/lifetime parameter not in scope here
// E0483, // lifetime of operand does not outlive the operation
// E0484, // reference is not valid at the time of borrow
// E0485, // automatically reference is not valid at the time of borrow
// E0486, // type of expression contains references that are not valid during..
// E0487, // unsafe use of destructor: destructor might be called while...
// E0488, // lifetime of variable does not enclose its declaration
// E0489, // type/lifetime parameter not in scope here
E0490, // a value of type `..` is borrowed for too long
E0498, // malformed plugin attribute
E0514, // metadata version mismatch
Expand Down
32 changes: 32 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0316.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
A `where` clause contains a nested quantification over lifetimes.

Erroneous code example:

```compile_fail,E0316
trait Tr<'a, 'b> {}

fn foo<T>(t: T)
where
for<'a> &'a T: for<'b> Tr<'a, 'b>, // error: nested quantification
{
}
```

Rust syntax allows lifetime quantifications in two places within
`where` clauses: Quantifying over the trait bound only (as in
`Ty: for<'l> Trait<'l>`) and quantifying over the whole clause
(as in `for<'l> &'l Ty: Trait<'l>`). Using both in the same clause
leads to a nested lifetime quantification, which is not supported.

The following example compiles, because the clause with the nested
quantification has been rewritten to use only one `for<>`:

```
trait Tr<'a, 'b> {}

fn foo<T>(t: T)
where
for<'a, 'b> &'a T: Tr<'a, 'b>, // ok
{
}
```
11 changes: 3 additions & 8 deletions compiler/rustc_lint/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,16 +679,11 @@ pub fn transparent_newtype_field<'a, 'tcx>(
variant: &'a ty::VariantDef,
) -> Option<&'a ty::FieldDef> {
let param_env = tcx.param_env(variant.def_id);
for field in &variant.fields {
variant.fields.iter().find(|field| {
let field_ty = tcx.type_of(field.did);
let is_zst = tcx.layout_of(param_env.and(field_ty)).map_or(false, |layout| layout.is_zst());

if !is_zst {
return Some(field);
}
}

None
!is_zst
})
}

/// Is type known to be non-null?
Expand Down
10 changes: 1 addition & 9 deletions compiler/rustc_resolve/src/late/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1841,14 +1841,6 @@ fn object_lifetime_defaults_for_item(
}

impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
// FIXME(#37666) this works around a limitation in the region inferencer
fn hack<F>(&mut self, f: F)
where
F: for<'b> FnOnce(&mut LifetimeContext<'b, 'tcx>),
{
f(self)
}

fn with<F>(&mut self, wrap_scope: Scope<'_>, f: F)
where
F: for<'b> FnOnce(ScopeRef<'_>, &mut LifetimeContext<'b, 'tcx>),
Expand Down Expand Up @@ -2252,7 +2244,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
};
self.with(scope, move |old_scope, this| {
this.check_lifetime_params(old_scope, &generics.params);
this.hack(walk); // FIXME(#37666) workaround in place of `walk(this)`
walk(this);
});
}

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ impl<T> Bound<T> {
}
}

/// Converts from `&mut Bound<T>` to `Bound<&T>`.
/// Converts from `&mut Bound<T>` to `Bound<&mut T>`.
#[inline]
#[unstable(feature = "bound_as_ref", issue = "80996")]
pub fn as_mut(&mut self) -> Bound<&mut T> {
Expand Down
24 changes: 15 additions & 9 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2100,9 +2100,11 @@ impl<T> [T] {
///
/// If the value is found then [`Result::Ok`] is returned, containing the
/// index of the matching element. If there are multiple matches, then any
/// one of the matches could be returned. If the value is not found then
/// [`Result::Err`] is returned, containing the index where a matching
/// element could be inserted while maintaining sorted order.
/// one of the matches could be returned. The index is chosen
/// deterministically, but is subject to change in future versions of Rust.
/// If the value is not found then [`Result::Err`] is returned, containing
/// the index where a matching element could be inserted while maintaining
/// sorted order.
///
/// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`].
///
Expand Down Expand Up @@ -2153,9 +2155,11 @@ impl<T> [T] {
///
/// If the value is found then [`Result::Ok`] is returned, containing the
/// index of the matching element. If there are multiple matches, then any
/// one of the matches could be returned. If the value is not found then
/// [`Result::Err`] is returned, containing the index where a matching
/// element could be inserted while maintaining sorted order.
/// one of the matches could be returned. The index is chosen
/// deterministically, but is subject to change in future versions of Rust.
/// If the value is not found then [`Result::Err`] is returned, containing
/// the index where a matching element could be inserted while maintaining
/// sorted order.
///
/// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`].
///
Expand Down Expand Up @@ -2224,9 +2228,11 @@ impl<T> [T] {
///
/// If the value is found then [`Result::Ok`] is returned, containing the
/// index of the matching element. If there are multiple matches, then any
/// one of the matches could be returned. If the value is not found then
/// [`Result::Err`] is returned, containing the index where a matching
/// element could be inserted while maintaining sorted order.
/// one of the matches could be returned. The index is chosen
/// deterministically, but is subject to change in future versions of Rust.
/// If the value is not found then [`Result::Err`] is returned, containing
/// the index where a matching element could be inserted while maintaining
/// sorted order.
///
/// See also [`binary_search`], [`binary_search_by`], and [`partition_point`].
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn default_hook(info: &PanicInfo<'_>) {
Some(s) => *s,
None => match info.payload().downcast_ref::<String>() {
Some(s) => &s[..],
None => "Box<Any>",
None => "Box<dyn Any>",
},
};
let thread = thread_info::current_thread();
Expand Down
3 changes: 1 addition & 2 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ values:

* `y`, `yes`, `on`, or no value: Unwind tables are forced to be generated.
* `n`, `no`, or `off`: Unwind tables are not forced to be generated. If unwind
tables are required by the target or `-C panic=unwind`, an error will be
emitted.
tables are required by the target an error will be emitted.

The default if not specified depends on the target.

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ h2, h3, h4 {
border-bottom: 1px solid;
}
.impl, .method,
.type, .associatedconstant,
.type:not(.container-rustdoc), .associatedconstant,
.associatedtype {
flex-basis: 100%;
font-weight: 600;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ window.initSearch = function(rawSearchIndex) {
var description = document.createElement("div");
description.className = "desc";
var spanDesc = document.createElement("span");
spanDesc.innerText = item.desc + "\u00A0";
spanDesc.insertAdjacentHTML("beforeend", item.desc);

description.appendChild(spanDesc);
wrapper.appendChild(description);
Expand Down
39 changes: 39 additions & 0 deletions src/test/debuginfo/fixed-sized-array.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Testing the display of fixed sized arrays in cdb.

// cdb-only
// min-cdb-version: 10.0.18317.1001
// compile-flags:-g

// === CDB TESTS ==================================================================================

// cdb-command: g

// cdb-command: dx xs,d
// cdb-check:xs,d [Type: int [5]]
// cdb-check: [0] : 1 [Type: int]
// cdb-check: [1] : 2 [Type: int]
// cdb-check: [2] : 3 [Type: int]
// cdb-check: [3] : 4 [Type: int]
// cdb-check: [4] : 5 [Type: int]

// cdb-command: dx ys,d
// cdb-check:ys,d [Type: int [3]]
// cdb-check: [0] : 0 [Type: int]
// cdb-check: [1] : 0 [Type: int]
// cdb-check: [2] : 0 [Type: int]

fn main() {
// Fixed-size array (type signature is superfluous)
let xs: [i32; 5] = [1, 2, 3, 4, 5];

// All elements can be initialized to the same value
let ys: [i32; 3] = [0; 3];

// Indexing starts at 0
println!("first element of the array: {}", xs[0]);
println!("second element of the array: {}", xs[1]);

zzz(); // #break
}

fn zzz() { () }
51 changes: 51 additions & 0 deletions src/test/debuginfo/mutable-locs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Testing the display of Cell, RefCell, and RefMut in cdb.

// cdb-only
// min-cdb-version: 10.0.18317.1001
// compile-flags:-g

// === CDB TESTS ==================================================================================

// cdb-command: g

// cdb-command:dx static_c,d
// cdb-check:static_c,d [Type: core::cell::Cell<i32>]
// cdb-check: [+0x000] value [Type: core::cell::UnsafeCell<i32>]

// cdb-command: dx static_c.value,d
// cdb-check:static_c.value,d [Type: core::cell::UnsafeCell<i32>]
// cdb-check: [+0x000] value : 10 [Type: int]

// cdb-command: dx dynamic_c,d
// cdb-check:dynamic_c,d [Type: core::cell::RefCell<i32>]
// cdb-check: [+0x000] borrow [Type: core::cell::Cell<isize>]
// cdb-check: [...] value [Type: core::cell::UnsafeCell<i32>]

// cdb-command: dx dynamic_c.value,d
// cdb-check:dynamic_c.value,d [Type: core::cell::UnsafeCell<i32>]
// cdb-check: [+0x000] value : 15 [Type: int]

// cdb-command: dx b,d
// cdb-check:b,d [Type: core::cell::RefMut<i32>]
// cdb-check: [+0x000] value : [...] : 42 [Type: int *]
// cdb-check: [...] borrow [Type: core::cell::BorrowRefMut]

#![allow(unused_variables)]

use std::cell::{Cell, RefCell};

fn main() {
let static_c = Cell::new(5);
static_c.set(10);

let dynamic_c = RefCell::new(5);
dynamic_c.replace(15);

let dynamic_c_0 = RefCell::new(15);
let mut b = dynamic_c_0.borrow_mut();
*b = 42;

zzz(); // #break
}

fn zzz() {()}
38 changes: 38 additions & 0 deletions src/test/debuginfo/mutex.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Testing the display of Mutex and MutexGuard in cdb.

// cdb-only
// min-cdb-version: 10.0.21287.1005
// compile-flags:-g
// ignore-tidy-linelength

// === CDB TESTS ==================================================================================
//
// cdb-command:g
//
// cdb-command:dx m,d
// cdb-check:m,d [Type: std::sync::mutex::Mutex<i32>]
// cdb-check: [+0x000] inner [Type: std::sys_common::mutex::MovableMutex]
// cdb-check: [+0x008] poison [Type: std::sync::poison::Flag]
// cdb-check: [+0x00c] data [Type: core::cell::UnsafeCell<i32>]

//
// cdb-command:dx m.data,d
// cdb-check:m.data,d [Type: core::cell::UnsafeCell<i32>]
// cdb-check: [+0x000] value : 0 [Type: int]

//
// cdb-command:dx lock,d
// cdb-check:lock,d : Ok({...}) [Type: core::result::Result<std::sync::mutex::MutexGuard<i32>, std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32>>>]
// cdb-check: [value] [Type: std::sync::mutex::MutexGuard<i32>]

use std::sync::Mutex;

#[allow(unused_variables)]
fn main()
{
let m = Mutex::new(0);
let lock = m.try_lock();
zzz(); // #break
}

fn zzz() {}
12 changes: 8 additions & 4 deletions src/test/debuginfo/pretty-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// compile-flags:-g
// min-gdb-version: 7.7
// min-lldb-version: 310
// min-cdb-version: 10.0.18317.1001

// === GDB TESTS ===================================================================================

Expand Down Expand Up @@ -71,8 +72,12 @@
// cdb-command: g

// cdb-command: dx slice,d
// cdb-check:slice,d [...]
// NOTE: While slices have a .natvis entry that works in VS & VS Code, it fails in CDB 10.0.18362.1
// cdb-check:slice,d : { len=4 } [Type: slice<i32>]
// cdb-check: [len] : 4 [Type: unsigned __int64]
// cdb-check: [0] : 0 [Type: int]
// cdb-check: [1] : 1 [Type: int]
// cdb-check: [2] : 2 [Type: int]
// cdb-check: [3] : 3 [Type: int]

// cdb-command: dx vec,d
// cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64, alloc::alloc::Global>]
Expand All @@ -84,8 +89,7 @@
// cdb-check: [3] : 7 [Type: unsigned __int64]

// cdb-command: dx str_slice
// cdb-check:str_slice [...]
// NOTE: While string slices have a .natvis entry that works in VS & VS Code, it fails in CDB
// cdb-check:str_slice : "IAMA string slice!" [Type: str]

// cdb-command: dx string
// cdb-check:string : "IAMA string!" [Type: [...]::String]
Expand Down
Loading