Skip to content

Rollup of 5 pull requests #72367

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 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e07f63e
add testcase for issue-70818
csmoe Apr 30, 2020
fb81c42
make yield span optional
csmoe May 5, 2020
a5d103f
record upvar into GeneratorInteriorTypeCause
csmoe May 5, 2020
d4bdcfd
don't record upvars into generator interior
csmoe May 6, 2020
382a963
filter upvars that cause trait obligation
csmoe May 6, 2020
d2e5a8e
bless issue-70818 test case
csmoe May 6, 2020
c9e1465
checking on either interior or upvar
csmoe May 7, 2020
afa75d6
exhaustively match during structural match checking
lcnr May 12, 2020
f37d606
note for `ty::Error`.
lcnr May 12, 2020
2a69df2
Be more conservative concerning `structural_match`
lcnr May 12, 2020
516798e
comment return sites
lcnr May 13, 2020
60d9df2
Add tests for opaque types
lcnr May 13, 2020
4af04cb
Continue lowering for unsupported async generator instead of returnin…
marmeladema May 16, 2020
ed84780
Fix going back in history to a search result page on firefox
GuillaumeGomez May 16, 2020
46159b3
split_inclusive: add tracking issue number (72360)
golddranks May 19, 2020
7a9e286
Rollup merge of #71923 - csmoe:issue-70818, r=tmandry
Dylan-DPC May 20, 2020
1611ed8
Rollup merge of #72153 - lcnr:exhaustively-match, r=pnkfelix
Dylan-DPC May 20, 2020
a3feed6
Rollup merge of #72272 - GuillaumeGomez:fix-back-on-page-with-search-…
Dylan-DPC May 20, 2020
1630338
Rollup merge of #72275 - marmeladema:fix-issue-71104-2, r=ecstatic-morse
Dylan-DPC May 20, 2020
30415eb
Rollup merge of #72361 - golddranks:split_inclusive_add_tracking_issu…
Dylan-DPC May 20, 2020
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
26 changes: 13 additions & 13 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ impl<T> [T] {
/// assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
/// assert!(iter.next().is_none());
/// ```
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
#[inline]
pub fn split_inclusive<F>(&self, pred: F) -> SplitInclusive<'_, T, F>
where
Expand All @@ -1194,7 +1194,7 @@ impl<T> [T] {
/// }
/// assert_eq!(v, [10, 40, 1, 20, 1, 1]);
/// ```
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
#[inline]
pub fn split_inclusive_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>
where
Expand Down Expand Up @@ -3852,7 +3852,7 @@ impl<T, P> FusedIterator for Split<'_, T, P> where P: FnMut(&T) -> bool {}
///
/// [`split_inclusive`]: ../../std/primitive.slice.html#method.split_inclusive
/// [slices]: ../../std/primitive.slice.html
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
pub struct SplitInclusive<'a, T: 'a, P>
where
P: FnMut(&T) -> bool,
Expand All @@ -3862,7 +3862,7 @@ where
finished: bool,
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<T: fmt::Debug, P> fmt::Debug for SplitInclusive<'_, T, P>
where
P: FnMut(&T) -> bool,
Expand All @@ -3876,7 +3876,7 @@ where
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<T, P> Clone for SplitInclusive<'_, T, P>
where
P: Clone + FnMut(&T) -> bool,
Expand All @@ -3886,7 +3886,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, T, P> Iterator for SplitInclusive<'a, T, P>
where
P: FnMut(&T) -> bool,
Expand Down Expand Up @@ -3915,7 +3915,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, T, P> DoubleEndedIterator for SplitInclusive<'a, T, P>
where
P: FnMut(&T) -> bool,
Expand All @@ -3940,7 +3940,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<T, P> FusedIterator for SplitInclusive<'_, T, P> where P: FnMut(&T) -> bool {}

/// An iterator over the mutable subslices of the vector which are separated
Expand Down Expand Up @@ -4065,7 +4065,7 @@ impl<T, P> FusedIterator for SplitMut<'_, T, P> where P: FnMut(&T) -> bool {}
///
/// [`split_inclusive_mut`]: ../../std/primitive.slice.html#method.split_inclusive_mut
/// [slices]: ../../std/primitive.slice.html
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
pub struct SplitInclusiveMut<'a, T: 'a, P>
where
P: FnMut(&T) -> bool,
Expand All @@ -4075,7 +4075,7 @@ where
finished: bool,
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<T: fmt::Debug, P> fmt::Debug for SplitInclusiveMut<'_, T, P>
where
P: FnMut(&T) -> bool,
Expand All @@ -4088,7 +4088,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, T, P> Iterator for SplitInclusiveMut<'a, T, P>
where
P: FnMut(&T) -> bool,
Expand Down Expand Up @@ -4128,7 +4128,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, T, P> DoubleEndedIterator for SplitInclusiveMut<'a, T, P>
where
P: FnMut(&T) -> bool,
Expand Down Expand Up @@ -4162,7 +4162,7 @@ where
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<T, P> FusedIterator for SplitInclusiveMut<'_, T, P> where P: FnMut(&T) -> bool {}

/// An iterator over subslices separated by elements that match a predicate
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3335,7 +3335,7 @@ impl str {
/// .split_inclusive('\n').collect();
/// assert_eq!(v, ["Mary had a little lamb\n", "little lamb\n", "little lamb.\n"]);
/// ```
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
#[inline]
pub fn split_inclusive<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitInclusive<'a, P> {
SplitInclusive(SplitInternal {
Expand Down Expand Up @@ -4575,7 +4575,7 @@ pub struct SplitAsciiWhitespace<'a> {
///
/// [`split_inclusive`]: ../../std/primitive.str.html#method.split_inclusive
/// [`str`]: ../../std/primitive.str.html
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
pub struct SplitInclusive<'a, P: Pattern<'a>>(SplitInternal<'a, P>);

impl_fn_for_zst! {
Expand Down Expand Up @@ -4668,7 +4668,7 @@ impl<'a> DoubleEndedIterator for SplitAsciiWhitespace<'a> {
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
impl FusedIterator for SplitAsciiWhitespace<'_> {}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, P: Pattern<'a>> Iterator for SplitInclusive<'a, P> {
type Item = &'a str;

Expand All @@ -4678,22 +4678,22 @@ impl<'a, P: Pattern<'a>> Iterator for SplitInclusive<'a, P> {
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, P: Pattern<'a, Searcher: fmt::Debug>> fmt::Debug for SplitInclusive<'a, P> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SplitInclusive").field("0", &self.0).finish()
}
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, P: Pattern<'a, Searcher: Clone>> Clone for SplitInclusive<'a, P> {
fn clone(&self) -> Self {
SplitInclusive(self.0.clone())
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, P: Pattern<'a, Searcher: ReverseSearcher<'a>>> DoubleEndedIterator
for SplitInclusive<'a, P>
{
Expand All @@ -4703,7 +4703,7 @@ impl<'a, P: Pattern<'a, Searcher: ReverseSearcher<'a>>> DoubleEndedIterator
}
}

#[unstable(feature = "split_inclusive", issue = "none")]
#[unstable(feature = "split_inclusive", issue = "72360")]
impl<'a, P: Pattern<'a>> FusedIterator for SplitInclusive<'a, P> {}

/// An iterator of [`u16`] over the string encoded as UTF-16.
Expand Down
1 change: 0 additions & 1 deletion src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
"`async` generators are not yet supported"
)
.emit();
return hir::ExprKind::Err;
}
None => self.generator_kind = Some(hir::GeneratorKind::Gen),
}
Expand Down
17 changes: 7 additions & 10 deletions src/librustc_middle/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,16 +1114,13 @@ impl<'tcx> TyCtxt<'tcx> {

let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default();
for (k, v) in resolutions.trait_map {
// FIXME(#71104) Should really be using just `node_id_to_hir_id` but
// some `NodeId` do not seem to have a corresponding HirId.
if let Some(hir_id) = definitions.opt_node_id_to_hir_id(k) {
let map = trait_map.entry(hir_id.owner).or_default();
let v = v
.into_iter()
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
.collect();
map.insert(hir_id.local_id, StableVec::new(v));
}
let hir_id = definitions.node_id_to_hir_id(k);
let map = trait_map.entry(hir_id.owner).or_default();
let v = v
.into_iter()
.map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id)))
.collect();
map.insert(hir_id.local_id, StableVec::new(v));
}

GlobalCtxt {
Expand Down
14 changes: 13 additions & 1 deletion src/librustc_mir_build/hair/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,20 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
traits::NonStructuralMatchTy::Dynamic => {
"trait objects cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Opaque => {
"opaque types cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Generator => {
"generators cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Param => {
bug!("use of constant whose type is a parameter inside a pattern")
bug!("use of a constant whose type is a parameter inside a pattern")
}
traits::NonStructuralMatchTy::Projection => {
bug!("use of a constant whose type is a projection inside a pattern")
}
traits::NonStructuralMatchTy::Foreign => {
bug!("use of a value of a foreign type inside a pattern")
}
};

Expand Down
Loading