Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f4c59b3
Use `drop_in_place` in `array::IntoIter::drop`
SimonSapin Oct 25, 2019
7550b61
Fix documentation for `Iterator::count()`.
ArturKovacs Nov 4, 2019
6ce3e1d
Fixed trailing whitespace.
ArturKovacs Nov 4, 2019
23be25c
Improve wording in the documentation of `Iterator::count()`.
ArturKovacs Nov 4, 2019
0282c27
rename cfg(rustdoc) into cfg(doc)
GuillaumeGomez Nov 6, 2019
b7c0e46
Add long error explanation for E0623
GuillaumeGomez Nov 7, 2019
ffc1c5a
Update ui tests
GuillaumeGomez Nov 7, 2019
413ab57
docs: Fix link to BufWriter::flush
bryanburgers Nov 8, 2019
1b8b2ee
add raw ptr variant of UnsafeCell::get
RalfJung Nov 9, 2019
8d56bcc
download .tar.xz if python3 is used
Oct 29, 2019
0019371
bootstrap: don't call support_xz in hot-path
Nov 11, 2019
f9f5a88
Add a callback that allows compiler consumers to override queries.
vakaras Nov 11, 2019
e1cf38a
Move injected_panic_runtime to CrateStore
Mark-Simulacrum Nov 11, 2019
2c6d609
Move allocator_kind to CrateStore
Mark-Simulacrum Nov 11, 2019
1aee3e4
Use a relative bindir for rustdoc to find rustc
cuviper Nov 11, 2019
db5fc10
[mir-opt] Turn on the `ConstProp` pass by default
wesleywiser Oct 28, 2019
e8f3a9f
add Result::map_or
tesuji Nov 11, 2019
eb99c73
Match constructor first in Constructor methods
Nadrieril Nov 12, 2019
357d53c
Introduce Constructor::NonExhaustive
Nadrieril Nov 12, 2019
e398d89
Move NonExhaustive checks to the relevant match branches
Nadrieril Nov 12, 2019
ec45882
Add test for issue-30904
JohnTitor Nov 12, 2019
bae9832
Add test for issue-40231
JohnTitor Nov 12, 2019
412f000
Add test for issue-52432
JohnTitor Nov 12, 2019
74d45af
Add test for issue-63279
JohnTitor Nov 12, 2019
bfa5e5f
Fallback to the unmodified path in bindir_relative
cuviper Nov 12, 2019
f696b21
Move self-profile infrastructure to data structures
Mark-Simulacrum Nov 11, 2019
8c29b74
Remove dead code for encoding/decoding lint IDs
Mark-Simulacrum Nov 12, 2019
2fd5454
Register queries with self profiler in rustc_interface
Mark-Simulacrum Nov 12, 2019
6a3a055
Update error_codes.rs
Dylan-DPC Nov 13, 2019
1de094a
Update error_codes.rs
Dylan-DPC Nov 13, 2019
fd868d4
tidy up!
Dylan-DPC Nov 13, 2019
aba385a
Trailing full stop
RalfJung Nov 13, 2019
19ebe2f
clarify why we can do the ptr cast
RalfJung Nov 13, 2019
5b5ae01
expand docs
RalfJung Nov 13, 2019
861698a
make things ugly
RalfJung Nov 13, 2019
c309266
Rollup merge of #65821 - SimonSapin:in-place, r=Amanieu
JohnTitor Nov 13, 2019
36b0aeb
Rollup merge of #65932 - guanqun:download-xz, r=alexcrichton
JohnTitor Nov 13, 2019
bfcf7f6
Rollup merge of #66074 - wesleywiser:test_run_const_prop, r=oli-obk
JohnTitor Nov 13, 2019
7c666a7
Rollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPC
JohnTitor Nov 13, 2019
1d89492
Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=Quie…
JohnTitor Nov 13, 2019
0395fc7
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r…
JohnTitor Nov 13, 2019
7c3562c
Rollup merge of #66227 - bryanburgers:bufwriter-docs-fix-flush-link, …
JohnTitor Nov 13, 2019
0310708
Rollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapin
JohnTitor Nov 13, 2019
4a00361
Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapin
JohnTitor Nov 13, 2019
891c054
Rollup merge of #66297 - vakaras:edit-queries, r=oli-obk
JohnTitor Nov 13, 2019
606c2ab
Rollup merge of #66317 - cuviper:bindir_relative, r=Mark-Simulacrum
JohnTitor Nov 13, 2019
92f3558
Rollup merge of #66330 - Nadrieril:nonexhaustive-constructor, r=varkor
JohnTitor Nov 13, 2019
9091d50
Rollup merge of #66331 - JohnTitor:add-tests, r=Centril
JohnTitor Nov 13, 2019
f037024
Rollup merge of #66334 - Mark-Simulacrum:sess-cstore, r=petrochenkov
JohnTitor Nov 13, 2019
23b4fba
Rollup merge of #66335 - Mark-Simulacrum:self-profile-to-data, r=mich…
JohnTitor Nov 13, 2019
96a9511
Rollup merge of #66337 - Mark-Simulacrum:no-decode-lint-id, r=Dylan-DPC
JohnTitor Nov 13, 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
10 changes: 10 additions & 0 deletions src/test/ui/consts/issue-52432.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![feature(const_raw_ptr_to_usize_cast)]

