Skip to content

Fix extended bootstrap issues with OpenSSL on NetBSD build hosts #44320

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
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
80e3f89
Add blanket TryFrom impl when From is implemented.
jimmycuadra Aug 30, 2017
b0edfce
Implement TryFrom explicitly for infallible numeric conversions.
jimmycuadra Aug 30, 2017
414ee9a
Remove test case that assumes FromStr provides TryFrom<&'a str>.
jimmycuadra Aug 30, 2017
36c0ff8
Reword docs for Infallible to make them easier to understand.
jimmycuadra Sep 1, 2017
93a56cd
impl From<Infallible> for TryFromIntError.
jimmycuadra Sep 1, 2017
e9f01bc
Added a way to retrieve the key out of a HashMap when it's being repl…
Binero Sep 2, 2017
f65bb2a
Manuall rebase of @Migi pull/41336
Eh2406 Sep 3, 2017
9a547fc
get ci green
Eh2406 Sep 3, 2017
a312b47
Marked `Entry::replace` as unstable.
Binero Sep 3, 2017
d3de465
Addressed @BurntSuchi's remarks regarding Entry::replace
Binero Sep 12, 2017
732dd2f
Missing trailing newline
Eh2406 Sep 12, 2017
b91bac2
readd test
Eh2406 Sep 14, 2017
5f6de3d
Derive additional traits for Infallible.
jimmycuadra Sep 19, 2017
2c78bb4
Add --all flag to ./x.py clean
tommyip Sep 20, 2017
09d90e5
Do not show "available paths" help in ./x.py clean
tommyip Sep 20, 2017
cfc711e
fix version number
Eh2406 Sep 21, 2017
2adeba6
update xsv to head
Eh2406 Sep 21, 2017
9562981
impl std::error::Error for convert::Infallible.
jimmycuadra Sep 22, 2017
79f2439
Impl fmt::Display for convert::Infallible.
jimmycuadra Sep 22, 2017
e64efc9
Add support for `..=` syntax
durka Sep 19, 2017
4737c5a
Substitute `...` with the expanded form
Badel2 Sep 20, 2017
7aabf57
Add information about the syntax used in ranges
Badel2 Sep 21, 2017
54c4a83
dotdoteq_in_patterns feature gate
Badel2 Sep 21, 2017
15fa85c
extract explicit_predicates_of
Sep 23, 2017
1c589b7
TrustedRandomAccess specialisation for Cloned.
Sep 23, 2017
f94bd36
add aarch64-unknown-linux-musl target
bcressey Sep 5, 2017
99c0c52
docs improvement std::sync::{PoisonError, TryLockError}
lorepozo Sep 23, 2017
4d2a8c5
Simplify implementation of Display and Error for convert::Infallible.
jimmycuadra Sep 24, 2017
ba74a86
Add back mistakenly removed numeric conversions.
jimmycuadra Sep 24, 2017
bc43e17
Add doc example to HashMap::hasher
napen123 Sep 23, 2017
ddee9fb
Point at parameter type on E0301
estebank Sep 23, 2017
874124b
Backport libs stabilizations to 1.21 beta
dtolnay Sep 25, 2017
d5d41f2
Add missing links in fmt module
GuillaumeGomez Sep 25, 2017
3db0094
Improve wording for StepBy
steveklabnik Sep 25, 2017
20d4c0f
Move src/librustc_mir/transform/nll.rs to a subdirectory
SimonSapin Sep 25, 2017
9c3fa4d
Point at signature on unused lint
estebank Sep 25, 2017
f7fd04a
docs improvement sync::atomic::Atomic*
lorepozo Sep 25, 2017
13724fa
Add more custom folding to `core::iter` adaptors
cuviper Sep 26, 2017
9e35b79
rustc: Default 32 codegen units at O0
alexcrichton Sep 25, 2017
3730dfd
impl Trait in argument position desugaring:
mdevlamynck Sep 26, 2017
e58f528
merge fixes, addressing CR comments
gaurikholkar Sep 11, 2017
aa6f0c8
modify message for return time having multiple lifetimes
gaurikholkar Sep 11, 2017
bbf82be
tidy fix
gaurikholkar Sep 11, 2017
d7bb575
use present tense consistently and update references
nikomatsakis Sep 12, 2017
9e4649e
remove random newlines from error messages, fix compile-fail test
nikomatsakis Sep 12, 2017
4bbb58d
remove error code description
gaurikholkar Sep 23, 2017
5c59bba
minor fixes
gaurikholkar Sep 24, 2017
73543d5
fix test reference
nikomatsakis Sep 26, 2017
34d36c0
mir-borrowck: Add borrow data parameter to `report_illegal_mutation_o…
zilbuz Sep 24, 2017
e28c73d
mir-borrowck: Add span labels to `report_illegal_mutation_of_borrowed()`
zilbuz Sep 24, 2017
838105f
Use a different error code to avoid conflicts
mdevlamynck Sep 26, 2017
5102309
bump rustfmt
Badel2 Sep 26, 2017
b683538
mir-borrowck: Edit compile-fail tests with E0506 error to also test o…
zilbuz Sep 26, 2017
6d4989b
Add span label to E0384 for MIR borrowck
KiChjang Sep 24, 2017
0e6f4cf
Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkov
bors Sep 27, 2017
b53b853
bootstrap: use shasum(1) on NetBSD build hosts
jakllsch Aug 31, 2017
90aa66b
bootstrap: use tar -z on extract
jakllsch Aug 31, 2017
cde47ce
Remove DepNodeIndex::new is already impl for Idx
spastorino Sep 27, 2017
70c3a3d
Remove DepNodeIndexNew::new and ::index, they are already impl for Idx
spastorino Sep 27, 2017
e0e14c9
Remove SerializedDepNodeIndex::new it is already impl for Idx
spastorino Sep 27, 2017
0f97b6b
Apply attr proc macros before cfg processing
tmnilsson Sep 12, 2017
2bd104f
Impl Try for Option
huntiep Jun 8, 2017
f098d7b
Add tests for Option and Result Try impl
huntiep Jun 8, 2017
8f63e8d
Add docs for Missing, correct Option's Try test
huntiep Jun 8, 2017
28996db
Rename option::Missing to NoneError
huntiep Jun 18, 2017
e30d92b
Add UI tests
huntiep Sep 22, 2017
44d5090
Auto merge of #44782 - estebank:issue-36700, r=GuillaumeGomez
bors Sep 27, 2017
c5cad5a
Update RLS and Rustfmt
nrc Sep 22, 2017
c0ea270
Rename rls component to rls-preview on nightly
nrc Sep 22, 2017
bfcb290
Add RLS and Rustfmt to the toolstate mechanism
nrc Sep 22, 2017
71a0be0
Update the RLS again
nrc Sep 25, 2017
9b91b87
Update the Cargo submodule
alexcrichton Sep 27, 2017
041d355
Update some minor dependencies
alexcrichton Sep 27, 2017
9cb90f4
Auto merge of #44779 - tjkirch:master, r=alexcrichton
bors Sep 28, 2017
20fc215
Normalize spaces in lang attributes.
Havvy Sep 28, 2017
f22b9da
Auto merge of #44790 - clarcharr:zip_bytes, r=sfackler
bors Sep 28, 2017
d887369
Auto merge of #44806 - KiChjang:mir-err-notes-2, r=pnkfelix
bors Sep 28, 2017
7694ca4
Update to the `cc` crate
alexcrichton Sep 23, 2017
3457a22
ci: Fix building disabled containers
kallisti5 Sep 5, 2017
688a858
Auto merge of #44785 - alexcrichton:update-cargo, r=nikomatsakis
bors Sep 28, 2017
3c96d40
Auto merge of #44278 - Binero:master, r=BurntSushi
bors Sep 28, 2017
46ef620
Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyf…
bors Sep 28, 2017
a379780
Auto merge of #44811 - zilbuz:issue-44596/E0506, r=arielb1
bors Sep 29, 2017
1a29e82
Remove conflicting TryFrom impls on 32-bit targets.
jimmycuadra Sep 29, 2017
0253d98
Auto merge of #44847 - estebank:unused-signature, r=nikomatsakis
bors Sep 29, 2017
d514263
Auto merge of #44853 - alexcrichton:debug-codegen-units, r=michaelwoe…
bors Sep 29, 2017
09ee9b7
Auto merge of #44856 - cuviper:more-fold, r=dtolnay
bors Sep 29, 2017
51cd061
Auto merge of #44866 - mdevlamynck:impl-trait, r=eddyb
bors Sep 29, 2017
6f87d20
Auto merge of #42526 - huntiep:try_opt, r=nikomatsakis
bors Sep 29, 2017
966cf33
Simplify implementation of From<Infallible> for TryFromIntError.
jimmycuadra Sep 29, 2017
27d95d3
Fix more TryFrom impls for integers.
jimmycuadra Sep 29, 2017
b7041bf
Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfackler
bors Sep 29, 2017
f407b2b
Rollup merge of #44124 - gaurikholkar:return_self, r=arielb1
Mark-Simulacrum Sep 29, 2017
f91c55e
Rollup merge of #44287 - Eh2406:master, r=aturon
Mark-Simulacrum Sep 29, 2017
20f892f
Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1a…
Mark-Simulacrum Sep 29, 2017
6bc8ca0
Rollup merge of #44694 - tommyip:make_clean, r=Mark-Simulacrum
Mark-Simulacrum Sep 29, 2017
8083877
Rollup merge of #44708 - toidiu:ak-44493, r=nikomatsakis
Mark-Simulacrum Sep 29, 2017
f2feb83
Rollup merge of #44794 - napen123:master, r=frewsxcv
Mark-Simulacrum Sep 29, 2017
b1437bc
Rollup merge of #44797 - lucasem:master, r=frewsxcv
Mark-Simulacrum Sep 29, 2017
570f1ce
Rollup merge of #44824 - dtolnay:22really21, r=alexcrichton
Mark-Simulacrum Sep 29, 2017
327cd0d
Rollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMis…
Mark-Simulacrum Sep 29, 2017
3d7a390
Rollup merge of #44840 - steveklabnik:fix-wording, r=BurntSushi
Mark-Simulacrum Sep 29, 2017
7c3d376
Rollup merge of #44845 - SimonSapin:nll_mod_rs, r=nikomatsakis
Mark-Simulacrum Sep 29, 2017
7756d39
Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik
Mark-Simulacrum Sep 29, 2017
37c74e1
Rollup merge of #44889 - spastorino:remove_new, r=arielb1
Mark-Simulacrum Sep 29, 2017
4489a7a
Rollup merge of #44900 - Havvy:normalize-lang-attribute-spacing, r=sf…
Mark-Simulacrum Sep 29, 2017
d6451f0
Rollup merge of #44903 - kallisti5:ci-build-disabled, r=aidanhs
Mark-Simulacrum Sep 29, 2017
4491ea5
Auto merge of #44893 - spastorino:remove_new_and_index, r=nikomatsakis
bors Sep 30, 2017
c4cca3a
Auto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors Sep 30, 2017
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
28 changes: 27 additions & 1 deletion src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
#![stable(feature = "rust1", since = "1.0.0")]

use iter::{FromIterator, FusedIterator, TrustedLen};
use mem;
use {mem, ops};

// Note that this is not a lang item per se, but it has a hidden dependency on
// `Iterator`, which is one. The compiler assumes that the `next` method of
Expand Down Expand Up @@ -1123,3 +1123,29 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
}
}
}

/// The error type that results from applying the try operator (`?`) to a `None` value. If you wish
/// to allow `x?` (where `x` is an `Option<T>`) to be converted into your error type, you can
/// implement `impl From<NoneError>` for `YourErrorType`. In that case, `x?` within a function that
/// returns `Result<_, YourErrorType>` will translate a `None` value into an `Err` result.
#[unstable(feature = "try_trait", issue = "42327")]
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct NoneError;

#[unstable(feature = "try_trait", issue = "42327")]
impl<T> ops::Try for Option<T> {
type Ok = T;
type Error = NoneError;

fn into_result(self) -> Result<T, NoneError> {
self.ok_or(NoneError)
}

fn from_ok(v: T) -> Self {
Some(v)
}

fn from_error(_: NoneError) -> Self {
None
}
}
1 change: 1 addition & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#![feature(test)]
#![feature(trusted_len)]
#![feature(try_from)]
#![feature(try_trait)]
#![feature(unique)]

#![feature(const_atomic_bool_new)]
Expand Down
27 changes: 27 additions & 0 deletions src/libcore/tests/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,30 @@ fn test_cloned() {
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val));
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1));
}

#[test]
fn test_try() {
fn try_option_some() -> Option<u8> {
let val = Some(1)?;
Some(val)
}
assert_eq!(try_option_some(), Some(1));

fn try_option_none() -> Option<u8> {
let val = None?;
Some(val)
}
assert_eq!(try_option_none(), None);

fn try_option_ok() -> Result<u8, NoneError> {
let val = Some(1)?;
Ok(val)
}
assert_eq!(try_option_ok(), Ok(1));

fn try_option_err() -> Result<u8, NoneError> {
let val = None?;
Ok(val)
}
assert_eq!(try_option_err(), Err(NoneError));
}
29 changes: 29 additions & 0 deletions src/libcore/tests/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use core::option::*;

fn op1() -> Result<isize, &'static str> { Ok(666) }
fn op2() -> Result<isize, &'static str> { Err("sadface") }

Expand Down Expand Up @@ -202,3 +204,30 @@ pub fn test_unwrap_or_default() {
assert_eq!(op1().unwrap_or_default(), 666);
assert_eq!(op2().unwrap_or_default(), 0);
}

#[test]
fn test_try() {
fn try_result_some() -> Option<u8> {
let val = Ok(1)?;
Some(val)
}
assert_eq!(try_result_some(), Some(1));

fn try_result_none() -> Option<u8> {
let val = Err(NoneError)?;
Some(val)
}
assert_eq!(try_result_none(), None);

fn try_result_ok() -> Result<u8, u8> {
let val = Ok(1)?;
Ok(val)
}
assert_eq!(try_result_ok(), Ok(1));

fn try_result_err() -> Result<u8, u8> {
let val = Err(1)?;
Ok(val)
}
assert_eq!(try_result_err(), Err(1));
}
25 changes: 25 additions & 0 deletions src/test/ui/suggestions/try-on-option.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(try_trait)]

fn main() {}

fn foo() -> Result<u32, ()> {
let x: Option<u32> = None;
x?;
Ok(22)
}

fn bar() -> u32 {
let x: Option<u32> = None;
x?;
22
}
22 changes: 22 additions & 0 deletions src/test/ui/suggestions/try-on-option.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` is not satisfied
--> $DIR/try-on-option.rs:17:5
|
17 | x?;
| ^^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
|
= note: required by `std::convert::From::from`

error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
--> $DIR/try-on-option.rs:23:5
|
23 | x?;
| --
| |
| cannot use the `?` operator in a function that returns `u32`
| in this macro invocation
|
= help: the trait `std::ops::Try` is not implemented for `u32`
= note: required by `std::ops::Try::from_error`

error: aborting due to 2 previous errors