wget \
patch
-# FIXME: build the `ptx-linker` instead.
-RUN curl -sL https://github.com/denzp/rust-ptx-linker/releases/download/v0.9.0-alpha.2/rust-ptx-linker.linux64.tar.gz | \
- tar -xzvC /usr/bin
-
RUN curl -sL https://nodejs.org/dist/v9.2.0/node-v9.2.0-linux-x64.tar.xz | \
tar -xJ
fn case11_mask_mult_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
- b'a'...b'z' => true,
+ b'a'..=b'z' => true,
_ => false
}
}
fn case12_mask_shifted_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
- b'a'...b'z' => true,
+ b'a'..=b'z' => true,
_ => false
}
}
fn case13_subtract_shifted_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
- b'a'...b'z' => true,
+ b'a'..=b'z' => true,
_ => false
}
}
fn case14_subtract_multiplied_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
- b'a'...b'z' => true,
+ b'a'..=b'z' => true,
_ => false
}
}
}
}
-/// Maps a byte in 0x00...0xFF to a `char` whose code point has the same value, in U+0000 to U+00FF.
+/// Maps a byte in 0x00..=0xFF to a `char` whose code point has the same value, in U+0000..=U+00FF.
///
/// Unicode is designed such that this effectively decodes bytes
/// with the character encoding that IANA calls ISO-8859-1.
/// Checks if the value is an ASCII alphabetic character:
///
- /// - U+0041 'A' ... U+005A 'Z', or
- /// - U+0061 'a' ... U+007A 'z'.
+ /// - U+0041 'A' ..= U+005A 'Z', or
+ /// - U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII uppercase character:
- /// U+0041 'A' ... U+005A 'Z'.
+ /// U+0041 'A' ..= U+005A 'Z'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII lowercase character:
- /// U+0061 'a' ... U+007A 'z'.
+ /// U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
/// Checks if the value is an ASCII alphanumeric character:
///
- /// - U+0041 'A' ... U+005A 'Z', or
- /// - U+0061 'a' ... U+007A 'z', or
- /// - U+0030 '0' ... U+0039 '9'.
+ /// - U+0041 'A' ..= U+005A 'Z', or
+ /// - U+0061 'a' ..= U+007A 'z', or
+ /// - U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII decimal digit:
- /// U+0030 '0' ... U+0039 '9'.
+ /// U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
/// Checks if the value is an ASCII hexadecimal digit:
///
- /// - U+0030 '0' ... U+0039 '9', or
- /// - U+0041 'A' ... U+0046 'F', or
- /// - U+0061 'a' ... U+0066 'f'.
+ /// - U+0030 '0' ..= U+0039 '9', or
+ /// - U+0041 'A' ..= U+0046 'F', or
+ /// - U+0061 'a' ..= U+0066 'f'.
///
/// # Examples
///
/// Checks if the value is an ASCII punctuation character:
///
- /// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
- /// - U+003A ... U+0040 `: ; < = > ? @`, or
- /// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or
- /// - U+007B ... U+007E `{ | } ~`
+ /// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
+ /// - U+003A ..= U+0040 `: ; < = > ? @`, or
+ /// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or
+ /// - U+007B ..= U+007E `{ | } ~`
///
/// # Examples
///
}
/// Checks if the value is an ASCII graphic character:
- /// U+0021 '!' ... U+007E '~'.
+ /// U+0021 '!' ..= U+007E '~'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII control character:
- /// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
+ /// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
///
/// Checks if the value is an ASCII alphabetic character:
///
- /// - U+0041 'A' ... U+005A 'Z', or
- /// - U+0061 'a' ... U+007A 'z'.
+ /// - U+0041 'A' ..= U+005A 'Z', or
+ /// - U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII uppercase character:
- /// U+0041 'A' ... U+005A 'Z'.
+ /// U+0041 'A' ..= U+005A 'Z'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII lowercase character:
- /// U+0061 'a' ... U+007A 'z'.
+ /// U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
/// Checks if the value is an ASCII alphanumeric character:
///
- /// - U+0041 'A' ... U+005A 'Z', or
- /// - U+0061 'a' ... U+007A 'z', or
- /// - U+0030 '0' ... U+0039 '9'.
+ /// - U+0041 'A' ..= U+005A 'Z', or
+ /// - U+0061 'a' ..= U+007A 'z', or
+ /// - U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII decimal digit:
- /// U+0030 '0' ... U+0039 '9'.
+ /// U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
/// Checks if the value is an ASCII hexadecimal digit:
///
- /// - U+0030 '0' ... U+0039 '9', or
- /// - U+0041 'A' ... U+0046 'F', or
- /// - U+0061 'a' ... U+0066 'f'.
+ /// - U+0030 '0' ..= U+0039 '9', or
+ /// - U+0041 'A' ..= U+0046 'F', or
+ /// - U+0061 'a' ..= U+0066 'f'.
///
/// # Examples
///
/// Checks if the value is an ASCII punctuation character:
///
- /// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
- /// - U+003A ... U+0040 `: ; < = > ? @`, or
- /// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or
- /// - U+007B ... U+007E `{ | } ~`
+ /// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
+ /// - U+003A ..= U+0040 `: ; < = > ? @`, or
+ /// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or
+ /// - U+007B ..= U+007E `{ | } ~`
///
/// # Examples
///
}
/// Checks if the value is an ASCII graphic character:
- /// U+0021 '!' ... U+007E '~'.
+ /// U+0021 '!' ..= U+007E '~'.
///
/// # Examples
///
}
/// Checks if the value is an ASCII control character:
- /// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
+ /// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
///
/// operation because the returned value could be pointing to invalid
/// memory.
///
+ /// When calling this method, you have to ensure that if the pointer is
+ /// non-NULL, then it is properly aligned, dereferencable (for the whole
+ /// size of `T`) and points to an initialized instance of `T`. This applies
+ /// even if the result of this method is unused!
+ /// (The part about being initialized is not yet fully decided, but until
+ /// it is, the only safe approach is to ensure that they are indeed initialized.)
+ ///
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
- /// not necessarily reflect the actual lifetime of the data.
+ /// not necessarily reflect the actual lifetime of the data. It is up to the
+ /// caller to ensure that for the duration of this lifetime, the memory this
+ /// pointer points to does not get written to outside of `UnsafeCell<U>`.
///
/// # Examples
///
/// operation because the returned value could be pointing to invalid
/// memory.
///
+ /// When calling this method, you have to ensure that if the pointer is
+ /// non-NULL, then it is properly aligned, dereferencable (for the whole
+ /// size of `T`) and points to an initialized instance of `T`. This applies
+ /// even if the result of this method is unused!
+ /// (The part about being initialized is not yet fully decided, but until
+ /// it is, the only safe approach is to ensure that they are indeed initialized.)
+ ///
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
- /// not necessarily reflect the actual lifetime of the data.
+ /// not necessarily reflect the actual lifetime of the data. It is up to the
+ /// caller to ensure that for the duration of this lifetime, the memory this
+ /// pointer points to does not get written to outside of `UnsafeCell<U>`.
///
/// # Examples
///
///
/// # Safety
///
- /// As with `as_ref`, this is unsafe because it cannot verify the validity
+ /// As with [`as_ref`], this is unsafe because it cannot verify the validity
/// of the returned pointer, nor can it ensure that the lifetime `'a`
/// returned is indeed a valid lifetime for the contained data.
///
+ /// When calling this method, you have to ensure that if the pointer is
+ /// non-NULL, then it is properly aligned, dereferencable (for the whole
+ /// size of `T`) and points to an initialized instance of `T`. This applies
+ /// even if the result of this method is unused!
+ /// (The part about being initialized is not yet fully decided, but until
+ /// it is the only safe approach is to ensure that they are indeed initialized.)
+ ///
+ /// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
+ /// not necessarily reflect the actual lifetime of the data. It is up to the
+ /// caller to ensure that for the duration of this lifetime, the memory this
+ /// pointer points to does not get accessed through any other pointer.
+ ///
+ /// [`as_ref`]: #method.as_ref
+ ///
/// # Examples
///
/// Basic usage:
/// A literal.
Lit(P<Expr>),
- /// A range pattern (e.g., `1...2` or `1..2`).
+ /// A range pattern (e.g., `1..=2` or `1..2`).
Range(P<Expr>, P<Expr>, RangeEnd),
/// `[a, b, ..i, y, z]` is represented as:
continue;
}
+ if let Some(parent_def_id) = self.tcx.parent(def_id) {
+ if let Some(parent_hir_id) = self.tcx.hir()
+ .as_local_hir_id(parent_def_id) {
+ // lifetimes in `derive` expansions don't count (Issue #53738)
+ if self.tcx.hir().attrs_by_hir_id(parent_hir_id).iter()
+ .any(|attr| attr.check_name(sym::automatically_derived)) {
+ continue;
+ }
+ }
+ }
+
let mut err = self.tcx.struct_span_lint_hir(
lint::builtin::SINGLE_USE_LIFETIMES,
id,
return;
}
- // If we're compiling a dylib, then we let symbol visibility in object
- // files to take care of whether they're exported or not.
- //
- // If we're compiling a cdylib, however, we manually create a list of
- // exported symbols to ensure we don't expose any more. The object files
- // have far more public symbols than we actually want to export, so we
- // hide them all here.
- if crate_type == CrateType::Dylib ||
- crate_type == CrateType::ProcMacro {
- return
- }
+ // We manually create a list of exported symbols to ensure we don't expose any more.
+ // The object files have far more public symbols than we actually want to export,
+ // so we hide them all here.
- // Symbol visibility takes care of this for the WebAssembly.
- // Additionally the only known linker, LLD, doesn't support the script
- // arguments just yet
- if self.sess.target.target.arch == "wasm32" {
+ if !self.sess.target.target.options.limit_rdylib_exports {
return;
}
+ if crate_type == CrateType::ProcMacro {
+ return
+ }
+
let mut arg = OsString::new();
let path = tmpdir.join("list");
Variant(DefId),
/// Literal values.
ConstantValue(&'tcx ty::Const<'tcx>),
- /// Ranges of literal values (`2...5` and `2..5`).
+ /// Ranges of literal values (`2..=5` and `2..5`).
ConstantRange(u128, u128, Ty<'tcx>, RangeEnd),
/// Array patterns of length n.
Slice(u64),
/// `IntRange`s always store a contiguous range. This means that values are
/// encoded such that `0` encodes the minimum value for the integer,
/// regardless of the signedness.
-/// For example, the pattern `-128...127i8` is encoded as `0..=255`.
+/// For example, the pattern `-128..=127i8` is encoded as `0..=255`.
/// This makes comparisons and arithmetic on interval endpoints much more
/// straightforward. See `signed_bias` for details.
///
}
// Empty groups `a::b::{}` are turned into synthetic `self` imports
- // `a::b::c::{self as __dummy}`, so that their prefixes are correctly
+ // `a::b::c::{self as _}`, so that their prefixes are correctly
// resolved and checked for privacy/stability/etc.
if items.is_empty() && !empty_for_self(&prefix) {
let new_span = prefix[prefix.len() - 1].ident.span;
Ident::new(kw::SelfLower, new_span)
),
kind: ast::UseTreeKind::Simple(
- Some(Ident::from_str_and_span("__dummy", new_span).gensym()),
+ Some(Ident::new(kw::Underscore, new_span)),
ast::DUMMY_NODE_ID,
ast::DUMMY_NODE_ID,
),
///
/// All other types are defined somewhere and possibly imported, but the primitive ones need
/// special handling, since they have no place of origin.
-#[derive(Default)]
struct PrimitiveTypeTable {
primitive_types: FxHashMap<Name, PrimTy>,
}
impl PrimitiveTypeTable {
fn new() -> PrimitiveTypeTable {
- let mut table = PrimitiveTypeTable::default();
-
- table.intern("bool", Bool);
- table.intern("char", Char);
- table.intern("f32", Float(FloatTy::F32));
- table.intern("f64", Float(FloatTy::F64));
- table.intern("isize", Int(IntTy::Isize));
- table.intern("i8", Int(IntTy::I8));
- table.intern("i16", Int(IntTy::I16));
- table.intern("i32", Int(IntTy::I32));
- table.intern("i64", Int(IntTy::I64));
- table.intern("i128", Int(IntTy::I128));
- table.intern("str", Str);
- table.intern("usize", Uint(UintTy::Usize));
- table.intern("u8", Uint(UintTy::U8));
- table.intern("u16", Uint(UintTy::U16));
- table.intern("u32", Uint(UintTy::U32));
- table.intern("u64", Uint(UintTy::U64));
- table.intern("u128", Uint(UintTy::U128));
- table
- }
-
- fn intern(&mut self, string: &str, primitive_type: PrimTy) {
- self.primitive_types.insert(Symbol::intern(string), primitive_type);
+ let mut table = FxHashMap::default();
+
+ table.insert(sym::bool, Bool);
+ table.insert(sym::char, Char);
+ table.insert(sym::f32, Float(FloatTy::F32));
+ table.insert(sym::f64, Float(FloatTy::F64));
+ table.insert(sym::isize, Int(IntTy::Isize));
+ table.insert(sym::i8, Int(IntTy::I8));
+ table.insert(sym::i16, Int(IntTy::I16));
+ table.insert(sym::i32, Int(IntTy::I32));
+ table.insert(sym::i64, Int(IntTy::I64));
+ table.insert(sym::i128, Int(IntTy::I128));
+ table.insert(sym::str, Str);
+ table.insert(sym::usize, Uint(UintTy::Usize));
+ table.insert(sym::u8, Uint(UintTy::U8));
+ table.insert(sym::u16, Uint(UintTy::U16));
+ table.insert(sym::u32, Uint(UintTy::U32));
+ table.insert(sym::u64, Uint(UintTy::U64));
+ table.insert(sym::u128, Uint(UintTy::U128));
+ Self { primitive_types: table }
}
}
}
if bits >= i128_align_src && bits <= 128 {
// Default alignment for i128 is decided by taking the alignment of
- // largest-sized i{64...128}.
+ // largest-sized i{64..=128}.
i128_align_src = bits;
dl.i128_align = a;
}
/// wasm32 where the whole program either has simd or not.
pub simd_types_indirect: bool,
+ /// Pass a list of symbol which should be exported in the dylib to the linker.
+ pub limit_rdylib_exports: bool,
+
/// If set, have the linker export exactly these symbols, instead of using
/// the usual logic to figure this out from the crate itself.
pub override_export_symbols: Option<Vec<String>>,
emit_debug_gdb_scripts: true,
requires_uwtable: false,
simd_types_indirect: true,
+ limit_rdylib_exports: true,
override_export_symbols: None,
merge_functions: MergeFunctions::Aliases,
target_mcount: "mcount".to_string(),
key!(emit_debug_gdb_scripts, bool);
key!(requires_uwtable, bool);
key!(simd_types_indirect, bool);
+ key!(limit_rdylib_exports, bool);
key!(override_export_symbols, opt_list);
key!(merge_functions, MergeFunctions)?;
key!(target_mcount);
target_option_val!(emit_debug_gdb_scripts);
target_option_val!(requires_uwtable);
target_option_val!(simd_types_indirect);
+ target_option_val!(limit_rdylib_exports);
target_option_val!(override_export_symbols);
target_option_val!(merge_functions);
target_option_val!(target_mcount);
has_rpath: true,
target_family: Some("unix".to_string()),
is_like_solaris: true,
+ limit_rdylib_exports: false, // Linker doesn't support this
.. Default::default()
}
// no dynamic linking, no need for default visibility!
default_hidden_visibility: true,
+ // Symbol visibility takes care of this for the WebAssembly.
+ // Additionally the only known linker, LLD, doesn't support the script
+ // arguments just yet
+ limit_rdylib_exports: false,
+
// we use the LLD shipped with the Rust toolchain by default
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Wasm,
is_like_emscripten: true,
max_atomic_width: Some(32),
post_link_args,
+ limit_rdylib_exports: false,
target_family: Some("unix".to_string()),
.. Default::default()
};
is_like_emscripten: true,
max_atomic_width: Some(32),
post_link_args,
+ limit_rdylib_exports: false,
target_family: Some("unix".to_string()),
codegen_backend: "emscripten".to_string(),
.. Default::default()
/// Returns the `DefId` of the constant parameter that the provided expression is a path to.
pub fn const_param_def_id(&self, expr: &hir::Expr) -> Option<DefId> {
+ // Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
+ // currently have to be wrapped in curly brackets, so it's necessary to special-case.
+ let expr = match &expr.node {
+ ExprKind::Block(block, _) if block.stmts.is_empty() && block.expr.is_some() =>
+ block.expr.as_ref().unwrap(),
+ _ => expr,
+ };
+
match &expr.node {
ExprKind::Path(hir::QPath::Resolved(_, path)) => match path.res {
Res::Def(DefKind::ConstParam, did) => Some(did),
ty,
};
- let mut expr = &tcx.hir().body(ast_const.body).value;
-
- // Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
- // currently have to be wrapped in curly brackets, so it's necessary to special-case.
- if let ExprKind::Block(block, _) = &expr.node {
- if block.stmts.is_empty() {
- if let Some(trailing) = &block.expr {
- expr = &trailing;
- }
- }
- }
-
+ let expr = &tcx.hir().body(ast_const.body).value;
if let Some(def_id) = self.const_param_def_id(expr) {
// Find the name and index of the const parameter by indexing the generics of the
// parent item and construct a `ParamConst`.
debug!("check_pat_walk(pat={:?},expected={:?},def_bm={:?})", pat, expected, def_bm);
+ let mut path_resolution = None;
let is_non_ref_pat = match pat.node {
PatKind::Struct(..) |
PatKind::TupleStruct(..) |
}
}
PatKind::Path(ref qpath) => {
- let (def, _, _) = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span);
- match def {
+ let resolution = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span);
+ path_resolution = Some(resolution);
+ match resolution.0 {
Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssocConst, _) => false,
_ => true,
}
)
}
PatKind::Path(ref qpath) => {
- self.check_pat_path(pat, qpath, expected)
+ self.check_pat_path(pat, path_resolution.unwrap(), qpath, expected)
}
PatKind::Struct(ref qpath, ref fields, etc) => {
self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, discrim_span)
fn check_pat_path(
&self,
pat: &hir::Pat,
+ path_resolution: (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment]),
qpath: &hir::QPath,
expected: Ty<'tcx>,
) -> Ty<'tcx> {
let tcx = self.tcx;
- // Resolve the path and check the definition for errors.
- let (res, opt_ty, segments) = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span);
+ // We have already resolved the path.
+ let (res, opt_ty, segments) = path_resolution;
match res {
Res::Err => {
self.set_tainted_by_errors();
Field(P<Expr>, Ident),
/// An indexing operation (e.g., `foo[2]`).
Index(P<Expr>, P<Expr>),
- /// A range (e.g., `1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`).
+ /// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`).
Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
/// Variable reference, possibly containing `::` and/or type
}
});
- let span = span.apply_mark(ecx.current_expansion.mark);
-
- let name = Ident::from_str_and_span(&format!("__register_diagnostic_{}", code), span).gensym();
-
- MacEager::items(smallvec![
- ecx.item_mod(
- span,
- span,
- name,
- vec![],
- vec![],
- )
- ])
+ MacEager::items(smallvec![])
}
#[allow(deprecated)]
def: &ast::Item,
edition: Edition
) -> SyntaxExtension {
- let lhs_nm = ast::Ident::from_str("lhs").gensym();
- let rhs_nm = ast::Ident::from_str("rhs").gensym();
+ let lhs_nm = ast::Ident::new(sym::lhs, def.span);
+ let rhs_nm = ast::Ident::new(sym::rhs, def.span);
+ let tt_spec = ast::Ident::new(sym::tt, def.span);
// Parse the macro_rules! invocation
let body = match def.node {
let argument_gram = vec![
quoted::TokenTree::Sequence(DelimSpan::dummy(), Lrc::new(quoted::SequenceRepetition {
tts: vec![
- quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, ast::Ident::from_str("tt")),
+ quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec),
quoted::TokenTree::token(token::FatArrow, def.span),
- quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, ast::Ident::from_str("tt")),
+ quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec),
],
separator: Some(Token::new(
if body.legacy { token::Semi } else { token::Comma }, def.span
tok: "ed::TokenTree) -> Result<(), String> {
debug!("has_legal_fragment_specifier({:?})", tok);
if let quoted::TokenTree::MetaVarDecl(_, _, ref frag_spec) = *tok {
- let frag_name = frag_spec.as_str();
let frag_span = tok.span();
- if !is_legal_fragment_specifier(sess, features, attrs, &frag_name, frag_span) {
- return Err(frag_name.to_string());
+ if !is_legal_fragment_specifier(sess, features, attrs, frag_spec.name, frag_span) {
+ return Err(frag_spec.to_string());
}
}
Ok(())
fn is_legal_fragment_specifier(_sess: &ParseSess,
_features: &Features,
_attrs: &[ast::Attribute],
- frag_name: &str,
+ frag_name: Symbol,
_frag_span: Span) -> bool {
/*
* If new fragment specifiers are invented in nightly, `_sess`,
* this function.
*/
match frag_name {
- "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
- "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" |
- "" => true,
+ sym::item | sym::block | sym::stmt | sym::expr | sym::pat |
+ sym::lifetime | sym::path | sym::ty | sym::ident | sym::meta | sym::tt |
+ sym::vis | sym::literal | kw::Invalid => true,
_ => false,
}
}
// }
let sp = ignored_span(cx, DUMMY_SP);
let ecx = &cx.ext_cx;
- let test_id = ecx.ident_of("test").gensym();
+ let test_id = Ident::with_empty_ctxt(sym::test);
// test::test_main_static(...)
let mut test_runner = cx.test_runner.clone().unwrap_or(
let test_extern_stmt = ecx.stmt_item(sp, ecx.item(sp,
test_id,
vec![],
- ast::ItemKind::ExternCrate(Some(sym::test))
+ ast::ItemKind::ExternCrate(None)
));
// pub fn main() { ... }
pub const PREC_CLOSURE: i8 = -40;
pub const PREC_JUMP: i8 = -30;
pub const PREC_RANGE: i8 = -10;
-// The range 2 ... 14 is reserved for AssocOp binary operator precedences.
+// The range 2..=14 is reserved for AssocOp binary operator precedences.
pub const PREC_PREFIX: i8 = 50;
pub const PREC_POSTFIX: i8 = 60;
pub const PREC_PAREN: i8 = 99;
bin,
bind_by_move_pattern_guards,
block,
+ bool,
borrowck_graphviz_postflow,
borrowck_graphviz_preflow,
box_patterns,
cfg_target_has_atomic,
cfg_target_thread_local,
cfg_target_vendor,
+ char,
clone,
Clone,
clone_closures,
label_break_value,
lang,
lang_items,
+ lhs,
lib,
lifetime,
link,
result,
Result,
Return,
+ rhs,
rlib,
rt,
rtm_target_feature,
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib
// only-nvptx64
+// ignore-nvptx64
#![no_std]
// assembly-output: emit-asm
// compile-flags: --crate-type rlib
// only-nvptx64
+// ignore-nvptx64
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60
// only-nvptx64
+// ignore-nvptx64
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib -C target-cpu=sm_50
// only-nvptx64
+// ignore-nvptx64
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib
// only-nvptx64
+// ignore-nvptx64
#![feature(abi_ptx, core_intrinsics)]
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib
// only-nvptx64
+// ignore-nvptx64
#![feature(abi_ptx)]
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type bin
// only-nvptx64
+// ignore-nvptx64
#![feature(abi_ptx)]
#![no_main]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib
// only-nvptx64
+// ignore-nvptx64
#![feature(abi_ptx)]
#![no_std]
// assembly-output: ptx-linker
// compile-flags: --crate-type cdylib
// only-nvptx64
+// ignore-nvptx64
#![feature(abi_ptx)]
#![no_std]
--- /dev/null
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
+ [x; {N}]
+}
+
+fn g<T, const N: usize>(x: T) -> [T; N] {
+ [x; {N}]
+ //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied [E0277]
+}
+
+fn main() {
+ let x: [u32; 5] = f::<u32, 5>(3);
+ assert_eq!(x, [3u32; 5]);
+}
--- /dev/null
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+ --> $DIR/issue-61336-2.rs:1:12
+ |
+LL | #![feature(const_generics)]
+ | ^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/issue-61336-2.rs:9:5
+ |
+LL | [x; {N}]
+ | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+ = note: the `Copy` trait is required because the repeated element will be copied
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
trait Baz<'f> { }
+// `Derive`d impls shouldn't trigger a warning, either (Issue #53738).
+
+#[derive(Debug)]
+struct Quux<'a> {
+ priors: &'a u32,
+}
+
fn main() { }
--- /dev/null
+// In this regression test we check that a path pattern referring to a unit variant
+// through a type alias is successful in inferring the generic argument.
+
+// compile-pass
+
+#![feature(type_alias_enum_variants)]
+
+enum Opt<T> {
+ N,
+ S(T),
+}
+
+type OptAlias<T> = Opt<T>;
+
+fn f1(x: OptAlias<u8>) {
+ match x {
+ OptAlias::N // We previously failed to infer `T` to `u8`.
+ => (),
+ _ => (),
+ }
+
+ match x {
+ <
+ OptAlias<_> // And we failed to infer this type also.
+ >::N => (),
+ _ => (),
+ }
+}
+
+fn main() {}