Skip to content

Commit 02fffc1

Browse files
committed
Code review changes and fix rustdoc test.
1 parent a6c4025 commit 02fffc1

File tree

5 files changed

+16
-44
lines changed

5 files changed

+16
-44
lines changed

src/librustc/mir/interpret/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,18 @@ pub struct GlobalId<'tcx> {
148148
pub promoted: Option<mir::Promoted>,
149149
}
150150

151-
/// Input argument for `tcx.lit_to_const`
151+
/// Input argument for `tcx.lit_to_const`.
152152
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, HashStable)]
153153
pub struct LitToConstInput<'tcx> {
154-
/// The absolute value of the resultant constant
154+
/// The absolute value of the resultant constant.
155155
pub lit: &'tcx LitKind,
156-
/// The type of the constant
156+
/// The type of the constant.
157157
pub ty: Ty<'tcx>,
158-
/// If the constant is negative
158+
/// If the constant is negative.
159159
pub neg: bool,
160160
}
161161

162-
/// Error type for `tcx.lit_to_const`
162+
/// Error type for `tcx.lit_to_const`.
163163
#[derive(Copy, Clone, Debug, Eq, PartialEq, HashStable)]
164164
pub enum LitToConstError {
165165
UnparseableFloat,

src/librustc_mir_build/hair/pattern/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ pub(crate) use self::check_match::check_match;
88

99
use crate::hair::util::UserAnnotatedTyHelpers;
1010

11-
use rustc::mir::interpret::{
12-
get_slice_bytes, sign_extend, ConstValue, ErrorHandled, LitToConstError, LitToConstInput,
13-
};
11+
use rustc::mir::interpret::{get_slice_bytes, sign_extend, ConstValue, ErrorHandled};
12+
use rustc::mir::interpret::{LitToConstError, LitToConstInput};
1413
use rustc::mir::UserTypeProjection;
1514
use rustc::mir::{BorrowKind, Field, Mutability};
1615
use rustc::ty::layout::VariantIdx;

src/librustc_typeck/astconv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore-tidy-filelength FIXME(#67418) Split up this file
1+
// ignore-tidy-filelength FIXME(#67418) Split up this file.
22
//! Conversion from AST representation of types to the `ty.rs` representation.
33
//! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an
44
//! instance of `AstConv`.
@@ -2716,7 +2716,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
27162716

27172717
if let Some(lit_input) = lit_input {
27182718
// If an error occurred, ignore that it's a literal and leave reporting the error up to
2719-
// mir
2719+
// mir.
27202720
if let Ok(c) = tcx.at(expr.span).lit_to_const(lit_input) {
27212721
return c;
27222722
}

src/libsyntax/ast.rs

+6-33
Original file line numberDiff line numberDiff line change
@@ -1441,17 +1441,8 @@ pub struct MacroDef {
14411441
pub legacy: bool,
14421442
}
14431443

1444-
#[derive(
1445-
Clone,
1446-
RustcEncodable,
1447-
RustcDecodable,
1448-
Debug,
1449-
Copy,
1450-
Hash,
1451-
Eq,
1452-
PartialEq,
1453-
HashStable_Generic
1454-
)]
1444+
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, Hash, Eq, PartialEq)]
1445+
#[derive(HashStable_Generic)]
14551446
pub enum StrStyle {
14561447
/// A regular string, like `"foo"`.
14571448
Cooked,
@@ -1501,17 +1492,8 @@ impl StrLit {
15011492
}
15021493

15031494
/// Type of the integer literal based on provided suffix.
1504-
#[derive(
1505-
Clone,
1506-
Copy,
1507-
RustcEncodable,
1508-
RustcDecodable,
1509-
Debug,
1510-
Hash,
1511-
Eq,
1512-
PartialEq,
1513-
HashStable_Generic
1514-
)]
1495+
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug, Hash, Eq, PartialEq)]
1496+
#[derive(HashStable_Generic)]
15151497
pub enum LitIntType {
15161498
/// e.g. `42_i32`.
15171499
Signed(IntTy),
@@ -1522,17 +1504,8 @@ pub enum LitIntType {
15221504
}
15231505

15241506
/// Type of the float literal based on provided suffix.
1525-
#[derive(
1526-
Clone,
1527-
Copy,
1528-
RustcEncodable,
1529-
RustcDecodable,
1530-
Debug,
1531-
Hash,
1532-
Eq,
1533-
PartialEq,
1534-
HashStable_Generic
1535-
)]
1507+
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug, Hash, Eq, PartialEq)]
1508+
#[derive(HashStable_Generic)]
15361509
pub enum LitFloatType {
15371510
/// A float literal with a suffix (`1f32` or `1E10f32`).
15381511
Suffixed(FloatTy),

src/test/rustdoc/const-generics/add-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct Simd<T, const WIDTH: usize> {
1111
inner: T,
1212
}
1313

14-
// @has foo/struct.Simd.html '//div[@id="implementations-list"]/h3/code' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>'
14+
// @has foo/struct.Simd.html '//div[@id="implementations-list"]/h3/code' 'impl Add<Simd<u8, 16usize>> for Simd<u8, 16>'
1515
impl Add for Simd<u8, 16> {
1616
type Output = Self;
1717

0 commit comments

Comments
 (0)