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 9 pull requests #58470

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e6d5f25
Fix #57730
Zoxc Jan 29, 2019
9d2a0b9
add regression test for #57979
nikomatsakis Feb 1, 2019
0d28a24
Remove code for updating copyright years in generate-deriving-span-tests
KamilaBorowska Feb 8, 2019
df420aa
Remove initial newline from automatically generated span tests
KamilaBorowska Feb 8, 2019
8f6d05b
Don't default on std crate when manipulating browser history
GuillaumeGomez Feb 8, 2019
719be24
fix Box::into_unique effecitvely transmuting to a raw ptr
RalfJung Feb 13, 2019
26ade1c
mark failures expected due to panics
RalfJung Feb 9, 2019
7f5dc49
review or fix miri failures in iter, slice, cell, time
RalfJung Feb 9, 2019
72be9a6
review or fix remaining miri failures in libcore
RalfJung Feb 9, 2019
e24af6c
the formatting issue got fixed
RalfJung Feb 13, 2019
b17ca01
review failures in binary_heap, str, vec_deque
RalfJung Feb 13, 2019
4c1a1c3
review failures in btree, string
RalfJung Feb 13, 2019
767dadf
review failures in heap, slice, vec
RalfJung Feb 13, 2019
c154bf7
miri: test with slightly larger BTrees
RalfJung Feb 13, 2019
a301655
Use posix_spawn_file_actions_addchdir_np when possible
cuviper Feb 13, 2019
283ffcf
Check the self-type of inherent associated constants
matthewjasper Feb 11, 2019
f565efd
mask `compiler_builtins` docs
euclio Feb 14, 2019
2c339ae
Add specific error for unstable const fn features
varkor Feb 5, 2019
feb3408
Update const fn tests
varkor Feb 5, 2019
519783a
Fix documentation typo
varkor Feb 5, 2019
cce2c89
add .stderr file
nikomatsakis Feb 14, 2019
8ca4406
Add updated NLL tests
varkor Feb 14, 2019
b9efe60
Rollup merge of #57981 - Zoxc:fix-57979, r=nikomatsakis
Centril Feb 14, 2019
634022c
Rollup merge of #58196 - varkor:const-fn-feature-gate-error, r=oli-obk
Centril Feb 14, 2019
2f5d8bc
Rollup merge of #58293 - xfix:patch-16, r=Mark-Simulacrum
Centril Feb 14, 2019
a62a203
Rollup merge of #58306 - GuillaumeGomez:crate-browser-history, r=Quie…
Centril Feb 14, 2019
983899b
Rollup merge of #58353 - matthewjasper:typeck-pattern-constants, r=ar…
Centril Feb 14, 2019
cef3d81
Rollup merge of #58429 - RalfJung:box, r=TimNN
Centril Feb 14, 2019
5cf28dd
Rollup merge of #58433 - RalfJung:miri-mark-tests, r=TimNN
Centril Feb 14, 2019
c88130d
Rollup merge of #58438 - cuviper:posix_spawn_file_actions_addchdir_np…
Centril Feb 14, 2019
2439466
Rollup merge of #58448 - euclio:missing-summaries, r=QuietMisdreavus
Centril Feb 14, 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
30 changes: 7 additions & 23 deletions src/etc/generate-deriving-span-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
sample usage: src/etc/generate-deriving-span-tests.py
"""

import os, datetime, stat, re
import os, stat

TEST_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), '../test/ui/derives/'))

YEAR = datetime.datetime.now().year

TEMPLATE = """
TEMPLATE = """\
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'

{error_deriving}
Expand Down Expand Up @@ -63,19 +61,11 @@ def create_test_case(type, trait, super_traits, error_count):

errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count))
code = string.format(traits = all_traits, errors = errors)
return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code)
return TEMPLATE.format(error_deriving=error_deriving, code = code)

def write_file(name, string):
test_file = os.path.join(TEST_DIR, 'derives-span-%s.rs' % name)

with open(test_file) as f:
old_str = f.read()
old_str_ignoring_date = re.sub(r'^// Copyright \d+',
'// Copyright {year}'.format(year = YEAR), old_str)
if old_str_ignoring_date == string:
# if all we're doing is updating the copyright year, ignore it
return 0

# set write permission if file exists, so it can be changed
if os.path.exists(test_file):
os.chmod(test_file, stat.S_IWUSR)
Expand All @@ -86,8 +76,6 @@ def write_file(name, string):
# mark file read-only
os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)

return 1


ENUM = 1
STRUCT = 2
Expand All @@ -110,15 +98,11 @@ def write_file(name, string):
('Hash', [], 1)]:
traits[trait] = (ALL, supers, errs)

files = 0

for (trait, (types, super_traits, error_count)) in traits.items():
mk = lambda ty: create_test_case(ty, trait, super_traits, error_count)
if types & ENUM:
files += write_file(trait + '-enum', mk(ENUM_TUPLE))
files += write_file(trait + '-enum-struct-variant', mk(ENUM_STRUCT))
write_file(trait + '-enum', mk(ENUM_TUPLE))
write_file(trait + '-enum-struct-variant', mk(ENUM_STRUCT))
if types & STRUCT:
files += write_file(trait + '-struct', mk(STRUCT_FIELDS))
files += write_file(trait + '-tuple-struct', mk(STRUCT_TUPLE))

print('Generated {files} deriving span test{}.'.format('s' if files != 1 else '', files = files))
write_file(trait + '-struct', mk(STRUCT_FIELDS))
write_file(trait + '-tuple-struct', mk(STRUCT_TUPLE))
11 changes: 8 additions & 3 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,15 @@ impl<T: ?Sized> Box<T> {
#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_raw_non_null instead")]
#[inline]
#[doc(hidden)]
pub fn into_unique(b: Box<T>) -> Unique<T> {
let unique = b.0;
pub fn into_unique(mut b: Box<T>) -> Unique<T> {
// Box is kind-of a library type, but recognized as a "unique pointer" by
// Stacked Borrows. This function here corresponds to "reborrowing to
// a raw pointer", but there is no actual reborrow here -- so
// without some care, the pointer we are returning here still carries
// the `Uniq` tag. We round-trip through a mutable reference to avoid that.
let unique = unsafe { b.0.as_mut() as *mut T };
mem::forget(b);
unique
unsafe { Unique::new_unchecked(unique) }
}

/// Consumes and leaks the `Box`, returning a mutable reference,
Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/tests/arc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(not(miri))]

use std::any::Any;
use std::sync::{Arc, Weak};
use std::cell::RefCell;
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/tests/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn assert_covariance() {
//
// Destructors must be called exactly once per element.
#[test]
#[cfg(not(miri))]
#[cfg(not(miri))] // Miri does not support panics
fn panic_safe() {
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);

Expand Down
30 changes: 30 additions & 0 deletions src/liballoc/tests/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use super::DeterministicRng;
#[test]
fn test_basic_large() {
let mut map = BTreeMap::new();
#[cfg(not(miri))] // Miri is too slow
let size = 10000;
#[cfg(miri)]
let size = 200;
assert_eq!(map.len(), 0);

for i in 0..size {
Expand Down Expand Up @@ -69,7 +72,10 @@ fn test_basic_small() {

#[test]
fn test_iter() {
#[cfg(not(miri))] // Miri is too slow
let size = 10000;
#[cfg(miri)]
let size = 200;

// Forwards
let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
Expand All @@ -91,7 +97,10 @@ fn test_iter() {

#[test]
fn test_iter_rev() {
#[cfg(not(miri))] // Miri is too slow
let size = 10000;
#[cfg(miri)]
let size = 200;

// Forwards
let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
Expand Down Expand Up @@ -127,7 +136,10 @@ fn test_values_mut() {

#[test]
fn test_iter_mixed() {
#[cfg(not(miri))] // Miri is too slow
let size = 10000;
#[cfg(miri)]
let size = 200;

// Forwards
let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
Expand Down Expand Up @@ -214,42 +226,50 @@ fn test_range_equal_empty_cases() {

#[test]
#[should_panic]
#[cfg(not(miri))] // Miri does not support panics
fn test_range_equal_excluded() {
let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect();
map.range((Excluded(2), Excluded(2)));
}

#[test]
#[should_panic]
#[cfg(not(miri))] // Miri does not support panics
fn test_range_backwards_1() {
let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect();
map.range((Included(3), Included(2)));
}

#[test]
#[should_panic]
#[cfg(not(miri))] // Miri does not support panics
fn test_range_backwards_2() {
let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect();
map.range((Included(3), Excluded(2)));
}

#[test]
#[should_panic]
#[cfg(not(miri))] // Miri does not support panics
fn test_range_backwards_3() {
let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect();
map.range((Excluded(3), Included(2)));
}

#[test]
#[should_panic]
#[cfg(not(miri))] // Miri does not support panics
fn test_range_backwards_4() {
let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect();
map.range((Excluded(3), Excluded(2)));
}

#[test]
fn test_range_1000() {
#[cfg(not(miri))] // Miri is too slow
let size = 1000;
#[cfg(miri)]
let size = 200;
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();

fn test(map: &BTreeMap<u32, u32>, size: u32, min: Bound<&u32>, max: Bound<&u32>) {
Expand Down Expand Up @@ -286,7 +306,10 @@ fn test_range_borrowed_key() {

#[test]
fn test_range() {
#[cfg(not(miri))] // Miri is too slow
let size = 200;
#[cfg(miri)]
let size = 30;
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();

for i in 0..size {
Expand All @@ -305,7 +328,10 @@ fn test_range() {

#[test]
fn test_range_mut() {
#[cfg(not(miri))] // Miri is too slow
let size = 200;
#[cfg(miri)]
let size = 30;
let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();

for i in 0..size {
Expand Down Expand Up @@ -479,7 +505,10 @@ fn test_bad_zst() {
#[test]
fn test_clone() {
let mut map = BTreeMap::new();
#[cfg(not(miri))] // Miri is too slow
let size = 100;
#[cfg(miri)]
let size = 30;
assert_eq!(map.len(), 0);

for i in 0..size {
Expand Down Expand Up @@ -631,6 +660,7 @@ create_append_test!(test_append_145, 145);
create_append_test!(test_append_170, 170);
create_append_test!(test_append_181, 181);
create_append_test!(test_append_239, 239);
#[cfg(not(miri))] // Miri is too slow
create_append_test!(test_append_1700, 1700);

fn rand_data(len: usize) -> Vec<(u32, u32)> {
Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/tests/btree/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(not(miri))]

mod map;
mod set;

Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/tests/heap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(not(miri))]

use std::alloc::{Global, Alloc, Layout, System};

/// Issue #45955.
Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/tests/rc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(not(miri))]

use std::any::Any;
use std::rc::{Rc, Weak};
use std::cell::RefCell;
Expand Down
Loading