fn main() {
[(); &(static |x| {}) as *const _ as usize];
//~^ ERROR: closures cannot be static
//~| ERROR: type annotations needed
[(); &(static || {}) as *const _ as usize];
//~^ ERROR: closures cannot be static
//~| ERROR: evaluation of constant value failed
}
28 changes: 28 additions & 0 deletions src/test/ui/consts/issue-52432.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
error[E0697]: closures cannot be static
--> $DIR/issue-52432.rs:4:12
|
LL | [(); &(static |x| {}) as *const _ as usize];
| ^^^^^^^^^^

error[E0697]: closures cannot be static
--> $DIR/issue-52432.rs:7:12
|
LL | [(); &(static || {}) as *const _ as usize];
| ^^^^^^^^^

error[E0282]: type annotations needed
--> $DIR/issue-52432.rs:4:20
|
LL | [(); &(static |x| {}) as *const _ as usize];
| ^ consider giving this closure parameter a type

error[E0080]: evaluation of constant value failed
--> $DIR/issue-52432.rs:7:10
|
LL | [(); &(static || {}) as *const _ as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0080, E0282, E0697.
For more information about an error, try `rustc --explain E0080`.
54 changes: 54 additions & 0 deletions src/test/ui/issues/issue-40231-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// check-pass

#![allow(dead_code)]

trait Structure<E>: Sized where E: Encoding {
type RefTarget: ?Sized;
type FfiPtr;
unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
}

enum Slice {}

impl<E> Structure<E> for Slice where E: Encoding {
type RefTarget = [E::Unit];
type FfiPtr = (*const E::FfiUnit, usize);
unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
panic!()
}
}

trait Encoding {
type Unit: Unit;
type FfiUnit;
}

trait Unit {}

enum Utf16 {}

impl Encoding for Utf16 {
type Unit = Utf16Unit;
type FfiUnit = u16;
}

struct Utf16Unit(pub u16);

impl Unit for Utf16Unit {}

type SUtf16Str = SeStr<Slice, Utf16>;

struct SeStr<S, E> where S: Structure<E>, E: Encoding {
_data: S::RefTarget,
}

impl<S, E> SeStr<S, E> where S: Structure<E>, E: Encoding {
pub unsafe fn from_ptr<'a>(_ptr: S::FfiPtr) -> Option<&'a Self> {
panic!()
}
}

fn main() {
const TEXT_U16: &'static [u16] = &[];
let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
}
54 changes: 54 additions & 0 deletions src/test/ui/issues/issue-40231-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// check-pass

#![allow(dead_code)]

trait Structure<E>: Sized where E: Encoding {
type RefTarget: ?Sized;
type FfiPtr;
unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
}

enum Slice {}

