#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
- pub fn range<Min: ?Sized + Ord = K, Max: ?Sized + Ord = K>(&self,
- min: Bound<&Min>,
- max: Bound<&Max>)
- -> Range<K, V>
+ pub fn range<Min: ?Sized + Ord, Max: ?Sized + Ord>(&self,
+ min: Bound<&Min>,
+ max: Bound<&Max>)
+ -> Range<K, V>
where K: Borrow<Min> + Borrow<Max>
{
range_impl!(&self.root,
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
- pub fn range_mut<Min: ?Sized + Ord = K, Max: ?Sized + Ord = K>(&mut self,
- min: Bound<&Min>,
- max: Bound<&Max>)
- -> RangeMut<K, V>
+ pub fn range_mut<Min: ?Sized + Ord, Max: ?Sized + Ord>(&mut self,
+ min: Bound<&Min>,
+ max: Bound<&Max>)
+ -> RangeMut<K, V>
where K: Borrow<Min> + Borrow<Max>
{
range_impl!(&mut self.root,
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
- pub fn range<'a, Min: ?Sized + Ord = T, Max: ?Sized + Ord = T>(&'a self,
- min: Bound<&Min>,
- max: Bound<&Max>)
- -> Range<'a, T>
+ pub fn range<'a, Min: ?Sized + Ord, Max: ?Sized + Ord>(&'a self,
+ min: Bound<&Min>,
+ max: Bound<&Max>)
+ -> Range<'a, T>
where T: Borrow<Min> + Borrow<Max>
{
fn first<A, B>((a, _): (A, B)) -> A {
/// ```
#[unstable(feature = "iter_arith", reason = "bounds recently changed",
issue = "27739")]
- fn sum<S=<Self as Iterator>::Item>(self) -> S where
+ fn sum<S>(self) -> S where
S: Add<Self::Item, Output=S> + Zero,
Self: Sized,
{
/// ```
#[unstable(feature="iter_arith", reason = "bounds recently changed",
issue = "27739")]
- fn product<P=<Self as Iterator>::Item>(self) -> P where
+ fn product<P>(self) -> P where
P: Mul<Self::Item, Output=P> + One,
Self: Sized,
{
use syntax::ast;
use syntax::attr;
use syntax::codemap::Span;
+use syntax::feature_gate::{GateIssue, emit_feature_err};
use syntax::parse::token::special_idents;
use syntax::ptr::P;
use rustc_front::hir;
let parent = tcx.map.get_parent(param.id);
+ if space != TypeSpace && default.is_some() {
+ if !tcx.sess.features.borrow().default_type_parameter_fallback {
+ emit_feature_err(&tcx.sess.parse_sess.span_diagnostic,
+ "default_type_parameter_fallback",
+ param.span,
+ GateIssue::Language,
+ "other than on a `struct` or `enum` definition, \
+ defaults for type parameters are experimental \
+ and known to be buggy");
+ }
+ }
+
let def = ty::TypeParameterDef {
space: space,
index: index,
#![crate_type = "lib"]
#![crate_name = "default_param_test"]
+#![feature(default_type_parameter_fallback)]
use std::marker::PhantomData;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![feature(default_type_parameter_fallback)]
+
fn avg<T=T::Item>(_: T) {} //~ ERROR associated type `Item` not found for `T`
fn main() {}