Skip to content
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

Rollup of 12 pull requests #62882

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5397dfc
Remove obsolete “should not have to exist” reasons
SimonSapin Jul 8, 2019
01d93bf
Split the SliceConcat trait into Concat and Join
SimonSapin Jul 8, 2019
283f676
Take separator by value in `[T]::join`
SimonSapin Jul 8, 2019
b62a77b
Add joining slices of slices with a slice separator, not just a singl…
SimonSapin Jul 8, 2019
50840ee
Delay bug; this sidesteps ICE'ing when compiler is just doing error-r…
pnkfelix Jul 9, 2019
837fe7b
Regression test.
pnkfelix Jul 9, 2019
d0635ee
Update src/liballoc/slice.rs
SimonSapin Jul 9, 2019
bbc9366
Update src/liballoc/slice.rs
SimonSapin Jul 9, 2019
5f7768a
Update src/liballoc/str.rs
SimonSapin Jul 9, 2019
d73c23d
explain how to search without owned data
RalfJung Jul 13, 2019
3f77f2c
better comments
RalfJung Jul 14, 2019
469b7a9
rustc_typeck: improve diagnostics for _ const/static declarations
lundibundi Jul 18, 2019
c6735a6
fixup! rustc_typeck: improve diagnostics for _ const/static declarations
lundibundi Jul 19, 2019
10d4159
Revert "Disable stack probing for gnux32."
crlf0710 Jul 19, 2019
b361864
fixup! rustc_typeck: improve diagnostics for _ const/static declarations
lundibundi Jul 19, 2019
c1b4d62
rustc: Compile the `fmt_macros` crate as an rlib
alexcrichton Jul 19, 2019
c6e027d
fixup! rustc_typeck: improve diagnostics for _ const/static declarations
lundibundi Jul 19, 2019
0e73386
Use sharded maps for interning
Zoxc Jun 12, 2019
2641bed
Tweak span for variant not found error
estebank Jul 20, 2019
97e8d67
Break dependencies between `syntax_ext` and some other crates
petrochenkov Jul 17, 2019
995429d
Move proc macro server into libsyntax
petrochenkov Jul 18, 2019
1196dfe
Move test harness generation into libsyntax_ext
petrochenkov Jul 18, 2019
b93d2ac
Merge `rustc_allocator` into `libsyntax_ext`
petrochenkov Jul 16, 2019
188330b
Move standard library injection into libsyntax_ext
petrochenkov Jul 18, 2019
ec5f089
syntax_ext: `proc_macro_decls` -> `proc_macro_harness`
petrochenkov Jul 18, 2019
21b502b
warn that raw pointers must be aligned when used, and that writes cau…
RalfJung Jul 20, 2019
2e6b13a
references must be aligned; also move up the warning that fn ptrs mus…
RalfJung Jul 20, 2019
18dceab
Add tests for issue-58887
JohnTitor Jul 21, 2019
f502bf7
sync with nomicon: raw ptr must be non-dangling and aligned every tim…
RalfJung Jul 21, 2019
4081222
apply feedback
RalfJung Jul 21, 2019
e75ae15
Move into existential-type dir
JohnTitor Jul 21, 2019
795d96d
Place::as_place_ref is now Place::as_ref
spastorino Jul 21, 2019
a7b9246
weasle, weasle
RalfJung Jul 22, 2019
9196781
account for non-drop-glue types
RalfJung Jul 22, 2019
c3aa3d8
Rollup merge of #61779 - Zoxc:sharded, r=oli-obk
Centril Jul 22, 2019
723fd5d
Rollup merge of #62523 - pnkfelix:delay-bug-to-resolve-issue-62203-ic…
Centril Jul 22, 2019
9785008
Rollup merge of #62528 - SimonSapin:concat, r=alexcrichton
Centril Jul 22, 2019
966ba8d
Rollup merge of #62656 - RalfJung:contains-no-own, r=Dylan-DPC
Centril Jul 22, 2019
8fad976
Rollup merge of #62771 - petrochenkov:depext, r=eddyb
Centril Jul 22, 2019
823d575
Rollup merge of #62804 - lundibundi:help-infer-const-static, r=eddyb
Centril Jul 22, 2019
8311f71
Rollup merge of #62808 - crlf0710:gnux32_stack_probe, r=nikic
Centril Jul 22, 2019
b704be5
Rollup merge of #62813 - alexcrichton:less-dylib, r=Mark-Simulacrum
Centril Jul 22, 2019
cb1b6c9
Rollup merge of #62817 - estebank:variant-sp, r=matthewjasper
Centril Jul 22, 2019
1d5ea88
Rollup merge of #62822 - RalfJung:pointers, r=Centril
Centril Jul 22, 2019
f7621c5
Rollup merge of #62842 - JohnTitor:test-for-58887, r=alexreg
Centril Jul 22, 2019
80aa34d
Rollup merge of #62859 - spastorino:rename-to-as-ref, r=Centril
Centril Jul 22, 2019
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: 0 additions & 32 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2751,20 +2751,6 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rustc_allocator"
version = "0.0.0"
dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_target 0.0.0",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax 0.0.0",
"syntax_pos 0.0.0",
]