impl<E> Structure<E> for Slice where E: Encoding {
type RefTarget = [E::Unit];
type FfiPtr = (*const E::FfiUnit, usize);
unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
panic!()
}
}

trait Encoding {
type Unit: Unit;
type FfiUnit;
}

trait Unit {}

enum Utf16 {}

impl Encoding for Utf16 {
type Unit = Utf16Unit;
type FfiUnit = u16;
}

struct Utf16Unit(pub u16);

impl Unit for Utf16Unit {}

struct SUtf16Str {
_data: <Slice as Structure<Utf16>>::RefTarget,
}

impl SUtf16Str {
pub unsafe fn from_ptr<'a>(ptr: <Slice as Structure<Utf16>>::FfiPtr)
-> Option<&'a Self> {
std::mem::transmute::<Option<&[<Utf16 as Encoding>::Unit]>, _>(
<Slice as Structure<Utf16>>::borrow_from_ffi_ptr(ptr))
}
}

fn main() {
const TEXT_U16: &'static [u16] = &[];
let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
}
9 changes: 9 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-63279.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(type_alias_impl_trait)]

type Closure = impl FnOnce(); //~ ERROR: type mismatch resolving

fn c() -> Closure {
|| -> Closure { || () }
}

fn main() {}
13 changes: 13 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-63279.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0271]: type mismatch resolving `<[closure@$DIR/issue-63279.rs:6:5: 6:28] as std::ops::FnOnce<()>>::Output == ()`
--> $DIR/issue-63279.rs:3:1
|
LL | type Closure = impl FnOnce();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found ()
|
= note: expected type `Closure`
found type `()`
= note: the return type of a function must have a statically known size

error: aborting due to previous error

For more information about this error, try `rustc --explain E0271`.
36 changes: 36 additions & 0 deletions src/test/ui/unboxed-closures/issue-30904.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#![feature(fn_traits, unboxed_closures)]

fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}

struct Compose<F,G>(F,G);
impl<T,F,G> FnOnce<(T,)> for Compose<F,G>
where F: FnOnce<(T,)>, G: FnOnce<(F::Output,)> {
type Output = G::Output;
extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output {
(self.1)((self.0)(x))
}
}

struct Str<'a>(&'a str);
fn mk_str<'a>(s: &'a str) -> Str<'a> { Str(s) }

fn main() {
let _: for<'a> fn(&'a str) -> Str<'a> = mk_str;
// expected concrete lifetime, found bound lifetime parameter 'a
let _: for<'a> fn(&'a str) -> Str<'a> = Str;
//~^ ERROR: mismatched types

test(|_: &str| {});
test(mk_str);
// expected concrete lifetime, found bound lifetime parameter 'x
test(Str); //~ ERROR: type mismatch in function arguments

test(Compose(|_: &str| {}, |_| {}));
test(Compose(mk_str, |_| {}));
// internal compiler error: cannot relate bound region:
// ReLateBound(DebruijnIndex { depth: 2 },
// BrNamed(DefId { krate: 0, node: DefIndex(6) => test::'x }, 'x(65)))
//<= ReSkolemized(0,
// BrNamed(DefId { krate: 0, node: DefIndex(6) => test::'x }, 'x(65)))
test(Compose(Str, |_| {}));
}
24 changes: 24 additions & 0 deletions src/test/ui/unboxed-closures/issue-30904.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
error[E0308]: mismatched types
--> $DIR/issue-30904.rs:20:45
|
LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str;
| ^^^ expected concrete lifetime, found bound lifetime parameter 'a
|
= note: expected type `for<'a> fn(&'a str) -> Str<'a>`
found type `fn(&str) -> Str<'_> {Str::<'_>}`

error[E0631]: type mismatch in function arguments
--> $DIR/issue-30904.rs:26:10
|
LL | fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
| ---- -------------------------- required by this bound in `test`
...
LL | struct Str<'a>(&'a str);
| ------------------------ found signature of `fn(&str) -> _`
...
LL | test(Str);
| ^^^ expected signature of `for<'x> fn(&'x str) -> _`

error: aborting due to 2 previous errors

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