[[package]]
name = "rustc_apfloat"
version = "0.0.0"
Expand Down Expand Up @@ -2822,7 +2808,6 @@ dependencies = [
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_allocator 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_codegen_utils 0.0.0",
"rustc_data_structures 0.0.0",
Expand Down Expand Up @@ -2877,34 +2862,21 @@ dependencies = [
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"arena 0.0.0",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"graphviz 0.0.0",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_allocator 0.0.0",
"rustc_ast_borrowck 0.0.0",
"rustc_codegen_utils 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_incremental 0.0.0",
"rustc_interface 0.0.0",
"rustc_lint 0.0.0",
"rustc_metadata 0.0.0",
"rustc_mir 0.0.0",
"rustc_passes 0.0.0",
"rustc_plugin 0.0.0",
"rustc_privacy 0.0.0",
"rustc_resolve 0.0.0",
"rustc_save_analysis 0.0.0",
"rustc_target 0.0.0",
"rustc_traits 0.0.0",
"rustc_typeck 0.0.0",
"serialize 0.0.0",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax 0.0.0",
"syntax_ext 0.0.0",
"syntax_pos 0.0.0",
]

Expand Down Expand Up @@ -2948,7 +2920,6 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_allocator 0.0.0",
"rustc_ast_borrowck 0.0.0",
"rustc_codegen_ssa 0.0.0",
"rustc_codegen_utils 0.0.0",
Expand Down Expand Up @@ -3036,7 +3007,6 @@ dependencies = [
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax 0.0.0",
"syntax_ext 0.0.0",
"syntax_pos 0.0.0",
]

Expand Down Expand Up @@ -3081,9 +3051,7 @@ dependencies = [
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_mir 0.0.0",
"syntax 0.0.0",
"syntax_ext 0.0.0",
"syntax_pos 0.0.0",
]

Expand Down
104 changes: 83 additions & 21 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ impl<T> [T] {
/// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn concat<Separator: ?Sized>(&self) -> T::Output
where T: SliceConcat<Separator>
pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
where Self: Concat<Item>
{
SliceConcat::concat(self)
Concat::concat(self)
}

/// Flattens a slice of `T` into a single value `Self::Output`, placing a
Expand All @@ -508,12 +508,13 @@ impl<T> [T] {
/// ```
/// assert_eq!(["hello", "world"].join(" "), "hello world");
/// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
/// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);
/// ```
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
pub fn join<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
where T: SliceConcat<Separator>
pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where Self: Join<Separator>
{
SliceConcat::join(self, sep)
Join::join(self, sep)
}

/// Flattens a slice of `T` into a single value `Self::Output`, placing a
Expand All @@ -528,10 +529,10 @@ impl<T> [T] {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
pub fn connect<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
where T: SliceConcat<Separator>
pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
where Self: Join<Separator>
{
SliceConcat::join(self, sep)
Join::join(self, sep)
}

}
Expand Down Expand Up @@ -578,45 +579,83 @@ impl [u8] {
// Extension traits for slices over specific kinds of data
////////////////////////////////////////////////////////////////////////////////

/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat)
/// and [`[T]::join`](../../std/primitive.slice.html#method.join)
/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat).
///
/// Note: the `Item` type parameter is not used in this trait,
/// but it allows impls to be more generic.
/// Without it, we get this error:
///
/// ```error
/// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
/// --> src/liballoc/slice.rs:608:6
/// |
/// 608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
/// | ^ unconstrained type parameter
/// ```
///
/// This is because there could exist `V` types with multiple `Borrow<[_]>` impls,
/// such that multiple `T` types would apply:
///
/// ```
/// # #[allow(dead_code)]
/// pub struct Foo(Vec<u32>, Vec<String>);
///
/// impl std::borrow::Borrow<[u32]> for Foo {
/// fn borrow(&self) -> &[u32] { &self.0 }
/// }
///
/// impl std::borrow::Borrow<[String]> for Foo {
/// fn borrow(&self) -> &[String] { &self.1 }
/// }
/// ```
#[unstable(feature = "slice_concat_trait", issue = "27747")]
pub trait SliceConcat<Separator: ?Sized>: Sized {
pub trait Concat<Item: ?Sized> {
#[unstable(feature = "slice_concat_trait", issue = "27747")]
/// The resulting type after concatenation
type Output;

/// Implementation of [`[T]::concat`](../../std/primitive.slice.html#method.concat)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
fn concat(slice: &[Self]) -> Self::Output;
fn concat(slice: &Self) -> Self::Output;
}

/// Helper trait for [`[T]::join`](../../std/primitive.slice.html#method.join)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
pub trait Join<Separator> {
#[unstable(feature = "slice_concat_trait", issue = "27747")]
/// The resulting type after concatenation
type Output;

/// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
fn join(slice: &[Self], sep: &Separator) -> Self::Output;
fn join(slice: &Self, sep: Separator) -> Self::Output;
}

#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
type Output = Vec<T>;

fn concat(slice: &[Self]) -> Vec<T> {
fn concat(slice: &Self) -> Vec<T> {
let size = slice.iter().map(|slice| slice.borrow().len()).sum();
let mut result = Vec::with_capacity(size);
for v in slice {
result.extend_from_slice(v.borrow())
}
result
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&T> for [V] {
type Output = Vec<T>;

fn join(slice: &[Self], sep: &T) -> Vec<T> {
fn join(slice: &Self, sep: &T) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size = slice.iter().map(|slice| slice.borrow().len()).sum::<usize>() + slice.len() - 1;
let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() + slice.len() - 1;
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());

Expand All @@ -628,6 +667,29 @@ impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&[T]> for [V] {
type Output = Vec<T>;

fn join(slice: &Self, sep: &[T]) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() +
sep.len() * (slice.len() - 1);
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());

for v in iter {
result.extend_from_slice(sep);
result.extend_from_slice(v.borrow())
}
result
}
}

////////////////////////////////////////////////////////////////////////////////
// Standard trait implementations for slices
////////////////////////////////////////////////////////////////////////////////
Expand Down
21 changes: 13 additions & 8 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use core::unicode::conversions;

use crate::borrow::ToOwned;
use crate::boxed::Box;
use crate::slice::{SliceConcat, SliceIndex};
use crate::slice::{Concat, Join, SliceIndex};
use crate::string::String;
use crate::vec::Vec;

Expand Down Expand Up @@ -71,17 +71,22 @@ pub use core::str::SplitAsciiWhitespace;
#[stable(feature = "str_escape", since = "1.34.0")]
pub use core::str::{EscapeDebug, EscapeDefault, EscapeUnicode};

#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
issue = "27747")]
impl<S: Borrow<str>> SliceConcat<str> for S {
/// Note: `str` in `Concat<str>` is not meaningful here.
/// This type parameter of the trait only exists to enable another impl.
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<S: Borrow<str>> Concat<str> for [S] {
type Output = String;

fn concat(slice: &[Self]) -> String {
Self::join(slice, "")
fn concat(slice: &Self) -> String {
Join::join(slice, "")
}
}

#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<S: Borrow<str>> Join<&str> for [S] {
type Output = String;

fn join(slice: &[Self], sep: &str) -> String {
fn join(slice: &Self, sep: &str) -> String {
unsafe {
String::from_utf8_unchecked( join_generic_copy(slice, sep.as_bytes()) )
}
Expand Down
9 changes: 9 additions & 0 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,15 @@ impl<T> [T] {
/// assert!(v.contains(&30));
/// assert!(!v.contains(&50));
/// ```
///
/// If you do not have an `&T`, but just an `&U` such that `T: Borrow<U>`
/// (e.g. `String: Borrow<str>`), you can use `iter().any`:
///
/// ```
/// let v = [String::from("hello"), String::from("world")]; // slice of `String`
/// assert!(v.iter().any(|e| e == "hello")); // search with `&str`
/// assert!(!v.iter().any(|e| e == "hi"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn contains(&self, x: &T) -> bool
where T: PartialEq
Expand Down
1 change: 0 additions & 1 deletion src/libfmt_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2018"
[lib]
name = "fmt_macros"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
syntax_pos = { path = "../libsyntax_pos" }
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ use syntax::errors;
use syntax::ext::hygiene::ExpnId;
use syntax::print::pprust;
use syntax::source_map::{respan, ExpnInfo, ExpnKind, DesugaringKind, Spanned};
use syntax::std_inject;
use syntax::symbol::{kw, sym, Symbol};
use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::parse::token::{self, Token};
Expand Down Expand Up @@ -241,7 +240,7 @@ pub fn lower_crate(
dep_graph.assert_ignored();

LoweringContext {
crate_root: std_inject::injected_crate_name().map(Symbol::intern),
crate_root: sess.parse_sess.injected_crate_name.try_get().copied(),
sess,
cstore,
resolver,
Expand Down
19 changes: 10 additions & 9 deletions src/librustc/infer/lexical_region_resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,16 +764,17 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
}
}

span_bug!(
// Errors in earlier passes can yield error variables without
// resolution errors here; delay ICE in favor of those errors.
self.tcx().sess.delay_span_bug(
self.var_infos[node_idx].origin.span(),
"collect_error_for_expanding_node() could not find \
error for var {:?} in universe {:?}, lower_bounds={:#?}, \
upper_bounds={:#?}",
node_idx,
node_universe,
lower_bounds,
upper_bounds
);
&format!("collect_error_for_expanding_node() could not find \
error for var {:?} in universe {:?}, lower_bounds={:#?}, \
upper_bounds={:#?}",
node_idx,
node_universe,
lower_bounds,
upper_bounds));
}

fn collect_concrete_regions(
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ pub mod infer;
pub mod lint;

pub mod middle {
pub mod allocator;
pub mod borrowck;
pub mod expr_use_visitor;
pub mod cstore;
Expand Down
16 changes: 0 additions & 16 deletions src/librustc/middle/allocator.rs

This file was deleted.

Loading